@opencx/widget 2.4.4-rn.0 → 2.4.4-rn.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/dist/basic.cjs +31 -31
  2. package/dist/basic.cjs.map +1 -1
  3. package/dist/basic.js +37 -38
  4. package/dist/basic.js.map +1 -1
  5. package/dist/core/client/api.d.ts +6 -15
  6. package/dist/core/client/chat.d.ts +10 -10
  7. package/dist/core/client/contact.d.ts +2 -2
  8. package/dist/core/index.d.ts +2 -0
  9. package/dist/core/types/helpers.d.ts +1 -1
  10. package/dist/core/types/index.d.ts +2 -3
  11. package/dist/core/types/schemas-v2.d.ts +92 -91
  12. package/dist/core/types/schemas.d.ts +123 -69
  13. package/dist/{index-Cjs7ckCU.js → index-B-VyJuQ9.js} +964 -864
  14. package/dist/index-B-VyJuQ9.js.map +1 -0
  15. package/dist/index-D2PGs8oF.cjs +18 -0
  16. package/dist/index-D2PGs8oF.cjs.map +1 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.js +337 -282
  20. package/dist/index.js.map +1 -1
  21. package/dist/package.json.d.ts +1 -1
  22. package/dist/react-web/hooks/useAbstractChat.d.ts +22 -21
  23. package/dist/react-web/hooks/useAxiosInstance.d.ts +35 -23
  24. package/dist/react-web/hooks/useUploadFiles.d.ts +1 -1
  25. package/dist/react-web/providers/ChatProvider.d.ts +24 -24
  26. package/dist/react-web/providers/ContactProvider.d.ts +4 -4
  27. package/dist/react.cjs +1 -1
  28. package/dist/react.js +1 -1
  29. package/dist/schemas-v2-BiJWHypc.cjs +2 -0
  30. package/dist/schemas-v2-BiJWHypc.cjs.map +1 -0
  31. package/dist/schemas-v2-DZ3nwfID.js +138 -0
  32. package/dist/schemas-v2-DZ3nwfID.js.map +1 -0
  33. package/dist/src/components/RenderFile.d.ts +1 -1
  34. package/dist/src/components/dialog.d.ts +2 -2
  35. package/dist-embed/script.js +107 -107
  36. package/dist-embed/script.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/index-BVoLVQCZ.cjs +0 -18
  39. package/dist/index-BVoLVQCZ.cjs.map +0 -1
  40. package/dist/index-Cjs7ckCU.js.map +0 -1
  41. package/dist/schemas-BBAV6Sd_.js +0 -122
  42. package/dist/schemas-BBAV6Sd_.js.map +0 -1
  43. package/dist/schemas-wky4fpbc.cjs +0 -2
  44. package/dist/schemas-wky4fpbc.cjs.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { default as z } from 'zod';
2
+ import { chatAttachmentSchema } from './schemas-v2';
2
3
  export declare enum SessionStatus {
3
4
  OPEN = 0,
4
5
  CLOSED_RESOLVED = 1,
@@ -49,56 +50,48 @@ export declare const chatSessionSchema: z.ZodObject<{
49
50
  email: z.ZodString;
50
51
  avatar_url: z.ZodOptional<z.ZodString>;
51
52
  }, "strip", z.ZodTypeAny, {
52
- email: string;
53
53
  name: string;
54
+ email: string;
54
55
  avatar_url?: string | undefined;
55
56
  }, {
56
- email: string;
57
57
  name: string;
58
+ email: string;
58
59
  avatar_url?: string | undefined;
59
60
  }>>>;
60
61
  sentiment: z.ZodNullable<z.ZodNativeEnum<typeof SentimentEnum>>;
61
62
  }, "strip", z.ZodTypeAny, {
63
+ status: SessionStatus;
62
64
  id: string;
65
+ channel: SessionChannel;
66
+ language: string | null;
63
67
  ai_closure_type: AIClosureType | null;
64
68
  assignee_id: number | null;
65
- channel: SessionChannel;
66
- status: SessionStatus;
67
69
  summary: string | null;
68
- language: string | null;
69
70
  last_message: string | null;
70
71
  last_message_at: Date | null;
71
72
  sentiment: SentimentEnum | null;
72
73
  assignee?: {
73
- email: string;
74
74
  name: string;
75
+ email: string;
75
76
  avatar_url?: string | undefined;
76
77
  } | null | undefined;
77
78
  }, {
79
+ status: SessionStatus;
78
80
  id: string;
81
+ channel: SessionChannel;
82
+ language: string | null;
79
83
  ai_closure_type: AIClosureType | null;
80
84
  assignee_id: number | null;
81
- channel: SessionChannel;
82
- status: SessionStatus;
83
85
  summary: string | null;
84
- language: string | null;
85
86
  last_message: string | null;
86
87
  last_message_at: Date | null;
87
88
  sentiment: SentimentEnum | null;
88
89
  assignee?: {
89
- email: string;
90
90
  name: string;
91
+ email: string;
91
92
  avatar_url?: string | undefined;
92
93
  } | null | undefined;
93
94
  }>;
