@opencx/widget 2.1.0 → 2.3.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.
Files changed (69) hide show
  1. package/README.md +30 -105
  2. package/dist/basic.cjs +4 -4
  3. package/dist/basic.cjs.map +1 -1
  4. package/dist/basic.js +790 -785
  5. package/dist/basic.js.map +1 -1
  6. package/dist/core/client/api.d.ts +21 -7
  7. package/dist/core/client/chat.d.ts +62 -0
  8. package/dist/core/client/chat.test.d.ts +1 -0
  9. package/dist/core/client/client.d.ts +6 -36
  10. package/dist/core/client/config.d.ts +35 -0
  11. package/dist/core/client/config.test.d.ts +1 -0
  12. package/dist/core/client/contact.d.ts +32 -0
  13. package/dist/core/client/contact.test.d.ts +1 -0
  14. package/dist/core/client/index.d.ts +3 -1
  15. package/dist/core/index.d.ts +6 -1
  16. package/dist/core/platform/index.d.ts +1 -10
  17. package/dist/core/types/index.d.ts +24 -2
  18. package/dist/core/types/pub-sub.d.ts +19 -82
  19. package/dist/core/types/schemas-v2.d.ts +687 -0
  20. package/dist/core/utils/create-fetch.d.ts +24 -0
  21. package/dist/index-B7LNpE9i.cjs +18 -0
  22. package/dist/index-B7LNpE9i.cjs.map +1 -0
  23. package/dist/{index-zWyDrord.js → index-BQfnx4Er.js} +1182 -1310
  24. package/dist/index-BQfnx4Er.js.map +1 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.js +376 -370
  28. package/dist/index.js.map +1 -1
  29. package/dist/react-bindings/context/ChatContext.d.ts +130 -0
  30. package/dist/react-bindings/hooks/useContact.d.ts +9 -0
  31. package/dist/react-bindings/hooks/usePubsub.d.ts +3 -0
  32. package/dist/react-bindings/hooks/useSendMessage.d.ts +6 -0
  33. package/dist/react-bindings/index.d.ts +3 -0
  34. package/dist/react-lib/hooks/useAbstractChat.d.ts +42 -45
  35. package/dist/react-lib/hooks/useAxiosInstance.d.ts +37 -0
  36. package/dist/react-lib/hooks/useUploadFiles.d.ts +1 -1
  37. package/dist/react-lib/providers/ChatProvider.d.ts +54 -46
  38. package/dist/react-lib/types/index.d.ts +1 -0
  39. package/dist/react.cjs +1 -1
  40. package/dist/react.cjs.map +1 -1
  41. package/dist/react.js +2 -2
  42. package/dist/react.js.map +1 -1
  43. package/dist/schemas-BBAV6Sd_.js +122 -0
  44. package/dist/schemas-BBAV6Sd_.js.map +1 -0
  45. package/dist/schemas-wky4fpbc.cjs +2 -0
  46. package/dist/schemas-wky4fpbc.cjs.map +1 -0
  47. package/dist/src/components/dialog.d.ts +2 -2
  48. package/dist/src/designs/basic/index.d.ts +5 -2
  49. package/dist/style.css +1 -1
  50. package/dist-embed/script.js +106 -106
  51. package/dist-embed/script.js.map +1 -1
  52. package/package.json +1 -3
  53. package/dist/core/managers/chathistory-manager.d.ts +0 -61
  54. package/dist/core/managers/session-manager.d.ts +0 -35
  55. package/dist/core/transport/http.transport.d.ts +0 -17
  56. package/dist/core/transport/transport.d.ts +0 -25
  57. package/dist/core/types/transport.d.ts +0 -31
  58. package/dist/history-to-widget-messages-CP0hKjhv.js +0 -195
  59. package/dist/history-to-widget-messages-CP0hKjhv.js.map +0 -1
  60. package/dist/history-to-widget-messages-CdbZolRN.cjs +0 -2
  61. package/dist/history-to-widget-messages-CdbZolRN.cjs.map +0 -1
  62. package/dist/index-BGDwCf6r.cjs +0 -18
  63. package/dist/index-BGDwCf6r.cjs.map +0 -1
  64. package/dist/index-zWyDrord.js.map +0 -1
  65. package/dist/react-lib/hooks/handle-socket-messages.d.ts +0 -27
  66. package/dist/react-lib/hooks/socket.d.ts +0 -11
  67. package/dist/react-lib/hooks/socketState.d.ts +0 -2
  68. package/dist/react-lib/hooks/useBaseClient.d.ts +0 -2
  69. package/dist/react-lib/providers/ClientProvider.d.ts +0 -7
