@botpress/webchat-client 0.1.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.
@@ -0,0 +1,201 @@
1
+ export type MessageCreated = {
2
+ type: 'message_created'
3
+ /**
4
+ * The Message object represents a message in a [Conversation](#schema_conversation) for a specific [User](#schema_user).
5
+ */
6
+ data: {
7
+ /**
8
+ * Id of the [Message](#schema_message)
9
+ */
10
+ id: string
11
+ /**
12
+ * Creation date of the [Message](#schema_message) in ISO 8601 format
13
+ */
14
+ createdAt: string
15
+ /**
16
+ * Payload is the content of the message.
17
+ */
18
+ payload:
19
+ | {
20
+ audioUrl: string
21
+ type: 'audio'
22
+ [k: string]: any
23
+ }
24
+ | {
25
+ title: string
26
+ subtitle?: string
27
+ imageUrl?: string
28
+ actions: {
29
+ action: 'postback' | 'url' | 'say'
30
+ label: string
31
+ value: string
32
+ [k: string]: any
33
+ }[]
34
+ type: 'card'
35
+ [k: string]: any
36
+ }
37
+ | {
38
+ items: {
39
+ title: string
40
+ subtitle?: string
41
+ imageUrl?: string
42
+ actions: {
43
+ action: 'postback' | 'url' | 'say'
44
+ label: string
45
+ value: string
46
+ [k: string]: any
47
+ }[]
48
+ [k: string]: any
49
+ }[]
50
+ type: 'carousel'
51
+ [k: string]: any
52
+ }
53
+ | {
54
+ text: string
55
+ options: {
56
+ label: string
57
+ value: string
58
+ [k: string]: any
59
+ }[]
60
+ type: 'choice'
61
+ disableFreeText?: boolean
62
+ [k: string]: any
63
+ }
64
+ | {
65
+ text: string
66
+ options: {
67
+ label: string
68
+ value: string
69
+ [k: string]: any
70
+ }[]
71
+ type: 'dropdown'
72
+ [k: string]: any
73
+ }
74
+ | {
75
+ fileUrl: string
76
+ title?: string
77
+ type: 'file'
78
+ [k: string]: any
79
+ }
80
+ | {
81
+ imageUrl: string
82
+ type: 'image'
83
+ [k: string]: any
84
+ }
85
+ | {
86
+ latitude: number
87
+ longitude: number
88
+ address?: string
89
+ title?: string
90
+ type: 'location'
91
+ [k: string]: any
92
+ }
93
+ | {
94
+ text: string
95
+ type: 'text'
96
+ value?: string
97
+ [k: string]: any
98
+ }
99
+ | {
100
+ videoUrl: string
101
+ type: 'video'
102
+ [k: string]: any
103
+ }
104
+ | {
105
+ items: (
106
+ | {
107
+ type: 'text'
108
+ payload: {
109
+ text: string
110
+ [k: string]: any
111
+ }
112
+ [k: string]: any
113
+ }
114
+ | {
115
+ type: 'markdown'
116
+ payload: {
117
+ markdown: string
118
+ [k: string]: any
119
+ }
120
+ [k: string]: any
121
+ }
122
+ | {
123
+ type: 'image'
124
+ payload: {
125
+ imageUrl: string
126
+ [k: string]: any
127
+ }
128
+ [k: string]: any
129
+ }
130
+ | {
131
+ type: 'audio'
132
+ payload: {
133
+ audioUrl: string
134
+ [k: string]: any
135
+ }
136
+ [k: string]: any
137
+ }
138
+ | {
139
+ type: 'video'
140
+ payload: {
141
+ videoUrl: string
142
+ [k: string]: any
143
+ }
144
+ [k: string]: any
145
+ }
146
+ | {
147
+ type: 'file'
148
+ payload: {
149
+ fileUrl: string
150
+ title?: string
151
+ [k: string]: any
152
+ }
153
+ [k: string]: any
154
+ }
155
+ | {
156
+ type: 'location'
157
+ payload: {
158
+ latitude: number
159
+ longitude: number
160
+ address?: string
161
+ title?: string
162
+ [k: string]: any
163
+ }
164
+ [k: string]: any
165
+ }
166
+ )[]
167
+ type: 'bloc'
168
+ [k: string]: any
169
+ }
170
+ | {
171
+ markdown: string
172
+ type: 'markdown'
173
+ [k: string]: any
174
+ }
175
+ | {
176
+ type: 'custom'
177
+ url: string
178
+ name: string
179
+ data?: any
180
+ [k: string]: any
181
+ }
182
+ /**
183
+ * ID of the [User](#schema_user)
184
+ */
185
+ userId: string
186
+ /**
187
+ * ID of the [Conversation](#schema_conversation)
188
+ */
189
+ conversationId: string
190
+ /**
191
+ * Metadata of the message
192
+ */
193
+ metadata?: {
194
+ [k: string]: any
195
+ }
196
+ /**
197
+ * ID of the message this message is replying to
198
+ */
199
+ replyTo?: string
200
+ }
201
+ }
@@ -0,0 +1,201 @@
1
+ export type MessageUpdated = {
2
+ type: 'message_updated'
3
+ /**
4
+ * The Message object represents a message in a [Conversation](#schema_conversation) for a specific [User](#schema_user).
5
+ */
6
+ data: {
7
+ /**
8
+ * Id of the [Message](#schema_message)
9
+ */
10
+ id: string
11
+ /**
12
+ * Creation date of the [Message](#schema_message) in ISO 8601 format
13
+ */
14
+ createdAt: string
15
+ /**
16
+ * Payload is the content of the message.
17
+ */
18
+ payload:
19
+ | {
20
+ audioUrl: string
21
+ type: 'audio'
22
+ [k: string]: any
23
+ }
24
+ | {
25
+ title: string
26
+ subtitle?: string
27
+ imageUrl?: string
28
+ actions: {
29
+ action: 'postback' | 'url' | 'say'
30
+ label: string
31
+ value: string
32
+ [k: string]: any
33
+ }[]
34
+ type: 'card'
35
+ [k: string]: any
36
+ }
37
+ | {
38
+ items: {
39
+ title: string
40
+ subtitle?: string
41
+ imageUrl?: string
42
+ actions: {
43
+ action: 'postback' | 'url' | 'say'
44
+ label: string
45
+ value: string
46
+ [k: string]: any
47
+ }[]
48
+ [k: string]: any
49
+ }[]
50
+ type: 'carousel'
51
+ [k: string]: any
52
+ }
53
+ | {
54
+ text: string
55
+ options: {
56
+ label: string
57
+ value: string
58
+ [k: string]: any
59
+ }[]
60
+ type: 'choice'
61
+ disableFreeText?: boolean
62
+ [k: string]: any
63
+ }
64
+ | {
65
+ text: string
66
+ options: {
67
+ label: string
68
+ value: string
69
+ [k: string]: any
70
+ }[]
71
+ type: 'dropdown'
72
+ [k: string]: any
73
+ }
74
+ | {
75
+ fileUrl: string
76
+ title?: string
77
+ type: 'file'
78
+ [k: string]: any
79
+ }
80
+ | {
81
+ imageUrl: string
82
+ type: 'image'
83
+ [k: string]: any
84
+ }
85
+ | {
86
+ latitude: number
87
+ longitude: number
88
+ address?: string
89
+ title?: string
90
+ type: 'location'
91
+ [k: string]: any
92
+ }
93
+ | {
94
+ text: string
95
+ type: 'text'
96
+ value?: string
97
+ [k: string]: any
98
+ }
99
+ | {
100
+ videoUrl: string
101
+ type: 'video'
102
+ [k: string]: any
103
+ }
104
+ | {
105
+ items: (
106
+ | {
107
+ type: 'text'
108
+ payload: {
109
+ text: string
110
+ [k: string]: any
111
+ }
112
+ [k: string]: any
113
+ }
114
+ | {
115
+ type: 'markdown'
116
+ payload: {
117
+ markdown: string
118
+ [k: string]: any
119
+ }
120
+ [k: string]: any
121
+ }
122
+ | {
123
+ type: 'image'
124
+ payload: {
125
+ imageUrl: string
126
+ [k: string]: any
127
+ }
128
+ [k: string]: any
129
+ }
130
+ | {
131
+ type: 'audio'
132
+ payload: {
133
+ audioUrl: string
134
+ [k: string]: any
135
+ }
136
+ [k: string]: any
137
+ }
138
+ | {
139
+ type: 'video'
140
+ payload: {
141
+ videoUrl: string
142
+ [k: string]: any
143
+ }
144
+ [k: string]: any
145
+ }
146
+ | {
147
+ type: 'file'
148
+ payload: {
149
+ fileUrl: string
150
+ title?: string
151
+ [k: string]: any
152
+ }
153
+ [k: string]: any
154
+ }
155
+ | {
156
+ type: 'location'
157
+ payload: {
158
+ latitude: number
159
+ longitude: number
160
+ address?: string
161
+ title?: string
162
+ [k: string]: any
163
+ }
164
+ [k: string]: any
165
+ }
166
+ )[]
167
+ type: 'bloc'
168
+ [k: string]: any
169
+ }
170
+ | {
171
+ markdown: string
172
+ type: 'markdown'
173
+ [k: string]: any
174
+ }
175
+ | {
176
+ type: 'custom'
177
+ url: string
178
+ name: string
179
+ data?: any
180
+ [k: string]: any
181
+ }
182
+ /**
183
+ * ID of the [User](#schema_user)
184
+ */
185
+ userId: string
186
+ /**
187
+ * ID of the [Conversation](#schema_conversation)
188
+ */
189
+ conversationId: string
190
+ /**
191
+ * Metadata of the message
192
+ */
193
+ metadata?: {
194
+ [k: string]: any
195
+ }
196
+ /**
197
+ * ID of the message this message is replying to
198
+ */
199
+ replyTo?: string
200
+ }
201
+ }
@@ -0,0 +1,6 @@
1
+ export type TypingStarted = {
2
+ type: 'typing_started'
3
+ data: {
4
+ timeout?: number
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ export type TypingStopped = {
2
+ type: 'typing_stopped'
3
+ data: {}
4
+ }
@@ -0,0 +1,8 @@
1
+ export type WebchatConfig = {
2
+ type: 'webchat_config'
3
+ data: {
4
+ config: {
5
+ [k: string]: any
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ export type WebchatVisibility = {
2
+ type: 'webchat_visibility'
3
+ data: {
4
+ visibility: 'show' | 'hide' | 'toggle'
5
+ }
6
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { createClient, createUser, type Client } from './client'
2
+ export * from './gen/client/types.gen'
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "@repo/typescript-config/react-library.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "paths": {}
6
+ },
7
+ "ts-node": {
8
+ "swc": true
9
+ },
10
+ "include": ["src", "vite.config.ts", "openapi-ts.config.ts"],
11
+ "exclude": ["node_modules", "dist"]
12
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { defineConfig } from 'vite'
2
+ import { resolve } from 'path'
3
+ import treeShakeable from 'rollup-plugin-tree-shakeable'
4
+ import dts from 'vite-plugin-dts'
5
+
6
+ export default defineConfig({
7
+ plugins: [treeShakeable(), dts({ rollupTypes: true })],
8
+ build: {
9
+ lib: {
10
+ entry: resolve(__dirname, 'src/index.ts'),
11
+ formats: ['es'],
12
+ },
13
+ rollupOptions: {
14
+ output: {
15
+ preserveModules: true,
16
+ },
17
+ },
18
+ },
19
+ })