94
- export type ChatAttachmentType = {
95
- id: string;
96
- name: string;
97
- size: number;
98
- type: string;
99
- url: string;
100
- };
101
- export declare const chatAttachmentSchema: z.ZodType<ChatAttachmentType>;
102
95
  export declare const chatHistoryMessageSchema: z.ZodObject<{
103
96
  publicId: z.ZodString;
104
97
  message: z.ZodNullable<z.ZodString>;
@@ -111,33 +104,63 @@ export declare const chatHistoryMessageSchema: z.ZodObject<{
111
104
  handoff_happened_during_office_hours: z.ZodNullable<z.ZodBoolean>;
112
105
  session_id: z.ZodString;
113
106
  updated_at: z.ZodNullable<z.ZodString>;
114
- attachments: z.ZodOptional<z.ZodArray<z.ZodType<ChatAttachmentType, z.ZodTypeDef, ChatAttachmentType>, "many">>;
107
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
108
+ id: z.ZodString;
109
+ name: z.ZodString;
110
+ size: z.ZodNumber;
111
+ type: z.ZodString;
112
+ url: z.ZodString;
113
+ }, "strip", z.ZodTypeAny, {
114
+ type: string;
115
+ id: string;
116
+ name: string;
117
+ size: number;
118
+ url: string;
119
+ }, {
120
+ type: string;
121
+ id: string;
122
+ name: string;
123
+ size: number;
124
+ url: string;
125
+ }>, "many">>;
115
126
  }, "strip", z.ZodTypeAny, {
116
127
  message: string | null;
117
128
  type: string | null;
118
129
  publicId: string;
130
+ session_id: string;
119
131
  agent_avatar: string | null;
120
132
  agent_id: number | null;
121
133
  agent_name: string | null;
122
134
  created_at: string;
123
135
  from_user: boolean | null;
124
136
  handoff_happened_during_office_hours: boolean | null;
125
- session_id: string;
126
137
  updated_at: string | null;
127
- attachments?: ChatAttachmentType[] | undefined;
138
+ attachments?: {
139
+ type: string;
140
+ id: string;
141
+ name: string;
142
+ size: number;
143
+ url: string;
144
+ }[] | undefined;
128
145
  }, {
129
146
  message: string | null;
130
147
  type: string | null;
131
148
  publicId: string;
149
+ session_id: string;
132
150
  agent_avatar: string | null;
133
151
  agent_id: number | null;
134
152
  agent_name: string | null;
135
153
  created_at: string;
136
154
  from_user: boolean | null;
137
155
  handoff_happened_during_office_hours: boolean | null;
138
- session_id: string;
139
156
  updated_at: string | null;
140
- attachments?: ChatAttachmentType[] | undefined;
157
+ attachments?: {
158
+ type: string;
159
+ id: string;
160
+ name: string;
161
+ size: number;
162
+ url: string;
163
+ }[] | undefined;
141
164
  }>;
