@botpress/webchat 2.2.12 → 2.2.14

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 (38) hide show
  1. package/.turbo/turbo-build.log +8 -10
  2. package/dist/adapters/{messaging-to-target.d.ts → adapters/messaging-to-target.d.ts} +20 -19
  3. package/dist/adapters/adapters/messaging-to-webchat.d.ts +5 -0
  4. package/dist/adapters/adapters/webchat-to-messaging.d.ts +223 -0
  5. package/dist/adapters/{webchat-to-target.d.ts → adapters/webchat-to-target.d.ts} +15 -14
  6. package/dist/adapters/index.d.ts +6 -3
  7. package/dist/adapters/messaging.d.ts +1455 -0
  8. package/dist/adapters/sdk.d.ts +472 -0
  9. package/dist/adapters/target.d.ts +2 -2
  10. package/dist/adapters/typings.d.ts +12 -0
  11. package/dist/adapters/webchat.d.ts +1171 -0
  12. package/dist/client/MessagingClient/client.d.ts +3 -3
  13. package/dist/client/PushpinClient/state-machine.d.ts +5 -5
  14. package/dist/components/Block.d.ts +1 -1
  15. package/dist/components/Composer/Composer.d.ts +0 -1
  16. package/dist/components/Container/Container.d.ts +0 -1
  17. package/dist/components/Fab/Fab.d.ts +0 -1
  18. package/dist/components/MessageList/MessageList.d.ts +1 -1
  19. package/dist/components/TypingIndicator/TypingIndicator.d.ts +1 -1
  20. package/dist/components/renderers/Audio/Audio.d.ts +0 -1
  21. package/dist/components/renderers/Carousel/Carousel.d.ts +0 -1
  22. package/dist/components/renderers/File/File.d.ts +0 -1
  23. package/dist/components/renderers/Image/Image.d.ts +0 -1
  24. package/dist/components/renderers/Location/Location.d.ts +0 -1
  25. package/dist/components/renderers/Video/Video.d.ts +0 -1
  26. package/dist/gen/signals/index.d.ts +30 -30
  27. package/dist/gen/signals/messageCreated.z.d.ts +30 -30
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.js +18305 -28071
  30. package/dist/index.umd.cjs +102 -178
  31. package/dist/providers/WebchatProvider.d.ts +0 -1
  32. package/dist/schemas/init.d.ts +14 -15
  33. package/dist/schemas/theme.d.ts +8 -8
  34. package/dist/stores/offlineStore.d.ts +1 -1
  35. package/dist/style.css +1 -1
  36. package/dist/styles/index.d.ts +1 -0
  37. package/dist/types/block-type.d.ts +1 -1
  38. package/package.json +1 -3
