@botpress/webchat 2.3.0 → 2.3.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 (44) hide show
  1. package/.eslintrc.js +11 -0
  2. package/.turbo/turbo-build.log +16 -15
  3. package/dist/adapters/index.d.ts +1 -6
  4. package/dist/adapters/target.d.ts +1 -6
  5. package/dist/adapters/typings.d.ts +1 -6
  6. package/dist/adapters/webchat-to-target.d.ts +8 -0
  7. package/dist/adapters/webchat.d.ts +3 -1986
  8. package/dist/client/state-machine.d.ts +1 -1
  9. package/dist/client/types.d.ts +1 -0
  10. package/dist/components/MessageList/MessageList.d.ts +1 -1
  11. package/dist/components/renderers/Audio/Audio.d.ts +1 -0
  12. package/dist/components/renderers/Carousel/Carousel.d.ts +1 -0
  13. package/dist/components/renderers/File/File.d.ts +1 -0
  14. package/dist/components/renderers/Image/Image.d.ts +1 -0
  15. package/dist/components/renderers/Location/Location.d.ts +1 -0
  16. package/dist/components/renderers/Video/Video.d.ts +1 -0
  17. package/dist/gen/client/models.d.ts +0 -52
  18. package/dist/gen/client/operations/createMessage.d.ts +0 -104
  19. package/dist/gen/client/operations/getMessage.d.ts +0 -52
  20. package/dist/gen/client/operations/listConversationMessages.d.ts +0 -52
  21. package/dist/gen/signals/index.d.ts +34 -127
  22. package/dist/gen/signals/messageCreated.t.d.ts +0 -52
  23. package/dist/gen/signals/messageCreated.z.d.ts +34 -127
  24. package/dist/index.js +66154 -23951
  25. package/dist/index.umd.cjs +172 -127
  26. package/dist/schemas/init.d.ts +14 -14
  27. package/dist/schemas/theme.d.ts +8 -8
  28. package/dist/stores/offlineStore.d.ts +1 -1
  29. package/dist/stores/webchatStore.d.ts +2 -2
  30. package/dist/style.css +1 -1
  31. package/dist/styles/classes.d.ts +22 -22
  32. package/dist/types/block-type.d.ts +2 -0
  33. package/package.json +21 -22
  34. package/dist/adapters/adapters/messaging-to-target.d.ts +0 -184
  35. package/dist/adapters/adapters/messaging-to-webchat.d.ts +0 -5
  36. package/dist/adapters/adapters/webchat-to-messaging.d.ts +0 -223
  37. package/dist/adapters/adapters/webchat-to-target.d.ts +0 -197
  38. package/dist/adapters/messaging.d.ts +0 -1455
  39. package/dist/adapters/sdk.d.ts +0 -472
  40. package/dist/client/inner-client/event-emitter.d.ts +0 -10
  41. package/dist/client/inner-client/eventsource.d.ts +0 -22
  42. package/dist/client/inner-client/index.d.ts +0 -42
  43. package/dist/client/inner-client/signal-listener.d.ts +0 -47
  44. package/openapi.ts +0 -35
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/webchat",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.umd.cjs",
@@ -15,32 +15,32 @@
15
15
  "scripts": {
16
16
  "check:type": "tsc --noEmit",
17
17
  "build": "vite build",
18
- "test": "vitest run",
19
- "gen:client": "OUT_DIR=./src/gen es-node ./openapi"
18
+ "test": "vitest run"
20
19
  },
