@opencx/widget 2.6.0 → 2.6.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 (102) hide show
  1. package/dist/api-BEtFfKMB.cjs +2 -0
  2. package/dist/api-BEtFfKMB.cjs.map +1 -0
  3. package/dist/api-Cez5T-se.js +1393 -0
  4. package/dist/api-Cez5T-se.js.map +1 -0
  5. package/dist/basic.cjs +85 -85
  6. package/dist/basic.cjs.map +1 -1
  7. package/dist/basic.js +13159 -12639
  8. package/dist/basic.js.map +1 -1
  9. package/dist/core/client/api.d.ts +414 -40
  10. package/dist/core/client/chat.d.ts +33 -19
  11. package/dist/core/client/config.d.ts +13 -3
  12. package/dist/core/client/contact.d.ts +9 -13
  13. package/dist/core/client/index.d.ts +1 -1
  14. package/dist/core/index.d.ts +1 -1
  15. package/dist/core/sdk/index.d.ts +11 -0
  16. package/dist/core/types/contact.d.ts +2 -0
  17. package/dist/core/types/helpers.d.ts +5 -2
  18. package/dist/core/types/index.d.ts +6 -6
  19. package/dist/core/types/messages.d.ts +20 -9
  20. package/dist/core/types/schemas-v2.d.ts +10 -713
  21. package/dist/index-BzidnDPX.cjs +18 -0
  22. package/dist/index-BzidnDPX.cjs.map +1 -0
  23. package/dist/index-DUlnC30_.js +1219 -0
  24. package/dist/index-DUlnC30_.js.map +1 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.js +22 -1071
  28. package/dist/index.js.map +1 -1
  29. package/dist/react-web/core-integration/ChatProvider.d.ts +107 -0
  30. package/dist/react-web/core-integration/components.d.ts +11 -0
  31. package/dist/react-web/core-integration/hooks/useChatMessages.d.ts +70 -0
  32. package/dist/react-web/core-integration/hooks/useChatSession.d.ts +83 -0
  33. package/dist/react-web/core-integration/hooks/useConfig.d.ts +1 -0
  34. package/dist/react-web/core-integration/hooks/useContact.d.ts +17 -0
  35. package/dist/react-web/core-integration/hooks/useLocale.d.ts +4 -0
  36. package/dist/react-web/core-integration/hooks/usePreludeData.d.ts +36 -0
  37. package/dist/react-web/core-integration/hooks/usePubsub.d.ts +2 -0
  38. package/dist/react-web/{hooks → core-integration/hooks}/useUploadFiles.d.ts +2 -2
  39. package/dist/react-web/{hooks → core-integration/hooks}/useVote.d.ts +2 -2
  40. package/dist/react-web/core-integration/hooks.d.ts +9 -0
  41. package/dist/react-web/core-integration/index.d.ts +2 -0
  42. package/dist/react-web/index.d.ts +4 -10
  43. package/dist/react-web/types/components.d.ts +6 -3
  44. package/dist/react-web/types/index.d.ts +3 -2
  45. package/dist/react-web/types/options.d.ts +4 -30
  46. package/dist/react.cjs +1 -1
  47. package/dist/react.cjs.map +1 -1
  48. package/dist/react.js +10 -46
  49. package/dist/react.js.map +1 -1
  50. package/dist/src/@components/BotOrAgentMessageGroup.d.ts +1 -2
  51. package/dist/src/@components/BotOrAgentMessageWrapper.d.ts +2 -2
  52. package/dist/src/@components/ChatEvent.component.d.ts +3 -3
  53. package/dist/src/@components/Text.component.d.ts +1 -1
  54. package/dist/src/components/button.d.ts +1 -1
  55. package/dist/src/components/dialog.d.ts +9 -9
  56. package/dist/src/designs/basic/index.d.ts +1 -1
  57. package/dist/style.css +1 -1
  58. package/dist-embed/script.js +119 -124
  59. package/dist-embed/script.js.map +1 -1
  60. package/package.json +7 -4
  61. package/dist/core/tests/utils/create-fetch.test.d.ts +0 -1
  62. package/dist/core/types/schemas.d.ts +0 -543
  63. package/dist/core/utils/create-fetch.d.ts +0 -25
  64. package/dist/core/utils/genId.d.ts +0 -2
  65. package/dist/core/utils/history-to-widget-messages.d.ts +0 -4
  66. package/dist/genUuid-C12yFv3j.js +0 -137
  67. package/dist/genUuid-C12yFv3j.js.map +0 -1
  68. package/dist/genUuid-DdeSE04H.cjs +0 -2
  69. package/dist/genUuid-DdeSE04H.cjs.map +0 -1
  70. package/dist/index-C87obATS.js +0 -2616
  71. package/dist/index-C87obATS.js.map +0 -1
  72. package/dist/index-ChwS_h0D.cjs +0 -18
  73. package/dist/index-ChwS_h0D.cjs.map +0 -1
  74. package/dist/package.json.d.ts +0 -158
  75. package/dist/react-web/Root.d.ts +0 -6
  76. package/dist/react-web/hooks/index.d.ts +0 -6
  77. package/dist/react-web/hooks/use-sound.d.ts +0 -13
  78. package/dist/react-web/hooks/use-sound.test.d.ts +0 -1
  79. package/dist/react-web/hooks/use-sync-state.test.d.ts +0 -1
  80. package/dist/react-web/hooks/useAbstractChat.d.ts +0 -157
  81. package/dist/react-web/hooks/useAxiosInstance.d.ts +0 -190
  82. package/dist/react-web/hooks/useSyncState.d.ts +0 -4
  83. package/dist/react-web/hooks/useTimeoutState.d.ts +0 -3
  84. package/dist/react-web/providers/ChatProvider.d.ts +0 -143
  85. package/dist/react-web/providers/ConfigDataProvider.d.ts +0 -62
  86. package/dist/react-web/providers/ContactProvider.d.ts +0 -58
  87. package/dist/react-web/providers/LocalesProvider.d.ts +0 -11
  88. package/dist/react-web/providers/componentRegistry.d.ts +0 -13
  89. package/dist/react-web/providers/use-widget-sfx.d.ts +0 -7
  90. package/dist/react-web/providers/usePreludeData.d.ts +0 -2
  91. package/dist/react-web/utils/debug.d.ts +0 -2
  92. package/dist/react-web/utils/getters.d.ts +0 -24
  93. package/dist/react-web/utils/index.d.ts +0 -1
  94. package/dist/src/hooks/useShouldCollectData.d.ts +0 -3
  95. /package/dist/react-web/{locales → core-integration/locales}/ar.locale.d.ts +0 -0
  96. /package/dist/react-web/{locales → core-integration/locales}/de.locale.d.ts +0 -0
  97. /package/dist/react-web/{locales → core-integration/locales}/en.locale.d.ts +0 -0
  98. /package/dist/react-web/{locales → core-integration/locales}/fr.locale.d.ts +0 -0
  99. /package/dist/react-web/{locales → core-integration/locales}/helper.d.ts +0 -0
  100. /package/dist/react-web/{locales → core-integration/locales}/index.d.ts +0 -0
  101. /package/dist/react-web/{locales → core-integration/locales}/nl.locale.d.ts +0 -0
  102. /package/dist/react-web/{locales → core-integration/locales}/pt.locale.d.ts +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opencx/widget",