142
165
  declare const agentSchema: z.ZodObject<{
143
166
  name: z.ZodString;
@@ -158,36 +181,66 @@ declare const agentSchema: z.ZodObject<{
158
181
  export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
159
182
  type: z.ZodLiteral<"message">;
160
183
  value: z.ZodString;
161
- attachments: z.ZodOptional<z.ZodArray<z.ZodType<ChatAttachmentType, z.ZodTypeDef, ChatAttachmentType>, "many">>;
184
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
185
+ id: z.ZodString;
186
+ name: z.ZodString;
187
+ size: z.ZodNumber;
188
+ type: z.ZodString;
189
+ url: z.ZodString;
190
+ }, "strip", z.ZodTypeAny, {
191
+ type: string;
192
+ id: string;
193
+ name: string;
194
+ size: number;
195
+ url: string;
196
+ }, {
197
+ type: string;
198
+ id: string;
199
+ name: string;
200
+ size: number;
201
+ url: string;
202
+ }>, "many">>;
162
203
  is_stream_chunk: z.ZodOptional<z.ZodBoolean>;
163
204
  server_session_id: z.ZodString;
164
205
  client_message_id: z.ZodOptional<z.ZodString>;
165
206
  server_message_id: z.ZodString;
166
207
  }, "strip", z.ZodTypeAny, {
167
- value: string;
168
208
  type: "message";
209
+ value: string;
169
210
  server_session_id: string;
170
211
  server_message_id: string;
171
- attachments?: ChatAttachmentType[] | undefined;
212
+ attachments?: {
213
+ type: string;
214
+ id: string;
215
+ name: string;
216
+ size: number;
217
+ url: string;
218
+ }[] | undefined;
172
219
  is_stream_chunk?: boolean | undefined;
173
220
  client_message_id?: string | undefined;
174
221
  }, {
175
- value: string;
176
222
  type: "message";
223
+ value: string;
177
224
  server_session_id: string;
178
225
  server_message_id: string;
179
- attachments?: ChatAttachmentType[] | undefined;
226
+ attachments?: {
227
+ type: string;
228
+ id: string;
229
+ name: string;
230
+ size: number;
231
+ url: string;
232
+ }[] | undefined;
180
233
  is_stream_chunk?: boolean | undefined;
181
234
  client_message_id?: string | undefined;
182
235
  }>, z.ZodObject<{
183
236
  type: z.ZodLiteral<"info">;
184
237
  value: z.ZodString;
185
238
  }, "strip", z.ZodTypeAny, {
186
- value: string;
187
239
  type: "info";
188
- }, {
189
240
  value: string;
241
+ }, {
190
242
  type: "info";
243
+ value: string;
191
244
  }>, z.ZodObject<{
192
245
  type: z.ZodLiteral<"ui">;
193
246
  value: z.ZodObject<{
@@ -212,6 +265,7 @@ export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscr
212
265
  client_message_id: z.ZodOptional<z.ZodString>;
213
266
  server_session_id: z.ZodString;
214
267
  }, "strip", z.ZodTypeAny, {
268
+ type: "ui";
215
269
  value: {
216
270
  type: string;
217
271
  name: string;
@@ -219,10 +273,10 @@ export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscr
219
273
  request_response?: any;
220
274
  message_id?: string | undefined;
221
275
  };
222
- type: "ui";
223
276
  server_session_id: string;
224
277
  client_message_id?: string | undefined;
225
278
  }, {
279
+ type: "ui";
226
280
  value: {
227
281
  type: string;
228
282
  name: string;
@@ -230,7 +284,6 @@ export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscr
230
284
  request_response?: any;
231
285
  message_id?: string | undefined;
232
286
  };
233
- type: "ui";
234
287
  server_session_id: string;
235
288
  client_message_id?: string | undefined;
236
289
  }>, z.ZodObject<{
@@ -246,17 +299,17 @@ export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscr
246
299
  event: MessageTypeEnum;
247
300
  }>;
248
301
  }, "strip", z.ZodTypeAny, {
302
+ type: "chat_event";
249
303
  value: {
250
304
  message: string;
251
305
  event: MessageTypeEnum;
252
306
  };
253
- type: "chat_event";
254
307
  }, {
308
+ type: "chat_event";
255
309
  value: {
256
310
  message: string;
257
311
  event: MessageTypeEnum;
258
312
  };
259
- type: "chat_event";
260
313
  }>, z.ZodObject<{
261
314
  type: z.ZodLiteral<"options">;
262
315
  value: z.ZodObject<{
@@ -268,16 +321,16 @@ export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscr
268
321
  }>;
269
322
  server_session_id: z.ZodString;
270
323
  }, "strip", z.ZodTypeAny, {
324
+ type: "options";
271
325
  value: {
272
326
  options: string[];
273
327
  };
274
- type: "options";
275
328
  server_session_id: string;
276
329
  }, {
330
+ type: "options";
277
331
  value: {
278
332
  options: string[];
279
333
  };
280
- type: "options";
281
334
  server_session_id: string;
282
335
  }>, z.ZodObject<{
283
336
  type: z.ZodLiteral<"session_update">;
@@ -297,129 +350,129 @@ export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscr
297
350
  email: z.ZodString;
298
351
  avatar_url: z.ZodOptional<z.ZodString>;
299
352
  }, "strip", z.ZodTypeAny, {
300
- email: string;
301
353
  name: string;
354
+ email: string;
302
355
  avatar_url?: string | undefined;
303
356
  }, {
304
- email: string;
305
357
  name: string;
358
+ email: string;
306
359
  avatar_url?: string | undefined;
307
360
  }>>>;