21
20
  "dependencies": {
21
+ "@bpinternal/webchat-http-client": "0.2.0",
22
22
  "@floating-ui/react": "^0.25.4",
23
- "@headlessui/react": "1.7.11",
23
+ "@headlessui/react": "^2.1.8",
24
24
  "@heroicons/react": "^2.1.5",
25
25
  "@radix-ui/react-avatar": "^1.0.3",
26
- "@radix-ui/react-collapsible": "^1.0.3",
27
- "@radix-ui/react-dialog": "^1.0.4",
28
- "@radix-ui/react-scroll-area": "^1.0.5",
26
+ "@radix-ui/react-collapsible": "^1.1.1",
27
+ "@radix-ui/react-dialog": "^1.1.2",
28
+ "@radix-ui/react-scroll-area": "^1.2.0",
29
29
  "@redux-devtools/extension": "^3.3.0",
30
30
  "@types/deep-equal": "^1.0.4",
31
- "@types/qs": "^6.9.8",
31
+ "@types/qs": "^6.9.15",
32
32
  "@types/react-scroll-to-bottom": "^4.2.5",
33
33
  "@types/react-textarea-autosize": "^8.0.0",
34
34
  "axios": "1.2.5",
35
- "clsx": "^2.0.0",
35
+ "clsx": "^2.1.1",
36
36
  "dayjs": "^1.11.10",
37
37
  "deep-equal": "^2.2.3",
38
38
  "embla-carousel-react": "8.0.0-rc11",
39
39
  "event-source-polyfill": "^1.0.31",
40
40
  "exponential-backoff": "^3.1.1",
41
- "qs": "^6.11.2",
42
- "react": "^18.2.0",
43
- "react-dom": "^18.2.0",
41
+ "qs": "^6.12.1",
42
+ "react": "^18.3.1",
43
+ "react-dom": "^18.3.1",
44
44
  "react-hot-toast": "^2.4.1",
45
45
  "react-markdown": "^9.0.1",
46
46
  "react-scroll-to-bottom": "^4.2.0",
@@ -50,25 +50,24 @@
50
50
  "remark-gfm": "^4.0.0",
51
51
  "theme-colors": "^0.1.0",
52
52
  "uuid": "^9.0.1",
53
- "zod": "^3.21.4",
53
+ "zod": "^3.22.4",
54
54
  "zustand": "^4.4.1"
55
55
  },
56
56
  "devDependencies": {
57
- "@bpinternal/es-node": "^0.0.4",
58
- "@bpinternal/yargs-extra": "^0.0.3",
57
+ "@repo/eslint-config": "workspace:*",
58
+ "@repo/typescript-config": "workspace:*",
59
59
  "@types/dom-speech-recognition": "^0.0.4",
60
60
  "@types/event-source-polyfill": "^1.0.2",
61
61
  "@types/json-schema": "^7.0.15",
62
- "@types/react": "^18.0.37",
63
- "@types/react-dom": "^18.0.11",
62
+ "@types/react": "18.3.10",
63
+ "@types/react-dom": "18.3.1",
64
64
  "@types/uuid": "^9.0.7",
65
65
  "@types/web": "^0.0.115",
66
- "@vitejs/plugin-react-swc": "^3.0.0",
67
- "vite": "^4.3.9",
66
+ "@vitejs/plugin-react-swc": "^3.3.2",
67
+ "vite": "^5.4.8",
68
68
  "vite-plugin-dts": "^3.5.4",
69
69
  "vite-plugin-libcss": "^1.1.1",
70
- "vite-plugin-svgr": "^3.2.0",
71
- "vitest": "^1.4.0",
72
- "webchat-api": "workspace:*"
70
+ "vite-plugin-svgr": "^4.2.0",
71
+ "vitest": "1.6.0"
73
72
  }
74
73
  }
