@opencx/widget 2.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 +105 -0
- package/dist/basic.cjs +259 -0
- package/dist/basic.cjs.map +1 -0
- package/dist/basic.d.ts +2 -0
- package/dist/basic.js +40507 -0
- package/dist/basic.js.map +1 -0
- package/dist/core/client/api.d.ts +15 -0
- package/dist/core/client/client.d.ts +39 -0
- package/dist/core/client/index.d.ts +1 -0
- package/dist/core/errors/index.d.ts +21 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/managers/chathistory-manager.d.ts +61 -0
- package/dist/core/managers/session-manager.d.ts +35 -0
- package/dist/core/platform/index.d.ts +20 -0
- package/dist/core/transport/http.transport.d.ts +17 -0
- package/dist/core/transport/transport.d.ts +25 -0
- package/dist/core/types/helpers.d.ts +5 -0
- package/dist/core/types/index.d.ts +32 -0
- package/dist/core/types/messages.d.ts +43 -0
- package/dist/core/types/prelude.d.ts +14 -0
- package/dist/core/types/pub-sub.d.ts +94 -0
- package/dist/core/types/schemas.d.ts +489 -0
- package/dist/core/types/transport.d.ts +31 -0
- package/dist/core/utils/genId.d.ts +2 -0
- package/dist/core/utils/genId.test.d.ts +1 -0
- package/dist/core/utils/history-to-widget-messages.d.ts +4 -0
- package/dist/history-to-widget-messages-CP0hKjhv.js +195 -0
- package/dist/history-to-widget-messages-CP0hKjhv.js.map +1 -0
- package/dist/history-to-widget-messages-CdbZolRN.cjs +2 -0
- package/dist/history-to-widget-messages-CdbZolRN.cjs.map +1 -0
- package/dist/index-C11ivBh5.js +2604 -0
- package/dist/index-C11ivBh5.js.map +1 -0
- package/dist/index-DQmRZV3b.cjs +18 -0
- package/dist/index-DQmRZV3b.cjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +445 -0
- package/dist/index.js.map +1 -0
- package/dist/react-lib/Root.d.ts +6 -0
- package/dist/react-lib/hooks/handle-socket-messages.d.ts +27 -0
- package/dist/react-lib/hooks/index.d.ts +6 -0
- package/dist/react-lib/hooks/socket.d.ts +11 -0
- package/dist/react-lib/hooks/socketState.d.ts +2 -0
- package/dist/react-lib/hooks/use-sound.d.ts +13 -0
- package/dist/react-lib/hooks/use-sound.test.d.ts +1 -0
- package/dist/react-lib/hooks/use-sync-state.test.d.ts +1 -0
- package/dist/react-lib/hooks/useAbstractChat.d.ts +159 -0
- package/dist/react-lib/hooks/useAxiosInstance.d.ts +121 -0
- package/dist/react-lib/hooks/useBaseClient.d.ts +2 -0
- package/dist/react-lib/hooks/useScrollTo.d.ts +2 -0
- package/dist/react-lib/hooks/useSyncState.d.ts +4 -0
- package/dist/react-lib/hooks/useTimeoutState.d.ts +3 -0
- package/dist/react-lib/hooks/useUploadFiles.d.ts +21 -0
- package/dist/react-lib/hooks/useVote.d.ts +2 -0
- package/dist/react-lib/hooks/useWidgetContentHeight.d.ts +9 -0
- package/dist/react-lib/index.d.ts +10 -0
- package/dist/react-lib/locales/ar.locale.d.ts +2 -0
- package/dist/react-lib/locales/de.locale.d.ts +2 -0
- package/dist/react-lib/locales/en.locale.d.ts +55 -0
- package/dist/react-lib/locales/fr.locale.d.ts +2 -0
- package/dist/react-lib/locales/helper.d.ts +65 -0
- package/dist/react-lib/locales/index.d.ts +3 -0
- package/dist/react-lib/locales/nl.locale.d.ts +2 -0
- package/dist/react-lib/locales/pt.locale.d.ts +2 -0
- package/dist/react-lib/providers/ChatProvider.d.ts +135 -0
- package/dist/react-lib/providers/ClientProvider.d.ts +7 -0
- package/dist/react-lib/providers/ConfigDataProvider.d.ts +62 -0
- package/dist/react-lib/providers/ContactProvider.d.ts +58 -0
- package/dist/react-lib/providers/LocalesProvider.d.ts +11 -0
- package/dist/react-lib/providers/componentRegistry.d.ts +13 -0
- package/dist/react-lib/providers/use-widget-sfx.d.ts +7 -0
- package/dist/react-lib/providers/usePreludeData.d.ts +2 -0
- package/dist/react-lib/types/components.d.ts +10 -0
- package/dist/react-lib/types/index.d.ts +6 -0
- package/dist/react-lib/types/options.d.ts +43 -0
- package/dist/react-lib/utils/create-safe-context.d.ts +1 -0
- package/dist/react-lib/utils/debug.d.ts +2 -0
- package/dist/react-lib/utils/getters.d.ts +24 -0
- package/dist/react-lib/utils/index.d.ts +1 -0
- package/dist/react.cjs +2 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +41 -0
- package/dist/react.js.map +1 -0
- package/dist/src/@components/BotMessage.d.ts +9 -0
- package/dist/src/@components/BotMessageWrapper.d.ts +7 -0
- package/dist/src/@components/ChatEvent.component.d.ts +9 -0
- package/dist/src/@components/Fallback.component.d.ts +8 -0
- package/dist/src/@components/Loading.component.d.ts +2 -0
- package/dist/src/@components/OpenLogoSvg.d.ts +4 -0
- package/dist/src/@components/Text.component.d.ts +3 -0
- package/dist/src/@components/index.d.ts +6 -0
- package/dist/src/@components/markdown.d.ts +3 -0
- package/dist/src/components/MotionDiv.d.ts +18 -0
- package/dist/src/components/RenderFile.d.ts +7 -0
- package/dist/src/components/avatar.d.ts +6 -0
- package/dist/src/components/button.d.ts +11 -0
- package/dist/src/components/dialog.d.ts +276 -0
- package/dist/src/components/dropdown-menu.d.ts +27 -0
- package/dist/src/components/input.d.ts +5 -0
- package/dist/src/components/keyboard.d.ts +7 -0
- package/dist/src/components/popover.d.ts +8 -0
- package/dist/src/components/skeleton.d.ts +3 -0
- package/dist/src/components/switch.d.ts +4 -0
- package/dist/src/components/tooltip.d.ts +10 -0
- package/dist/src/components/userMessage.d.ts +8 -0
- package/dist/src/components/wobble.d.ts +15 -0
- package/dist/src/designs/basic/WidgetPopoverTrigger.d.ts +5 -0
- package/dist/src/designs/basic/index.d.ts +5 -0
- package/dist/src/designs/basic/screens/chat-screen/ChatFooter.d.ts +2 -0
- package/dist/src/designs/basic/screens/chat-screen/ChatHeader.d.ts +2 -0
- package/dist/src/designs/basic/screens/chat-screen/ChatScreen.d.ts +2 -0
- package/dist/src/designs/basic/screens/chat-screen/SessionClosedDialog.d.ts +2 -0
- package/dist/src/designs/basic/screens/root-screen.d.ts +2 -0
- package/dist/src/designs/basic/screens/welcome-screen/WelcomeScreen.d.ts +2 -0
- package/dist/src/designs/constants.d.ts +15 -0
- package/dist/src/hooks/useShouldCollectData.d.ts +3 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/render.d.ts +2 -0
- package/dist/src/utils.d.ts +2 -0
- package/dist/style.css +1 -0
- package/dist-embed/script.js +476 -0
- package/dist-embed/script.js.map +1 -0
- package/package.json +153 -0
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
export declare enum SessionStatus {
|
|
3
|
+
OPEN = 0,
|
|
4
|
+
CLOSED_RESOLVED = 1,
|
|
5
|
+
CLOSED_UNRESOLVED = 2
|
|
6
|
+
}
|
|
7
|
+
export declare enum SessionChannel {
|
|
8
|
+
WEB = "web",
|
|
9
|
+
WEB_VOICE = "web_voice",
|
|
10
|
+
PHONE_VOICE = "phone_voice",
|
|
11
|
+
EMAIL = "email",
|
|
12
|
+
SMS = "sms",
|
|
13
|
+
WHATSAPP = "whatsapp",
|
|
14
|
+
API = "api"
|
|
15
|
+
}
|
|
16
|
+
export declare enum AIClosureType {
|
|
17
|
+
resolved = "resolved",
|
|
18
|
+
assumed_resolved = "assumed_resolved",
|
|
19
|
+
handed_off = "handed_off"
|
|
20
|
+
}
|
|
21
|
+
export declare enum SentimentEnum {
|
|
22
|
+
happy = "happy",
|
|
23
|
+
neutral = "neutral",
|
|
24
|
+
angry = "angry"
|
|
25
|
+
}
|
|
26
|
+
export declare enum MessageTypeEnum {
|
|
27
|
+
MESSAGE = "message",
|
|
28
|
+
HANDOFF = "handoff",
|
|
29
|
+
HANDOFF_TO_ZENDESK = "handoff_to_zendesk",
|
|
30
|
+
AGENT_MESSAGE = "agent_message",
|
|
31
|
+
AGENT_JOINED = "agent_joined",
|
|
32
|
+
AGENT_TOOK_SESSION_FROM_AI = "agent_took_session_from_ai",
|
|
33
|
+
AI_DECIDED_TO_RESOLVE_THE_ISSUE = "ai_decided_to_resolve_the_issue",
|
|
34
|
+
EMAIL_DRAFT_MESSAGE = "email_draft_message",
|
|
35
|
+
FOLLOWUP = "followup"
|
|
36
|
+
}
|
|
37
|
+
export declare const chatSessionSchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
ai_closure_type: z.ZodNullable<z.ZodNativeEnum<typeof AIClosureType>>;
|
|
40
|
+
assignee_id: z.ZodNullable<z.ZodNumber>;
|
|
41
|
+
channel: z.ZodNativeEnum<typeof SessionChannel>;
|
|
42
|
+
summary: z.ZodNullable<z.ZodString>;
|
|
43
|
+
status: z.ZodNativeEnum<typeof SessionStatus>;
|
|
44
|
+
language: z.ZodNullable<z.ZodString>;
|
|
45
|
+
last_message: z.ZodNullable<z.ZodString>;
|
|
46
|
+
last_message_at: z.ZodNullable<z.ZodDate>;
|
|
47
|
+
assignee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
email: z.ZodString;
|
|
50
|
+
avatar_url: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
email: string;
|
|
53
|
+
name: string;
|
|
54
|
+
avatar_url?: string | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
email: string;
|
|
57
|
+
name: string;
|
|
58
|
+
avatar_url?: string | undefined;
|
|
59
|
+
}>>>;
|
|
60
|
+
sentiment: z.ZodNullable<z.ZodNativeEnum<typeof SentimentEnum>>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
id: string;
|
|
63
|
+
ai_closure_type: AIClosureType | null;
|
|
64
|
+
assignee_id: number | null;
|
|
65
|
+
channel: SessionChannel;
|
|
66
|
+
status: SessionStatus;
|
|
67
|
+
summary: string | null;
|
|
68
|
+
language: string | null;
|
|
69
|
+
last_message: string | null;
|
|
70
|
+
last_message_at: Date | null;
|
|
71
|
+
sentiment: SentimentEnum | null;
|
|
72
|
+
assignee?: {
|
|
73
|
+
email: string;
|
|
74
|
+
name: string;
|
|
75
|
+
avatar_url?: string | undefined;
|
|
76
|
+
} | null | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
id: string;
|
|
79
|
+
ai_closure_type: AIClosureType | null;
|
|
80
|
+
assignee_id: number | null;
|
|
81
|
+
channel: SessionChannel;
|
|
82
|
+
status: SessionStatus;
|
|
83
|
+
summary: string | null;
|
|
84
|
+
language: string | null;
|
|
85
|
+
last_message: string | null;
|
|
86
|
+
last_message_at: Date | null;
|
|
87
|
+
sentiment: SentimentEnum | null;
|
|
88
|
+
assignee?: {
|
|
89
|
+
email: string;
|
|
90
|
+
name: string;
|
|
91
|
+
avatar_url?: string | undefined;
|
|
92
|
+
} | null | undefined;
|
|
93
|
+
}>;
|
|
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
|
+
export declare const chatHistoryMessageSchema: z.ZodObject<{
|
|
103
|
+
publicId: z.ZodString;
|
|
104
|
+
message: z.ZodNullable<z.ZodString>;
|
|
105
|
+
type: z.ZodNullable<z.ZodString>;
|
|
106
|
+
agent_avatar: z.ZodNullable<z.ZodString>;
|
|
107
|
+
agent_id: z.ZodNullable<z.ZodNumber>;
|
|
108
|
+
agent_name: z.ZodNullable<z.ZodString>;
|
|
109
|
+
created_at: z.ZodString;
|
|
110
|
+
from_user: z.ZodNullable<z.ZodBoolean>;
|
|
111
|
+
handoff_happened_during_office_hours: z.ZodNullable<z.ZodBoolean>;
|
|
112
|
+
session_id: z.ZodString;
|
|
113
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
114
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodType<ChatAttachmentType, z.ZodTypeDef, ChatAttachmentType>, "many">>;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
message: string | null;
|
|
117
|
+
type: string | null;
|
|
118
|
+
publicId: string;
|
|
119
|
+
agent_avatar: string | null;
|
|
120
|
+
agent_id: number | null;
|
|
121
|
+
agent_name: string | null;
|
|
122
|
+
created_at: string;
|
|
123
|
+
from_user: boolean | null;
|
|
124
|
+
handoff_happened_during_office_hours: boolean | null;
|
|
125
|
+
session_id: string;
|
|
126
|
+
updated_at: string | null;
|
|
127
|
+
attachments?: ChatAttachmentType[] | undefined;
|
|
128
|
+
}, {
|
|
129
|
+
message: string | null;
|
|
130
|
+
type: string | null;
|
|
131
|
+
publicId: string;
|
|
132
|
+
agent_avatar: string | null;
|
|
133
|
+
agent_id: number | null;
|
|
134
|
+
agent_name: string | null;
|
|
135
|
+
created_at: string;
|
|
136
|
+
from_user: boolean | null;
|
|
137
|
+
handoff_happened_during_office_hours: boolean | null;
|
|
138
|
+
session_id: string;
|
|
139
|
+
updated_at: string | null;
|
|
140
|
+
attachments?: ChatAttachmentType[] | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
declare const agentSchema: z.ZodObject<{
|
|
143
|
+
name: z.ZodString;
|
|
144
|
+
is_ai: z.ZodBoolean;
|
|
145
|
+
profile_picture: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
146
|
+
id: z.ZodNullable<z.ZodString>;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
id: string | null;
|
|
149
|
+
name: string;
|
|
150
|
+
is_ai: boolean;
|
|
151
|
+
profile_picture?: string | null | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
id: string | null;
|
|
154
|
+
name: string;
|
|
155
|
+
is_ai: boolean;
|
|
156
|
+
profile_picture?: string | null | undefined;
|
|
157
|
+
}>;
|
|
158
|
+
export declare const structuredSocketMessageSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
159
|
+
type: z.ZodLiteral<"message">;
|
|
160
|
+
value: z.ZodString;
|
|
161
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodType<ChatAttachmentType, z.ZodTypeDef, ChatAttachmentType>, "many">>;
|
|
162
|
+
is_stream_chunk: z.ZodOptional<z.ZodBoolean>;
|
|
163
|
+
server_session_id: z.ZodString;
|
|
164
|
+
client_message_id: z.ZodOptional<z.ZodString>;
|
|
165
|
+
server_message_id: z.ZodString;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
value: string;
|
|
168
|
+
type: "message";
|
|
169
|
+
server_session_id: string;
|
|
170
|
+
server_message_id: string;
|
|
171
|
+
attachments?: ChatAttachmentType[] | undefined;
|
|
172
|
+
is_stream_chunk?: boolean | undefined;
|
|
173
|
+
client_message_id?: string | undefined;
|
|
174
|
+
}, {
|
|
175
|
+
value: string;
|
|
176
|
+
type: "message";
|
|
177
|
+
server_session_id: string;
|
|
178
|
+
server_message_id: string;
|
|
179
|
+
attachments?: ChatAttachmentType[] | undefined;
|
|
180
|
+
is_stream_chunk?: boolean | undefined;
|
|
181
|
+
client_message_id?: string | undefined;
|
|
182
|
+
}>, z.ZodObject<{
|
|
183
|
+
type: z.ZodLiteral<"info">;
|
|
184
|
+
value: z.ZodString;
|
|
185
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
|
+
value: string;
|
|
187
|
+
type: "info";
|
|
188
|
+
}, {
|
|
189
|
+
value: string;
|
|
190
|
+
type: "info";
|
|
191
|
+
}>, z.ZodObject<{
|
|
192
|
+
type: z.ZodLiteral<"ui">;
|
|
193
|
+
value: z.ZodObject<{
|
|
194
|
+
type: z.ZodString;
|
|
195
|
+
request_response: z.ZodAny;
|
|
196
|
+
name: z.ZodString;
|
|
197
|
+
content: z.ZodString;
|
|
198
|
+
message_id: z.ZodOptional<z.ZodString>;
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
type: string;
|
|
201
|
+
name: string;
|
|
202
|
+
content: string;
|
|
203
|
+
request_response?: any;
|
|
204
|
+
message_id?: string | undefined;
|
|
205
|
+
}, {
|
|
206
|
+
type: string;
|
|
207
|
+
name: string;
|
|
208
|
+
content: string;
|
|
209
|
+
request_response?: any;
|
|
210
|
+
message_id?: string | undefined;
|
|
211
|
+
}>;
|
|
212
|
+
client_message_id: z.ZodOptional<z.ZodString>;
|
|
213
|
+
server_session_id: z.ZodString;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
value: {
|
|
216
|
+
type: string;
|
|
217
|
+
name: string;
|
|
218
|
+
content: string;
|
|
219
|
+
request_response?: any;
|
|
220
|
+
message_id?: string | undefined;
|
|
221
|
+
};
|
|
222
|
+
type: "ui";
|
|
223
|
+
server_session_id: string;
|
|
224
|
+
client_message_id?: string | undefined;
|
|
225
|
+
}, {
|
|
226
|
+
value: {
|
|
227
|
+
type: string;
|
|
228
|
+
name: string;
|
|
229
|
+
content: string;
|
|
230
|
+
request_response?: any;
|
|
231
|
+
message_id?: string | undefined;
|
|
232
|
+
};
|
|
233
|
+
type: "ui";
|
|
234
|
+
server_session_id: string;
|
|
235
|
+
client_message_id?: string | undefined;
|
|
236
|
+
}>, z.ZodObject<{
|
|
237
|
+
type: z.ZodLiteral<"chat_event">;
|
|
238
|
+
value: z.ZodObject<{
|
|
239
|
+
event: z.ZodNativeEnum<typeof MessageTypeEnum>;
|
|
240
|
+
message: z.ZodString;
|
|
241
|
+
}, "strip", z.ZodTypeAny, {
|
|
242
|
+
message: string;
|
|
243
|
+
event: MessageTypeEnum;
|
|
244
|
+
}, {
|
|
245
|
+
message: string;
|
|
246
|
+
event: MessageTypeEnum;
|
|
247
|
+
}>;
|
|
248
|
+
}, "strip", z.ZodTypeAny, {
|
|
249
|
+
value: {
|
|
250
|
+
message: string;
|
|
251
|
+
event: MessageTypeEnum;
|
|
252
|
+
};
|
|
253
|
+
type: "chat_event";
|
|
254
|
+
}, {
|
|
255
|
+
value: {
|
|
256
|
+
message: string;
|
|
257
|
+
event: MessageTypeEnum;
|
|
258
|
+
};
|
|
259
|
+
type: "chat_event";
|
|
260
|
+
}>, z.ZodObject<{
|
|
261
|
+
type: z.ZodLiteral<"options">;
|
|
262
|
+
value: z.ZodObject<{
|
|
263
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
264
|
+
}, "strip", z.ZodTypeAny, {
|
|
265
|
+
options: string[];
|
|
266
|
+
}, {
|
|
267
|
+
options: string[];
|
|
268
|
+
}>;
|
|
269
|
+
server_session_id: z.ZodString;
|
|
270
|
+
}, "strip", z.ZodTypeAny, {
|
|
271
|
+
value: {
|
|
272
|
+
options: string[];
|
|
273
|
+
};
|
|
274
|
+
type: "options";
|
|
275
|
+
server_session_id: string;
|
|
276
|
+
}, {
|
|
277
|
+
value: {
|
|
278
|
+
options: string[];
|
|
279
|
+
};
|
|
280
|
+
type: "options";
|
|
281
|
+
server_session_id: string;
|
|
282
|
+
}>, z.ZodObject<{
|
|
283
|
+
type: z.ZodLiteral<"session_update">;
|
|
284
|
+
value: z.ZodObject<{
|
|
285
|
+
session: z.ZodObject<{
|
|
286
|
+
id: z.ZodString;
|
|
287
|
+
ai_closure_type: z.ZodNullable<z.ZodNativeEnum<typeof AIClosureType>>;
|
|
288
|
+
assignee_id: z.ZodNullable<z.ZodNumber>;
|
|
289
|
+
channel: z.ZodNativeEnum<typeof SessionChannel>;
|
|
290
|
+
summary: z.ZodNullable<z.ZodString>;
|
|
291
|
+
status: z.ZodNativeEnum<typeof SessionStatus>;
|
|
292
|
+
language: z.ZodNullable<z.ZodString>;
|
|
293
|
+
last_message: z.ZodNullable<z.ZodString>;
|
|
294
|
+
last_message_at: z.ZodNullable<z.ZodDate>;
|
|
295
|
+
assignee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
296
|
+
name: z.ZodString;
|
|
297
|
+
email: z.ZodString;
|
|
298
|
+
avatar_url: z.ZodOptional<z.ZodString>;
|
|
299
|
+
}, "strip", z.ZodTypeAny, {
|
|
300
|
+
email: string;
|
|
301
|
+
name: string;
|
|
302
|
+
avatar_url?: string | undefined;
|
|
303
|
+
}, {
|
|
304
|
+
email: string;
|
|
305
|
+
name: string;
|
|
306
|
+
avatar_url?: string | undefined;
|
|
307
|
+
}>>>;
|
|
308
|
+
sentiment: z.ZodNullable<z.ZodNativeEnum<typeof SentimentEnum>>;
|
|
309
|
+
}, "strip", z.ZodTypeAny, {
|
|
310
|
+
id: string;
|
|
311
|
+
ai_closure_type: AIClosureType | null;
|
|
312
|
+
assignee_id: number | null;
|
|
313
|
+
channel: SessionChannel;
|
|
314
|
+
status: SessionStatus;
|
|
315
|
+
summary: string | null;
|
|
316
|
+
language: string | null;
|
|
317
|
+
last_message: string | null;
|
|
318
|
+
last_message_at: Date | null;
|
|
319
|
+
sentiment: SentimentEnum | null;
|
|
320
|
+
assignee?: {
|
|
321
|
+
email: string;
|
|
322
|
+
name: string;
|
|
323
|
+
avatar_url?: string | undefined;
|
|
324
|
+
} | null | undefined;
|
|
325
|
+
}, {
|
|
326
|
+
id: string;
|
|
327
|
+
ai_closure_type: AIClosureType | null;
|
|
328
|
+
assignee_id: number | null;
|
|
329
|
+
channel: SessionChannel;
|
|
330
|
+
status: SessionStatus;
|
|
331
|
+
summary: string | null;
|
|
332
|
+
language: string | null;
|
|
333
|
+
last_message: string | null;
|
|
334
|
+
last_message_at: Date | null;
|
|
335
|
+
sentiment: SentimentEnum | null;
|
|
336
|
+
assignee?: {
|
|
337
|
+
email: string;
|
|
338
|
+
name: string;
|
|
339
|
+
avatar_url?: string | undefined;
|
|
340
|
+
} | null | undefined;
|
|
341
|
+
}>;
|
|
342
|
+
}, "strip", z.ZodTypeAny, {
|
|
343
|
+
session: {
|
|
344
|
+
id: string;
|
|
345
|
+
ai_closure_type: AIClosureType | null;
|
|
346
|
+
assignee_id: number | null;
|
|
347
|
+
channel: SessionChannel;
|
|
348
|
+
status: SessionStatus;
|
|
349
|
+
summary: string | null;
|
|
350
|
+
language: string | null;
|
|
351
|
+
last_message: string | null;
|
|
352
|
+
last_message_at: Date | null;
|
|
353
|
+
sentiment: SentimentEnum | null;
|
|
354
|
+
assignee?: {
|
|
355
|
+
email: string;
|
|
356
|
+
name: string;
|
|
357
|
+
avatar_url?: string | undefined;
|
|
358
|
+
} | null | undefined;
|
|
359
|
+
};
|
|
360
|
+
}, {
|
|
361
|
+
session: {
|
|
362
|
+
id: string;
|
|
363
|
+
ai_closure_type: AIClosureType | null;
|
|
364
|
+
assignee_id: number | null;
|
|
365
|
+
channel: SessionChannel;
|
|
366
|
+
status: SessionStatus;
|
|
367
|
+
summary: string | null;
|
|
368
|
+
language: string | null;
|
|
369
|
+
last_message: string | null;
|
|
370
|
+
last_message_at: Date | null;
|
|
371
|
+
sentiment: SentimentEnum | null;
|
|
372
|
+
assignee?: {
|
|
373
|
+
email: string;
|
|
374
|
+
name: string;
|
|
375
|
+
avatar_url?: string | undefined;
|
|
376
|
+
} | null | undefined;
|
|
377
|
+
};
|
|
378
|
+
}>;
|
|
379
|
+
server_session_id: z.ZodString;
|
|
380
|
+
}, "strip", z.ZodTypeAny, {
|
|
381
|
+
value: {
|
|
382
|
+
session: {
|
|
383
|
+
id: string;
|
|
384
|
+
ai_closure_type: AIClosureType | null;
|
|
385
|
+
assignee_id: number | null;
|
|
386
|
+
channel: SessionChannel;
|
|
387
|
+
status: SessionStatus;
|
|
388
|
+
summary: string | null;
|
|
389
|
+
language: string | null;
|
|
390
|
+
last_message: string | null;
|
|
391
|
+
last_message_at: Date | null;
|
|
392
|
+
sentiment: SentimentEnum | null;
|
|
393
|
+
assignee?: {
|
|
394
|
+
email: string;
|
|
395
|
+
name: string;
|
|
396
|
+
avatar_url?: string | undefined;
|
|
397
|
+
} | null | undefined;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
type: "session_update";
|
|
401
|
+
server_session_id: string;
|
|
402
|
+
}, {
|
|
403
|
+
value: {
|
|
404
|
+
session: {
|
|
405
|
+
id: string;
|
|
406
|
+
ai_closure_type: AIClosureType | null;
|
|
407
|
+
assignee_id: number | null;
|
|
408
|
+
channel: SessionChannel;
|
|
409
|
+
status: SessionStatus;
|
|
410
|
+
summary: string | null;
|
|
411
|
+
language: string | null;
|
|
412
|
+
last_message: string | null;
|
|
413
|
+
last_message_at: Date | null;
|
|
414
|
+
sentiment: SentimentEnum | null;
|
|
415
|
+
assignee?: {
|
|
416
|
+
email: string;
|
|
417
|
+
name: string;
|
|
418
|
+
avatar_url?: string | undefined;
|
|
419
|
+
} | null | undefined;
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
type: "session_update";
|
|
423
|
+
server_session_id: string;
|
|
424
|
+
}>]>, z.ZodObject<{
|
|
425
|
+
timestamp: z.ZodString;
|
|
426
|
+
agent: z.ZodObject<{
|
|
427
|
+
name: z.ZodString;
|
|
428
|
+
is_ai: z.ZodBoolean;
|
|
429
|
+
profile_picture: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
430
|
+
id: z.ZodNullable<z.ZodString>;
|
|
431
|
+
}, "strip", z.ZodTypeAny, {
|
|
432
|
+
id: string | null;
|
|
433
|
+
name: string;
|
|
434
|
+
is_ai: boolean;
|
|
435
|
+
profile_picture?: string | null | undefined;
|
|
436
|
+
}, {
|
|
437
|
+
id: string | null;
|
|
438
|
+
name: string;
|
|
439
|
+
is_ai: boolean;
|
|
440
|
+
profile_picture?: string | null | undefined;
|
|
441
|
+
}>;
|
|
442
|
+
}, "strip", z.ZodTypeAny, {
|
|
443
|
+
timestamp: string;
|
|
444
|
+
agent: {
|
|
445
|
+
id: string | null;
|
|
446
|
+
name: string;
|
|
447
|
+
is_ai: boolean;
|
|
448
|
+
profile_picture?: string | null | undefined;
|
|
449
|
+
};
|
|
450
|
+
}, {
|
|
451
|
+
timestamp: string;
|
|
452
|
+
agent: {
|
|
453
|
+
id: string | null;
|
|
454
|
+
name: string;
|
|
455
|
+
is_ai: boolean;
|
|
456
|
+
profile_picture?: string | null | undefined;
|
|
457
|
+
};
|
|
458
|
+
}>>;
|
|
459
|
+
export declare const consumerSchema: z.ZodObject<{
|
|
460
|
+
id: z.ZodString;
|
|
461
|
+
name: z.ZodNullable<z.ZodString>;
|
|
462
|
+
created_at: z.ZodString;
|
|
463
|
+
avatar_url: z.ZodNullable<z.ZodString>;
|
|
464
|
+
email: z.ZodNullable<z.ZodString>;
|
|
465
|
+
}, "strip", z.ZodTypeAny, {
|
|
466
|
+
email: string | null;
|
|
467
|
+
id: string;
|
|
468
|
+
name: string | null;
|
|
469
|
+
avatar_url: string | null;
|
|
470
|
+
created_at: string;
|
|
471
|
+
}, {
|
|
472
|
+
email: string | null;
|
|
473
|
+
id: string;
|
|
474
|
+
name: string | null;
|
|
475
|
+
avatar_url: string | null;
|
|
476
|
+
created_at: string;
|
|
477
|
+
}>;
|
|
478
|
+
type AgentType = z.infer<typeof agentSchema>;
|
|
479
|
+
type ConsumerType = z.infer<typeof consumerSchema>;
|
|
480
|
+
type ChatSessionType = z.infer<typeof chatSessionSchema>;
|
|
481
|
+
type ChatSessionWithStatus = ChatSessionType & {
|
|
482
|
+
isSessionClosed: boolean;
|
|
483
|
+
isAssignedToAi: boolean;
|
|
484
|
+
isAssignedToHuman: boolean;
|
|
485
|
+
isPendingHuman: boolean;
|
|
486
|
+
};
|
|
487
|
+
type StructuredSocketMessageType = z.infer<typeof structuredSocketMessageSchema>;
|
|
488
|
+
type ChatHistoryMessageType = z.infer<typeof chatHistoryMessageSchema>;
|
|
489
|
+
export type { AgentType, ConsumerType, ChatSessionType, StructuredSocketMessageType, ChatHistoryMessageType, ChatSessionWithStatus, };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CoreOptions } from './index';
|
|
2
|
+
import { ApiCaller } from '../client/api';
|
|
3
|
+
import { SessionManager } from '../managers/session-manager';
|
|
4
|
+
import { ChatAttachmentType } from './schemas';
|
|
5
|
+
export type TransportOptions = {
|
|
6
|
+
api: ApiCaller;
|
|
7
|
+
sessionManager: SessionManager;
|
|
8
|
+
coreOptions: CoreOptions;
|
|
9
|
+
};
|
|
10
|
+
export interface MessageData {
|
|
11
|
+
id: string;
|
|
12
|
+
content: {
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
timestamp: string;
|
|
16
|
+
bot_token: string;
|
|
17
|
+
session_id: string;
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
attachments?: ChatAttachmentType[];
|
|
20
|
+
pathParams?: Record<string, string>;
|
|
21
|
+
queryParams?: Record<string, string>;
|
|
22
|
+
user?: {
|
|
23
|
+
external_id?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
email?: string;
|
|
26
|
+
phone?: string;
|
|
27
|
+
customData?: Record<string, string>;
|
|
28
|
+
avatarUrl?: string;
|
|
29
|
+
};
|
|
30
|
+
language?: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|