@opencx/widget-core 4.0.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.
- package/README.md +5 -0
- package/dist/__tests__/api-caller.mock.d.ts +1 -0
- package/dist/__tests__/context/contact/auth/auto-create-unverified-anonymous.spec.d.ts +0 -0
- package/dist/__tests__/context/contact/auth/auto-create-unverified-with-user-data-provided-by-org.spec.d.ts +0 -0
- package/dist/__tests__/context/contact/auth/manually-create-unverified-with-user-data-provided-by-user.spec.d.ts +0 -0
- package/dist/__tests__/context/contact/auth/with-secure-token.spec.d.ts +0 -0
- package/dist/__tests__/context/contact/should-collect-data.spec.d.ts +0 -0
- package/dist/__tests__/test-utils.d.ts +419 -0
- package/dist/__tests__/utils/Poller.spec.d.ts +1 -0
- package/dist/__tests__/utils/PrimitiveState.spec.d.ts +1 -0
- package/dist/api/api-caller.d.ts +437 -0
- package/dist/api/client.d.ts +12 -0
- package/dist/api/schema.d.ts +928 -0
- package/dist/context/active-session-polling.ctx.d.ts +25 -0
- package/dist/context/contact.ctx.d.ts +30 -0
- package/dist/context/message.ctx.d.ts +38 -0
- package/dist/context/router.ctx.d.ts +33 -0
- package/dist/context/session.ctx.d.ts +119 -0
- package/dist/context/storage.ctx.d.ts +15 -0
- package/dist/context/widget.ctx.d.ts +27 -0
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +699 -0
- package/dist/index.js.map +1 -0
- package/dist/types/agent-or-bot.d.ts +6 -0
- package/dist/types/component-name.d.ts +1 -0
- package/dist/types/dtos.d.ts +12 -0
- package/dist/types/external-storage.d.ts +5 -0
- package/dist/types/helpers.d.ts +2 -0
- package/dist/types/icons.d.ts +3 -0
- package/dist/types/json-value.d.ts +7 -0
- package/dist/types/messages.d.ts +55 -0
- package/dist/types/widget-config.d.ts +400 -0
- package/dist/utils/Poller.d.ts +12 -0
- package/dist/utils/PrimitiveState.d.ts +13 -0
- package/dist/utils/is-exhaustive.d.ts +1 -0
- package/dist/utils/run-catching.d.ts +13 -0
- package/dist/utils/uuid.d.ts +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { ApiCaller } from '../api/api-caller';
|
|
2
|
+
export declare const TestUtils: {
|
|
3
|
+
sleep: (ms: number) => Promise<unknown>;
|
|
4
|
+
mock: {
|
|
5
|
+
ApiCaller: {
|
|
6
|
+
createSession(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
7
|
+
parameters: {
|
|
8
|
+
query?: never;
|
|
9
|
+
header?: never;
|
|
10
|
+
path?: never;
|
|
11
|
+
cookie?: never;
|
|
12
|
+
};
|
|
13
|
+
requestBody: {
|
|
14
|
+
content: {
|
|
15
|
+
"application/json": import('../api/schema').components["schemas"]["CreateWidgetSessionDto"];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
responses: {
|
|
19
|
+
200: {
|
|
20
|
+
headers: {
|
|
21
|
+
[name: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
content: {
|
|
24
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetSessionDto"];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
500: {
|
|
28
|
+
headers: {
|
|
29
|
+
[name: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
content: {
|
|
32
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}, {
|
|
37
|
+
body: {
|
|
38
|
+
customData?: {
|
|
39
|
+
[key: string]: string | number | boolean | unknown | unknown;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
43
|
+
createUnverifiedContact(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
44
|
+
parameters: {
|
|
45
|
+
query?: never;
|
|
46
|
+
header: {
|
|
47
|
+
"x-bot-token": string;
|
|
48
|
+
};
|
|
49
|
+
path?: never;
|
|
50
|
+
cookie?: never;
|
|
51
|
+
};
|
|
52
|
+
requestBody: {
|
|
53
|
+
content: {
|
|
54
|
+
"application/json": import('../api/schema').components["schemas"]["CreateUnverifiedContactDto"];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
responses: {
|
|
58
|
+
200: {
|
|
59
|
+
headers: {
|
|
60
|
+
[name: string]: unknown;
|
|
61
|
+
};
|
|
62
|
+
content: {
|
|
63
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetContactTokenResponseDto"];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
500: {
|
|
67
|
+
headers: {
|
|
68
|
+
[name: string]: unknown;
|
|
69
|
+
};
|
|
70
|
+
content: {
|
|
71
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}, {
|
|
76
|
+
params: {
|
|
77
|
+
header: {
|
|
78
|
+
'x-bot-token': string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
body: {
|
|
82
|
+
email?: string;
|
|
83
|
+
non_verified_name?: string;
|
|
84
|
+
non_verified_custom_data?: {
|
|
85
|
+
[key: string]: string | number | boolean;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
89
|
+
getSessions(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
90
|
+
parameters: {
|
|
91
|
+
query: {
|
|
92
|
+
filters: string;
|
|
93
|
+
cursor?: string;
|
|
94
|
+
};
|
|
95
|
+
header?: never;
|
|
96
|
+
path?: never;
|
|
97
|
+
cookie?: never;
|
|
98
|
+
};
|
|
99
|
+
requestBody?: never;
|
|
100
|
+
responses: {
|
|
101
|
+
200: {
|
|
102
|
+
headers: {
|
|
103
|
+
[name: string]: unknown;
|
|
104
|
+
};
|
|
105
|
+
content: {
|
|
106
|
+
"application/json": import('../api/schema').components["schemas"]["PaginatedWidgetSessionsDto"];
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
500: {
|
|
110
|
+
headers: {
|
|
111
|
+
[name: string]: unknown;
|
|
112
|
+
};
|
|
113
|
+
content: {
|
|
114
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
}, {
|
|
119
|
+
params: {
|
|
120
|
+
query: {
|
|
121
|
+
cursor: string | undefined;
|
|
122
|
+
filters: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
signal: AbortSignal | undefined;
|
|
126
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
127
|
+
sendMessage(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
128
|
+
parameters: {
|
|
129
|
+
query?: never;
|
|
130
|
+
header?: never;
|
|
131
|
+
path?: never;
|
|
132
|
+
cookie?: never;
|
|
133
|
+
};
|
|
134
|
+
requestBody: {
|
|
135
|
+
content: {
|
|
136
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetSendMessageInputDto"];
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
responses: {
|
|
140
|
+
200: {
|
|
141
|
+
headers: {
|
|
142
|
+
[name: string]: unknown;
|
|
143
|
+
};
|
|
144
|
+
content: {
|
|
145
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetSendMessageOutputDto"];
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
500: {
|
|
149
|
+
headers: {
|
|
150
|
+
[name: string]: unknown;
|
|
151
|
+
};
|
|
152
|
+
content: {
|
|
153
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
}, {
|
|
158
|
+
body: {
|
|
159
|
+
uuid: string;
|
|
160
|
+
content: string;
|
|
161
|
+
session_id: string;
|
|
162
|
+
bot_token: string;
|
|
163
|
+
headers?: {
|
|
164
|
+
[key: string]: string;
|
|
165
|
+
} | null;
|
|
166
|
+
query_params?: {
|
|
167
|
+
[key: string]: string;
|
|
168
|
+
} | null;
|
|
169
|
+
body_properties?: {
|
|
170
|
+
[key: string]: unknown;
|
|
171
|
+
} | null;
|
|
172
|
+
language?: string | null;
|
|
173
|
+
attachments?: {
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
size: number;
|
|
177
|
+
type: string;
|
|
178
|
+
url: string;
|
|
179
|
+
}[] | null;
|
|
180
|
+
clientContext?: {
|
|
181
|
+
[key: string]: unknown;
|
|
182
|
+
} | null;
|
|
183
|
+
custom_data?: {
|
|
184
|
+
[key: string]: unknown;
|
|
185
|
+
} | null;
|
|
186
|
+
exit_mode_prompt?: string;
|
|
187
|
+
};
|
|
188
|
+
signal: AbortSignal | undefined;
|
|
189
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
190
|
+
setAuthToken(target: typeof ApiCaller, _returnValue: void | undefined): void;
|
|
191
|
+
uploadFile(target: typeof ApiCaller, _returnValue: Partial<{
|
|
192
|
+
fileName: string;
|
|
193
|
+
fileUrl: string;
|
|
194
|
+
}> | undefined): void;
|
|
195
|
+
vote(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
196
|
+
parameters: {
|
|
197
|
+
query?: never;
|
|
198
|
+
header?: never;
|
|
199
|
+
path?: never;
|
|
200
|
+
cookie?: never;
|
|
201
|
+
};
|
|
202
|
+
requestBody: {
|
|
203
|
+
content: {
|
|
204
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetVoteDto"];
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
responses: {
|
|
208
|
+
200: {
|
|
209
|
+
headers: {
|
|
210
|
+
[name: string]: unknown;
|
|
211
|
+
};
|
|
212
|
+
content: {
|
|
213
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetVoteResponseDto"];
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
500: {
|
|
217
|
+
headers: {
|
|
218
|
+
[name: string]: unknown;
|
|
219
|
+
};
|
|
220
|
+
content: {
|
|
221
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
}, {
|
|
226
|
+
body: {
|
|
227
|
+
action: "upvote" | "downvote";
|
|
228
|
+
sessionId: string;
|
|
229
|
+
messagePublicId: string;
|
|
230
|
+
};
|
|
231
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
232
|
+
widgetPrelude(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
233
|
+
parameters: {
|
|
234
|
+
query?: never;
|
|
235
|
+
header: {
|
|
236
|
+
"X-Bot-Token": string;
|
|
237
|
+
};
|
|
238
|
+
path?: never;
|
|
239
|
+
cookie?: never;
|
|
240
|
+
};
|
|
241
|
+
requestBody?: never;
|
|
242
|
+
responses: {
|
|
243
|
+
200: {
|
|
244
|
+
headers: {
|
|
245
|
+
[name: string]: unknown;
|
|
246
|
+
};
|
|
247
|
+
content: {
|
|
248
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetPreludeDto"];
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
500: {
|
|
252
|
+
headers: {
|
|
253
|
+
[name: string]: unknown;
|
|
254
|
+
};
|
|
255
|
+
content: {
|
|
256
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
}, {
|
|
261
|
+
params: {
|
|
262
|
+
header: {
|
|
263
|
+
'X-Bot-Token': string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
267
|
+
getExternalWidgetConfig(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
268
|
+
parameters: {
|
|
269
|
+
query?: never;
|
|
270
|
+
header: {
|
|
271
|
+
"X-Bot-Token": string;
|
|
272
|
+
};
|
|
273
|
+
path?: never;
|
|
274
|
+
cookie?: never;
|
|
275
|
+
};
|
|
276
|
+
requestBody?: never;
|
|
277
|
+
responses: {
|
|
278
|
+
200: {
|
|
279
|
+
headers: {
|
|
280
|
+
[name: string]: unknown;
|
|
281
|
+
};
|
|
282
|
+
content: {
|
|
283
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetConfigDto"];
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
500: {
|
|
287
|
+
headers: {
|
|
288
|
+
[name: string]: unknown;
|
|
289
|
+
};
|
|
290
|
+
content: {
|
|
291
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
}, {
|
|
296
|
+
params: {
|
|
297
|
+
header: {
|
|
298
|
+
'X-Bot-Token': string;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
302
|
+
pollSessionAndHistory(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
303
|
+
parameters: {
|
|
304
|
+
query?: {
|
|
305
|
+
lastMessageTimestamp?: string;
|
|
306
|
+
};
|
|
307
|
+
header?: never;
|
|
308
|
+
path: {
|
|
309
|
+
sessionId: string;
|
|
310
|
+
};
|
|
311
|
+
cookie?: never;
|
|
312
|
+
};
|
|
313
|
+
requestBody?: never;
|
|
314
|
+
responses: {
|
|
315
|
+
200: {
|
|
316
|
+
headers: {
|
|
317
|
+
[name: string]: unknown;
|
|
318
|
+
};
|
|
319
|
+
content: {
|
|
320
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetSessionAndHistoryDto"];
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
500: {
|
|
324
|
+
headers: {
|
|
325
|
+
[name: string]: unknown;
|
|
326
|
+
};
|
|
327
|
+
content: {
|
|
328
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
}, {
|
|
333
|
+
params: {
|
|
334
|
+
path: {
|
|
335
|
+
sessionId: string;
|
|
336
|
+
};
|
|
337
|
+
query: {
|
|
338
|
+
lastMessageTimestamp: string;
|
|
339
|
+
} | undefined;
|
|
340
|
+
};
|
|
341
|
+
signal: AbortSignal;
|
|
342
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
343
|
+
resolveSession(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
344
|
+
parameters: {
|
|
345
|
+
query?: never;
|
|
346
|
+
header?: never;
|
|
347
|
+
path?: never;
|
|
348
|
+
cookie?: never;
|
|
349
|
+
};
|
|
350
|
+
requestBody: {
|
|
351
|
+
content: {
|
|
352
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetResolveSessionInputDto"];
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
responses: {
|
|
356
|
+
200: {
|
|
357
|
+
headers: {
|
|
358
|
+
[name: string]: unknown;
|
|
359
|
+
};
|
|
360
|
+
content: {
|
|
361
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetSessionDto"];
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
500: {
|
|
365
|
+
headers: {
|
|
366
|
+
[name: string]: unknown;
|
|
367
|
+
};
|
|
368
|
+
content: {
|
|
369
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
}, {
|
|
374
|
+
body: {
|
|
375
|
+
session_id: string;
|
|
376
|
+
};
|
|
377
|
+
signal: AbortSignal | undefined;
|
|
378
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
379
|
+
createStateCheckpoint(target: typeof ApiCaller, returnValue: Partial<import('openapi-fetch').FetchResponse<{
|
|
380
|
+
parameters: {
|
|
381
|
+
query?: never;
|
|
382
|
+
header?: never;
|
|
383
|
+
path?: never;
|
|
384
|
+
cookie?: never;
|
|
385
|
+
};
|
|
386
|
+
requestBody: {
|
|
387
|
+
content: {
|
|
388
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetCreateStateCheckpointInputDto"];
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
responses: {
|
|
392
|
+
200: {
|
|
393
|
+
headers: {
|
|
394
|
+
[name: string]: unknown;
|
|
395
|
+
};
|
|
396
|
+
content: {
|
|
397
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetCreateStateCheckpointOutputDto"];
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
500: {
|
|
401
|
+
headers: {
|
|
402
|
+
[name: string]: unknown;
|
|
403
|
+
};
|
|
404
|
+
content: {
|
|
405
|
+
"application/json": import('../api/schema').components["schemas"]["ErrorDto"];
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
}, {
|
|
410
|
+
body: {
|
|
411
|
+
session_id: string;
|
|
412
|
+
payload: {
|
|
413
|
+
[key: string]: unknown;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
}, `${string}/${string}`>> | undefined): void;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|