308
361
  sentiment: z.ZodNullable<z.ZodNativeEnum<typeof SentimentEnum>>;
309
362
  }, "strip", z.ZodTypeAny, {
363
+ status: SessionStatus;
310
364
  id: string;
365
+ channel: SessionChannel;
366
+ language: string | null;
311
367
  ai_closure_type: AIClosureType | null;
312
368
  assignee_id: number | null;
313
- channel: SessionChannel;
314
- status: SessionStatus;
315
369
  summary: string | null;
316
- language: string | null;
317
370
  last_message: string | null;
318
371
  last_message_at: Date | null;
319
372
  sentiment: SentimentEnum | null;
320
373
  assignee?: {
321
- email: string;
322
374
  name: string;
375
+ email: string;
323
376
  avatar_url?: string | undefined;
324
377
  } | null | undefined;
325
378
  }, {
379
+ status: SessionStatus;
326
380
  id: string;
381
+ channel: SessionChannel;
382
+ language: string | null;
327
383
  ai_closure_type: AIClosureType | null;
328
384
  assignee_id: number | null;
329
- channel: SessionChannel;
330
- status: SessionStatus;
331
385
  summary: string | null;
332
- language: string | null;
333
386
  last_message: string | null;
334
387
  last_message_at: Date | null;
335
388
  sentiment: SentimentEnum | null;
336
389
  assignee?: {
337
- email: string;
338
390
  name: string;
391
+ email: string;
339
392
  avatar_url?: string | undefined;
340
393
  } | null | undefined;
341
394
  }>;
342
395
  }, "strip", z.ZodTypeAny, {
343
396
  session: {
397
+ status: SessionStatus;
344
398
  id: string;
399
+ channel: SessionChannel;
400
+ language: string | null;
345
401
  ai_closure_type: AIClosureType | null;
346
402
  assignee_id: number | null;
347
- channel: SessionChannel;
348
- status: SessionStatus;
349
403
  summary: string | null;
350
- language: string | null;
351
404
  last_message: string | null;
352
405
  last_message_at: Date | null;
353
406
  sentiment: SentimentEnum | null;
354
407
  assignee?: {
355
- email: string;
356
408
  name: string;
409
+ email: string;
357
410
  avatar_url?: string | undefined;
358
411
  } | null | undefined;
359
412
  };
360
413
  }, {
361
414
  session: {
415
+ status: SessionStatus;
362
416
  id: string;
417
+ channel: SessionChannel;
418
+ language: string | null;
363
419
  ai_closure_type: AIClosureType | null;
364
420
  assignee_id: number | null;
365
- channel: SessionChannel;
366
- status: SessionStatus;
367
421
  summary: string | null;
368
- language: string | null;
369
422
  last_message: string | null;
370
423
  last_message_at: Date | null;
371
424
  sentiment: SentimentEnum | null;
372
425
  assignee?: {
373
- email: string;
374
426
  name: string;
427
+ email: string;
375
428
  avatar_url?: string | undefined;
376
429
  } | null | undefined;
377
430
  };
378
431
  }>;