@@ -0,0 +1,472 @@
1
+ import { z } from 'zod';
2
+ export declare const defaults: {
3
+ readonly text: {
4
+ readonly schema: z.ZodObject<{
5
+ text: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ text: string;
8
+ }, {
9
+ text: string;
10
+ }>;
11
+ };
12
+ readonly markdown: {
13
+ readonly schema: z.ZodObject<{
14
+ markdown: z.ZodString;
15
+ }, "strip", z.ZodTypeAny, {
16
+ markdown: string;
17
+ }, {
18
+ markdown: string;
19
+ }>;
20
+ };
21
+ readonly image: {
22
+ readonly schema: z.ZodObject<{
23
+ imageUrl: z.ZodString;
24
+ }, "strip", z.ZodTypeAny, {
25
+ imageUrl: string;
26
+ }, {
27
+ imageUrl: string;
28
+ }>;
29
+ };
30
+ readonly audio: {
31
+ readonly schema: z.ZodObject<{
32
+ audioUrl: z.ZodString;
33
+ }, "strip", z.ZodTypeAny, {
34
+ audioUrl: string;
35
+ }, {
36
+ audioUrl: string;
37
+ }>;
38
+ };
39
+ readonly video: {
40
+ readonly schema: z.ZodObject<{
41
+ videoUrl: z.ZodString;
42
+ }, "strip", z.ZodTypeAny, {
43
+ videoUrl: string;
44
+ }, {
45
+ videoUrl: string;
46
+ }>;
47
+ };
48
+ readonly file: {
49
+ readonly schema: z.ZodObject<{
50
+ fileUrl: z.ZodString;
51
+ title: z.ZodOptional<z.ZodString>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ fileUrl: string;
54
+ title?: string | undefined;
55
+ }, {
56
+ fileUrl: string;
57
+ title?: string | undefined;
58
+ }>;
59
+ };
60
+ readonly location: {
61
+ readonly schema: z.ZodObject<{
62
+ latitude: z.ZodNumber;
63
+ longitude: z.ZodNumber;
64
+ address: z.ZodOptional<z.ZodString>;
65
+ title: z.ZodOptional<z.ZodString>;
66
+ }, "strip", z.ZodTypeAny, {
67
+ latitude: number;
68
+ longitude: number;
69
+ address?: string | undefined;
70
+ title?: string | undefined;
71
+ }, {
72
+ latitude: number;
73
+ longitude: number;
74
+ address?: string | undefined;
75
+ title?: string | undefined;
76
+ }>;
77
+ };
78
+ readonly carousel: {
79
+ readonly schema: z.ZodObject<{
80
+ items: z.ZodArray<z.ZodObject<{
81
+ title: z.ZodString;
82
+ subtitle: z.ZodOptional<z.ZodString>;
83
+ imageUrl: z.ZodOptional<z.ZodString>;
84
+ actions: z.ZodArray<z.ZodObject<{
85
+ action: z.ZodEnum<["postback", "url", "say"]>;
86
+ label: z.ZodString;
87
+ value: z.ZodString;
88
+ }, "strip", z.ZodTypeAny, {
89
+ value: string;
90
+ action: "postback" | "url" | "say";
91
+ label: string;
92
+ }, {
93
+ value: string;
94
+ action: "postback" | "url" | "say";
95
+ label: string;
96
+ }>, "many">;
97
+ }, "strip", z.ZodTypeAny, {
98
+ title: string;
99
+ actions: {
100
+ value: string;
101
+ action: "postback" | "url" | "say";
102
+ label: string;
103
+ }[];
104
+ subtitle?: string | undefined;
105
+ imageUrl?: string | undefined;
106
+ }, {
107
+ title: string;
108
+ actions: {
109
+ value: string;
110
+ action: "postback" | "url" | "say";
111
+ label: string;
112
+ }[];
113
+ subtitle?: string | undefined;
114
+ imageUrl?: string | undefined;
115
+ }>, "many">;
116
+ }, "strip", z.ZodTypeAny, {
117
+ items: {
118
+ title: string;
119
+ actions: {
120
+ value: string;
121
+ action: "postback" | "url" | "say";
122
+ label: string;
123
+ }[];
124
+ subtitle?: string | undefined;
125
+ imageUrl?: string | undefined;
126
+ }[];
127
+ }, {
128
+ items: {
129
+ title: string;
130
+ actions: {
131
+ value: string;
132
+ action: "postback" | "url" | "say";
133
+ label: string;
134
+ }[];
135
+ subtitle?: string | undefined;
136
+ imageUrl?: string | undefined;
137
+ }[];
138
+ }>;
139
+ };
140
+ readonly card: {
141
+ readonly schema: z.ZodObject<{
142
+ title: z.ZodString;
143
+ subtitle: z.ZodOptional<z.ZodString>;
144
+ imageUrl: z.ZodOptional<z.ZodString>;
145
+ actions: z.ZodArray<z.ZodObject<{
146
+ action: z.ZodEnum<["postback", "url", "say"]>;
147
+ label: z.ZodString;
148
+ value: z.ZodString;
149
+ }, "strip", z.ZodTypeAny, {
150
+ value: string;
151
+ action: "postback" | "url" | "say";
152
+ label: string;
153
+ }, {
154
+ value: string;
155
+ action: "postback" | "url" | "say";
156
+ label: string;
157
+ }>, "many">;
158
+ }, "strip", z.ZodTypeAny, {
159
+ title: string;
160
+ actions: {
161
+ value: string;
162
+ action: "postback" | "url" | "say";
163
+ label: string;
164
+ }[];
165
+ subtitle?: string | undefined;
166
+ imageUrl?: string | undefined;
167
+ }, {
168
+ title: string;
169
+ actions: {
170
+ value: string;
171
+ action: "postback" | "url" | "say";
172
+ label: string;
173
+ }[];
174
+ subtitle?: string | undefined;
175
+ imageUrl?: string | undefined;
176
+ }>;
177
+ };
178
+ readonly dropdown: {
179
+ readonly schema: z.ZodObject<{
180
+ text: z.ZodString;
181
+ options: z.ZodArray<z.ZodObject<{
182
+ label: z.ZodString;
183
+ value: z.ZodString;
184
+ }, "strip", z.ZodTypeAny, {
185
+ value: string;
186
+ label: string;
187
+ }, {
188
+ value: string;
189
+ label: string;
190
+ }>, "many">;
191
+ }, "strip", z.ZodTypeAny, {
192
+ text: string;
193
+ options: {
194
+ value: string;
195
+ label: string;
196
+ }[];
197
+ }, {
198
+ text: string;
199
+ options: {
200
+ value: string;
201
+ label: string;
202
+ }[];
203
+ }>;
204
+ };
205
+ readonly choice: {
206
+ readonly schema: z.ZodObject<{
207
+ text: z.ZodString;
208
+ options: z.ZodArray<z.ZodObject<{
209
+ label: z.ZodString;
210
+ value: z.ZodString;
211
+ }, "strip", z.ZodTypeAny, {
212
+ value: string;
213
+ label: string;
214
+ }, {
215
+ value: string;
216
+ label: string;
217
+ }>, "many">;
218
+ }, "strip", z.ZodTypeAny, {
219
+ text: string;
220
+ options: {
221
+ value: string;
222
+ label: string;
223
+ }[];
224
+ }, {
225
+ text: string;
226
+ options: {
227
+ value: string;
228
+ label: string;
229
+ }[];
230
+ }>;
231
+ };
232
+ readonly bloc: {
233
+ readonly schema: z.ZodObject<{
234
+ items: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
235
+ type: z.ZodLiteral<"text">;
236
+ payload: z.ZodObject<{
237
+ text: z.ZodString;
238
+ }, "strip", z.ZodTypeAny, {
239
+ text: string;
240
+ }, {
241
+ text: string;
242
+ }>;
243
+ }, "strip", z.ZodTypeAny, {
244
+ type: "text";
245
+ payload: {
246
+ text: string;
247
+ };
248
+ }, {
249
+ type: "text";
250
+ payload: {
251
+ text: string;
252
+ };
253
+ }>, z.ZodObject<{
254
+ type: z.ZodLiteral<"markdown">;
255
+ payload: z.ZodObject<{
256
+ markdown: z.ZodString;
257
+ }, "strip", z.ZodTypeAny, {
258
+ markdown: string;
259
+ }, {
260
+ markdown: string;
261
+ }>;
262
+ }, "strip", z.ZodTypeAny, {
263
+ type: "markdown";
264
+ payload: {
265
+ markdown: string;
266
+ };
267
+ }, {
268
+ type: "markdown";
269
+ payload: {
270
+ markdown: string;
271
+ };
272
+ }>, z.ZodObject<{
273
+ type: z.ZodLiteral<"image">;
274
+ payload: z.ZodObject<{
275
+ imageUrl: z.ZodString;
276
+ }, "strip", z.ZodTypeAny, {
277
+ imageUrl: string;
278
+ }, {
279
+ imageUrl: string;
280
+ }>;
281
+ }, "strip", z.ZodTypeAny, {
282
+ type: "image";
283
+ payload: {
284
+ imageUrl: string;
285
+ };
286
+ }, {
287
+ type: "image";
288
+ payload: {
289
+ imageUrl: string;
290
+ };
291
+ }>, z.ZodObject<{
292
+ type: z.ZodLiteral<"audio">;
293
+ payload: z.ZodObject<{
294
+ audioUrl: z.ZodString;
295
+ }, "strip", z.ZodTypeAny, {
296
+ audioUrl: string;
297
+ }, {
298
+ audioUrl: string;
299
+ }>;
300
+ }, "strip", z.ZodTypeAny, {
301
+ type: "audio";
302
+ payload: {
303
+ audioUrl: string;
304
+ };
305
+ }, {
306
+ type: "audio";
307
+ payload: {
308
+ audioUrl: string;
309
+ };
310
+ }>, z.ZodObject<{
311
+ type: z.ZodLiteral<"video">;
312
+ payload: z.ZodObject<{
313
+ videoUrl: z.ZodString;
314
+ }, "strip", z.ZodTypeAny, {
315
+ videoUrl: string;
316
+ }, {
317
+ videoUrl: string;
318
+ }>;
319
+ }, "strip", z.ZodTypeAny, {
320
+ type: "video";
321
+ payload: {
322
+ videoUrl: string;
323
+ };
324
+ }, {
325
+ type: "video";
326
+ payload: {
327
+ videoUrl: string;
328
+ };
329
+ }>, z.ZodObject<{
330
+ type: z.ZodLiteral<"file">;
331
+ payload: z.ZodObject<{
332
+ fileUrl: z.ZodString;
333
+ title: z.ZodOptional<z.ZodString>;
334
+ }, "strip", z.ZodTypeAny, {
335
+ fileUrl: string;
336
+ title?: string | undefined;
337
+ }, {
338
+ fileUrl: string;
339
+ title?: string | undefined;
340
+ }>;
341
+ }, "strip", z.ZodTypeAny, {
342
+ type: "file";
343
+ payload: {
344
+ fileUrl: string;
345
+ title?: string | undefined;
346
+ };
347
+ }, {
348
+ type: "file";
349
+ payload: {
350
+ fileUrl: string;
351
+ title?: string | undefined;
352
+ };
353
+ }>, z.ZodObject<{
354
+ type: z.ZodLiteral<"location">;
355
+ payload: z.ZodObject<{
356
+ latitude: z.ZodNumber;
357
+ longitude: z.ZodNumber;
358
+ address: z.ZodOptional<z.ZodString>;
359
+ title: z.ZodOptional<z.ZodString>;
360
+ }, "strip", z.ZodTypeAny, {
361
+ latitude: number;
362
+ longitude: number;
363
+ address?: string | undefined;
364
+ title?: string | undefined;
365
+ }, {
366
+ latitude: number;
367
+ longitude: number;
368
+ address?: string | undefined;
369
+ title?: string | undefined;
370
+ }>;
371
+ }, "strip", z.ZodTypeAny, {
372
+ type: "location";
373
+ payload: {
374
+ latitude: number;
375
+ longitude: number;
376
+ address?: string | undefined;
377
+ title?: string | undefined;
378
+ };
379
+ }, {
380
+ type: "location";
381
+ payload: {
382
+ latitude: number;
383
+ longitude: number;
384
+ address?: string | undefined;
385
+ title?: string | undefined;
386
+ };
387
+ }>]>, "many">;
388
+ }, "strip", z.ZodTypeAny, {
389
+ items: ({
390
+ type: "text";
391
+ payload: {
392
+ text: string;
393
+ };
394
+ } | {
395
+ type: "markdown";
396
+ payload: {
397
+ markdown: string;
398
+ };
399
+ } | {
400
+ type: "image";
401
+ payload: {
402
+ imageUrl: string;
403
+ };
404
+ } | {
405
+ type: "audio";
406
+ payload: {
407
+ audioUrl: string;
408
+ };
409
+ } | {
410
+ type: "video";
411
+ payload: {
412
+ videoUrl: string;
413
+ };
414
+ } | {
415
+ type: "file";
416
+ payload: {
417
+ fileUrl: string;
418
+ title?: string | undefined;
419
+ };
420
+ } | {
421
+ type: "location";
422
+ payload: {
423
+ latitude: number;
424
+ longitude: number;
425
+ address?: string | undefined;
426
+ title?: string | undefined;
427
+ };
428
+ })[];
429
+ }, {
430
+ items: ({
431
+ type: "text";
432
+ payload: {
433
+ text: string;
434
+ };
435
+ } | {
436
+ type: "markdown";
437
+ payload: {
438
+ markdown: string;
439
+ };
440
+ } | {
441
+ type: "image";
442
+ payload: {
443
+ imageUrl: string;
444
+ };
445
+ } | {
446
+ type: "audio";
447
+ payload: {
448
+ audioUrl: string;
449
+ };
450
+ } | {
451
+ type: "video";
452
+ payload: {
453
+ videoUrl: string;
454
+ };
455
+ } | {
456
+ type: "file";
457
+ payload: {
458
+ fileUrl: string;
459
+ title?: string | undefined;
460
+ };
461
+ } | {
462
+ type: "location";
463
+ payload: {
464
+ latitude: number;
465
+ longitude: number;
466
+ address?: string | undefined;
467
+ title?: string | undefined;
468
+ };
469
+ })[];
470
+ }>;
471
+ };
472
+ };
@@ -1,4 +1,4 @@
1
- import * as adapters from 'webchat-adapters';
1
+ import * as types from './typings';
2
2
  export type AudioMessage = {
3
3
  type: 'audio';
4
4
  url: string;
@@ -74,7 +74,7 @@ export type ColumnOf<T extends Message> = Omit<ColumnMessage, 'blocks'> & {
74
74
  export type RowOf<T extends Message> = Omit<RowMessage, 'blocks'> & {
75
75
  blocks: T[];
76
76
  };
77
- export type Messages = adapters.MessagesOf<Message>;
77
+ export type Messages = types.MessagesOf<Message>;
78
78
  export type AdapterOutput = {
79
79
  payload: Message;
80
80
  disableInput?: boolean;
@@ -0,0 +1,12 @@
1
+ type ValueOf<T> = T[keyof T];
2
+ export type MessagesOf<M extends {
3
+ type: string;
4
+ }> = {
5
+ [Type in M['type']]: Extract<M, {
6
+ type: Type;
7
+ }>;
8
+ };
9
+ export type Adapter<A extends Record<string, object>, B extends Record<string, object>> = {
10
+ [Type in keyof A]: (message: A[Type]) => ValueOf<B>;
11
+ };
12
+ export {};