3
3
  "private": false,
4
- "version": "2.6.0",
4
+ "version": "2.6.2",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -117,6 +117,8 @@
117
117
  "class-variance-authority": "^0.7.0",
118
118
  "jsdom": "^25.0.1",
119
119
  "mutative": "^1.0.11",
120
+ "openapi-fetch": "^0.13.4",
121
+ "openapi-typescript": "^7.5.2",
120
122
  "postcss": "^8.4.41",
121
123
  "postcss-prefix-selector": "^1.16.1",
122
124
  "react": "^18.3.1",
@@ -139,17 +141,18 @@
139
141
  "scripts": {
140
142
  "clean": "rm -rf ./dist ./dist-embed",
141
143
  "clean:dist": "rm -rf ./dist ./dist-embed",
142
- "build:lib": "vite build",
143
144
  "dev": "vite -c vite.config.ts",
145
+ "build:lib": "vite build",
144
146
  "build:embed": "vite build -c vite.embed.config.ts",
147
+ "gen:sdk": "pnpm dlx openapi-typescript http://localhost:8080/widget-api-yaml -o ./core/sdk/schema.d.ts",
145
148
  "test": "vitest run",
146
- "batman": "pnpm build:lib && pnpm build:embed",
147
149
  "test:watch": "vitest --watch",
148
150
  "cs": "changeset",
149
151
  "csv": "changeset version",
150
152
  "csp": "changeset publish",
151
153
  "type-check": "tsc --noEmit",
152
154
  "lint": "biome lint --fix",
153
- "format": "biome format --fix"
155
+ "format": "biome format --fix",
156
+ "batman": "pnpm build:lib && pnpm build:embed"
154
157
  }