379
432
  server_session_id: z.ZodString;
380
433
  }, "strip", z.ZodTypeAny, {
434
+ type: "session_update";
381
435
  value: {
382
436
  session: {
437
+ status: SessionStatus;
383
438
  id: string;
439
+ channel: SessionChannel;
440
+ language: string | null;
384
441
  ai_closure_type: AIClosureType | null;
385
442
  assignee_id: number | null;
386
- channel: SessionChannel;
387
- status: SessionStatus;
388
443
  summary: string | null;
389
- language: string | null;
390
444
  last_message: string | null;
391
445
  last_message_at: Date | null;
392
446
  sentiment: SentimentEnum | null;
393
447
  assignee?: {
394
- email: string;
395
448
  name: string;
449
+ email: string;
396
450
  avatar_url?: string | undefined;
397
451
  } | null | undefined;
398
452
  };
399
453
  };
400
- type: "session_update";
401
454
  server_session_id: string;
402
455
  }, {
456
+ type: "session_update";
403
457
  value: {
404
458
  session: {
459
+ status: SessionStatus;
405
460
  id: string;
461
+ channel: SessionChannel;
462
+ language: string | null;
406
463
  ai_closure_type: AIClosureType | null;
407
464
  assignee_id: number | null;
408
- channel: SessionChannel;
409
- status: SessionStatus;
410
465
  summary: string | null;
411
- language: string | null;
412
466
  last_message: string | null;
413
467
  last_message_at: Date | null;
414
468
  sentiment: SentimentEnum | null;
415
469
  assignee?: {
416
- email: string;
417
470
  name: string;
471
+ email: string;
418
472
  avatar_url?: string | undefined;
419
473
  } | null | undefined;
420
474
  };
421
475
  };
422
- type: "session_update";
423
476
  server_session_id: string;
424
477
  }>]>, z.ZodObject<{
425
478
  timestamp: z.ZodString;
@@ -440,21 +493,21 @@ export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscr
440
493
  profile_picture?: string | null | undefined;
441
494
  }>;
442
495
  }, "strip", z.ZodTypeAny, {
443
- timestamp: string;
444
496
  agent: {
445
497
  id: string | null;
446
498
  name: string;
447
499
  is_ai: boolean;
448
500
  profile_picture?: string | null | undefined;
449
501
  };
450
- }, {
451
502
  timestamp: string;
503
+ }, {
452
504
  agent: {
453
505
  id: string | null;
454
506
  name: string;
455
507
  is_ai: boolean;
456
508
  profile_picture?: string | null | undefined;
457
509
  };
510
+ timestamp: string;
458
511
  }>>;
459
512
  export declare const consumerSchema: z.ZodObject<{
460
513
  id: z.ZodString;
@@ -463,15 +516,15 @@ export declare const consumerSchema: z.ZodObject<{
463
516
  avatar_url: z.ZodNullable<z.ZodString>;
464
517
  email: z.ZodNullable<z.ZodString>;
465
518
  }, "strip", z.ZodTypeAny, {
466
- email: string | null;
467
519
  id: string;
468
520
  name: string | null;
521
+ email: string | null;
469
522
  avatar_url: string | null;
470
523
  created_at: string;
471
524
  }, {
472
- email: string | null;
473
525
  id: string;
474
526
  name: string | null;
527
+ email: string | null;
475
528
  avatar_url: string | null;
476
529
  created_at: string;
477
530
  }>;
@@ -486,4 +539,5 @@ type ChatSessionWithStatus = ChatSessionType & {
486
539
  };
487
540
  type StructuredSocketMessageType = z.infer<typeof structuredSocketMessageSchema>;
488
541
  type ChatHistoryMessageType = z.infer<typeof chatHistoryMessageSchema>;
489
- export type { AgentType, ConsumerType, ChatSessionType, StructuredSocketMessageType, ChatHistoryMessageType, ChatSessionWithStatus, };
542
+ type ChatAttachmentType = z.infer<typeof chatAttachmentSchema>;
543
+ export type { AgentType, ConsumerType, ChatSessionType, StructuredSocketMessageType, ChatHistoryMessageType, ChatAttachmentType, ChatSessionWithStatus, };