@ujet/websdk-headless 3.0.5 → 3.1.3
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 +45 -6
- package/dist/index.d.ts +564 -415
- package/dist/index.js +139 -41281
- package/dist/index.mjs +42064 -0
- package/package.json +4 -9
- package/dist/index.cjs +0 -563
package/dist/index.d.ts
CHANGED
|
@@ -1,423 +1,572 @@
|
|
|
1
|
-
|
|
1
|
+
interface RequestReturn {
|
|
2
|
+
headers: Record<string, string>;
|
|
3
|
+
data: any;
|
|
4
|
+
}
|
|
5
|
+
interface LogData {
|
|
6
|
+
loglevel: string;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
application: string;
|
|
9
|
+
version: string;
|
|
10
|
+
device: string;
|
|
11
|
+
tenant: string;
|
|
12
|
+
company_id: string;
|
|
13
|
+
location_url: string;
|
|
14
|
+
channel: string;
|
|
15
|
+
message: string;
|
|
16
|
+
data: any;
|
|
17
|
+
tracker_id?: string;
|
|
18
|
+
}
|
|
19
|
+
interface ClientEvent {
|
|
20
|
+
name: string;
|
|
21
|
+
payload: {
|
|
22
|
+
lang: string;
|
|
23
|
+
menu_id: number;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface MessageRequest {
|
|
28
|
+
type: string;
|
|
29
|
+
content?: string;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
interface ChatRequest {
|
|
33
|
+
lang?: string;
|
|
34
|
+
trigger_id?: string;
|
|
35
|
+
ticket_id?: string;
|
|
36
|
+
email?: string;
|
|
37
|
+
greeting?: string;
|
|
38
|
+
cobrowsable?: boolean;
|
|
39
|
+
custom_data?: string | Record<string, any>;
|
|
40
|
+
}
|
|
41
|
+
interface EscalateRequest {
|
|
42
|
+
force_escalate: boolean;
|
|
43
|
+
menu_id: number;
|
|
44
|
+
lang: string;
|
|
45
|
+
}
|
|
46
|
+
interface CobrowseRequest {
|
|
47
|
+
code: string;
|
|
48
|
+
from: string;
|
|
49
|
+
nonce: string;
|
|
50
|
+
}
|
|
51
|
+
interface RateRequest {
|
|
52
|
+
rating: number;
|
|
53
|
+
feedback: string;
|
|
54
|
+
}
|
|
55
|
+
interface SurveyAnswers {
|
|
56
|
+
[id: string]: number | string;
|
|
57
|
+
}
|
|
58
|
+
interface ChatEndUserEventRequest {
|
|
59
|
+
event: {
|
|
60
|
+
name: "content_card_clicked" | "content_card_button_clicked";
|
|
61
|
+
payload: Record<string, string>;
|
|
62
|
+
};
|
|
63
|
+
end_user_name?: string;
|
|
64
|
+
}
|
|
65
|
+
interface CallRequest {
|
|
66
|
+
phone_number: string;
|
|
67
|
+
lang?: string;
|
|
68
|
+
scheduled_at?: string;
|
|
69
|
+
ticket_id?: string;
|
|
70
|
+
email?: string;
|
|
71
|
+
recording_permission?: "recording_permission_not_asked" | "recording_permission_granted" | "recording_permission_denied";
|
|
72
|
+
}
|
|
73
|
+
interface EmailRequest {
|
|
74
|
+
name?: string;
|
|
75
|
+
email: string;
|
|
76
|
+
content: string;
|
|
77
|
+
lang?: string;
|
|
78
|
+
files?: File[];
|
|
79
|
+
recaptcha?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface LanguageOption {
|
|
83
|
+
lang: string;
|
|
84
|
+
name: string;
|
|
85
|
+
localeName?: string;
|
|
86
|
+
}
|
|
87
|
+
interface CompanyResponse {
|
|
88
|
+
name: string;
|
|
89
|
+
subdomain: string;
|
|
90
|
+
support_email: string;
|
|
91
|
+
languages: LanguageOption[];
|
|
92
|
+
action_tracking: boolean;
|
|
93
|
+
email_transcripts: boolean;
|
|
94
|
+
message_preview: boolean;
|
|
95
|
+
email_enhancement: boolean;
|
|
96
|
+
display_history: boolean;
|
|
97
|
+
use_recording: boolean;
|
|
98
|
+
use_web: boolean;
|
|
99
|
+
}
|
|
100
|
+
interface MenuChannel {
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
type: string;
|
|
103
|
+
menu_id: number;
|
|
104
|
+
collect_email: boolean;
|
|
105
|
+
deflected?: boolean;
|
|
106
|
+
deflection_type?: string;
|
|
107
|
+
[key: string]: unknown;
|
|
108
|
+
}
|
|
109
|
+
interface MenuItem {
|
|
110
|
+
id: number;
|
|
111
|
+
name?: string;
|
|
112
|
+
enabled: boolean;
|
|
113
|
+
redirection?: {
|
|
114
|
+
option: string;
|
|
115
|
+
data: string;
|
|
116
|
+
};
|
|
117
|
+
children?: MenuItem[];
|
|
118
|
+
channels: MenuChannel[];
|
|
119
|
+
deflection?: {
|
|
120
|
+
enabled: boolean;
|
|
121
|
+
type: string;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
interface MenuResponse {
|
|
125
|
+
menus: MenuItem[];
|
|
126
|
+
direct: {
|
|
127
|
+
key: boolean;
|
|
128
|
+
user: boolean;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
interface WaitTimeResponse {
|
|
132
|
+
chat: number;
|
|
133
|
+
voice_call: number;
|
|
134
|
+
}
|
|
135
|
+
interface HumanAgent {
|
|
136
|
+
id: number;
|
|
137
|
+
name: string;
|
|
138
|
+
avatar_url: string;
|
|
139
|
+
first_name: string;
|
|
140
|
+
last_name: string;
|
|
141
|
+
status?: string;
|
|
142
|
+
}
|
|
143
|
+
interface VirtualAgent {
|
|
144
|
+
id: number;
|
|
145
|
+
name: string;
|
|
146
|
+
avatar_url: string;
|
|
147
|
+
status?: string;
|
|
148
|
+
}
|
|
149
|
+
interface ChatResponse {
|
|
150
|
+
id: number;
|
|
151
|
+
lang: string;
|
|
152
|
+
status: string;
|
|
153
|
+
status_text: string;
|
|
154
|
+
created_at: string;
|
|
155
|
+
features: string[];
|
|
156
|
+
menus: {
|
|
157
|
+
id: number;
|
|
158
|
+
name: string;
|
|
159
|
+
}[];
|
|
160
|
+
provider_type: string;
|
|
161
|
+
csat_settings: {
|
|
162
|
+
enabled: boolean;
|
|
163
|
+
feedback_enabled: boolean;
|
|
164
|
+
};
|
|
165
|
+
survey_enabled: boolean;
|
|
166
|
+
region?: string;
|
|
167
|
+
provider_channel_id?: string;
|
|
168
|
+
transcript_requested_count?: number;
|
|
169
|
+
agent?: HumanAgent;
|
|
170
|
+
virtual_agent?: VirtualAgent;
|
|
171
|
+
external_agent?: VirtualAgent;
|
|
172
|
+
all_agents: HumanAgent[];
|
|
173
|
+
all_virtual_agents: VirtualAgent[];
|
|
174
|
+
}
|
|
175
|
+
interface ChatDeflectionResponse {
|
|
176
|
+
enabled: boolean;
|
|
177
|
+
threshold: number;
|
|
178
|
+
email: boolean;
|
|
179
|
+
keep_waiting: boolean;
|
|
180
|
+
external_deflection_links: {
|
|
181
|
+
enabled: boolean;
|
|
182
|
+
ids: number[];
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
interface MessageResponse {
|
|
186
|
+
$index: number;
|
|
187
|
+
$sid: string;
|
|
188
|
+
$timestamp: Date;
|
|
189
|
+
$userType: string;
|
|
190
|
+
$userId: number;
|
|
191
|
+
type: string;
|
|
192
|
+
content?: string;
|
|
193
|
+
event?: string;
|
|
194
|
+
file?: File;
|
|
195
|
+
[key: string]: unknown;
|
|
196
|
+
}
|
|
197
|
+
interface CallResponse {
|
|
198
|
+
id: number;
|
|
199
|
+
lang: string;
|
|
200
|
+
menu_id: number;
|
|
201
|
+
status: string;
|
|
202
|
+
type: string;
|
|
203
|
+
scheduled_at?: string;
|
|
204
|
+
recording_permitted: boolean;
|
|
205
|
+
survey_enabled: boolean;
|
|
206
|
+
created_at: string;
|
|
207
|
+
menus: {
|
|
208
|
+
id: number;
|
|
209
|
+
name: string;
|
|
210
|
+
}[];
|
|
211
|
+
}
|
|
212
|
+
interface FileTypeItem {
|
|
213
|
+
description: string;
|
|
214
|
+
extension: string;
|
|
215
|
+
}
|
|
216
|
+
interface QuestionItem {
|
|
217
|
+
id: number;
|
|
218
|
+
type: "csat" | "star" | "free-form" | "scale" | "enumeration";
|
|
219
|
+
display_text: string;
|
|
220
|
+
name?: string;
|
|
221
|
+
is_csat?: boolean;
|
|
222
|
+
position?: number;
|
|
223
|
+
valid_answers?: {
|
|
224
|
+
key: string;
|
|
225
|
+
value: string;
|
|
226
|
+
}[];
|
|
227
|
+
}
|
|
228
|
+
interface ChatSurveyResponse {
|
|
229
|
+
id?: number;
|
|
230
|
+
lang?: string;
|
|
231
|
+
sign_off_display_text: string;
|
|
232
|
+
questions: QuestionItem[];
|
|
233
|
+
}
|
|
234
|
+
interface ChatTaskMessageResponse {
|
|
235
|
+
id: number;
|
|
236
|
+
task_va_id: number;
|
|
237
|
+
participant_id: number;
|
|
238
|
+
content: any;
|
|
239
|
+
}
|
|
240
|
+
interface ChatHistoryItem {
|
|
241
|
+
comm_id: number;
|
|
242
|
+
assigned_at: string;
|
|
243
|
+
comm_type: string;
|
|
244
|
+
timezone: string;
|
|
245
|
+
entries: MessageResponse[];
|
|
246
|
+
[key: string]: unknown;
|
|
247
|
+
}
|
|
248
|
+
interface ChatHistoryResponse {
|
|
249
|
+
chats: ChatHistoryItem[];
|
|
250
|
+
missing_chat_ids: number[];
|
|
251
|
+
pagination: {
|
|
252
|
+
next_page: number;
|
|
253
|
+
per_page: number;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
interface UserProfile {
|
|
257
|
+
identity?: string;
|
|
258
|
+
name?: string;
|
|
259
|
+
email?: string;
|
|
260
|
+
}
|
|
261
|
+
interface TriggerMessage {
|
|
262
|
+
lang: string;
|
|
263
|
+
text: string;
|
|
264
|
+
}
|
|
265
|
+
interface TriggerItem {
|
|
266
|
+
id: number;
|
|
267
|
+
stay_time: number;
|
|
268
|
+
messages: TriggerMessage[];
|
|
269
|
+
visitor_type: string;
|
|
270
|
+
page_visit_count: number;
|
|
271
|
+
keywords_included?: string[];
|
|
272
|
+
keywords_excluded?: string[];
|
|
273
|
+
}
|
|
2
274
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
loglevel: string;
|
|
9
|
-
timestamp: string;
|
|
10
|
-
application: string;
|
|
11
|
-
version: string;
|
|
12
|
-
device: string;
|
|
13
|
-
tenant: string;
|
|
14
|
-
company_id: string;
|
|
15
|
-
location_url: string;
|
|
16
|
-
channel: string;
|
|
17
|
-
message: string;
|
|
18
|
-
data: any;
|
|
19
|
-
tracker_id?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface MessageRequest {
|
|
22
|
-
type: string;
|
|
23
|
-
content?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface ChatRequest {
|
|
26
|
-
lang?: string;
|
|
27
|
-
trigger_id?: string;
|
|
28
|
-
ticket_id?: string;
|
|
29
|
-
email?: string;
|
|
30
|
-
greeting?: string;
|
|
31
|
-
cobrowsable?: boolean;
|
|
32
|
-
}
|
|
33
|
-
export interface EscalateRequest {
|
|
34
|
-
force_escalate: boolean;
|
|
35
|
-
menu_id: number;
|
|
36
|
-
lang: string;
|
|
37
|
-
}
|
|
38
|
-
export interface RateRequest {
|
|
39
|
-
rating: number;
|
|
40
|
-
feedback: string;
|
|
41
|
-
}
|
|
42
|
-
export interface SurveyAnswers {
|
|
43
|
-
[id: string]: number | string;
|
|
44
|
-
}
|
|
45
|
-
export interface CallRequest {
|
|
46
|
-
phone_number: string;
|
|
47
|
-
lang?: string;
|
|
48
|
-
scheduled_at?: string;
|
|
49
|
-
ticket_id?: string;
|
|
50
|
-
email?: string;
|
|
51
|
-
recording_permission?: boolean;
|
|
52
|
-
}
|
|
53
|
-
export interface EmailRequest {
|
|
54
|
-
name?: string;
|
|
55
|
-
email: string;
|
|
56
|
-
content: string;
|
|
57
|
-
lang?: string;
|
|
58
|
-
files?: File[];
|
|
59
|
-
recaptcha?: string;
|
|
60
|
-
}
|
|
61
|
-
export type RequestMethod = (url: string, options: RequestInit | Record<string, any>) => Promise<RequestReturn>;
|
|
62
|
-
export type EventHandler = (data: any) => void;
|
|
63
|
-
export type IssueChatTokenMethod = () => Promise<{
|
|
64
|
-
identity: string;
|
|
65
|
-
token: string;
|
|
275
|
+
type RequestMethod = (url: string, options: RequestInit | Record<string, any>) => Promise<RequestReturn>;
|
|
276
|
+
type EventHandler = (data: any) => void;
|
|
277
|
+
type IssueChatTokenMethod = () => Promise<{
|
|
278
|
+
identity: string;
|
|
279
|
+
token: string;
|
|
66
280
|
}>;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
$userId: number;
|
|
210
|
-
type: string;
|
|
211
|
-
content?: string;
|
|
212
|
-
event?: string;
|
|
213
|
-
file?: File;
|
|
214
|
-
[key: string]: unknown;
|
|
215
|
-
}
|
|
216
|
-
export interface CallResponse {
|
|
217
|
-
id: number;
|
|
218
|
-
lang: string;
|
|
219
|
-
menu_id: number;
|
|
220
|
-
status: string;
|
|
221
|
-
type: string;
|
|
222
|
-
scheduled_at?: string;
|
|
223
|
-
recording_permitted: boolean;
|
|
224
|
-
survey_enabled: boolean;
|
|
225
|
-
created_at: string;
|
|
226
|
-
}
|
|
227
|
-
export interface QuestionItem {
|
|
228
|
-
id: number;
|
|
229
|
-
type: string;
|
|
230
|
-
display_text: string;
|
|
231
|
-
valid_answers?: {
|
|
232
|
-
key: string;
|
|
233
|
-
value: string;
|
|
234
|
-
}[];
|
|
235
|
-
}
|
|
236
|
-
export interface ChatSurveyResponse {
|
|
237
|
-
sign_off_display_text: string;
|
|
238
|
-
questions: QuestionItem[];
|
|
239
|
-
}
|
|
240
|
-
export interface UserProfile {
|
|
241
|
-
identity?: string;
|
|
242
|
-
name?: string;
|
|
243
|
-
email?: string;
|
|
244
|
-
}
|
|
245
|
-
export interface TriggerMessage {
|
|
246
|
-
lang: string;
|
|
247
|
-
text: string;
|
|
248
|
-
}
|
|
249
|
-
export interface TriggerItem {
|
|
250
|
-
id: number;
|
|
251
|
-
stay_time: number;
|
|
252
|
-
messages: TriggerMessage[];
|
|
253
|
-
visitor_type: string;
|
|
254
|
-
page_visit_count: number;
|
|
255
|
-
keywords_included?: string[];
|
|
256
|
-
keywords_excluded?: string[];
|
|
257
|
-
}
|
|
258
|
-
export declare class EventManager {
|
|
259
|
-
private handlers;
|
|
260
|
-
addEventListener(eventName: string, handler: EventHandler): void;
|
|
261
|
-
triggerEvent(eventName: string, data?: any): void;
|
|
262
|
-
removeEventListener(eventName: string, handler: EventHandler): void;
|
|
263
|
-
destroy(): void;
|
|
264
|
-
}
|
|
265
|
-
export declare class Chat {
|
|
266
|
-
private provider;
|
|
267
|
-
private state;
|
|
268
|
-
private store;
|
|
269
|
-
private globalEvents;
|
|
270
|
-
connected: boolean;
|
|
271
|
-
allowSkipVirtualAgent: boolean;
|
|
272
|
-
constructor(state: ChatResponse, issueChatToken: IssueChatTokenMethod);
|
|
273
|
-
_setGlobalEvents(events: EventManager): void;
|
|
274
|
-
get id(): number;
|
|
275
|
-
get menuId(): number;
|
|
276
|
-
get channelId(): string;
|
|
277
|
-
get lang(): string;
|
|
278
|
-
get userIdentity(): string;
|
|
279
|
-
get status(): string;
|
|
280
|
-
get statusText(): string;
|
|
281
|
-
get cobrowsable(): boolean;
|
|
282
|
-
get ongoing(): boolean;
|
|
283
|
-
get dismissed(): boolean;
|
|
284
|
-
get ended(): boolean;
|
|
285
|
-
get transcriptCount(): number;
|
|
286
|
-
get createdAt(): string;
|
|
287
|
-
get feedbackType(): string;
|
|
288
|
-
update(state: ChatResponse): void;
|
|
289
|
-
on(eventName: string, handler: EventHandler): void;
|
|
290
|
-
off(eventName: string, handler: EventHandler): void;
|
|
291
|
-
connect(): Promise<boolean>;
|
|
292
|
-
disconnect(): Promise<void>;
|
|
293
|
-
sendMessage(message: MessageRequest, file?: File): Promise<number>;
|
|
294
|
-
preview(text: string): Promise<void>;
|
|
295
|
-
fetchMessages(): Promise<MessageResponse[]>;
|
|
296
|
-
startTyping(): void;
|
|
297
|
-
stopTyping(): void;
|
|
298
|
-
destroy(): Promise<void>;
|
|
299
|
-
clearMediaStore(): Promise<void>;
|
|
300
|
-
private triggerEvent;
|
|
301
|
-
private registerMessageEvents;
|
|
281
|
+
type LoggerHandler = (channel: string, level: string, ...args: any[]) => void;
|
|
282
|
+
type GetServerMessage = (chatId: number, messageId: number) => Promise<ChatTaskMessageResponse>;
|
|
283
|
+
|
|
284
|
+
interface TokenResponse {
|
|
285
|
+
token: string;
|
|
286
|
+
}
|
|
287
|
+
interface ClientOption {
|
|
288
|
+
companyId: string;
|
|
289
|
+
authenticate: () => Promise<TokenResponse>;
|
|
290
|
+
tenant?: string;
|
|
291
|
+
host?: string;
|
|
292
|
+
lang?: string;
|
|
293
|
+
bridge?: string;
|
|
294
|
+
cobrowse?: {
|
|
295
|
+
enabled: boolean;
|
|
296
|
+
template?: string;
|
|
297
|
+
confirmSessionTemplate?: string;
|
|
298
|
+
confirmRemoteControlTemplate?: string;
|
|
299
|
+
confirmFullDeviceTemplate?: string;
|
|
300
|
+
sessionControlsTemplate?: string;
|
|
301
|
+
root?: Element;
|
|
302
|
+
messages?: CobrowseMessages;
|
|
303
|
+
api?: string;
|
|
304
|
+
license?: string;
|
|
305
|
+
trustedOrigins?: string[];
|
|
306
|
+
capabilities?: string[];
|
|
307
|
+
registration?: boolean;
|
|
308
|
+
redactedViews?: string[];
|
|
309
|
+
unredactedViews?: string[];
|
|
310
|
+
};
|
|
311
|
+
[key: string]: unknown;
|
|
312
|
+
}
|
|
313
|
+
interface ConnectOption {
|
|
314
|
+
companyId: string;
|
|
315
|
+
location: string;
|
|
316
|
+
host: string;
|
|
317
|
+
lang: string;
|
|
318
|
+
cobrowse: boolean;
|
|
319
|
+
bridge: string;
|
|
320
|
+
}
|
|
321
|
+
interface ConnectRequest {
|
|
322
|
+
type: string;
|
|
323
|
+
callbackId?: string;
|
|
324
|
+
data?: any;
|
|
325
|
+
}
|
|
326
|
+
interface ConnectResult {
|
|
327
|
+
type?: string;
|
|
328
|
+
result?: any;
|
|
329
|
+
}
|
|
330
|
+
interface ConnectCallback {
|
|
331
|
+
type: string;
|
|
332
|
+
request: string;
|
|
333
|
+
callbackId?: string;
|
|
334
|
+
result?: any;
|
|
335
|
+
error?: any;
|
|
336
|
+
}
|
|
337
|
+
interface CobrowseMessages {
|
|
338
|
+
confirmSessionTitle: string;
|
|
339
|
+
confirmSessionContent: string;
|
|
340
|
+
confirmRemoteControlTitle: string;
|
|
341
|
+
confirmRemoteControlContent: string;
|
|
342
|
+
confirmFullDeviceTitle: string;
|
|
343
|
+
confirmFullDeviceContent: string;
|
|
344
|
+
allowText: string;
|
|
345
|
+
denyText: string;
|
|
346
|
+
endSessionText: string;
|
|
347
|
+
}
|
|
348
|
+
interface CobrowseOption {
|
|
349
|
+
enabled?: boolean;
|
|
350
|
+
lang: string;
|
|
351
|
+
messages: CobrowseMessages;
|
|
352
|
+
root?: Element;
|
|
353
|
+
api?: string;
|
|
354
|
+
license?: string;
|
|
355
|
+
trustedOrigins?: string[];
|
|
356
|
+
template?: string;
|
|
357
|
+
confirmSessionTemplate?: string;
|
|
358
|
+
confirmRemoteControlTemplate?: string;
|
|
359
|
+
confirmFullDeviceTemplate?: string;
|
|
360
|
+
sessionControlsTemplate?: string;
|
|
361
|
+
capabilities?: string[];
|
|
362
|
+
registration?: boolean;
|
|
363
|
+
redactedViews?: string[];
|
|
364
|
+
unredactedViews?: string[];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
declare class EventManager {
|
|
368
|
+
private handlers;
|
|
369
|
+
addEventListener(eventName: string, handler: EventHandler): void;
|
|
370
|
+
triggerEvent(eventName: string, data?: any): void;
|
|
371
|
+
removeEventListener(eventName: string, handler: EventHandler): void;
|
|
372
|
+
destroy(): void;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare class Chat {
|
|
376
|
+
private provider;
|
|
377
|
+
private store;
|
|
378
|
+
private globalEvents;
|
|
379
|
+
state: ChatResponse;
|
|
380
|
+
connected: boolean;
|
|
381
|
+
allowSkipVirtualAgent: boolean;
|
|
382
|
+
inEscalation: boolean;
|
|
383
|
+
private events;
|
|
384
|
+
private cachedFiles;
|
|
385
|
+
constructor(state: ChatResponse, issueChatToken: IssueChatTokenMethod);
|
|
386
|
+
_setGlobalEvents(events: EventManager, fetchServerMessage: GetServerMessage): void;
|
|
387
|
+
get id(): number;
|
|
388
|
+
get menuId(): number;
|
|
389
|
+
get channelId(): string;
|
|
390
|
+
get lang(): string;
|
|
391
|
+
get virtual(): boolean;
|
|
392
|
+
get agent(): VirtualAgent | HumanAgent;
|
|
393
|
+
get allAgents(): {
|
|
394
|
+
virtual: VirtualAgent[];
|
|
395
|
+
human: HumanAgent[];
|
|
396
|
+
};
|
|
397
|
+
get userIdentity(): string;
|
|
398
|
+
get status(): string;
|
|
399
|
+
get statusText(): string;
|
|
400
|
+
get cobrowsable(): boolean;
|
|
401
|
+
get ongoing(): boolean;
|
|
402
|
+
get assigned(): boolean;
|
|
403
|
+
get dismissed(): boolean;
|
|
404
|
+
get ended(): boolean;
|
|
405
|
+
get transcriptCount(): number;
|
|
406
|
+
get createdAt(): string;
|
|
407
|
+
get inTask(): boolean;
|
|
408
|
+
get feedbackType(): "survey" | "rate" | "none";
|
|
409
|
+
update(state: ChatResponse): void;
|
|
410
|
+
on(eventName: string, handler: EventHandler): void;
|
|
411
|
+
off(eventName: string, handler: EventHandler): void;
|
|
412
|
+
connect(): Promise<boolean>;
|
|
413
|
+
disconnect(): Promise<void>;
|
|
414
|
+
sendMessage(message: MessageRequest, file?: File): Promise<number>;
|
|
415
|
+
preview(text: string): Promise<void>;
|
|
416
|
+
fetchMessages(): Promise<MessageResponse[]>;
|
|
417
|
+
startTyping(): void;
|
|
418
|
+
stopTyping(): void;
|
|
419
|
+
destroy(): Promise<void>;
|
|
420
|
+
clearMediaStore(): Promise<void>;
|
|
421
|
+
private triggerEvent;
|
|
422
|
+
private registerMessageEvents;
|
|
302
423
|
}
|
|
424
|
+
|
|
303
425
|
declare class Cobrowse {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
426
|
+
private _cobrowse;
|
|
427
|
+
private _options;
|
|
428
|
+
private _started;
|
|
429
|
+
constructor(instance: any, options: CobrowseOption);
|
|
430
|
+
private get root();
|
|
431
|
+
private get lang();
|
|
432
|
+
private get messages();
|
|
433
|
+
private get template();
|
|
434
|
+
static create(options: CobrowseOption): Promise<Cobrowse>;
|
|
435
|
+
setCustomData(data: any): void;
|
|
436
|
+
on(eventName: string, eventHandler: EventHandler): void;
|
|
437
|
+
start(): Promise<void>;
|
|
438
|
+
stop(): Promise<void>;
|
|
439
|
+
endSession(): Promise<void>;
|
|
440
|
+
createSessionCode(): Promise<string>;
|
|
441
|
+
private createConfirmConsent;
|
|
442
|
+
private setupConfirms;
|
|
443
|
+
private setupSessionControl;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
declare class Client {
|
|
447
|
+
VERSION: string;
|
|
448
|
+
options: ClientOption;
|
|
449
|
+
private communicator;
|
|
450
|
+
private methods;
|
|
451
|
+
private events;
|
|
452
|
+
request: RequestMethod;
|
|
453
|
+
chat: Chat;
|
|
454
|
+
cobrowse: Cobrowse;
|
|
455
|
+
constructor(options: ClientOption);
|
|
456
|
+
get deviceId(): string;
|
|
457
|
+
get user(): UserProfile;
|
|
458
|
+
get lang(): string;
|
|
459
|
+
set lang(lang: string);
|
|
460
|
+
destroy(): void;
|
|
461
|
+
on(eventName: string, handler: EventHandler): void;
|
|
462
|
+
off(eventName: string, handler: EventHandler): void;
|
|
463
|
+
_triggerEvent(eventName: string, data?: any): void;
|
|
464
|
+
getCompany(): Promise<CompanyResponse>;
|
|
465
|
+
getTrigger(lang?: string): Promise<TriggerItem>;
|
|
466
|
+
trackClientEvents(events: ClientEvent[]): Promise<RequestReturn>;
|
|
467
|
+
getProhibitedFileTypes(): Promise<FileTypeItem[]>;
|
|
468
|
+
getMenus(key?: string, lang?: string): Promise<MenuResponse>;
|
|
469
|
+
getAfterHourMessage(lang?: string): Promise<string>;
|
|
470
|
+
getTimeSlots(menuId: number | string, lang?: string): Promise<string[]>;
|
|
471
|
+
getWaitTimes(menuId: number | string, lang?: string): Promise<WaitTimeResponse>;
|
|
472
|
+
createCall(menuId: number | string, data: CallRequest): Promise<CallResponse>;
|
|
473
|
+
loadCall(callId: number | string): Promise<CallResponse>;
|
|
474
|
+
cancelCall(callId: number | string): Promise<CallResponse>;
|
|
475
|
+
createEmail(menuId: number | string, data: EmailRequest): Promise<RequestReturn>;
|
|
476
|
+
createChat(menuId: number | string, data?: ChatRequest): Promise<Chat>;
|
|
477
|
+
loadChat(chatId: number | string): Promise<Chat>;
|
|
478
|
+
resumeChat(chatId: number | string): Promise<Chat>;
|
|
479
|
+
loadOngoingChat(): Promise<Chat>;
|
|
480
|
+
finishChat(): Promise<void>;
|
|
481
|
+
destroyChat(): Promise<void>;
|
|
482
|
+
getChatDeflection(): Promise<ChatDeflectionResponse | null>;
|
|
483
|
+
sendChatTranscripts(emails: string[]): Promise<RequestReturn>;
|
|
484
|
+
getChatSurvey(): Promise<ChatSurveyResponse>;
|
|
485
|
+
sendChatSurvey(answers: SurveyAnswers): Promise<RequestReturn>;
|
|
486
|
+
sendChatRate(data: RateRequest): Promise<RequestReturn>;
|
|
487
|
+
escalateChat(data?: EscalateRequest): Promise<RequestReturn>;
|
|
488
|
+
trackChatEscalation(escalationId: number, channel: string): Promise<RequestReturn>;
|
|
489
|
+
trackChatEndUserEvent(data: ChatEndUserEventRequest): Promise<RequestReturn>;
|
|
490
|
+
getChatHistory(page?: number): Promise<ChatHistoryResponse>;
|
|
491
|
+
fetchMessages(): Promise<MessageResponse[]>;
|
|
492
|
+
sendFileMessage(file: File): Promise<number>;
|
|
493
|
+
sendTextMessage(content: string): Promise<number>;
|
|
494
|
+
createCobrowseCode(lang?: string, customData?: Record<string, string>): Promise<string>;
|
|
495
|
+
startCobrowse(from?: string): Promise<void>;
|
|
496
|
+
private initializeCobrowse;
|
|
497
|
+
private registerOngoingChat;
|
|
361
498
|
}
|
|
499
|
+
|
|
362
500
|
declare abstract class BaseProvider {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
501
|
+
static type: string;
|
|
502
|
+
private audio;
|
|
503
|
+
issueChatToken: IssueChatTokenMethod;
|
|
504
|
+
identity: string;
|
|
505
|
+
channelId: string;
|
|
506
|
+
region?: string;
|
|
507
|
+
inTask: boolean;
|
|
508
|
+
events: EventManager;
|
|
509
|
+
constructor(events: EventManager, state: ChatResponse, issueChatToken: IssueChatTokenMethod);
|
|
510
|
+
ping(): void;
|
|
511
|
+
on(eventName: string, handler: EventHandler): void;
|
|
512
|
+
off(eventName: string, handler: EventHandler): void;
|
|
513
|
+
trackInTask(message: MessageResponse): void;
|
|
514
|
+
abstract create(): Promise<void>;
|
|
515
|
+
abstract destroy(): Promise<void>;
|
|
516
|
+
abstract join(sid: string): Promise<void>;
|
|
517
|
+
abstract preview(text: string): Promise<void>;
|
|
518
|
+
abstract fetchMessages(files: {
|
|
519
|
+
[index: number]: File;
|
|
520
|
+
}): Promise<MessageResponse[]>;
|
|
521
|
+
abstract sendMessage(message: MessageRequest): Promise<number>;
|
|
522
|
+
abstract startTyping(): void;
|
|
523
|
+
abstract stopTyping(): void;
|
|
524
|
+
}
|
|
525
|
+
declare function addProviderType(Provider: typeof BaseProvider): void;
|
|
526
|
+
|
|
527
|
+
declare global {
|
|
528
|
+
interface Window {
|
|
529
|
+
webkitIndexedDB: IDBFactory;
|
|
530
|
+
mozIndexedDB: IDBFactory;
|
|
531
|
+
OIndexedDB: IDBFactory;
|
|
532
|
+
msIndexedDB: IDBFactory;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
declare class MediaStore {
|
|
536
|
+
private db;
|
|
537
|
+
private store;
|
|
538
|
+
save(index: number, file: File): Promise<void>;
|
|
539
|
+
getAll(): Promise<{
|
|
540
|
+
index: number;
|
|
541
|
+
file: File;
|
|
542
|
+
}[]>;
|
|
543
|
+
getAllFiles(): Promise<{
|
|
544
|
+
[index: number]: File;
|
|
545
|
+
}>;
|
|
546
|
+
clear(): Promise<void>;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
declare class Logger {
|
|
550
|
+
channel: string;
|
|
551
|
+
constructor(channel: string);
|
|
552
|
+
static addHandler(handler: LoggerHandler): void;
|
|
553
|
+
debug(...args: any[]): void;
|
|
554
|
+
info(...args: any[]): void;
|
|
555
|
+
warn(...args: any[]): void;
|
|
556
|
+
error(...args: any[]): void;
|
|
557
|
+
private _log;
|
|
558
|
+
}
|
|
559
|
+
declare const consoleLoggerHandler: LoggerHandler;
|
|
560
|
+
|
|
561
|
+
declare const ENVIRONMENT: string;
|
|
562
|
+
declare const VERSION: string;
|
|
563
|
+
declare const OPTIONS: {
|
|
564
|
+
companyId: string;
|
|
565
|
+
tenant: string;
|
|
566
|
+
trackerId: string;
|
|
567
|
+
deviceId: string;
|
|
568
|
+
application: string;
|
|
569
|
+
version: string;
|
|
421
570
|
};
|
|
422
571
|
|
|
423
|
-
export {};
|
|
572
|
+
export { BaseProvider, type CallRequest, type CallResponse, Chat, type ChatDeflectionResponse, type ChatEndUserEventRequest, type ChatHistoryItem, type ChatHistoryResponse, type ChatRequest, type ChatResponse, type ChatSurveyResponse, type ChatTaskMessageResponse, Client, type ClientEvent, type ClientOption, type CobrowseMessages, type CobrowseOption, type CobrowseRequest, type CompanyResponse, type ConnectCallback, type ConnectOption, type ConnectRequest, type ConnectResult, ENVIRONMENT, type EmailRequest, type EscalateRequest, type EventHandler, EventManager, type FileTypeItem, type GetServerMessage, type HumanAgent, type IssueChatTokenMethod, type LanguageOption, type LogData, Logger, type LoggerHandler, MediaStore, type MenuChannel, type MenuItem, type MenuResponse, type MessageRequest, type MessageResponse, OPTIONS, type QuestionItem, type RateRequest, type RequestMethod, type RequestReturn, type SurveyAnswers, type TokenResponse, type TriggerItem, type TriggerMessage, type UserProfile, VERSION, type VirtualAgent, type WaitTimeResponse, addProviderType, consoleLoggerHandler };
|