@@ -0,0 +1,687 @@
1
+ import { z } from 'zod';
2
+ declare const widgetPreludeSchema: z.ZodObject<{
3
+ initialQuestions: z.ZodArray<z.ZodString, "many">;
4
+ aiEnabled: z.ZodBoolean;
5
+ officeHours: z.ZodObject<{
6
+ monday: z.ZodOptional<z.ZodObject<{
7
+ from: z.ZodString;
8
+ to: z.ZodString;
9
+ }, "strip", z.ZodTypeAny, {
10
+ from: string;
11
+ to: string;
12
+ }, {
13
+ from: string;
14
+ to: string;
15
+ }>>;
16
+ tuesday: z.ZodOptional<z.ZodObject<{
17
+ from: z.ZodString;
18
+ to: z.ZodString;
19
+ }, "strip", z.ZodTypeAny, {
20
+ from: string;
21
+ to: string;
22
+ }, {
23
+ from: string;
24
+ to: string;
25
+ }>>;
26
+ wednesday: z.ZodOptional<z.ZodObject<{
27
+ from: z.ZodString;
28
+ to: z.ZodString;
29
+ }, "strip", z.ZodTypeAny, {
30
+ from: string;
31
+ to: string;
32
+ }, {
33
+ from: string;
34
+ to: string;
35
+ }>>;
36
+ thursday: z.ZodOptional<z.ZodObject<{
37
+ from: z.ZodString;
38
+ to: z.ZodString;
39
+ }, "strip", z.ZodTypeAny, {
40
+ from: string;
41
+ to: string;
42
+ }, {
43
+ from: string;
44
+ to: string;
45
+ }>>;
46
+ friday: z.ZodOptional<z.ZodObject<{
47
+ from: z.ZodString;
48
+ to: z.ZodString;
49
+ }, "strip", z.ZodTypeAny, {
50
+ from: string;
51
+ to: string;
52
+ }, {
53
+ from: string;
54
+ to: string;
55
+ }>>;
56
+ saturday: z.ZodOptional<z.ZodObject<{
57
+ from: z.ZodString;
58
+ to: z.ZodString;
59
+ }, "strip", z.ZodTypeAny, {
60
+ from: string;
61
+ to: string;
62
+ }, {
63
+ from: string;
64
+ to: string;
65
+ }>>;
66
+ sunday: z.ZodOptional<z.ZodObject<{
67
+ from: z.ZodString;
68
+ to: z.ZodString;
69
+ }, "strip", z.ZodTypeAny, {
70
+ from: string;
71
+ to: string;
72
+ }, {
73
+ from: string;
74
+ to: string;
75
+ }>>;
76
+ Everyday: z.ZodOptional<z.ZodObject<{
77
+ from: z.ZodString;
78
+ to: z.ZodString;
79
+ }, "strip", z.ZodTypeAny, {
80
+ from: string;
81
+ to: string;
82
+ }, {
83
+ from: string;
84
+ to: string;
85
+ }>>;
86
+ WeekDays: z.ZodOptional<z.ZodObject<{
87
+ from: z.ZodString;
88
+ to: z.ZodString;
89
+ }, "strip", z.ZodTypeAny, {
90
+ from: string;
91
+ to: string;
92
+ }, {
93
+ from: string;
94
+ to: string;
95
+ }>>;
96
+ }, "strip", z.ZodTypeAny, {
97
+ monday?: {
98
+ from: string;
99
+ to: string;
100
+ } | undefined;
101
+ tuesday?: {
102
+ from: string;
103
+ to: string;
104
+ } | undefined;
105
+ wednesday?: {
106
+ from: string;
107
+ to: string;
108
+ } | undefined;
109
+ thursday?: {
110
+ from: string;
111
+ to: string;
112
+ } | undefined;
113
+ friday?: {
114
+ from: string;
115
+ to: string;
116
+ } | undefined;
117
+ saturday?: {
118
+ from: string;
119
+ to: string;
120
+ } | undefined;
121
+ sunday?: {
122
+ from: string;
123
+ to: string;
124
+ } | undefined;
125
+ WeekDays?: {
126
+ from: string;
127
+ to: string;
128
+ } | undefined;
129
+ Everyday?: {
130
+ from: string;
131
+ to: string;
132
+ } | undefined;
133
+ }, {
134
+ monday?: {
135
+ from: string;
136
+ to: string;
137
+ } | undefined;
138
+ tuesday?: {
139
+ from: string;
140
+ to: string;
141
+ } | undefined;
142
+ wednesday?: {
143
+ from: string;
144
+ to: string;
145
+ } | undefined;
146
+ thursday?: {
147
+ from: string;
148
+ to: string;
149
+ } | undefined;
150
+ friday?: {
151
+ from: string;
152
+ to: string;
153
+ } | undefined;
154
+ saturday?: {
155
+ from: string;
156
+ to: string;
157
+ } | undefined;
158
+ sunday?: {
159
+ from: string;
160
+ to: string;
161
+ } | undefined;
162
+ WeekDays?: {
163
+ from: string;
164
+ to: string;
165
+ } | undefined;
166
+ Everyday?: {
167
+ from: string;
168
+ to: string;
169
+ } | undefined;
170
+ }>;
171
+ officeHoursTimezone: z.ZodNullable<z.ZodString>;
172
+ organizationName: z.ZodString;
173
+ }, "strip", z.ZodTypeAny, {
174
+ initialQuestions: string[];
175
+ aiEnabled: boolean;
176
+ officeHours: {
177
+ monday?: {
178
+ from: string;
179
+ to: string;
180
+ } | undefined;
181
+ tuesday?: {
182
+ from: string;
183
+ to: string;
184
+ } | undefined;
185
+ wednesday?: {
186
+ from: string;
187
+ to: string;
188
+ } | undefined;
189
+ thursday?: {
190
+ from: string;
191
+ to: string;
192
+ } | undefined;
193
+ friday?: {
194
+ from: string;
195
+ to: string;
196
+ } | undefined;
197
+ saturday?: {
198
+ from: string;
199
+ to: string;
200
+ } | undefined;
201
+ sunday?: {
202
+ from: string;
203
+ to: string;
204
+ } | undefined;
205
+ WeekDays?: {
206
+ from: string;
207
+ to: string;
208
+ } | undefined;
209
+ Everyday?: {
210
+ from: string;
211
+ to: string;
212
+ } | undefined;
213
+ };
214
+ officeHoursTimezone: string | null;
215
+ organizationName: string;
216
+ }, {
217
+ initialQuestions: string[];
218
+ aiEnabled: boolean;
219
+ officeHours: {
220
+ monday?: {
221
+ from: string;
222
+ to: string;
223
+ } | undefined;
224
+ tuesday?: {
225
+ from: string;
226
+ to: string;
227
+ } | undefined;
228
+ wednesday?: {
229
+ from: string;
230
+ to: string;
231
+ } | undefined;
232
+ thursday?: {
233
+ from: string;
234
+ to: string;
235
+ } | undefined;
236
+ friday?: {
237
+ from: string;
238
+ to: string;
239
+ } | undefined;
240
+ saturday?: {
241
+ from: string;
242
+ to: string;
243
+ } | undefined;
244
+ sunday?: {
245
+ from: string;
246
+ to: string;
247
+ } | undefined;
248
+ WeekDays?: {
249
+ from: string;
250
+ to: string;
251
+ } | undefined;
252
+ Everyday?: {
253
+ from: string;
254
+ to: string;
255
+ } | undefined;
256
+ };
257
+ officeHoursTimezone: string | null;
258
+ organizationName: string;
259
+ }>;
260
+ export declare const chatAttachmentSchema: z.ZodObject<{
261
+ id: z.ZodString;
262
+ name: z.ZodString;
263
+ size: z.ZodNumber;
264
+ type: z.ZodString;
265
+ url: z.ZodString;
266
+ }, "strip", z.ZodTypeAny, {
267
+ id: string;
268
+ type: string;
269
+ name: string;
270
+ size: number;
271
+ url: string;
272
+ }, {
273
+ id: string;
274
+ type: string;
275
+ name: string;
276
+ size: number;
277
+ url: string;
278
+ }>;
279
+ export declare enum MessageTypeEnum {
280
+ MESSAGE = "message",
281
+ HANDOFF = "handoff",
282
+ HANDOFF_TO_ZENDESK = "handoff_to_zendesk",
283
+ AGENT_MESSAGE = "agent_message",
284
+ AGENT_JOINED = "agent_joined",
285
+ AGENT_COMMENT = "agent_comment",
286
+ AGENT_TOOK_SESSION_FROM_AI = "agent_took_session_from_ai",
287
+ AGENT_REOPENED_SESSION = "agent_reopened_session",
288
+ AI_DECIDED_TO_RESOLVE_THE_ISSUE = "ai_decided_to_resolve_the_issue",
289
+ EMAIL_DRAFT_MESSAGE = "email_draft_message",
290
+ FOLLOWUP = "followup",
291
+ AI_ASSUMED_THE_SESSION_RESOLVED = "ai_assumed_the_session_resolved",
292
+ CONTACT_RESOLVED_THE_SESSION = "user_confirmed_the_session_resolved"
293
+ }
294
+ declare const widgetHistorySchema: z.ZodObject<{
295
+ publicId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
296
+ type: z.ZodNativeEnum<typeof MessageTypeEnum>;
297
+ sender: z.ZodObject<{
298
+ kind: z.ZodEnum<["user", "agent", "ai", "none", "unknown"]>;
299
+ name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
300
+ avatar: z.ZodNullable<z.ZodOptional<z.ZodString>>;
301
+ }, "strip", z.ZodTypeAny, {
302
+ kind: "unknown" | "agent" | "user" | "ai" | "none";
303
+ name?: string | null | undefined;
304
+ avatar?: string | null | undefined;
305
+ }, {
306
+ kind: "unknown" | "agent" | "user" | "ai" | "none";
307
+ name?: string | null | undefined;
308
+ avatar?: string | null | undefined;
309
+ }>;
310
+ content: z.ZodObject<{
311
+ text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ text?: string | null | undefined;
314
+ }, {
315
+ text?: string | null | undefined;
316
+ }>;
317
+ sentAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
318
+ actionCalls: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
319
+ actionName: z.ZodString;
320
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
321
+ result: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
322
+ }, "strip", z.ZodTypeAny, {
323
+ actionName: string;
324
+ args: Record<string, unknown>;
325
+ result?: Record<string, unknown> | null | undefined;
326
+ }, {
327
+ actionName: string;
328
+ args: Record<string, unknown>;
329
+ result?: Record<string, unknown> | null | undefined;
330
+ }>, "many">>>;
331
+ attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
332
+ id: z.ZodString;
333
+ name: z.ZodString;
334
+ size: z.ZodNumber;
335
+ type: z.ZodString;
336
+ url: z.ZodString;
337
+ }, "strip", z.ZodTypeAny, {
338
+ id: string;
339
+ type: string;
340
+ name: string;
341
+ size: number;
342
+ url: string;
343
+ }, {
344
+ id: string;
345
+ type: string;
346
+ name: string;
347
+ size: number;
348
+ url: string;
349
+ }>, "many">>>;
350
+ }, "strip", z.ZodTypeAny, {
351
+ type: MessageTypeEnum;
352
+ content: {
353
+ text?: string | null | undefined;
354
+ };
355
+ sender: {
356
+ kind: "unknown" | "agent" | "user" | "ai" | "none";
357
+ name?: string | null | undefined;
358
+ avatar?: string | null | undefined;
359
+ };
360
+ publicId?: string | null | undefined;
361
+ attachments?: {
362
+ id: string;
363
+ type: string;
364
+ name: string;
365
+ size: number;
366
+ url: string;
367
+ }[] | null | undefined;
368
+ sentAt?: Date | null | undefined;
369
+ actionCalls?: {
370
+ actionName: string;
371
+ args: Record<string, unknown>;
372
+ result?: Record<string, unknown> | null | undefined;
373
+ }[] | null | undefined;
374
+ }, {
375
+ type: MessageTypeEnum;
376
+ content: {
377
+ text?: string | null | undefined;
378
+ };
379
+ sender: {
380
+ kind: "unknown" | "agent" | "user" | "ai" | "none";
381
+ name?: string | null | undefined;
382
+ avatar?: string | null | undefined;
383
+ };
384
+ publicId?: string | null | undefined;
385
+ attachments?: {
386
+ id: string;
387
+ type: string;
388
+ name: string;
389
+ size: number;
390
+ url: string;
391
+ }[] | null | undefined;
392
+ sentAt?: Date | null | undefined;
393
+ actionCalls?: {
394
+ actionName: string;
395
+ args: Record<string, unknown>;
396
+ result?: Record<string, unknown> | null | undefined;
397
+ }[] | null | undefined;
398
+ }>;
399
+ declare const widgetSessionSchema: z.ZodObject<{
400
+ id: z.ZodString;
401
+ createdAt: z.ZodDate;
402
+ updatedAt: z.ZodDate;
403
+ isHandedOff: z.ZodBoolean;
404
+ isOpened: z.ZodBoolean;
405
+ assignee: z.ZodObject<{
406
+ kind: z.ZodEnum<["human", "ai", "none", "unknown"]>;
407
+ name: z.ZodNullable<z.ZodString>;
408
+ }, "strip", z.ZodTypeAny, {
409
+ name: string | null;
410
+ kind: "unknown" | "ai" | "none" | "human";
411
+ }, {
412
+ name: string | null;
413
+ kind: "unknown" | "ai" | "none" | "human";
414
+ }>;
415
+ channel: z.ZodString;
416
+ }, "strip", z.ZodTypeAny, {
417
+ id: string;
418
+ channel: string;
419
+ assignee: {
420
+ name: string | null;
421
+ kind: "unknown" | "ai" | "none" | "human";
422
+ };
423
+ createdAt: Date;
424
+ updatedAt: Date;
425
+ isHandedOff: boolean;
426
+ isOpened: boolean;
427
+ }, {
428
+ id: string;
429
+ channel: string;
430
+ assignee: {
431
+ name: string | null;
432
+ kind: "unknown" | "ai" | "none" | "human";
433
+ };
434
+ createdAt: Date;
435
+ updatedAt: Date;
436
+ isHandedOff: boolean;
437
+ isOpened: boolean;
438
+ }>;
439
+ declare const httpChatInputDto: z.ZodObject<{
440
+ id: z.ZodOptional<z.ZodString>;
441
+ content: z.ZodString;
442
+ session_id: z.ZodString;
443
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
444
+ bot_token: z.ZodString;
445
+ query_params: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
446
+ user: z.ZodObject<{
447
+ email: z.ZodOptional<z.ZodString>;
448
+ name: z.ZodOptional<z.ZodString>;
449
+ phone: z.ZodOptional<z.ZodString>;
450
+ avatar: z.ZodOptional<z.ZodString>;
451
+ customData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
452
+ }, "strip", z.ZodTypeAny, {
453
+ email?: string | undefined;
454
+ name?: string | undefined;
455
+ avatar?: string | undefined;
456
+ phone?: string | undefined;
457
+ customData?: Record<string, string> | undefined;
458
+ }, {
459
+ email?: string | undefined;
460
+ name?: string | undefined;
461
+ avatar?: string | undefined;
462
+ phone?: string | undefined;
463
+ customData?: Record<string, string> | undefined;
464
+ }>;
465
+ language: z.ZodNullable<z.ZodOptional<z.ZodString>>;
466
+ attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
467
+ id: z.ZodString;
468
+ name: z.ZodString;
469
+ size: z.ZodNumber;
470
+ type: z.ZodString;
471
+ url: z.ZodString;
472
+ }, "strip", z.ZodTypeAny, {
473
+ id: string;
474
+ type: string;
475
+ name: string;
476
+ size: number;
477
+ url: string;
478
+ }, {
479
+ id: string;
480
+ type: string;
481
+ name: string;
482
+ size: number;
483
+ url: string;
484
+ }>, "many">>>;
485
+ }, "strip", z.ZodTypeAny, {
486
+ session_id: string;
487
+ content: string;
488
+ user: {
489
+ email?: string | undefined;
490
+ name?: string | undefined;
491
+ avatar?: string | undefined;
492
+ phone?: string | undefined;
493
+ customData?: Record<string, string> | undefined;
494
+ };
495
+ headers: Record<string, string>;
496
+ bot_token: string;
497
+ id?: string | undefined;
498
+ language?: string | null | undefined;
499
+ attachments?: {
500
+ id: string;
501
+ type: string;
502
+ name: string;
503
+ size: number;
504
+ url: string;
505
+ }[] | null | undefined;
506
+ query_params?: Record<string, string> | null | undefined;
507
+ }, {
508
+ session_id: string;
509
+ content: string;
510
+ user: {
511
+ email?: string | undefined;
512
+ name?: string | undefined;
513
+ avatar?: string | undefined;
514
+ phone?: string | undefined;
515
+ customData?: Record<string, string> | undefined;
516
+ };
517
+ headers: Record<string, string>;
518
+ bot_token: string;
519
+ id?: string | undefined;
520
+ language?: string | null | undefined;
521
+ attachments?: {
522
+ id: string;
523
+ type: string;
524
+ name: string;
525
+ size: number;
526
+ url: string;
527
+ }[] | null | undefined;
528
+ query_params?: Record<string, string> | null | undefined;
529
+ }>;
530
+ declare const handleContactMessageOutputSchema: z.ZodDiscriminatedUnion<"success", [z.ZodObject<{
531
+ success: z.ZodLiteral<true>;
532
+ code: z.ZodOptional<z.ZodString>;
533
+ options: z.ZodOptional<z.ZodObject<{
534
+ type: z.ZodLiteral<"options">;
535
+ value: z.ZodArray<z.ZodString, "many">;
536
+ }, "strip", z.ZodTypeAny, {
537
+ value: string[];
538
+ type: "options";
539
+ }, {
540
+ value: string[];
541
+ type: "options";
542
+ }>>;
543
+ autopilotResponse: z.ZodOptional<z.ZodObject<{
544
+ type: z.ZodLiteral<"text">;
545
+ value: z.ZodObject<{
546
+ error: z.ZodBoolean;
547
+ content: z.ZodString;
548
+ }, "strip", z.ZodTypeAny, {
549
+ content: string;
550
+ error: boolean;
551
+ }, {
552
+ content: string;
553
+ error: boolean;
554
+ }>;
555
+ id: z.ZodOptional<z.ZodString>;
556
+ }, "strip", z.ZodTypeAny, {
557
+ value: {
558
+ content: string;
559
+ error: boolean;
560
+ };
561
+ type: "text";
562
+ id?: string | undefined;
563
+ }, {
564
+ value: {
565
+ content: string;
566
+ error: boolean;
567
+ };
568
+ type: "text";
569
+ id?: string | undefined;
570
+ }>>;
571
+ uiResponse: z.ZodOptional<z.ZodObject<{
572
+ type: z.ZodLiteral<"ui">;
573
+ value: z.ZodObject<{
574
+ type: z.ZodLiteral<"ui_component">;
575
+ request_response: z.ZodUnknown;
576
+ name: z.ZodString;
577
+ content: z.ZodOptional<z.ZodString>;
578
+ }, "strip", z.ZodTypeAny, {
579
+ type: "ui_component";
580
+ name: string;
581
+ request_response?: unknown;
582
+ content?: string | undefined;
583
+ }, {
584
+ type: "ui_component";
585
+ name: string;
586
+ request_response?: unknown;
587
+ content?: string | undefined;
588
+ }>;
589
+ }, "strip", z.ZodTypeAny, {
590
+ value: {
591
+ type: "ui_component";
592
+ name: string;
593
+ request_response?: unknown;
594
+ content?: string | undefined;
595
+ };
596
+ type: "ui";
597
+ }, {
598
+ value: {
599
+ type: "ui_component";
600
+ name: string;
601
+ request_response?: unknown;
602
+ content?: string | undefined;
603
+ };
604
+ type: "ui";
605
+ }>>;
606
+ sessionIsHandedOff: z.ZodOptional<z.ZodBoolean>;
607
+ }, "strip", z.ZodTypeAny, {
608
+ success: true;
609
+ code?: string | undefined;
610
+ options?: {
611
+ value: string[];
612
+ type: "options";
613
+ } | undefined;
614
+ autopilotResponse?: {
615
+ value: {
616
+ content: string;
617
+ error: boolean;
618
+ };
619
+ type: "text";
620
+ id?: string | undefined;
621
+ } | undefined;
622
+ uiResponse?: {
623
+ value: {
624
+ type: "ui_component";
625
+ name: string;
626
+ request_response?: unknown;
627
+ content?: string | undefined;
628
+ };
629
+ type: "ui";
630
+ } | undefined;
631
+ sessionIsHandedOff?: boolean | undefined;
632
+ }, {
633
+ success: true;
634
+ code?: string | undefined;
635
+ options?: {
636
+ value: string[];
637
+ type: "options";
638
+ } | undefined;
639
+ autopilotResponse?: {
640
+ value: {
641
+ content: string;
642
+ error: boolean;
643
+ };
644
+ type: "text";
645
+ id?: string | undefined;
646
+ } | undefined;
647
+ uiResponse?: {
648
+ value: {
649
+ type: "ui_component";
650
+ name: string;
651
+ request_response?: unknown;
652
+ content?: string | undefined;
653
+ };
654
+ type: "ui";
655
+ } | undefined;
656
+ sessionIsHandedOff?: boolean | undefined;
657
+ }>, z.ZodObject<{
658
+ success: z.ZodLiteral<false>;
659
+ error: z.ZodObject<{
660
+ code: z.ZodOptional<z.ZodString>;
661
+ message: z.ZodOptional<z.ZodString>;
662
+ }, "strip", z.ZodTypeAny, {
663
+ message?: string | undefined;
664
+ code?: string | undefined;
665
+ }, {
666
+ message?: string | undefined;
667
+ code?: string | undefined;
668
+ }>;
669
+ }, "strip", z.ZodTypeAny, {
670
+ error: {
671
+ message?: string | undefined;
672
+ code?: string | undefined;
673
+ };
674
+ success: false;
675
+ }, {
676
+ error: {
677
+ message?: string | undefined;
678
+ code?: string | undefined;
679
+ };
680
+ success: false;
681
+ }>]>;
682
+ export type HandleContactMessageOutputSchema = z.infer<typeof handleContactMessageOutputSchema>;
683
+ export type HttpChatInputSchema = z.infer<typeof httpChatInputDto>;
684
+ export type WidgetSessionSchema = z.infer<typeof widgetSessionSchema>;
685
+ export type WidgetHistorySchema = z.infer<typeof widgetHistorySchema>;
686
+ export type WidgetPreludeSchema = z.infer<typeof widgetPreludeSchema>;
687
+ export {};
@@ -0,0 +1,24 @@
1
+ type RequestInterceptor = (config: RequestConfig) => RequestConfig | Promise<RequestConfig>;
2
+ type ResponseInterceptor = (response: Response) => Response | Promise<Response>;
3
+ type ErrorInterceptor = (error: any) => any;
4
+ interface RequestConfig extends RequestInit {
5
+ baseURL?: string;
6
+ headers?: HeadersInit;
7
+ params?: Record<string, string>;
8
+ }
9
+ export interface CustomFetch {
10
+ (url: string, config?: RequestConfig): Promise<Response>;
11
+ interceptors: {
12
+ request: {
13
+ use: (interceptor: RequestInterceptor) => number;
14
+ eject: (id: number) => void;
15
+ };
16
+ response: {
17
+ use: (interceptor: ResponseInterceptor, errorInterceptor?: ErrorInterceptor) => number;
18
+ eject: (id: number) => void;
19
+ };
20
+ };
21
+ }
22
+ export declare function createFetch(defaultConfig?: RequestConfig): CustomFetch;
23
+ export declare function handleJsonResponse<T>(response: Response): Promise<T>;
24
+ export {};