155
158
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,543 +0,0 @@
1
- import { default as z } from 'zod';
2
- import { chatAttachmentSchema } from './schemas-v2';
3
- export declare enum SessionStatus {
4
- OPEN = 0,
5
- CLOSED_RESOLVED = 1,
6
- CLOSED_UNRESOLVED = 2
7
- }
8
- export declare enum SessionChannel {
9
- WEB = "web",
10
- WEB_VOICE = "web_voice",
11
- PHONE_VOICE = "phone_voice",
12
- EMAIL = "email",
13
- SMS = "sms",
14
- WHATSAPP = "whatsapp",
15
- API = "api"
16
- }
17
- export declare enum AIClosureType {
18
- resolved = "resolved",
19
- assumed_resolved = "assumed_resolved",
20
- handed_off = "handed_off"
21
- }
22
- export declare enum SentimentEnum {
23
- happy = "happy",
24
- neutral = "neutral",
25
- angry = "angry"
26
- }
27
- export declare enum MessageTypeEnum {
28
- MESSAGE = "message",
29
- HANDOFF = "handoff",
30
- HANDOFF_TO_ZENDESK = "handoff_to_zendesk",
31
- AGENT_MESSAGE = "agent_message",
32
- AGENT_JOINED = "agent_joined",
33
- AGENT_TOOK_SESSION_FROM_AI = "agent_took_session_from_ai",
34
- AI_DECIDED_TO_RESOLVE_THE_ISSUE = "ai_decided_to_resolve_the_issue",
35
- EMAIL_DRAFT_MESSAGE = "email_draft_message",
36
- FOLLOWUP = "followup"
37
- }
38
- export declare const chatSessionSchema: z.ZodObject<{
39
- id: z.ZodString;
40
- ai_closure_type: z.ZodNullable<z.ZodNativeEnum<typeof AIClosureType>>;
41
- assignee_id: z.ZodNullable<z.ZodNumber>;
42
- channel: z.ZodNativeEnum<typeof SessionChannel>;
43
- summary: z.ZodNullable<z.ZodString>;
44
- status: z.ZodNativeEnum<typeof SessionStatus>;
45
- language: z.ZodNullable<z.ZodString>;
46
- last_message: z.ZodNullable<z.ZodString>;
47
- last_message_at: z.ZodNullable<z.ZodDate>;
48
- assignee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
49
- name: z.ZodString;
50
- email: z.ZodString;
51
- avatar_url: z.ZodOptional<z.ZodString>;
52
- }, "strip", z.ZodTypeAny, {
53
- name: string;
54
- email: string;
55
- avatar_url?: string | undefined;
56
- }, {
57
- name: string;
58
- email: string;
59
- avatar_url?: string | undefined;
60
- }>>>;
61
- sentiment: z.ZodNullable<z.ZodNativeEnum<typeof SentimentEnum>>;
62
- }, "strip", z.ZodTypeAny, {
63
- status: SessionStatus;
64
- id: string;
65
- channel: SessionChannel;
66
- language: string | null;
67
- ai_closure_type: AIClosureType | null;
68
- assignee_id: number | null;
69
- summary: string | null;
70
- last_message: string | null;
71
- last_message_at: Date | null;
72
- sentiment: SentimentEnum | null;
73
- assignee?: {
74
- name: string;
75
- email: string;
76
- avatar_url?: string | undefined;
77
- } | null | undefined;
78
- }, {
79
- status: SessionStatus;
80
- id: string;
81
- channel: SessionChannel;
82
- language: string | null;
83
- ai_closure_type: AIClosureType | null;
84
- assignee_id: number | null;
85
- summary: string | null;
86
- last_message: string | null;
87
- last_message_at: Date | null;
88
- sentiment: SentimentEnum | null;
89
- assignee?: {
90
- name: string;
91
- email: string;
92
- avatar_url?: string | undefined;
93
- } | null | undefined;
94
- }>;
95
- export declare const chatHistoryMessageSchema: z.ZodObject<{
96
- publicId: z.ZodString;
97
- message: z.ZodNullable<z.ZodString>;
98
- type: z.ZodNullable<z.ZodString>;
99
- agent_avatar: z.ZodNullable<z.ZodString>;
100
- agent_id: z.ZodNullable<z.ZodNumber>;
101
- agent_name: z.ZodNullable<z.ZodString>;
102
- created_at: z.ZodString;
103
- from_user: z.ZodNullable<z.ZodBoolean>;
104
- handoff_happened_during_office_hours: z.ZodNullable<z.ZodBoolean>;
105
- session_id: z.ZodString;
106
- updated_at: z.ZodNullable<z.ZodString>;
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">>;
126
- }, "strip", z.ZodTypeAny, {
127
- message: string | null;
128
- type: string | null;
129
- publicId: string;
130
- session_id: string;
131
- agent_avatar: string | null;
132
- agent_id: number | null;
133
- agent_name: string | null;
134
- created_at: string;
135
- from_user: boolean | null;
136
- handoff_happened_during_office_hours: boolean | null;
137
- updated_at: string | null;
138
- attachments?: {
139
- type: string;
140
- id: string;
141
- name: string;
142
- size: number;
143
- url: string;
144
- }[] | undefined;
145
- }, {
146
- message: string | null;
147
- type: string | null;
148
- publicId: string;
149
- session_id: string;
150
- agent_avatar: string | null;
151
- agent_id: number | null;
152
- agent_name: string | null;
153
- created_at: string;
154
- from_user: boolean | null;
155
- handoff_happened_during_office_hours: boolean | null;
156
- updated_at: string | null;
157
- attachments?: {
158
- type: string;
159
- id: string;
160
- name: string;
161
- size: number;
162
- url: string;
163
- }[] | undefined;
164
- }>;
165
- declare const agentSchema: z.ZodObject<{
166
- name: z.ZodString;
167
- is_ai: z.ZodBoolean;
168
- profile_picture: z.ZodNullable<z.ZodOptional<z.ZodString>>;
169
- id: z.ZodNullable<z.ZodString>;
170
- }, "strip", z.ZodTypeAny, {
171
- id: string | null;
172
- name: string;
173
- is_ai: boolean;
174
- profile_picture?: string | null | undefined;
175
- }, {
176
- id: string | null;
177
- name: string;
178
- is_ai: boolean;
179
- profile_picture?: string | null | undefined;
180
- }>;
181
- export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
182
- type: z.ZodLiteral<"message">;
183
- value: z.ZodString;
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">>;
203
- is_stream_chunk: z.ZodOptional<z.ZodBoolean>;
204
- server_session_id: z.ZodString;
205
- client_message_id: z.ZodOptional<z.ZodString>;
206
- server_message_id: z.ZodString;
207
- }, "strip", z.ZodTypeAny, {
208
- type: "message";
209
- value: string;
210
- server_session_id: string;
211
- server_message_id: string;
212
- attachments?: {
213
- type: string;
214
- id: string;
215
- name: string;
216
- size: number;
217
- url: string;
218
- }[] | undefined;
219
- is_stream_chunk?: boolean | undefined;
220
- client_message_id?: string | undefined;
221
- }, {
222
- type: "message";
223
- value: string;
224
- server_session_id: string;
225
- server_message_id: string;
226
- attachments?: {
227
- type: string;
228
- id: string;
229
- name: string;
230
- size: number;
231
- url: string;
232
- }[] | undefined;
233
- is_stream_chunk?: boolean | undefined;
234
- client_message_id?: string | undefined;
235
- }>, z.ZodObject<{
236
- type: z.ZodLiteral<"info">;
237
- value: z.ZodString;
238
- }, "strip", z.ZodTypeAny, {
239
- type: "info";
240
- value: string;
241
- }, {
242
- type: "info";
243
- value: string;
244
- }>, z.ZodObject<{
245
- type: z.ZodLiteral<"ui">;
246
- value: z.ZodObject<{
247
- type: z.ZodString;
248
- request_response: z.ZodAny;
249
- name: z.ZodString;
250
- content: z.ZodString;
251
- message_id: z.ZodOptional<z.ZodString>;
252
- }, "strip", z.ZodTypeAny, {
253
- type: string;
254
- name: string;
255
- content: string;
256
- request_response?: any;
257
- message_id?: string | undefined;
258
- }, {
259
- type: string;
260
- name: string;
261
- content: string;
262
- request_response?: any;
263
- message_id?: string | undefined;
264
- }>;
265
- client_message_id: z.ZodOptional<z.ZodString>;
266
- server_session_id: z.ZodString;
267
- }, "strip", z.ZodTypeAny, {
268
- type: "ui";
269
- value: {
270
- type: string;
271
- name: string;
272
- content: string;
273
- request_response?: any;
274
- message_id?: string | undefined;
275
- };
276
- server_session_id: string;
277
- client_message_id?: string | undefined;
278
- }, {
279
- type: "ui";
280
- value: {
281
- type: string;
282
- name: string;
283
- content: string;
284
- request_response?: any;
285
- message_id?: string | undefined;
286
- };
287
- server_session_id: string;
288
- client_message_id?: string | undefined;
289
- }>, z.ZodObject<{
290
- type: z.ZodLiteral<"chat_event">;
291
- value: z.ZodObject<{
292
- event: z.ZodNativeEnum<typeof MessageTypeEnum>;
293
- message: z.ZodString;
294
- }, "strip", z.ZodTypeAny, {
295
- message: string;
296
- event: MessageTypeEnum;
297
- }, {
298
- message: string;
299
- event: MessageTypeEnum;
300
- }>;
301
- }, "strip", z.ZodTypeAny, {
302
- type: "chat_event";
303
- value: {
304
- message: string;
305
- event: MessageTypeEnum;
306
- };
307
- }, {
308
- type: "chat_event";
309
- value: {
310
- message: string;
311
- event: MessageTypeEnum;
312
- };
313
- }>, z.ZodObject<{
314
- type: z.ZodLiteral<"options">;
315
- value: z.ZodObject<{
316
- options: z.ZodArray<z.ZodString, "many">;
317
- }, "strip", z.ZodTypeAny, {
318
- options: string[];
319
- }, {
320
- options: string[];
321
- }>;
322
- server_session_id: z.ZodString;
323
- }, "strip", z.ZodTypeAny, {
324
- type: "options";
325
- value: {
326
- options: string[];
327
- };
328
- server_session_id: string;
329
- }, {
330
- type: "options";
331
- value: {
332
- options: string[];
333
- };
334
- server_session_id: string;
335
- }>, z.ZodObject<{
336
- type: z.ZodLiteral<"session_update">;
337
- value: z.ZodObject<{
338
- session: z.ZodObject<{
339
- id: z.ZodString;
340
- ai_closure_type: z.ZodNullable<z.ZodNativeEnum<typeof AIClosureType>>;
341
- assignee_id: z.ZodNullable<z.ZodNumber>;
342
- channel: z.ZodNativeEnum<typeof SessionChannel>;
343
- summary: z.ZodNullable<z.ZodString>;
344
- status: z.ZodNativeEnum<typeof SessionStatus>;
345
- language: z.ZodNullable<z.ZodString>;
346
- last_message: z.ZodNullable<z.ZodString>;
347
- last_message_at: z.ZodNullable<z.ZodDate>;
348
- assignee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
349
- name: z.ZodString;
350
- email: z.ZodString;
351
- avatar_url: z.ZodOptional<z.ZodString>;
352
- }, "strip", z.ZodTypeAny, {
353
- name: string;
354
- email: string;
355
- avatar_url?: string | undefined;
356
- }, {
357
- name: string;
358
- email: string;
359
- avatar_url?: string | undefined;
360
- }>>>;
361
- sentiment: z.ZodNullable<z.ZodNativeEnum<typeof SentimentEnum>>;
362
- }, "strip", z.ZodTypeAny, {
363
- status: SessionStatus;
364
- id: string;
365
- channel: SessionChannel;
366
- language: string | null;
367
- ai_closure_type: AIClosureType | null;
368
- assignee_id: number | null;
369
- summary: string | null;
370
- last_message: string | null;
371
- last_message_at: Date | null;
372
- sentiment: SentimentEnum | null;
373
- assignee?: {
374
- name: string;
375
- email: string;
376
- avatar_url?: string | undefined;
377
- } | null | undefined;
378
- }, {
379
- status: SessionStatus;
380
- id: string;
381
- channel: SessionChannel;
382
- language: string | null;
383
- ai_closure_type: AIClosureType | null;
384
- assignee_id: number | null;
385
- summary: string | null;
386
- last_message: string | null;
387
- last_message_at: Date | null;
388
- sentiment: SentimentEnum | null;
389
- assignee?: {
390
- name: string;
391
- email: string;
392
- avatar_url?: string | undefined;
393
- } | null | undefined;
394
- }>;
395
- }, "strip", z.ZodTypeAny, {
396
- session: {
397
- status: SessionStatus;
398
- id: string;
399
- channel: SessionChannel;
400
- language: string | null;
401
- ai_closure_type: AIClosureType | null;
402
- assignee_id: number | null;
403
- summary: string | null;
404
- last_message: string | null;
405
- last_message_at: Date | null;
406
- sentiment: SentimentEnum | null;
407
- assignee?: {
408
- name: string;
409
- email: string;
410
- avatar_url?: string | undefined;
411
- } | null | undefined;
412
- };
413
- }, {
414
- session: {
415
- status: SessionStatus;
416
- id: string;
417
- channel: SessionChannel;
418
- language: string | null;
419
- ai_closure_type: AIClosureType | null;
420
- assignee_id: number | null;
421
- summary: string | null;
422
- last_message: string | null;
423
- last_message_at: Date | null;
424
- sentiment: SentimentEnum | null;
425
- assignee?: {
426
- name: string;
427
- email: string;
428
- avatar_url?: string | undefined;
429
- } | null | undefined;
430
- };
431
- }>;
432
- server_session_id: z.ZodString;
433
- }, "strip", z.ZodTypeAny, {
434
- type: "session_update";
435
- value: {
436
- session: {
437
- status: SessionStatus;
438
- id: string;
439
- channel: SessionChannel;
440
- language: string | null;
441
- ai_closure_type: AIClosureType | null;
442
- assignee_id: number | null;
443
- summary: string | null;
444
- last_message: string | null;
445
- last_message_at: Date | null;
446
- sentiment: SentimentEnum | null;
447
- assignee?: {
448
- name: string;
449
- email: string;
450
- avatar_url?: string | undefined;
451
- } | null | undefined;
452
- };
453
- };
454
- server_session_id: string;
455
- }, {
456
- type: "session_update";
457
- value: {
458
- session: {
459
- status: SessionStatus;
460
- id: string;
461
- channel: SessionChannel;
462
- language: string | null;
463
- ai_closure_type: AIClosureType | null;
464
- assignee_id: number | null;
465
- summary: string | null;
466
- last_message: string | null;
467
- last_message_at: Date | null;
468
- sentiment: SentimentEnum | null;
469
- assignee?: {
470
- name: string;
471
- email: string;
472
- avatar_url?: string | undefined;
473
- } | null | undefined;
474
- };
475
- };
476
- server_session_id: string;
477
- }>]>, z.ZodObject<{
478
- timestamp: z.ZodString;
479
- agent: z.ZodObject<{
480
- name: z.ZodString;
481
- is_ai: z.ZodBoolean;
482
- profile_picture: z.ZodNullable<z.ZodOptional<z.ZodString>>;
483
- id: z.ZodNullable<z.ZodString>;
484
- }, "strip", z.ZodTypeAny, {
485
- id: string | null;
486
- name: string;
487
- is_ai: boolean;
488
- profile_picture?: string | null | undefined;
489
- }, {
490
- id: string | null;
491
- name: string;
492
- is_ai: boolean;
493
- profile_picture?: string | null | undefined;
494
- }>;
495
- }, "strip", z.ZodTypeAny, {
496
- agent: {
497
- id: string | null;
498
- name: string;
499
- is_ai: boolean;
500
- profile_picture?: string | null | undefined;
501
- };
502
- timestamp: string;
503
- }, {
504
- agent: {
505
- id: string | null;
506
- name: string;
507
- is_ai: boolean;
508
- profile_picture?: string | null | undefined;
509
- };
510
- timestamp: string;
511
- }>>;
512
- export declare const consumerSchema: z.ZodObject<{
513
- id: z.ZodString;
514
- name: z.ZodNullable<z.ZodString>;
515
- created_at: z.ZodString;
516
- avatar_url: z.ZodNullable<z.ZodString>;
517
- email: z.ZodNullable<z.ZodString>;
518
- }, "strip", z.ZodTypeAny, {
519
- id: string;
520
- name: string | null;
521
- email: string | null;
522
- avatar_url: string | null;
523
- created_at: string;
524
- }, {
525
- id: string;
526
- name: string | null;
527
- email: string | null;
528
- avatar_url: string | null;
529
- created_at: string;
530
- }>;
531
- type AgentType = z.infer<typeof agentSchema>;
532
- type ConsumerType = z.infer<typeof consumerSchema>;
533
- type ChatSessionType = z.infer<typeof chatSessionSchema>;
534
- type ChatSessionWithStatus = ChatSessionType & {
535
- isSessionClosed: boolean;
536
- isAssignedToAi: boolean;
537
- isAssignedToHuman: boolean;
538
- isPendingHuman: boolean;
539
- };
540
- type StructuredSocketMessageType = z.infer<typeof structuredSocketMessageSchema>;
541
- type ChatHistoryMessageType = z.infer<typeof chatHistoryMessageSchema>;
542
- type ChatAttachmentType = z.infer<typeof chatAttachmentSchema>;
543
- export type { AgentType, ConsumerType, ChatSessionType, StructuredSocketMessageType, ChatHistoryMessageType, ChatAttachmentType, ChatSessionWithStatus, };
@@ -1,25 +0,0 @@
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
- type Fetch = typeof globalThis.fetch;
23
- export declare function createFetch(defaultConfig?: RequestConfig, fetch?: Fetch): CustomFetch;
24
- export declare function handleJsonResponse<T>(response: Response): Promise<T>;
25
- export {};
@@ -1,2 +0,0 @@
1
- declare const genId: (len?: number) => string;
2
- export { genId };
@@ -1,4 +0,0 @@
1
- import { MessageType } from '../types/messages';
2
- import { ChatHistoryMessageType } from '../types/schemas';
3
- declare function mapChatHistoryToMessage(value: ChatHistoryMessageType[]): MessageType[];
4
- export { mapChatHistoryToMessage };