call-control-sdk 6.0.7 → 6.0.9
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/dist/index.d.mts +179 -1062
- package/dist/index.d.ts +179 -1062
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,1203 +1,320 @@
|
|
|
1
|
-
import { SxProps } from '@mui/material';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const logout: LogoutFunction = async () => {
|
|
16
|
-
* // Logout logic
|
|
17
|
-
* return await apiCall();
|
|
18
|
-
* };
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @since 1.0.0
|
|
22
|
-
* @author CTI SDK Team
|
|
23
|
-
*/
|
|
24
|
-
type LogoutFunction = () => Promise<any>;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 📊 Hook State Management Types
|
|
28
|
-
*
|
|
29
|
-
* @type HookStateTypes
|
|
30
|
-
* @description 🎛️ Type definitions for all hook state variables
|
|
31
|
-
* Provides type safety for loading, success, error, and data states
|
|
32
|
-
*
|
|
33
|
-
* @since 1.0.0
|
|
34
|
-
* @author CTI SDK Team
|
|
35
|
-
*/
|
|
36
|
-
type HookStateTypes$2 = {
|
|
37
|
-
/**
|
|
38
|
-
* ⏳ Loading state indicator
|
|
39
|
-
* @description Boolean flag indicating if a logout operation is in progress
|
|
40
|
-
* @type {boolean}
|
|
41
|
-
*/
|
|
42
|
-
isLoading: boolean;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* ✅ Success state indicator
|
|
46
|
-
* @description Boolean flag indicating if the last logout was successful
|
|
47
|
-
* @type {boolean}
|
|
48
|
-
*/
|
|
49
|
-
isSuccess: boolean;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* ❌ Error state indicator
|
|
53
|
-
* @description Boolean flag indicating if the last logout encountered an error
|
|
54
|
-
* @type {boolean}
|
|
55
|
-
*/
|
|
56
|
-
isError: boolean;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 🛡️ Error object
|
|
60
|
-
* @description Contains the error object when a logout fails
|
|
61
|
-
* @type {any}
|
|
62
|
-
*/
|
|
63
|
-
error: any;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* 📊 Response data
|
|
67
|
-
* @description Contains the response data from successful logout
|
|
68
|
-
* @type {any}
|
|
69
|
-
*/
|
|
70
|
-
data: any;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* 🚪 useLogout Hook Return Type
|
|
75
|
-
*
|
|
76
|
-
* @interface UseLogoutReturn
|
|
77
|
-
* @description 🎯 Complete return type for the useLogout hook
|
|
78
|
-
* Contains all functions and state for logout functionality
|
|
79
|
-
*
|
|
80
|
-
* @properties
|
|
81
|
-
* - `logout: LogoutFunction` - 🚪 Logout function
|
|
82
|
-
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
83
|
-
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
84
|
-
* - `isError: boolean` - ❌ Error state indicator
|
|
85
|
-
* - `error: any` - 🛡️ Error object when logout fails
|
|
86
|
-
* - `data: any` - 📊 Response data from successful logout
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* ```typescript
|
|
90
|
-
* const LogoutButton = () => {
|
|
91
|
-
* const hookReturn: UseLogoutReturn = useLogout();
|
|
92
|
-
* const {
|
|
93
|
-
* logout,
|
|
94
|
-
* isLoading,
|
|
95
|
-
* isSuccess,
|
|
96
|
-
* isError,
|
|
97
|
-
* error
|
|
98
|
-
* } = hookReturn;
|
|
99
|
-
*
|
|
100
|
-
* // Use the hook functionality
|
|
101
|
-
* };
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @since 1.0.0
|
|
105
|
-
* @author CTI SDK Team
|
|
106
|
-
*/
|
|
107
|
-
interface UseLogoutReturn extends HookStateTypes$2 {
|
|
108
|
-
/**
|
|
109
|
-
* 🚪 Logout function
|
|
110
|
-
* @description Handles secure agent logout with comprehensive cleanup procedures
|
|
111
|
-
* @type {LogoutFunction}
|
|
112
|
-
*/
|
|
113
|
-
logout: LogoutFunction;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* 🚪 Logout Custom Hook
|
|
118
|
-
*
|
|
119
|
-
* @function useLogout
|
|
120
|
-
* @description 🎯 Custom React hook that provides comprehensive agent logout functionality
|
|
121
|
-
* for the CTI SDK. It handles secure logout procedures, complete state cleanup,
|
|
122
|
-
* and storage management with intelligent error handling and proper cleanup.
|
|
123
|
-
*
|
|
124
|
-
* @returns {UseLogoutReturn} Hook return object containing:
|
|
125
|
-
* - `logout: LogoutFunction` - 🚪 Logout function
|
|
126
|
-
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
127
|
-
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
128
|
-
* - `isError: boolean` - ❌ Error state indicator
|
|
129
|
-
* - `error: any` - 🛡️ Error object when logout fails
|
|
130
|
-
* - `data: any` - 📊 Response data from successful logout
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```typescript
|
|
134
|
-
* // Basic usage in a component
|
|
135
|
-
* const LogoutButton = () => {
|
|
136
|
-
* const {
|
|
137
|
-
* logout,
|
|
138
|
-
* isLoading,
|
|
139
|
-
* isSuccess,
|
|
140
|
-
* isError,
|
|
141
|
-
* error
|
|
142
|
-
* } = useLogout();
|
|
143
|
-
*
|
|
144
|
-
* const handleLogout = async () => {
|
|
145
|
-
* try {
|
|
146
|
-
* const result = await logout();
|
|
147
|
-
* console.log('🚪 Logout successful:', result);
|
|
148
|
-
* // Redirect to login page or handle success
|
|
149
|
-
* } catch (err) {
|
|
150
|
-
* console.error('❌ Logout failed:', err);
|
|
151
|
-
* }
|
|
152
|
-
* };
|
|
153
|
-
*
|
|
154
|
-
* return (
|
|
155
|
-
* <button
|
|
156
|
-
* onClick={handleLogout}
|
|
157
|
-
* disabled={isLoading}
|
|
158
|
-
* >
|
|
159
|
-
* {isLoading ? 'Logging out...' : 'Logout'}
|
|
160
|
-
* </button>
|
|
161
|
-
* );
|
|
162
|
-
* };
|
|
163
|
-
* ```
|
|
164
|
-
*
|
|
165
|
-
* @features
|
|
166
|
-
* - 🚪 Secure agent logout with API validation
|
|
167
|
-
* - 🗑️ Complete state cleanup and reset
|
|
168
|
-
* - 💾 Storage management (localStorage & sessionStorage)
|
|
169
|
-
* - ⏳ Comprehensive loading state management
|
|
170
|
-
* - 🛡️ Robust error handling and recovery
|
|
171
|
-
* - 📊 Real-time state updates via SDK manager
|
|
172
|
-
* - 🔄 Automatic storage cleanup
|
|
173
|
-
*
|
|
174
|
-
* @logic
|
|
175
|
-
* - 🔍 Retrieves agent state from localStorage
|
|
176
|
-
* - 📦 Constructs logout API payload
|
|
177
|
-
* - 📡 Makes API call to logout agent
|
|
178
|
-
* - 🗑️ Clears SDK state manager
|
|
179
|
-
* - 💾 Clears all storage (localStorage & sessionStorage)
|
|
180
|
-
* - 📊 Handles success/error states
|
|
181
|
-
* - ⏳ Manages loading states
|
|
182
|
-
*
|
|
183
|
-
* @since 1.0.0
|
|
184
|
-
* @author CTI SDK Team
|
|
185
|
-
*/
|
|
186
|
-
declare const useLogout: () => UseLogoutReturn;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* 📅 End Call Data Interface
|
|
190
|
-
*
|
|
191
|
-
* @interface EndCallData
|
|
192
|
-
* @description 📊 Defines the structure for call termination input data
|
|
193
|
-
* Contains disposition and callback information for ending calls
|
|
194
|
-
*
|
|
195
|
-
* @properties
|
|
196
|
-
* - `disposition?: string` - 📝 Call outcome classification (default: "RES")
|
|
197
|
-
* - `followUp?: string` - 📅 Follow-up requirement (default: "N")
|
|
198
|
-
* - `callbackDate?: string` - 📅 Scheduled callback date (default: "")
|
|
199
|
-
* - `callbackHrs?: string` - 🕐 Scheduled callback hour (default: "")
|
|
200
|
-
* - `callbackMins?: string` - 🕐 Scheduled callback minute (default: "")
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* ```typescript
|
|
204
|
-
* // Basic end call data
|
|
205
|
-
* const endCallData: EndCallData = {
|
|
206
|
-
* disposition: "RES",
|
|
207
|
-
* followUp: "N"
|
|
208
|
-
* };
|
|
209
|
-
*
|
|
210
|
-
* // With callback scheduling
|
|
211
|
-
* const endCallWithCallback: EndCallData = {
|
|
212
|
-
* disposition: "RES",
|
|
213
|
-
* followUp: "Y",
|
|
214
|
-
* callbackDate: "2024-01-15",
|
|
215
|
-
* callbackHrs: "14",
|
|
216
|
-
* callbackMins: "30"
|
|
217
|
-
* };
|
|
218
|
-
* ```
|
|
219
|
-
*
|
|
220
|
-
* @since 1.0.0
|
|
221
|
-
* @author CTI SDK Team
|
|
222
|
-
*/
|
|
223
|
-
interface EndCallData {
|
|
224
|
-
/**
|
|
225
|
-
* 📝 Call outcome classification
|
|
226
|
-
* @description How the call ended (default: "RES" for Resolved)
|
|
227
|
-
* @type {string | undefined}
|
|
228
|
-
*/
|
|
229
|
-
disposition?: string;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* 📅 Follow-up requirement
|
|
233
|
-
* @description Whether follow-up is required (default: "N" for No)
|
|
234
|
-
* @type {string | undefined}
|
|
235
|
-
*/
|
|
236
|
-
followUp?: string;
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* 📅 Scheduled callback date
|
|
240
|
-
* @description Date for callback scheduling (YYYY-MM-DD format)
|
|
241
|
-
* @type {string | undefined}
|
|
242
|
-
*/
|
|
243
|
-
callbackDate?: string;
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* 🕐 Scheduled callback hour
|
|
247
|
-
* @description Hour for callback scheduling (0-23)
|
|
248
|
-
* @type {string | undefined}
|
|
249
|
-
*/
|
|
250
|
-
callbackHrs?: string;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* 🕐 Scheduled callback minute
|
|
254
|
-
* @description Minute for callback scheduling (0-59)
|
|
255
|
-
* @type {string | undefined}
|
|
256
|
-
*/
|
|
257
|
-
callbackMins?: string;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* 📞 Call Termination Function Type
|
|
262
|
-
*
|
|
263
|
-
* @type CallTerminationFunction
|
|
264
|
-
* @description 🎯 Type definition for the call termination function
|
|
265
|
-
* Handles call termination with disposition tracking and callback scheduling
|
|
266
|
-
*
|
|
267
|
-
* @param {EndCallData} data - 📊 Call termination data containing disposition and callback info
|
|
268
|
-
* @returns {Promise<any>} Promise that resolves with API response data or rejects with error
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* ```typescript
|
|
272
|
-
* const handleEndCall: CallTerminationFunction = async (data) => {
|
|
273
|
-
* // Call termination logic
|
|
274
|
-
* return await apiCall(data);
|
|
275
|
-
* };
|
|
276
|
-
* ```
|
|
277
|
-
*
|
|
278
|
-
* @since 1.0.0
|
|
279
|
-
* @author CTI SDK Team
|
|
280
|
-
*/
|
|
281
|
-
type CallTerminationFunction = (data: EndCallData) => Promise<any>;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* 📊 Hook State Management Types
|
|
285
|
-
*
|
|
286
|
-
* @type HookStateTypes
|
|
287
|
-
* @description 🎛️ Type definitions for all hook state variables
|
|
288
|
-
* Provides type safety for loading, success, error, and data states
|
|
289
|
-
*
|
|
290
|
-
* @since 1.0.0
|
|
291
|
-
* @author CTI SDK Team
|
|
4
|
+
* @fileoverview 📦 TypeScript Declaration File for Call Control SDK
|
|
5
|
+
* @description Comprehensive CTI (Computer Telephony Integration) SDK for React applications.
|
|
6
|
+
* Provides complete call control functionality including dialing, conferencing, transferring,
|
|
7
|
+
* and real-time call management with WebSocket integration.
|
|
8
|
+
*
|
|
9
|
+
* @author Achala SDK Team
|
|
10
|
+
* @version 6.x.x
|
|
11
|
+
* @since 2024
|
|
292
12
|
*/
|
|
293
|
-
type HookStateTypes$1 = {
|
|
294
|
-
/**
|
|
295
|
-
* ⏳ Loading state indicator
|
|
296
|
-
* @description Boolean flag indicating if a call termination operation is in progress
|
|
297
|
-
* @type {boolean}
|
|
298
|
-
*/
|
|
299
|
-
isLoading: boolean;
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* ✅ Success state indicator
|
|
303
|
-
* @description Boolean flag indicating if the last call termination was successful
|
|
304
|
-
* @type {boolean}
|
|
305
|
-
*/
|
|
306
|
-
isSuccess: boolean;
|
|
307
13
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
* @type {boolean}
|
|
312
|
-
*/
|
|
313
|
-
isError: boolean;
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* 🛡️ Error object
|
|
317
|
-
* @description Contains the error object when a call termination fails
|
|
318
|
-
* @type {any}
|
|
319
|
-
*/
|
|
320
|
-
error: any;
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* 📊 Response data
|
|
324
|
-
* @description Contains the response data from successful call terminations
|
|
325
|
-
* @type {any}
|
|
326
|
-
*/
|
|
327
|
-
data: any;
|
|
328
|
-
};
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// 🎯 MAIN SDK FUNCTIONS
|
|
16
|
+
// =============================================================================
|
|
329
17
|
|
|
330
18
|
/**
|
|
331
|
-
*
|
|
19
|
+
* 🚀 SDK Initialization Parameters Interface
|
|
332
20
|
*
|
|
333
|
-
* @interface
|
|
334
|
-
* @description
|
|
335
|
-
* Contains all functions and state for call termination functionality
|
|
21
|
+
* @interface InitSDKParams
|
|
22
|
+
* @description Parameters required for SDK initialization
|
|
336
23
|
*
|
|
337
24
|
* @properties
|
|
338
|
-
* - `
|
|
339
|
-
* - `
|
|
340
|
-
* - `
|
|
341
|
-
* - `
|
|
342
|
-
* - `error: any` - 🛡️ Error object when call fails
|
|
343
|
-
* - `data: any` - 📊 Response data from successful calls
|
|
25
|
+
* - `apiKey: string` - Authentication key for SDK access
|
|
26
|
+
* - `tenantId: string` - Tenant identifier for multi-tenancy support
|
|
27
|
+
* - `agentId: string` - Agent identifier for call management
|
|
28
|
+
* - `sdkConfig?: SDKConfig` - Optional SDK configuration for customizing behavior
|
|
344
29
|
*
|
|
345
30
|
* @example
|
|
346
31
|
* ```typescript
|
|
347
|
-
* const
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
* } = hookReturn;
|
|
356
|
-
*
|
|
357
|
-
* // Use the hook functionality
|
|
32
|
+
* const initParams: InitSDKParams = {
|
|
33
|
+
* apiKey: "your-api-key",
|
|
34
|
+
* tenantId: "tenant-123",
|
|
35
|
+
* agentId: "agent-456",
|
|
36
|
+
* sdkConfig: {
|
|
37
|
+
* isDraggable: true,
|
|
38
|
+
* disableSoftPhone: false
|
|
39
|
+
* }
|
|
358
40
|
* };
|
|
359
41
|
* ```
|
|
360
42
|
*
|
|
361
43
|
* @since 1.0.0
|
|
362
44
|
* @author CTI SDK Team
|
|
363
45
|
*/
|
|
364
|
-
interface
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
46
|
+
interface InitSDKParams {
|
|
47
|
+
/** Authentication key for SDK access */
|
|
48
|
+
apiKey: string;
|
|
49
|
+
/** Tenant identifier for multi-tenancy support */
|
|
50
|
+
tenantId: string;
|
|
51
|
+
/** Agent identifier for call management */
|
|
52
|
+
agentId: string;
|
|
53
|
+
/** Optional SDK configuration for customizing behavior */
|
|
54
|
+
sdkConfig?: SDKConfig;
|
|
371
55
|
}
|
|
372
56
|
|
|
373
57
|
/**
|
|
374
|
-
*
|
|
58
|
+
* 🚀 Initialize the Call Control SDK
|
|
375
59
|
*
|
|
376
|
-
* @function
|
|
377
|
-
* @description
|
|
378
|
-
*
|
|
379
|
-
* and proper call cleanup with intelligent state management and error handling.
|
|
60
|
+
* @function initSDK
|
|
61
|
+
* @description Initializes the Call Control SDK with authentication credentials and configuration.
|
|
62
|
+
* Sets up event tracking, state management, and establishes connection to the CTI system.
|
|
380
63
|
*
|
|
381
|
-
* @
|
|
382
|
-
*
|
|
383
|
-
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
384
|
-
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
385
|
-
* - `isError: boolean` - ❌ Error state indicator
|
|
386
|
-
* - `error: any` - 🛡️ Error object when call fails
|
|
387
|
-
* - `data: any` - 📊 Response data from successful calls
|
|
64
|
+
* @param {InitSDKParams} params - Object containing API key, tenant ID, agent ID, and optional config
|
|
65
|
+
* @returns {Promise<void>} Promise that resolves when initialization is complete
|
|
388
66
|
*
|
|
389
67
|
* @example
|
|
390
68
|
* ```typescript
|
|
391
|
-
* // Basic
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
* isError,
|
|
398
|
-
* error
|
|
399
|
-
* } = useEndCall();
|
|
400
|
-
*
|
|
401
|
-
* const endCall = async () => {
|
|
402
|
-
* try {
|
|
403
|
-
* const result = await handleEndCall({
|
|
404
|
-
* disposition: "RES",
|
|
405
|
-
* followUp: "N"
|
|
406
|
-
* });
|
|
407
|
-
* console.log('📞 Call ended:', result);
|
|
408
|
-
* } catch (err) {
|
|
409
|
-
* console.error('❌ End call failed:', err);
|
|
410
|
-
* }
|
|
411
|
-
* };
|
|
69
|
+
* // Basic initialization
|
|
70
|
+
* await initSDK({
|
|
71
|
+
* apiKey: "your-api-key",
|
|
72
|
+
* tenantId: "tenant-123",
|
|
73
|
+
* agentId: "agent-456"
|
|
74
|
+
* });
|
|
412
75
|
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
76
|
+
* // With custom configuration
|
|
77
|
+
* await initSDK({
|
|
78
|
+
* apiKey: "your-api-key",
|
|
79
|
+
* tenantId: "tenant-123",
|
|
80
|
+
* agentId: "agent-456",
|
|
81
|
+
* sdkConfig: {
|
|
82
|
+
* isDraggable: true,
|
|
83
|
+
* disableSoftPhone: false,
|
|
84
|
+
* disableEndCallButton: false
|
|
85
|
+
* }
|
|
86
|
+
* });
|
|
422
87
|
* ```
|
|
423
88
|
*
|
|
424
|
-
* @
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
* - ⏳ Comprehensive loading state management
|
|
429
|
-
* - 🛡️ Robust error handling and recovery
|
|
430
|
-
* - 📊 Real-time state updates via SDK manager
|
|
431
|
-
* - 🔄 Automatic call state management
|
|
432
|
-
*
|
|
433
|
-
* @logic
|
|
434
|
-
* - 🔍 Retrieves agent state from localStorage
|
|
435
|
-
* - 📦 Constructs comprehensive API payload
|
|
436
|
-
* - 📡 Makes API call to end call
|
|
437
|
-
* - 🔄 Updates SDK state manager
|
|
438
|
-
* - 📊 Handles success/error states
|
|
439
|
-
* - ⏳ Manages loading states
|
|
89
|
+
* @throws {Error} When API key is missing or invalid
|
|
90
|
+
* @throws {Error} When tenant ID is missing or invalid
|
|
91
|
+
* @throws {Error} When agent ID is missing or invalid
|
|
92
|
+
* @throws {Error} When initialization fails due to network or authentication issues
|
|
440
93
|
*
|
|
441
94
|
* @since 1.0.0
|
|
442
95
|
* @author CTI SDK Team
|
|
443
96
|
*/
|
|
444
|
-
declare
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* @interface CallData
|
|
448
|
-
* @description Comprehensive interface defining call-related data structure for CTI operations.
|
|
449
|
-
* Contains all necessary information about active calls, including metadata, status, and references.
|
|
450
|
-
*
|
|
451
|
-
* @declaration
|
|
452
|
-
* ```typescript
|
|
453
|
-
* interface CallData {
|
|
454
|
-
* mobileNumber?: string;
|
|
455
|
-
* callReferenceId?: string;
|
|
456
|
-
* convoxId?: string;
|
|
457
|
-
* type?: string;
|
|
458
|
-
* status?: string;
|
|
459
|
-
* agent_id?: string;
|
|
460
|
-
* phone_number?: string;
|
|
461
|
-
* event_time?: string;
|
|
462
|
-
* convox_id?: string;
|
|
463
|
-
* process_id?: string;
|
|
464
|
-
* process_name?: string;
|
|
465
|
-
* }
|
|
466
|
-
* ```
|
|
467
|
-
*
|
|
468
|
-
* @requiredParams None (all fields are optional for flexibility)
|
|
469
|
-
*
|
|
470
|
-
* @returnType Interface definition
|
|
471
|
-
*
|
|
472
|
-
* @example
|
|
473
|
-
* ```typescript
|
|
474
|
-
* const callData: CallData = {
|
|
475
|
-
* mobileNumber: "1234567890",
|
|
476
|
-
* callReferenceId: "REF123456",
|
|
477
|
-
* status: "ONCALL",
|
|
478
|
-
* agent_id: "agent001",
|
|
479
|
-
* process_id: "proc001",
|
|
480
|
-
* process_name: "Sales Process"
|
|
481
|
-
* };
|
|
482
|
-
* ```
|
|
483
|
-
*
|
|
484
|
-
* @return Interface definition for call data structure
|
|
485
|
-
*
|
|
486
|
-
* @conclusion Essential data structure for all call-related operations and state management.
|
|
487
|
-
*/
|
|
488
|
-
interface CallData$1 {
|
|
489
|
-
/** Mobile number of the caller or callee */
|
|
490
|
-
mobileNumber?: string;
|
|
491
|
-
/** Unique reference identifier for the call */
|
|
492
|
-
callReferenceId?: string;
|
|
493
|
-
/** Convox system identifier for the call */
|
|
494
|
-
convoxId?: string;
|
|
495
|
-
/** Type of call (inbound, outbound, internal, etc.) */
|
|
496
|
-
type?: string;
|
|
497
|
-
/** Current status of the call (ONCALL, RINGING, WRAPUP, etc.) */
|
|
498
|
-
status?: string;
|
|
499
|
-
/** Agent identifier associated with the call */
|
|
500
|
-
agent_id?: string;
|
|
501
|
-
/** Phone number involved in the call */
|
|
502
|
-
phone_number?: string;
|
|
503
|
-
/** Timestamp when the call event occurred */
|
|
504
|
-
event_time?: string;
|
|
505
|
-
/** Convox system call ID */
|
|
506
|
-
convox_id?: string;
|
|
507
|
-
/** Process identifier for the call */
|
|
508
|
-
process_id?: string;
|
|
509
|
-
/** Name of the process handling the call */
|
|
510
|
-
process_name?: string;
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* @interface CallControlPanelProps
|
|
514
|
-
* @description Props interface for the main CallControlPanel component.
|
|
515
|
-
* Defines the properties that can be passed to customize the call control interface behavior.
|
|
516
|
-
*
|
|
517
|
-
* @declaration
|
|
518
|
-
* ```typescript
|
|
519
|
-
* interface CallControlPanelProps {
|
|
520
|
-
* onDataChange?: (data: CallData) => void;
|
|
521
|
-
* }
|
|
522
|
-
* ```
|
|
523
|
-
*
|
|
524
|
-
* @requiredParams None (all props are optional)
|
|
525
|
-
*
|
|
526
|
-
* @returnType Interface definition
|
|
527
|
-
*
|
|
528
|
-
* @example
|
|
529
|
-
* ```tsx
|
|
530
|
-
* <CallControlPanel
|
|
531
|
-
* onDataChange={(callData) => {
|
|
532
|
-
* console.log('Call status changed:', callData.status);
|
|
533
|
-
* // Handle call data updates
|
|
534
|
-
* }}
|
|
535
|
-
* />
|
|
536
|
-
* ```
|
|
537
|
-
*
|
|
538
|
-
* @return Interface definition for component props
|
|
539
|
-
*
|
|
540
|
-
* @conclusion Provides flexible configuration for the call control panel component.
|
|
541
|
-
*/
|
|
542
|
-
interface CallControlPanelProps$1 {
|
|
543
|
-
/** Optional callback function triggered when call data changes */
|
|
544
|
-
onDataChange?: (data: CallData$1) => void;
|
|
545
|
-
}
|
|
546
|
-
/**
|
|
547
|
-
* @interface SDKConfig
|
|
548
|
-
* @description Configuration interface for customizing the Call Control SDK behavior.
|
|
549
|
-
* Allows disabling specific features and customizing the visual appearance of components.
|
|
550
|
-
*
|
|
551
|
-
* @declaration
|
|
552
|
-
* ```typescript
|
|
553
|
-
* interface SDKConfig {
|
|
554
|
-
* disableEndCallButton?: boolean;
|
|
555
|
-
* disabledDialButton?: boolean;
|
|
556
|
-
* disableCallTransferButton?: boolean;
|
|
557
|
-
* isDraggable?: boolean;
|
|
558
|
-
* disableSoftPhone?: boolean;
|
|
559
|
-
* disableConferenceButton?: boolean;
|
|
560
|
-
* disabled?: SxProps;
|
|
561
|
-
* enabled?: SxProps;
|
|
562
|
-
* outlined?: SxProps;
|
|
563
|
-
* }
|
|
564
|
-
* ```
|
|
565
|
-
*
|
|
566
|
-
* @requiredParams None (all configuration options are optional)
|
|
567
|
-
*
|
|
568
|
-
* @returnType Interface definition
|
|
569
|
-
*
|
|
570
|
-
* @example
|
|
571
|
-
* ```typescript
|
|
572
|
-
* const sdkConfig: SDKConfig = {
|
|
573
|
-
* disableEndCallButton: false,
|
|
574
|
-
* disabledDialButton: true,
|
|
575
|
-
* isDraggable: true,
|
|
576
|
-
* disableSoftPhone: false,
|
|
577
|
-
* enabled: { backgroundColor: 'green' },
|
|
578
|
-
* disabled: { backgroundColor: 'gray' }
|
|
579
|
-
* };
|
|
580
|
-
* ```
|
|
581
|
-
*
|
|
582
|
-
* @return Interface definition for SDK configuration
|
|
583
|
-
*
|
|
584
|
-
* @conclusion Provides comprehensive customization options for the CTI interface.
|
|
585
|
-
*/
|
|
586
|
-
interface SDKConfig {
|
|
587
|
-
/** Whether to disable the end call button */
|
|
588
|
-
disableEndCallButton?: boolean;
|
|
589
|
-
/** Whether to disable the dial button */
|
|
590
|
-
disabledDialButton?: boolean;
|
|
591
|
-
/** Whether to disable the call transfer button */
|
|
592
|
-
disableCallTransferButton?: boolean;
|
|
593
|
-
/** Whether the control panel should be draggable */
|
|
594
|
-
isDraggable?: boolean;
|
|
595
|
-
/** Whether to disable the soft phone iframe */
|
|
596
|
-
disableSoftPhone?: boolean;
|
|
597
|
-
/** Whether to disable the conference button */
|
|
598
|
-
disableConferenceButton?: boolean;
|
|
599
|
-
/** Custom styles for disabled button states */
|
|
600
|
-
disabled?: SxProps;
|
|
601
|
-
/** Custom styles for enabled button states */
|
|
602
|
-
enabled?: SxProps;
|
|
603
|
-
/** Custom styles for outlined button states */
|
|
604
|
-
outlined?: SxProps;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
/**
|
|
608
|
-
* @fileoverview 📞 TypeScript Declaration File for useClickToCall Hook
|
|
609
|
-
*
|
|
610
|
-
* This file contains TypeScript type definitions for the useClickToCall custom hook
|
|
611
|
-
* and its related interfaces. It provides comprehensive type safety and IntelliSense
|
|
612
|
-
* support for developers using the CTI SDK.
|
|
613
|
-
*
|
|
614
|
-
* 🎯 Key Type Definitions:
|
|
615
|
-
* - 📱 StartCallPayload interface for call initiation data
|
|
616
|
-
* - 📞 useClickToCall hook return type
|
|
617
|
-
* - 🔄 Call initiation function signature
|
|
618
|
-
* - 📊 State management types
|
|
619
|
-
*
|
|
620
|
-
* @author CTI SDK Team
|
|
621
|
-
* @version 6.1.0
|
|
622
|
-
* @since 1.0.0
|
|
623
|
-
*/
|
|
97
|
+
declare function initSDK(params: InitSDKParams): Promise<void>;
|
|
624
98
|
|
|
625
99
|
/**
|
|
626
|
-
*
|
|
100
|
+
* 📋 Get SDK Version
|
|
627
101
|
*
|
|
628
|
-
* @
|
|
629
|
-
* @description
|
|
630
|
-
* Contains the mobile number required to initiate a call
|
|
102
|
+
* @function getSDKVersion
|
|
103
|
+
* @description Returns the current version of the Call Control SDK
|
|
631
104
|
*
|
|
632
|
-
* @
|
|
633
|
-
* - `mobileNumber: string` - 📱 The phone number to call (required)
|
|
105
|
+
* @returns {string} Current SDK version string
|
|
634
106
|
*
|
|
635
107
|
* @example
|
|
636
108
|
* ```typescript
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
* mobileNumber: "1234567890"
|
|
640
|
-
* };
|
|
641
|
-
*
|
|
642
|
-
* // Usage in component
|
|
643
|
-
* const { handleStartCall } = useClickToCall();
|
|
644
|
-
* await handleStartCall({ mobileNumber: "9876543210" });
|
|
109
|
+
* const version = getSDKVersion();
|
|
110
|
+
* console.log(`Using Call Control SDK version: ${version}`);
|
|
645
111
|
* ```
|
|
646
112
|
*
|
|
647
113
|
* @since 1.0.0
|
|
648
114
|
* @author CTI SDK Team
|
|
649
115
|
*/
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* 📱 Phone number to call
|
|
653
|
-
* @description The mobile number that will be called
|
|
654
|
-
* @type {string}
|
|
655
|
-
*/
|
|
656
|
-
mobileNumber: string;
|
|
657
|
-
}
|
|
116
|
+
declare function getSDKVersion(): string;
|
|
658
117
|
|
|
659
118
|
/**
|
|
660
|
-
*
|
|
119
|
+
* ✅ Check SDK Initialization Status
|
|
661
120
|
*
|
|
662
|
-
* @
|
|
663
|
-
* @description
|
|
664
|
-
* Handles both regular calls and conference calls based on agent state
|
|
121
|
+
* @function isSDKInitialized
|
|
122
|
+
* @description Checks if the SDK has been successfully initialized
|
|
665
123
|
*
|
|
666
|
-
* @
|
|
667
|
-
* @returns {Promise<any>} Promise that resolves with API response data or rejects with error
|
|
124
|
+
* @returns {boolean} True if SDK is initialized, false otherwise
|
|
668
125
|
*
|
|
669
126
|
* @example
|
|
670
127
|
* ```typescript
|
|
671
|
-
*
|
|
672
|
-
* //
|
|
673
|
-
*
|
|
674
|
-
* }
|
|
128
|
+
* if (isSDKInitialized()) {
|
|
129
|
+
* // SDK is ready to use
|
|
130
|
+
* console.log("SDK is initialized and ready");
|
|
131
|
+
* } else {
|
|
132
|
+
* console.log("SDK needs to be initialized first");
|
|
133
|
+
* }
|
|
675
134
|
* ```
|
|
676
135
|
*
|
|
677
136
|
* @since 1.0.0
|
|
678
137
|
* @author CTI SDK Team
|
|
679
138
|
*/
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
/**
|
|
683
|
-
* 📊 Hook State Management Types
|
|
684
|
-
*
|
|
685
|
-
* @type HookStateTypes
|
|
686
|
-
* @description 🎛️ Type definitions for all hook state variables
|
|
687
|
-
* Provides type safety for loading, success, error, and data states
|
|
688
|
-
*
|
|
689
|
-
* @since 1.0.0
|
|
690
|
-
* @author CTI SDK Team
|
|
691
|
-
*/
|
|
692
|
-
type HookStateTypes = {
|
|
693
|
-
/**
|
|
694
|
-
* ⏳ Loading state indicator
|
|
695
|
-
* @description Boolean flag indicating if a call operation is currently in progress
|
|
696
|
-
* @type {boolean}
|
|
697
|
-
*/
|
|
698
|
-
isLoading: boolean;
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* ✅ Success state indicator
|
|
702
|
-
* @description Boolean flag indicating if the last call operation was successful
|
|
703
|
-
* @type {boolean}
|
|
704
|
-
*/
|
|
705
|
-
isSuccess: boolean;
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* ❌ Error state indicator
|
|
709
|
-
* @description Boolean flag indicating if the last call operation encountered an error
|
|
710
|
-
* @type {boolean}
|
|
711
|
-
*/
|
|
712
|
-
isError: boolean;
|
|
139
|
+
declare function isSDKInitialized(): boolean;
|
|
713
140
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
* @type {any}
|
|
718
|
-
*/
|
|
719
|
-
error: any;
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* 📊 Response data
|
|
723
|
-
* @description Contains the response data from successful call operations
|
|
724
|
-
* @type {any}
|
|
725
|
-
*/
|
|
726
|
-
data: any;
|
|
727
|
-
};
|
|
141
|
+
// =============================================================================
|
|
142
|
+
// 🎭 COMPONENT EXPORTS
|
|
143
|
+
// =============================================================================
|
|
728
144
|
|
|
729
145
|
/**
|
|
730
|
-
*
|
|
146
|
+
* 🎭 Call Control Panel Component
|
|
731
147
|
*
|
|
732
|
-
* @
|
|
733
|
-
* @description
|
|
734
|
-
*
|
|
148
|
+
* @component CallControlPanel
|
|
149
|
+
* @description Main call control panel component for the CTI SDK.
|
|
150
|
+
* Provides comprehensive call management interface with all necessary controls.
|
|
735
151
|
*
|
|
736
|
-
* @
|
|
737
|
-
*
|
|
738
|
-
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
739
|
-
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
740
|
-
* - `isError: boolean` - ❌ Error state indicator
|
|
741
|
-
* - `error: any` - 🛡️ Error object when call fails
|
|
742
|
-
* - `data: any` - 📊 Response data from successful calls
|
|
152
|
+
* @param {CallControlPanelProps} props - Component props
|
|
153
|
+
* @returns {JSX.Element} Call control panel interface
|
|
743
154
|
*
|
|
744
155
|
* @example
|
|
745
|
-
* ```
|
|
746
|
-
*
|
|
747
|
-
* const hookReturn: UseClickToCallReturn = useClickToCall();
|
|
748
|
-
* const {
|
|
749
|
-
* handleStartCall,
|
|
750
|
-
* isLoading,
|
|
751
|
-
* isSuccess,
|
|
752
|
-
* isError,
|
|
753
|
-
* error
|
|
754
|
-
* } = hookReturn;
|
|
755
|
-
*
|
|
756
|
-
* // Use the hook functionality
|
|
757
|
-
* };
|
|
156
|
+
* ```tsx
|
|
157
|
+
* <CallControlPanel onDataChange={handleDataChange} />
|
|
758
158
|
* ```
|
|
759
159
|
*
|
|
760
160
|
* @since 1.0.0
|
|
761
161
|
* @author CTI SDK Team
|
|
762
162
|
*/
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* 📞 Call initiation function
|
|
766
|
-
* @description Handles call initiation with intelligent routing based on agent state
|
|
767
|
-
* @type {CallInitiationFunction}
|
|
768
|
-
*/
|
|
769
|
-
handleStartCall: CallInitiationFunction;
|
|
770
|
-
}
|
|
163
|
+
declare const CallControlPanel: React.ComponentType<CallControlPanelProps>;
|
|
771
164
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
* @function useClickToCall
|
|
776
|
-
* @description 🎯 Custom React hook that provides comprehensive call initiation functionality
|
|
777
|
-
* for the CTI SDK. It intelligently handles both regular calls and conference calls
|
|
778
|
-
* based on the current agent state, with proper loading states and error handling.
|
|
779
|
-
*
|
|
780
|
-
* @returns {UseClickToCallReturn} Hook return object containing:
|
|
781
|
-
* - `handleStartCall: CallInitiationFunction` - 📞 Call initiation function
|
|
782
|
-
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
783
|
-
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
784
|
-
* - `isError: boolean` - ❌ Error state indicator
|
|
785
|
-
* - `error: any` - 🛡️ Error object when call fails
|
|
786
|
-
* - `data: any` - 📊 Response data from successful calls
|
|
787
|
-
*
|
|
788
|
-
* @example
|
|
789
|
-
* ```typescript
|
|
790
|
-
* // Basic usage in a component
|
|
791
|
-
* const CallButton = () => {
|
|
792
|
-
* const {
|
|
793
|
-
* handleStartCall,
|
|
794
|
-
* isLoading,
|
|
795
|
-
* isSuccess,
|
|
796
|
-
* isError,
|
|
797
|
-
* error
|
|
798
|
-
* } = useClickToCall();
|
|
799
|
-
*
|
|
800
|
-
* const makeCall = async () => {
|
|
801
|
-
* try {
|
|
802
|
-
* const result = await handleStartCall({
|
|
803
|
-
* mobileNumber: "1234567890"
|
|
804
|
-
* });
|
|
805
|
-
* console.log('📞 Call initiated:', result);
|
|
806
|
-
* } catch (err) {
|
|
807
|
-
* console.error('❌ Call failed:', err);
|
|
808
|
-
* }
|
|
809
|
-
* };
|
|
810
|
-
*
|
|
811
|
-
* return (
|
|
812
|
-
* <button
|
|
813
|
-
* onClick={makeCall}
|
|
814
|
-
* disabled={isLoading}
|
|
815
|
-
* >
|
|
816
|
-
* {isLoading ? 'Calling...' : 'Make Call'}
|
|
817
|
-
* </button>
|
|
818
|
-
* );
|
|
819
|
-
* };
|
|
820
|
-
* ```
|
|
821
|
-
*
|
|
822
|
-
* @features
|
|
823
|
-
* - 🎯 Intelligent call routing based on agent state
|
|
824
|
-
* - 📱 Regular call initiation for idle agents
|
|
825
|
-
* - 👥 Conference call initiation for busy agents
|
|
826
|
-
* - ⏳ Comprehensive loading state management
|
|
827
|
-
* - 🛡️ Robust error handling and recovery
|
|
828
|
-
* - 📊 Real-time state updates via SDK manager
|
|
829
|
-
* - 🔄 Automatic conference dialog management
|
|
830
|
-
*
|
|
831
|
-
* @logic
|
|
832
|
-
* - 🔍 Checks agent status from localStorage state
|
|
833
|
-
* - 📞 Initiates regular call if agent is IDLE
|
|
834
|
-
* - 👥 Initiates conference call if agent is ONCALL
|
|
835
|
-
* - ⚠️ Shows alert if agent is not ready
|
|
836
|
-
* - 🔄 Updates conference line state for conference calls
|
|
837
|
-
* - 🎭 Opens conference dialog for conference calls
|
|
838
|
-
*
|
|
839
|
-
* @since 1.0.0
|
|
840
|
-
* @author CTI SDK Team
|
|
841
|
-
*/
|
|
842
|
-
declare const useClickToCall: () => UseClickToCallReturn;
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* @fileoverview 📞 TypeScript Declaration File for CallControlPanel Component
|
|
846
|
-
*
|
|
847
|
-
* This file contains TypeScript type definitions for the CallControlPanel component
|
|
848
|
-
* and its related interfaces. It provides comprehensive type safety and IntelliSense
|
|
849
|
-
* support for developers using the CTI SDK main component.
|
|
850
|
-
*
|
|
851
|
-
* 🎯 Key Type Definitions:
|
|
852
|
-
* - 📞 CallControlPanelProps interface for component props
|
|
853
|
-
* - 📞 CallData interface for call data structure
|
|
854
|
-
* - 🔄 Data change callback types
|
|
855
|
-
* - 📊 Component return types
|
|
856
|
-
* - 🎯 Error handling types
|
|
857
|
-
*
|
|
858
|
-
* @author CTI SDK Team
|
|
859
|
-
* @version 6.1.0
|
|
860
|
-
* @since 1.0.0
|
|
861
|
-
*/
|
|
165
|
+
// =============================================================================
|
|
166
|
+
// 🗃️ TYPE EXPORTS
|
|
167
|
+
// =============================================================================
|
|
862
168
|
|
|
863
169
|
/**
|
|
864
170
|
* 📞 Call Data Interface
|
|
865
171
|
*
|
|
866
172
|
* @interface CallData
|
|
867
|
-
* @description
|
|
868
|
-
*
|
|
173
|
+
* @description Comprehensive interface defining call-related data structure for CTI operations.
|
|
174
|
+
* Contains all necessary information about active calls, including metadata, status, and references.
|
|
869
175
|
*
|
|
870
176
|
* @properties
|
|
871
|
-
* - `mobileNumber?: string` -
|
|
872
|
-
* - `callReferenceId?: string` -
|
|
873
|
-
* - `convoxId?: string` -
|
|
874
|
-
* - `type?: string` -
|
|
875
|
-
* - `status?: string` -
|
|
876
|
-
* - `agent_id?: string` -
|
|
877
|
-
* - `phone_number?: string` -
|
|
878
|
-
* - `event_time?: string` -
|
|
879
|
-
* - `convox_id?: string` -
|
|
880
|
-
* - `process_id?: string` -
|
|
881
|
-
* - `process_name?: string` -
|
|
882
|
-
*
|
|
883
|
-
* @example
|
|
884
|
-
* ```typescript
|
|
885
|
-
* const callData: CallData = {
|
|
886
|
-
* mobileNumber: "1234567890",
|
|
887
|
-
* callReferenceId: "REF123456",
|
|
888
|
-
* status: "ONCALL",
|
|
889
|
-
* agent_id: "agent001",
|
|
890
|
-
* process_id: "proc001",
|
|
891
|
-
* process_name: "Sales Process"
|
|
892
|
-
* };
|
|
893
|
-
* ```
|
|
177
|
+
* - `mobileNumber?: string` - Mobile number of the caller or callee
|
|
178
|
+
* - `callReferenceId?: string` - Unique reference identifier for the call
|
|
179
|
+
* - `convoxId?: string` - Convox system identifier for the call
|
|
180
|
+
* - `type?: string` - Type of call (inbound, outbound, internal, etc.)
|
|
181
|
+
* - `status?: string` - Current status of the call (ONCALL, RINGING, WRAPUP, etc.)
|
|
182
|
+
* - `agent_id?: string` - Agent identifier associated with the call
|
|
183
|
+
* - `phone_number?: string` - Phone number involved in the call
|
|
184
|
+
* - `event_time?: string` - Timestamp when the call event occurred
|
|
185
|
+
* - `convox_id?: string` - Convox system call ID
|
|
186
|
+
* - `process_id?: string` - Process identifier for the call
|
|
187
|
+
* - `process_name?: string` - Name of the process handling the call
|
|
894
188
|
*
|
|
895
189
|
* @since 1.0.0
|
|
896
190
|
* @author CTI SDK Team
|
|
897
191
|
*/
|
|
898
192
|
interface CallData {
|
|
899
|
-
/** Mobile number of the caller or callee */
|
|
900
193
|
mobileNumber?: string;
|
|
901
|
-
/** Unique reference identifier for the call */
|
|
902
194
|
callReferenceId?: string;
|
|
903
|
-
/** Convox system identifier for the call */
|
|
904
195
|
convoxId?: string;
|
|
905
|
-
/** Type of call (inbound, outbound, internal, etc.) */
|
|
906
196
|
type?: string;
|
|
907
|
-
/** Current status of the call (ONCALL, RINGING, WRAPUP, etc.) */
|
|
908
197
|
status?: string;
|
|
909
|
-
/** Agent identifier associated with the call */
|
|
910
198
|
agent_id?: string;
|
|
911
|
-
/** Phone number involved in the call */
|
|
912
199
|
phone_number?: string;
|
|
913
|
-
/** Timestamp when the call event occurred */
|
|
914
200
|
event_time?: string;
|
|
915
|
-
/** Convox system call ID */
|
|
916
201
|
convox_id?: string;
|
|
917
|
-
/** Process identifier for the call */
|
|
918
202
|
process_id?: string;
|
|
919
|
-
/** Name of the process handling the call */
|
|
920
203
|
process_name?: string;
|
|
921
204
|
}
|
|
922
205
|
|
|
923
206
|
/**
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
* @type DataChangeCallback
|
|
927
|
-
* @description 🎯 Type definition for data change callback function
|
|
928
|
-
* Called whenever call data changes in the component
|
|
207
|
+
* ⚙️ SDK Configuration Interface
|
|
929
208
|
*
|
|
930
|
-
* @
|
|
931
|
-
* @
|
|
209
|
+
* @interface SDKConfig
|
|
210
|
+
* @description Configuration interface for customizing the Call Control SDK behavior.
|
|
211
|
+
* Allows disabling specific features and customizing the visual appearance of components.
|
|
932
212
|
*
|
|
933
|
-
* @
|
|
934
|
-
*
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
939
|
-
*
|
|
213
|
+
* @properties
|
|
214
|
+
* - `disableEndCallButton?: boolean` - Whether to disable the end call button
|
|
215
|
+
* - `disabledDialButton?: boolean` - Whether to disable the dial button
|
|
216
|
+
* - `disableCallTransferButton?: boolean` - Whether to disable the call transfer button
|
|
217
|
+
* - `isDraggable?: boolean` - Whether the control panel should be draggable
|
|
218
|
+
* - `disableSoftPhone?: boolean` - Whether to disable the soft phone iframe
|
|
219
|
+
* - `disableConferenceButton?: boolean` - Whether to disable the conference button
|
|
220
|
+
* - `disabled?: SxProps` - Custom styles for disabled button states
|
|
221
|
+
* - `enabled?: SxProps` - Custom styles for enabled button states
|
|
222
|
+
* - `outlined?: SxProps` - Custom styles for outlined button states
|
|
940
223
|
*
|
|
941
224
|
* @since 1.0.0
|
|
942
225
|
* @author CTI SDK Team
|
|
943
226
|
*/
|
|
944
|
-
|
|
227
|
+
interface SDKConfig {
|
|
228
|
+
disableEndCallButton?: boolean;
|
|
229
|
+
disabledDialButton?: boolean;
|
|
230
|
+
disableCallTransferButton?: boolean;
|
|
231
|
+
isDraggable?: boolean;
|
|
232
|
+
disableSoftPhone?: boolean;
|
|
233
|
+
disableConferenceButton?: boolean;
|
|
234
|
+
disabled?: any;
|
|
235
|
+
enabled?: any;
|
|
236
|
+
outlined?: any;
|
|
237
|
+
}
|
|
945
238
|
|
|
946
239
|
/**
|
|
947
|
-
*
|
|
240
|
+
* 🎭 Call Control Panel Props Interface
|
|
948
241
|
*
|
|
949
242
|
* @interface CallControlPanelProps
|
|
950
|
-
* @description
|
|
951
|
-
*
|
|
243
|
+
* @description Props interface for the CallControlPanel component.
|
|
244
|
+
* Defines the properties passed to the call control panel.
|
|
952
245
|
*
|
|
953
246
|
* @properties
|
|
954
|
-
* - `onDataChange?:
|
|
955
|
-
*
|
|
956
|
-
* @example
|
|
957
|
-
* ```tsx
|
|
958
|
-
* <CallControlPanel
|
|
959
|
-
* onDataChange={(callData) => {
|
|
960
|
-
* console.log('Call status changed:', callData.status);
|
|
961
|
-
* // Handle call data updates
|
|
962
|
-
* }}
|
|
963
|
-
* />
|
|
964
|
-
* ```
|
|
247
|
+
* - `onDataChange?: (data: CallData) => void` - Callback for call data changes
|
|
965
248
|
*
|
|
966
249
|
* @since 1.0.0
|
|
967
250
|
* @author CTI SDK Team
|
|
968
251
|
*/
|
|
969
252
|
interface CallControlPanelProps {
|
|
970
|
-
|
|
971
|
-
onDataChange?: DataChangeCallback;
|
|
253
|
+
onDataChange?: (data: CallData) => void;
|
|
972
254
|
}
|
|
973
255
|
|
|
256
|
+
// =============================================================================
|
|
257
|
+
// 🔧 HOOK EXPORTS
|
|
258
|
+
// =============================================================================
|
|
259
|
+
|
|
974
260
|
/**
|
|
975
|
-
*
|
|
261
|
+
* 🚪 Logout Hook
|
|
976
262
|
*
|
|
977
|
-
* @
|
|
978
|
-
* @description
|
|
979
|
-
*
|
|
263
|
+
* @function useLogout
|
|
264
|
+
* @description Custom hook for handling agent logout functionality.
|
|
265
|
+
* Provides logout functionality with proper cleanup and state management.
|
|
980
266
|
*
|
|
981
|
-
* @
|
|
982
|
-
* @returns {JSX.Element} React component element
|
|
267
|
+
* @returns {Function} Logout function
|
|
983
268
|
*
|
|
984
269
|
* @example
|
|
985
270
|
* ```typescript
|
|
986
|
-
* const
|
|
987
|
-
*
|
|
988
|
-
* });
|
|
271
|
+
* const logout = useLogout();
|
|
272
|
+
* logout();
|
|
989
273
|
* ```
|
|
990
274
|
*
|
|
991
275
|
* @since 1.0.0
|
|
992
276
|
* @author CTI SDK Team
|
|
993
277
|
*/
|
|
994
|
-
|
|
995
|
-
type CallControlPanelComponent = React.MemoExoticComponent<
|
|
996
|
-
(props: CallControlPanelProps) => React.ReactElement
|
|
997
|
-
>;
|
|
278
|
+
declare function useLogout(): () => void;
|
|
998
279
|
|
|
999
280
|
/**
|
|
1000
|
-
*
|
|
281
|
+
* 🔚 End Call Hook
|
|
1001
282
|
*
|
|
1002
|
-
* @function
|
|
1003
|
-
* @description
|
|
1004
|
-
*
|
|
283
|
+
* @function useEndCall
|
|
284
|
+
* @description Custom hook for handling call termination functionality.
|
|
285
|
+
* Provides end call functionality with proper state management and cleanup.
|
|
1005
286
|
*
|
|
1006
|
-
* @
|
|
1007
|
-
* @returns {JSX.Element} React component providing complete call control interface
|
|
287
|
+
* @returns {Function} End call function
|
|
1008
288
|
*
|
|
1009
289
|
* @example
|
|
1010
|
-
* ```
|
|
1011
|
-
*
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
* // With data change callback
|
|
1015
|
-
* <CallControlPanel
|
|
1016
|
-
* onDataChange={(callData) => {
|
|
1017
|
-
* console.log('Call data updated:', callData);
|
|
1018
|
-
* // Handle call data changes
|
|
1019
|
-
* }}
|
|
1020
|
-
* />
|
|
290
|
+
* ```typescript
|
|
291
|
+
* const endCall = useEndCall();
|
|
292
|
+
* endCall();
|
|
1021
293
|
* ```
|
|
1022
294
|
*
|
|
1023
|
-
* @
|
|
1024
|
-
*
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
295
|
+
* @since 1.0.0
|
|
296
|
+
* @author CTI SDK Team
|
|
297
|
+
*/
|
|
298
|
+
declare function useEndCall(): () => void;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* 📞 Click to Call Hook
|
|
302
|
+
*
|
|
303
|
+
* @function useClickToCall
|
|
304
|
+
* @description Custom hook for handling click-to-call functionality.
|
|
305
|
+
* Provides dialing functionality with proper state management and error handling.
|
|
1031
306
|
*
|
|
1032
|
-
* @
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
*
|
|
1036
|
-
*
|
|
1037
|
-
*
|
|
307
|
+
* @returns {Function} Click to call function
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* const clickToCall = useClickToCall();
|
|
312
|
+
* clickToCall("1234567890");
|
|
313
|
+
* ```
|
|
1038
314
|
*
|
|
1039
315
|
* @since 1.0.0
|
|
1040
316
|
* @author CTI SDK Team
|
|
1041
317
|
*/
|
|
1042
|
-
declare
|
|
1043
|
-
|
|
1044
|
-
/**
|
|
1045
|
-
* @fileoverview Call Control SDK - Main Entry Point
|
|
1046
|
-
* @description Comprehensive CTI (Computer Telephony Integration) SDK for React applications.
|
|
1047
|
-
* Provides complete call control functionality including dialing, conferencing, transferring,
|
|
1048
|
-
* and real-time call management with WebSocket integration.
|
|
1049
|
-
*
|
|
1050
|
-
* @author Achala IT Solutions
|
|
1051
|
-
* @version 1.0.0
|
|
1052
|
-
* @since 2024
|
|
1053
|
-
*/
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
* @interface InitSDKParams
|
|
1057
|
-
* @description Parameters required for SDK initialization
|
|
1058
|
-
*
|
|
1059
|
-
* @declaration
|
|
1060
|
-
* ```typescript
|
|
1061
|
-
* interface InitSDKParams {
|
|
1062
|
-
* apiKey: string;
|
|
1063
|
-
* tenantId: string;
|
|
1064
|
-
* agentId: string;
|
|
1065
|
-
* sdkConfig?: SDKConfig;
|
|
1066
|
-
* }
|
|
1067
|
-
* ```
|
|
1068
|
-
*
|
|
1069
|
-
* @requiredParams
|
|
1070
|
-
* - `apiKey: string` - Authentication key for SDK access
|
|
1071
|
-
* - `tenantId: string` - Tenant identifier for multi-tenancy support
|
|
1072
|
-
* - `agentId: string` - Agent identifier for call management
|
|
1073
|
-
*
|
|
1074
|
-
* @returnType Interface definition
|
|
1075
|
-
*
|
|
1076
|
-
* @example
|
|
1077
|
-
* ```typescript
|
|
1078
|
-
* const initParams: InitSDKParams = {
|
|
1079
|
-
* apiKey: "your-api-key",
|
|
1080
|
-
* tenantId: "tenant-123",
|
|
1081
|
-
* agentId: "agent-456",
|
|
1082
|
-
* sdkConfig: {
|
|
1083
|
-
* isDraggable: true,
|
|
1084
|
-
* disableSoftPhone: false
|
|
1085
|
-
* }
|
|
1086
|
-
* };
|
|
1087
|
-
* ```
|
|
1088
|
-
*
|
|
1089
|
-
* @return Interface definition for SDK initialization parameters
|
|
1090
|
-
*
|
|
1091
|
-
* @conclusion Essential interface for proper SDK initialization with all required parameters.
|
|
1092
|
-
*/
|
|
1093
|
-
interface InitSDKParams {
|
|
1094
|
-
/** Authentication key for SDK access */
|
|
1095
|
-
apiKey: string;
|
|
1096
|
-
/** Tenant identifier for multi-tenancy support */
|
|
1097
|
-
tenantId: string;
|
|
1098
|
-
/** Agent identifier for call management */
|
|
1099
|
-
agentId: string;
|
|
1100
|
-
/** Optional SDK configuration for customizing behavior */
|
|
1101
|
-
sdkConfig?: SDKConfig;
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* @function initSDK
|
|
1105
|
-
* @description Initializes the Call Control SDK with authentication credentials and configuration.
|
|
1106
|
-
* Sets up event tracking, state management, and establishes connection to the CTI system.
|
|
1107
|
-
*
|
|
1108
|
-
* @declaration
|
|
1109
|
-
* ```typescript
|
|
1110
|
-
* function initSDK(params: InitSDKParams): Promise<void>
|
|
1111
|
-
* ```
|
|
1112
|
-
*
|
|
1113
|
-
* @requiredParams
|
|
1114
|
-
* - `params: InitSDKParams` - Object containing API key, tenant ID, agent ID, and optional config
|
|
1115
|
-
*
|
|
1116
|
-
* @returnType `Promise<void>`
|
|
1117
|
-
*
|
|
1118
|
-
* @example
|
|
1119
|
-
* ```typescript
|
|
1120
|
-
* // Basic initialization
|
|
1121
|
-
* await initSDK({
|
|
1122
|
-
* apiKey: "your-api-key",
|
|
1123
|
-
* tenantId: "tenant-123",
|
|
1124
|
-
* agentId: "agent-456"
|
|
1125
|
-
* });
|
|
1126
|
-
*
|
|
1127
|
-
* // With custom configuration
|
|
1128
|
-
* await initSDK({
|
|
1129
|
-
* apiKey: "your-api-key",
|
|
1130
|
-
* tenantId: "tenant-123",
|
|
1131
|
-
* agentId: "agent-456",
|
|
1132
|
-
* sdkConfig: {
|
|
1133
|
-
* isDraggable: true,
|
|
1134
|
-
* disableSoftPhone: false,
|
|
1135
|
-
* disableEndCallButton: false
|
|
1136
|
-
* }
|
|
1137
|
-
* });
|
|
1138
|
-
* ```
|
|
1139
|
-
*
|
|
1140
|
-
* @return Promise that resolves when initialization is complete
|
|
1141
|
-
*
|
|
1142
|
-
* @throws {Error} When API key is missing or invalid
|
|
1143
|
-
* @throws {Error} When tenant ID is missing or invalid
|
|
1144
|
-
* @throws {Error} When agent ID is missing or invalid
|
|
1145
|
-
* @throws {Error} When initialization fails due to network or authentication issues
|
|
1146
|
-
*
|
|
1147
|
-
* @conclusion Critical function that must be called before using any SDK functionality.
|
|
1148
|
-
*/
|
|
1149
|
-
declare function initSDK({ apiKey, tenantId, agentId, sdkConfig, }: InitSDKParams): Promise<void>;
|
|
1150
|
-
/**
|
|
1151
|
-
* @function getSDKVersion
|
|
1152
|
-
* @description Returns the current version of the Call Control SDK
|
|
1153
|
-
*
|
|
1154
|
-
* @declaration
|
|
1155
|
-
* ```typescript
|
|
1156
|
-
* function getSDKVersion(): string
|
|
1157
|
-
* ```
|
|
1158
|
-
*
|
|
1159
|
-
* @requiredParams None
|
|
1160
|
-
*
|
|
1161
|
-
* @returnType `string`
|
|
1162
|
-
*
|
|
1163
|
-
* @example
|
|
1164
|
-
* ```typescript
|
|
1165
|
-
* const version = getSDKVersion();
|
|
1166
|
-
* console.log(`Using Call Control SDK version: ${version}`);
|
|
1167
|
-
* ```
|
|
1168
|
-
*
|
|
1169
|
-
* @return Current SDK version string
|
|
1170
|
-
*
|
|
1171
|
-
* @conclusion Utility function for version checking and debugging purposes.
|
|
1172
|
-
*/
|
|
1173
|
-
declare function getSDKVersion(): string;
|
|
1174
|
-
/**
|
|
1175
|
-
* @function isSDKInitialized
|
|
1176
|
-
* @description Checks if the SDK has been successfully initialized
|
|
1177
|
-
*
|
|
1178
|
-
* @declaration
|
|
1179
|
-
* ```typescript
|
|
1180
|
-
* function isSDKInitialized(): boolean
|
|
1181
|
-
* ```
|
|
1182
|
-
*
|
|
1183
|
-
* @requiredParams None
|
|
1184
|
-
*
|
|
1185
|
-
* @returnType `boolean`
|
|
1186
|
-
*
|
|
1187
|
-
* @example
|
|
1188
|
-
* ```typescript
|
|
1189
|
-
* if (isSDKInitialized()) {
|
|
1190
|
-
* // SDK is ready to use
|
|
1191
|
-
* console.log("SDK is initialized and ready");
|
|
1192
|
-
* } else {
|
|
1193
|
-
* console.log("SDK needs to be initialized first");
|
|
1194
|
-
* }
|
|
1195
|
-
* ```
|
|
1196
|
-
*
|
|
1197
|
-
* @return True if SDK is initialized, false otherwise
|
|
1198
|
-
*
|
|
1199
|
-
* @conclusion Utility function for checking SDK initialization status before using features.
|
|
1200
|
-
*/
|
|
1201
|
-
declare function isSDKInitialized(): boolean;
|
|
318
|
+
declare function useClickToCall(): (phoneNumber: string) => void;
|
|
1202
319
|
|
|
1203
|
-
export { CallControlPanel, type CallControlPanelProps
|
|
320
|
+
export { CallControlPanel, type CallControlPanelProps, type CallData, type InitSDKParams, type SDKConfig, getSDKVersion, initSDK, isSDKInitialized, useClickToCall, useEndCall, useLogout };
|