@@ -1,184 +0,0 @@
1
- import * as messaging from '../messaging';
2
- import * as target from '../target';
3
- import * as types from '../typings';
4
- type WithBubble<T extends target.Message> = target.BubbleOf<T>;
5
- export type MessagingToTargetAdapters = types.Adapter<messaging.Messages, target.AdaptersOutput>;
6
- export declare const audioAdapter: ({ type, audio }: {
7
- type: "audio";
8
- audio: string;
9
- className?: string | undefined;
10
- avatarUrl?: string | undefined;
11
- title?: string | undefined;
12
- }) => {
13
- payload: {
14
- type: "audio";
15
- url: string;
16
- };
17
- };
18
- export declare const cardAdapter: (card: {
19
- type: "card";
20
- title: string;
21
- actions: ({
22
- text: string;
23
- title: string;
24
- action: "Say something";
25
- } | {
26
- title: string;
27
- action: "Open URL";
28
- url: string;
29
- } | {
30
- title: string;
31
- action: "Postback";
32
- payload: string;
33
- })[];
34
- className?: string | undefined;
35
- avatarUrl?: string | undefined;
36
- subtitle?: string | undefined;
37
- image?: string | undefined;
38
- }) => {
39
- payload: WithBubble<target.ColumnMessage>;
40
- };
41
- export declare const carouselAdapter: ({ items }: {
42
- type: "carousel";
43
- items: {
44
- type: "card";
45
- title: string;
46
- actions: ({
47
- text: string;
48
- title: string;
49
- action: "Say something";
50
- } | {
51
- title: string;
52
- action: "Open URL";
53
- url: string;
54
- } | {
55
- title: string;
56
- action: "Postback";
57
- payload: string;
58
- })[];
59
- className?: string | undefined;
60
- avatarUrl?: string | undefined;
61
- subtitle?: string | undefined;
62
- image?: string | undefined;
63
- }[];
64
- className?: string | undefined;
65
- avatarUrl?: string | undefined;
66
- }) => {
67
- payload: {
68
- type: "carousel";
69
- blocks: target.ColumnMessage[];
70
- };
71
- };
72
- export declare const choiceAdapter: (x: {
73
- type: "single-choice";
74
- text: string;
75
- choices: {
76
- value: string;
77
- title: string;
78
- }[];
79
- className?: string | undefined;
80
- avatarUrl?: string | undefined;
81
- disableFreeText?: boolean | undefined;
82
- }) => {
83
- disableInput: boolean | undefined;
84
- payload: target.Message;
85
- };
86
- export declare const dropdownAdapter: (x: {
87
- type: "dropdown";
88
- options: {
89
- value: string;
90
- label: string;
91
- }[];
92
- className?: string | undefined;
93
- avatarUrl?: string | undefined;
94
- message?: string | undefined;
95
- allowCreation?: boolean | undefined;
96
- placeholderText?: string | undefined;
97
- allowMultiple?: boolean | undefined;
98
- buttonText?: string | undefined;
99
- width?: number | undefined;
100
- displayInKeyboard?: boolean | undefined;
101
- markdown?: boolean | undefined;
102
- text?: string | undefined;
103
- }) => {
104
- disableInput: true;
105
- payload: WithBubble<target.ColumnMessage>;
106
- };
107
- export declare const fileAdapter: ({ file, ...props }: {
108
- type: "file";
109
- file: string;
110
- className?: string | undefined;
111
- avatarUrl?: string | undefined;
112
- title?: string | undefined;
113
- }) => {
114
- payload: {
115
- type: "file";
116
- className?: string | undefined;
117
- avatarUrl?: string | undefined;
118
- title?: string | undefined;
119
- url: string;
120
- };
121
- };
122
- export declare const imageAdapter: ({ type, image }: {
123
- type: "image";
124
- image: string;
125
- className?: string | undefined;
126
- avatarUrl?: string | undefined;
127
- }) => {
128
- payload: {
129
- type: "image";
130
- url: string;
131
- };
132
- };
133
- export declare const locationAdapter: ({ type, latitude, longitude, title, address }: {
134
- type: "location";
135
- latitude: number;
136
- longitude: number;
137
- className?: string | undefined;
138
- avatarUrl?: string | undefined;
139
- address?: string | undefined;
140
- title?: string | undefined;
141
- }) => {
142
- payload: {
143
- type: "location";
144
- latitude: number;
145
- longitude: number;
146
- title: string;
147
- };
148
- };
149
- export declare const quickReplyAdapter: ({ text, payload }: {
150
- type: "quick_reply";
151
- text: string;
152
- payload?: string | undefined;
153
- }) => {
154
- payload: {
155
- type: "text";
156
- text: string;
157
- };
158
- };
159
- export declare const textAdapter: ({ type, text }: {
160
- type: "text";
161
- text: string;
162
- className?: string | undefined;
163
- avatarUrl?: string | undefined;
164
- markdown?: boolean | undefined;
165
- }) => {
166
- payload: WithBubble<{
167
- type: "text";
168
- text: string;
169
- }>;
170
- };
171
- export declare const videoAdapter: ({ type, video }: {
172
- type: "video";
173
- video: string;
174
- className?: string | undefined;
175
- avatarUrl?: string | undefined;
176
- title?: string | undefined;
177
- }) => {
178
- payload: {
179
- type: "video";
180
- url: string;
181
- };
182
- };
183
- export declare const messageAdapter: (message: messaging.Message) => target.AdapterOutput;
184
- export {};
@@ -1,5 +0,0 @@
1
- import * as webchat from '../webchat';
2
- import * as messaging from '../messaging';
3
- import * as types from '../typings';
4
- export type MessagingToWebChatMessageAdapters = types.Adapter<messaging.Messages, webchat.Messages>;
5
- export declare const messageAdapter: (message: messaging.Message) => webchat.Message;
@@ -1,223 +0,0 @@
1
- import * as webchat from '../webchat';
2
- import * as messaging from '../messaging';
3
- import * as types from '../typings';
4
- export type WebChatToMessagingMessageAdapters = types.Adapter<webchat.Messages, messaging.Messages>;
5
- export type WebChatToMessagingTriggerAdapters = types.Adapter<webchat.Triggers, messaging.Triggers>;
6
- export declare const audioAdapter: (x: {
7
- type: "audio";
8
- audioUrl: string;
9
- className?: string | undefined;
10
- }) => {
11
- type: "audio";
12
- audio: string;
13
- audioUrl: string;
14
- className?: string | undefined;
15
- };
16
- export declare const cardAdapter: (x: {
17
- type: "card";
18
- title: string;
19
- actions: {
20
- value: string;
21
- action: "postback" | "url" | "say";
22
- label: string;
23
- }[];
24
- className?: string | undefined;
25
- subtitle?: string | undefined;
26
- imageUrl?: string | undefined;
27
- }) => {
28
- type: "card";
29
- title: string;
30
- actions: ({
31
- text: string;
32
- title: string;
33
- action: "Say something";
34
- } | {
35
- title: string;
36
- action: "Open URL";
37
- url: string;
38
- } | {
39
- title: string;
40
- action: "Postback";
41
- payload: string;
42
- })[];
43
- className?: string | undefined;
44
- avatarUrl?: string | undefined;
45
- subtitle?: string | undefined;
46
- image?: string | undefined;
47
- };
48
- export declare const carouselAdapter: (x: {
49
- type: "carousel";
50
- items: {
51
- title: string;
52
- actions: {
53
- value: string;
54
- action: "postback" | "url" | "say";
55
- label: string;
56
- }[];
57
- imageUrl?: string | undefined;
58
- subtitle?: string | undefined;
59
- className?: string | undefined;
60
- }[];
61
- className?: string | undefined;
62
- }) => {
63
- type: "carousel";
64
- items: {
65
- type: "card";
66
- title: string;
67
- actions: ({
68
- text: string;
69
- title: string;
70
- action: "Say something";
71
- } | {
72
- title: string;
73
- action: "Open URL";
74
- url: string;
75
- } | {
76
- title: string;
77
- action: "Postback";
78
- payload: string;
79
- })[];
80
- className?: string | undefined;
81
- avatarUrl?: string | undefined;
82
- subtitle?: string | undefined;
83
- image?: string | undefined;
84
- }[];
85
- className?: string | undefined;
86
- };
87
- export declare const choiceAdapter: (x: {
88
- type: "choice";
89
- text: string;
90
- options: {
91
- value: string;
92
- label: string;
93
- }[];
94
- disableFreeText?: boolean | undefined;
95
- className?: string | undefined;
96
- }) => {
97
- type: "single-choice";
98
- text: string;
99
- choices: {
100
- title: string;
101
- value: string;
102
- }[];
103
- disableFreeText: boolean | undefined;
104
- options: {
105
- value: string;
106
- label: string;
107
- }[];
108
- className?: string | undefined;
109
- };
110
- export declare const dropdownAdapter: (x: {
111
- type: "dropdown";
112
- text: string;
113
- options: {
114
- value: string;
115
- label: string;
116
- }[];
117
- className?: string | undefined;
118
- }) => {
119
- type: "dropdown";
120
- message: string;
121
- options: {
122
- label: string;
123
- value: string;
124
- }[];
125
- text: string;
126
- className?: string | undefined;
127
- };
128
- export declare const fileAdapter: (x: {
129
- type: "file";
130
- fileUrl: string;
131
- title?: string | undefined;
132
- className?: string | undefined;
133
- }) => {
134
- type: "file";
135
- file: string;
136
- title: string | undefined;
137
- fileUrl: string;
138
- className?: string | undefined;
139
- };
140
- export declare const imageAdapter: (x: {
141
- type: "image";
142
- imageUrl: string;
143
- className?: string | undefined;
144
- }) => {
145
- type: "image";
146
- image: string;
147
- imageUrl: string;
148
- className?: string | undefined;
149
- };
150
- export declare const locationAdapter: (x: {
151
- type: "location";
152
- latitude: number;
153
- longitude: number;
154
- title?: string | undefined;
155
- address?: string | undefined;
156
- className?: string | undefined;
157
- }) => {
158
- type: "location";
159
- latitude: number;
160
- longitude: number;
161
- title?: string | undefined;
162
- address?: string | undefined;
163
- className?: string | undefined;
164
- };
165
- export declare const markdownAdapter: (x: {
166
- type: "markdown";
167
- markdown: string;
168
- className?: string | undefined;
169
- }) => {
170
- type: "text";
171
- text: string;
172
- markdown: true;
173
- className?: string | undefined;
174
- };
175
- export declare const textAdapter: (x: {
176
- type: "text";
177
- text: string;
178
- className?: string | undefined;
179
- }) => {
180
- type: "text";
181
- text: string;
182
- markdown: true;
183
- className?: string | undefined;
184
- };
185
- export declare const videoAdapter: (x: {
186
- type: "video";
187
- videoUrl: string;
188
- className?: string | undefined;
189
- }) => {
190
- type: "video";
191
- video: string;
192
- videoUrl: string;
193
- className?: string | undefined;
194
- };
195
- export declare const messageAdapter: (message: webchat.Message) => messaging.Message;
196
- export declare const webchatVisibilityAdapter: (x: {
197
- type: "webchat_visibility";
198
- data: {
199
- visibility: "show" | "hide" | "toggle";
200
- };
201
- }) => {
202
- type: "webchat-visibility";
203
- visibility: "show" | "hide" | "toggle";
204
- };
205
- export declare const webchatConfigAdapter: (x: {
206
- type: "webchat_config";
207
- data: {
208
- config: Record<string, any>;
209
- };
210
- }) => {
211
- type: "webchat-config";
212
- config: Record<string, any>;
213
- };
214
- export declare const customAdapter: (x: {
215
- type: "custom";
216
- data: {
217
- event: Record<string, any>;
218
- };
219
- }) => {
220
- type: "custom-event";
221
- event: Record<string, any>;
222
- };
223
- export declare const triggerAdapter: (trigger: webchat.Trigger) => messaging.Trigger;
@@ -1,197 +0,0 @@
1
- import * as target from '../target';
2
- import * as webchat from '../webchat';
3
- import * as types from '../typings';
4
- export type WebchatToTargetAdapters = types.Adapter<webchat.Messages, target.AdaptersOutput>;
5
- export declare const audioAdapter: (webchatMessage: {
6
- type: "audio";
7
- audioUrl: string;
8
- className?: string | undefined;
9
- }) => {
10
- payload: {
11
- type: "audio";
12
- url: string;
13
- };
14
- };
15
- export declare const cardAdapter: (webchatMessage: {
16
- type: "card";
17
- title: string;
18
- actions: {
19
- value: string;
20
- action: "postback" | "url" | "say";
21
- label: string;
22
- }[];
23
- className?: string | undefined;
24
- subtitle?: string | undefined;
25
- imageUrl?: string | undefined;
26
- }) => {
27
- payload: Omit<target.BubbleMessage, "block"> & {
28
- block: target.ColumnMessage;
29
- };
30
- };
31
- export declare const carouselAdapter: (webchatMessage: {
32
- type: "carousel";
33
- items: {
34
- title: string;
35
- actions: {
36
- value: string;
37
- action: "postback" | "url" | "say";
38
- label: string;
39
- }[];
40
- imageUrl?: string | undefined;
41
- subtitle?: string | undefined;
42
- className?: string | undefined;
43
- }[];
44
- className?: string | undefined;
45
- }) => {
46
- payload: {
47
- type: "carousel";
48
- blocks: target.ColumnMessage[];
49
- };
50
- };
51
- export declare const choiceAdapter: (webchatMessage: {
52
- type: "choice";
53
- text: string;
54
- options: {
55
- value: string;
56
- label: string;
57
- }[];
58
- disableFreeText?: boolean | undefined;
59
- className?: string | undefined;
60
- }) => {
61
- disableInput: boolean | undefined;
62
- payload: target.Message;
63
- };
64
- export declare const dropdownAdapter: (webchatMessage: {
65
- type: "dropdown";
66
- text: string;
67
- options: {
68
- value: string;
69
- label: string;
70
- }[];
71
- className?: string | undefined;
72
- }) => {
73
- disableInput: true;
74
- payload: Omit<target.BubbleMessage, "block"> & {
75
- block: target.ColumnMessage;
76
- };
77
- };
78
- export declare const fileAdapter: (webchatMessage: {
79
- type: "file";
80
- fileUrl: string;
81
- title?: string | undefined;
82
- className?: string | undefined;
83
- }) => {
84
- payload: {
85
- type: "file";
86
- className?: string | undefined;
87
- avatarUrl?: string | undefined;
88
- title?: string | undefined;
89
- url: string;
90
- };
91
- };
92
- export declare const imageAdapter: (webchatMessage: {
93
- type: "image";
94
- imageUrl: string;
95
- className?: string | undefined;
96
- }) => {
97
- payload: {
98
- type: "image";
99
- url: string;
100
- };
101
- };
102
- export declare const locationAdapter: (webchatMessage: {
103
- type: "location";
104
- latitude: number;
105
- longitude: number;
106
- title?: string | undefined;
107
- address?: string | undefined;
108
- className?: string | undefined;
109
- }) => {
110
- payload: {
111
- type: "location";
112
- latitude: number;
113
- longitude: number;
114
- title: string;
115
- };
116
- };
117
- export declare const markdownAdapter: (webchatMessage: {
118
- type: "markdown";
119
- markdown: string;
120
- className?: string | undefined;
121
- }) => {
122
- payload: Omit<target.BubbleMessage, "block"> & {
123
- block: {
124
- type: "text";
125
- text: string;
126
- };
127
- };
128
- };
129
- export declare const textAdapter: (webchatMessage: {
130
- type: "text";
131
- text: string;
132
- className?: string | undefined;
133
- }) => {
134
- payload: Omit<target.BubbleMessage, "block"> & {
135
- block: {
136
- type: "text";
137
- text: string;
138
- };
139
- };
140
- };
141
- export declare const videoAdapter: (webchatMessage: {
142
- type: "video";
143
- videoUrl: string;
144
- className?: string | undefined;
145
- }) => {
146
- payload: {
147
- type: "video";
148
- url: string;
149
- };
150
- };
151
- export declare const blocAdapter: (webchatMessage: {
152
- type: "bloc";
153
- items: ({
154
- type: "text";
155
- payload: {
156
- text: string;
157
- };
158
- } | {
159
- type: "markdown";
160
- payload: {
161
- markdown: string;
162
- };
163
- } | {
164
- type: "image";
165
- payload: {
166
- imageUrl: string;
167
- };
168
- } | {
169
- type: "audio";
170
- payload: {
171
- audioUrl: string;
172
- };
173
- } | {
174
- type: "video";
175
- payload: {
176
- videoUrl: string;
177
- };
178
- } | {
179
- type: "file";
180
- payload: {
181
- fileUrl: string;
182
- title?: string | undefined;
183
- };
184
- } | {
185
- type: "location";
186
- payload: {
187
- latitude: number;
188
- longitude: number;
189
- address?: string | undefined;
190
- title?: string | undefined;
191
- };
192
- })[];
193
- className?: string | undefined;
194
- }) => {
195
- payload: target.ColumnMessage;
196
- };
197
- export declare const messageAdapter: (message: webchat.Message) => target.AdapterOutput;