call-control-sdk 6.0.7 → 6.0.8
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 -1064
- package/dist/index.d.ts +179 -1064
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,1203 +1,318 @@
|
|
|
1
|
-
import { SxProps } from '@mui/material';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 🚪 Logout Function Type
|
|
6
|
-
*
|
|
7
|
-
* @type LogoutFunction
|
|
8
|
-
* @description 🎯 Type definition for the logout function
|
|
9
|
-
* Handles secure agent logout with comprehensive cleanup procedures
|
|
10
|
-
*
|
|
11
|
-
* @returns {Promise<any>} Promise that resolves with API response data or rejects with error
|
|
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
1
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
34
|
-
* @
|
|
2
|
+
* @fileoverview 📦 TypeScript Declaration File for Call Control SDK
|
|
3
|
+
* @description Comprehensive CTI (Computer Telephony Integration) SDK for React applications.
|
|
4
|
+
* Provides complete call control functionality including dialing, conferencing, transferring,
|
|
5
|
+
* and real-time call management with WebSocket integration.
|
|
6
|
+
*
|
|
7
|
+
* @author Achala IT Solutions
|
|
8
|
+
* @version 6.0.7
|
|
9
|
+
* @since 2024
|
|
35
10
|
*/
|
|
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
11
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
};
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// 🎯 MAIN SDK FUNCTIONS
|
|
14
|
+
// =============================================================================
|
|
72
15
|
|
|
73
16
|
/**
|
|
74
|
-
*
|
|
17
|
+
* 🚀 SDK Initialization Parameters Interface
|
|
75
18
|
*
|
|
76
|
-
* @interface
|
|
77
|
-
* @description
|
|
78
|
-
* Contains all functions and state for logout functionality
|
|
19
|
+
* @interface InitSDKParams
|
|
20
|
+
* @description Parameters required for SDK initialization
|
|
79
21
|
*
|
|
80
22
|
* @properties
|
|
81
|
-
* - `
|
|
82
|
-
* - `
|
|
83
|
-
* - `
|
|
84
|
-
* - `
|
|
85
|
-
* - `error: any` - 🛡️ Error object when logout fails
|
|
86
|
-
* - `data: any` - 📊 Response data from successful logout
|
|
23
|
+
* - `apiKey: string` - Authentication key for SDK access
|
|
24
|
+
* - `tenantId: string` - Tenant identifier for multi-tenancy support
|
|
25
|
+
* - `agentId: string` - Agent identifier for call management
|
|
26
|
+
* - `sdkConfig?: SDKConfig` - Optional SDK configuration for customizing behavior
|
|
87
27
|
*
|
|
88
28
|
* @example
|
|
89
29
|
* ```typescript
|
|
90
|
-
* const
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* } = hookReturn;
|
|
99
|
-
*
|
|
100
|
-
* // Use the hook functionality
|
|
30
|
+
* const initParams: InitSDKParams = {
|
|
31
|
+
* apiKey: "your-api-key",
|
|
32
|
+
* tenantId: "tenant-123",
|
|
33
|
+
* agentId: "agent-456",
|
|
34
|
+
* sdkConfig: {
|
|
35
|
+
* isDraggable: true,
|
|
36
|
+
* disableSoftPhone: false
|
|
37
|
+
* }
|
|
101
38
|
* };
|
|
102
39
|
* ```
|
|
103
40
|
*
|
|
104
41
|
* @since 1.0.0
|
|
105
42
|
* @author CTI SDK Team
|
|
106
43
|
*/
|
|
107
|
-
interface
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
44
|
+
interface InitSDKParams {
|
|
45
|
+
/** Authentication key for SDK access */
|
|
46
|
+
apiKey: string;
|
|
47
|
+
/** Tenant identifier for multi-tenancy support */
|
|
48
|
+
tenantId: string;
|
|
49
|
+
/** Agent identifier for call management */
|
|
50
|
+
agentId: string;
|
|
51
|
+
/** Optional SDK configuration for customizing behavior */
|
|
52
|
+
sdkConfig?: SDKConfig;
|
|
114
53
|
}
|
|
115
54
|
|
|
116
55
|
/**
|
|
117
|
-
*
|
|
56
|
+
* 🚀 Initialize the Call Control SDK
|
|
118
57
|
*
|
|
119
|
-
* @function
|
|
120
|
-
* @description
|
|
121
|
-
*
|
|
122
|
-
* and storage management with intelligent error handling and proper cleanup.
|
|
58
|
+
* @function initSDK
|
|
59
|
+
* @description Initializes the Call Control SDK with authentication credentials and configuration.
|
|
60
|
+
* Sets up event tracking, state management, and establishes connection to the CTI system.
|
|
123
61
|
*
|
|
124
|
-
* @
|
|
125
|
-
*
|
|
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
|
|
62
|
+
* @param {InitSDKParams} params - Object containing API key, tenant ID, agent ID, and optional config
|
|
63
|
+
* @returns {Promise<void>} Promise that resolves when initialization is complete
|
|
131
64
|
*
|
|
132
65
|
* @example
|
|
133
66
|
* ```typescript
|
|
134
|
-
* // Basic
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
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
|
|
292
|
-
*/
|
|
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
|
-
|
|
308
|
-
/**
|
|
309
|
-
* ❌ Error state indicator
|
|
310
|
-
* @description Boolean flag indicating if the last call termination encountered an error
|
|
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
|
-
};
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* 📞 useEndCall Hook Return Type
|
|
332
|
-
*
|
|
333
|
-
* @interface UseEndCallReturn
|
|
334
|
-
* @description 🎯 Complete return type for the useEndCall hook
|
|
335
|
-
* Contains all functions and state for call termination functionality
|
|
336
|
-
*
|
|
337
|
-
* @properties
|
|
338
|
-
* - `handleEndCall: CallTerminationFunction` - 📞 Call termination function
|
|
339
|
-
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
340
|
-
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
341
|
-
* - `isError: boolean` - ❌ Error state indicator
|
|
342
|
-
* - `error: any` - 🛡️ Error object when call fails
|
|
343
|
-
* - `data: any` - 📊 Response data from successful calls
|
|
344
|
-
*
|
|
345
|
-
* @example
|
|
346
|
-
* ```typescript
|
|
347
|
-
* const EndCallButton = () => {
|
|
348
|
-
* const hookReturn: UseEndCallReturn = useEndCall();
|
|
349
|
-
* const {
|
|
350
|
-
* handleEndCall,
|
|
351
|
-
* isLoading,
|
|
352
|
-
* isSuccess,
|
|
353
|
-
* isError,
|
|
354
|
-
* error
|
|
355
|
-
* } = hookReturn;
|
|
356
|
-
*
|
|
357
|
-
* // Use the hook functionality
|
|
358
|
-
* };
|
|
359
|
-
* ```
|
|
360
|
-
*
|
|
361
|
-
* @since 1.0.0
|
|
362
|
-
* @author CTI SDK Team
|
|
363
|
-
*/
|
|
364
|
-
interface UseEndCallReturn extends HookStateTypes$1 {
|
|
365
|
-
/**
|
|
366
|
-
* 📞 Call termination function
|
|
367
|
-
* @description Handles call termination with disposition tracking and callback scheduling
|
|
368
|
-
* @type {CallTerminationFunction}
|
|
369
|
-
*/
|
|
370
|
-
handleEndCall: CallTerminationFunction;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* 📞 End Call Custom Hook
|
|
375
|
-
*
|
|
376
|
-
* @function useEndCall
|
|
377
|
-
* @description 🎯 Custom React hook that provides comprehensive call termination functionality
|
|
378
|
-
* for the CTI SDK. It handles call disposition capture, callback scheduling,
|
|
379
|
-
* and proper call cleanup with intelligent state management and error handling.
|
|
380
|
-
*
|
|
381
|
-
* @returns {UseEndCallReturn} Hook return object containing:
|
|
382
|
-
* - `handleEndCall: CallTerminationFunction` - 📞 Call termination function
|
|
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
|
|
388
|
-
*
|
|
389
|
-
* @example
|
|
390
|
-
* ```typescript
|
|
391
|
-
* // Basic usage in a component
|
|
392
|
-
* const EndCallButton = () => {
|
|
393
|
-
* const {
|
|
394
|
-
* handleEndCall,
|
|
395
|
-
* isLoading,
|
|
396
|
-
* isSuccess,
|
|
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
|
-
* };
|
|
67
|
+
* // Basic initialization
|
|
68
|
+
* await initSDK({
|
|
69
|
+
* apiKey: "your-api-key",
|
|
70
|
+
* tenantId: "tenant-123",
|
|
71
|
+
* agentId: "agent-456"
|
|
72
|
+
* });
|
|
412
73
|
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
74
|
+
* // With custom configuration
|
|
75
|
+
* await initSDK({
|
|
76
|
+
* apiKey: "your-api-key",
|
|
77
|
+
* tenantId: "tenant-123",
|
|
78
|
+
* agentId: "agent-456",
|
|
79
|
+
* sdkConfig: {
|
|
80
|
+
* isDraggable: true,
|
|
81
|
+
* disableSoftPhone: false,
|
|
82
|
+
* disableEndCallButton: false
|
|
83
|
+
* }
|
|
84
|
+
* });
|
|
422
85
|
* ```
|
|
423
86
|
*
|
|
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
|
|
87
|
+
* @throws {Error} When API key is missing or invalid
|
|
88
|
+
* @throws {Error} When tenant ID is missing or invalid
|
|
89
|
+
* @throws {Error} When agent ID is missing or invalid
|
|
90
|
+
* @throws {Error} When initialization fails due to network or authentication issues
|
|
440
91
|
*
|
|
441
92
|
* @since 1.0.0
|
|
442
93
|
* @author CTI SDK Team
|
|
443
94
|
*/
|
|
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
|
-
*/
|
|
95
|
+
declare function initSDK(params: InitSDKParams): Promise<void>;
|
|
624
96
|
|
|
625
97
|
/**
|
|
626
|
-
*
|
|
98
|
+
* 📋 Get SDK Version
|
|
627
99
|
*
|
|
628
|
-
* @
|
|
629
|
-
* @description
|
|
630
|
-
* Contains the mobile number required to initiate a call
|
|
100
|
+
* @function getSDKVersion
|
|
101
|
+
* @description Returns the current version of the Call Control SDK
|
|
631
102
|
*
|
|
632
|
-
* @
|
|
633
|
-
* - `mobileNumber: string` - 📱 The phone number to call (required)
|
|
103
|
+
* @returns {string} Current SDK version string
|
|
634
104
|
*
|
|
635
105
|
* @example
|
|
636
106
|
* ```typescript
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
* mobileNumber: "1234567890"
|
|
640
|
-
* };
|
|
641
|
-
*
|
|
642
|
-
* // Usage in component
|
|
643
|
-
* const { handleStartCall } = useClickToCall();
|
|
644
|
-
* await handleStartCall({ mobileNumber: "9876543210" });
|
|
107
|
+
* const version = getSDKVersion();
|
|
108
|
+
* console.log(`Using Call Control SDK version: ${version}`);
|
|
645
109
|
* ```
|
|
646
110
|
*
|
|
647
111
|
* @since 1.0.0
|
|
648
112
|
* @author CTI SDK Team
|
|
649
113
|
*/
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* 📱 Phone number to call
|
|
653
|
-
* @description The mobile number that will be called
|
|
654
|
-
* @type {string}
|
|
655
|
-
*/
|
|
656
|
-
mobileNumber: string;
|
|
657
|
-
}
|
|
114
|
+
declare function getSDKVersion(): string;
|
|
658
115
|
|
|
659
116
|
/**
|
|
660
|
-
*
|
|
117
|
+
* ✅ Check SDK Initialization Status
|
|
661
118
|
*
|
|
662
|
-
* @
|
|
663
|
-
* @description
|
|
664
|
-
* Handles both regular calls and conference calls based on agent state
|
|
119
|
+
* @function isSDKInitialized
|
|
120
|
+
* @description Checks if the SDK has been successfully initialized
|
|
665
121
|
*
|
|
666
|
-
* @
|
|
667
|
-
* @returns {Promise<any>} Promise that resolves with API response data or rejects with error
|
|
122
|
+
* @returns {boolean} True if SDK is initialized, false otherwise
|
|
668
123
|
*
|
|
669
124
|
* @example
|
|
670
125
|
* ```typescript
|
|
671
|
-
*
|
|
672
|
-
* //
|
|
673
|
-
*
|
|
674
|
-
* }
|
|
126
|
+
* if (isSDKInitialized()) {
|
|
127
|
+
* // SDK is ready to use
|
|
128
|
+
* console.log("SDK is initialized and ready");
|
|
129
|
+
* } else {
|
|
130
|
+
* console.log("SDK needs to be initialized first");
|
|
131
|
+
* }
|
|
675
132
|
* ```
|
|
676
133
|
*
|
|
677
134
|
* @since 1.0.0
|
|
678
135
|
* @author CTI SDK Team
|
|
679
136
|
*/
|
|
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;
|
|
137
|
+
declare function isSDKInitialized(): boolean;
|
|
713
138
|
|
|
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
|
-
};
|
|
139
|
+
// =============================================================================
|
|
140
|
+
// 🎭 COMPONENT EXPORTS
|
|
141
|
+
// =============================================================================
|
|
728
142
|
|
|
729
143
|
/**
|
|
730
|
-
*
|
|
144
|
+
* 🎭 Call Control Panel Component
|
|
731
145
|
*
|
|
732
|
-
* @
|
|
733
|
-
* @description
|
|
734
|
-
*
|
|
146
|
+
* @component CallControlPanel
|
|
147
|
+
* @description Main call control panel component for the CTI SDK.
|
|
148
|
+
* Provides comprehensive call management interface with all necessary controls.
|
|
735
149
|
*
|
|
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
|
|
150
|
+
* @param {CallControlPanelProps} props - Component props
|
|
151
|
+
* @returns {JSX.Element} Call control panel interface
|
|
743
152
|
*
|
|
744
153
|
* @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
|
-
* };
|
|
154
|
+
* ```tsx
|
|
155
|
+
* <CallControlPanel onDataChange={handleDataChange} />
|
|
758
156
|
* ```
|
|
759
157
|
*
|
|
760
158
|
* @since 1.0.0
|
|
761
159
|
* @author CTI SDK Team
|
|
762
160
|
*/
|
|
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
|
-
}
|
|
161
|
+
declare const CallControlPanel: React.ComponentType<CallControlPanelProps>;
|
|
771
162
|
|
|
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
|
-
*/
|
|
163
|
+
// =============================================================================
|
|
164
|
+
// 🗃️ TYPE EXPORTS
|
|
165
|
+
// =============================================================================
|
|
862
166
|
|
|
863
167
|
/**
|
|
864
168
|
* 📞 Call Data Interface
|
|
865
169
|
*
|
|
866
170
|
* @interface CallData
|
|
867
|
-
* @description
|
|
868
|
-
*
|
|
171
|
+
* @description Comprehensive interface defining call-related data structure for CTI operations.
|
|
172
|
+
* Contains all necessary information about active calls, including metadata, status, and references.
|
|
869
173
|
*
|
|
870
174
|
* @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
|
-
* ```
|
|
175
|
+
* - `mobileNumber?: string` - Mobile number of the caller or callee
|
|
176
|
+
* - `callReferenceId?: string` - Unique reference identifier for the call
|
|
177
|
+
* - `convoxId?: string` - Convox system identifier for the call
|
|
178
|
+
* - `type?: string` - Type of call (inbound, outbound, internal, etc.)
|
|
179
|
+
* - `status?: string` - Current status of the call (ONCALL, RINGING, WRAPUP, etc.)
|
|
180
|
+
* - `agent_id?: string` - Agent identifier associated with the call
|
|
181
|
+
* - `phone_number?: string` - Phone number involved in the call
|
|
182
|
+
* - `event_time?: string` - Timestamp when the call event occurred
|
|
183
|
+
* - `convox_id?: string` - Convox system call ID
|
|
184
|
+
* - `process_id?: string` - Process identifier for the call
|
|
185
|
+
* - `process_name?: string` - Name of the process handling the call
|
|
894
186
|
*
|
|
895
187
|
* @since 1.0.0
|
|
896
188
|
* @author CTI SDK Team
|
|
897
189
|
*/
|
|
898
190
|
interface CallData {
|
|
899
|
-
/** Mobile number of the caller or callee */
|
|
900
191
|
mobileNumber?: string;
|
|
901
|
-
/** Unique reference identifier for the call */
|
|
902
192
|
callReferenceId?: string;
|
|
903
|
-
/** Convox system identifier for the call */
|
|
904
193
|
convoxId?: string;
|
|
905
|
-
/** Type of call (inbound, outbound, internal, etc.) */
|
|
906
194
|
type?: string;
|
|
907
|
-
/** Current status of the call (ONCALL, RINGING, WRAPUP, etc.) */
|
|
908
195
|
status?: string;
|
|
909
|
-
/** Agent identifier associated with the call */
|
|
910
196
|
agent_id?: string;
|
|
911
|
-
/** Phone number involved in the call */
|
|
912
197
|
phone_number?: string;
|
|
913
|
-
/** Timestamp when the call event occurred */
|
|
914
198
|
event_time?: string;
|
|
915
|
-
/** Convox system call ID */
|
|
916
199
|
convox_id?: string;
|
|
917
|
-
/** Process identifier for the call */
|
|
918
200
|
process_id?: string;
|
|
919
|
-
/** Name of the process handling the call */
|
|
920
201
|
process_name?: string;
|
|
921
202
|
}
|
|
922
203
|
|
|
923
204
|
/**
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
* @type DataChangeCallback
|
|
927
|
-
* @description 🎯 Type definition for data change callback function
|
|
928
|
-
* Called whenever call data changes in the component
|
|
205
|
+
* ⚙️ SDK Configuration Interface
|
|
929
206
|
*
|
|
930
|
-
* @
|
|
931
|
-
* @
|
|
207
|
+
* @interface SDKConfig
|
|
208
|
+
* @description Configuration interface for customizing the Call Control SDK behavior.
|
|
209
|
+
* Allows disabling specific features and customizing the visual appearance of components.
|
|
932
210
|
*
|
|
933
|
-
* @
|
|
934
|
-
*
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
939
|
-
*
|
|
211
|
+
* @properties
|
|
212
|
+
* - `disableEndCallButton?: boolean` - Whether to disable the end call button
|
|
213
|
+
* - `disabledDialButton?: boolean` - Whether to disable the dial button
|
|
214
|
+
* - `disableCallTransferButton?: boolean` - Whether to disable the call transfer button
|
|
215
|
+
* - `isDraggable?: boolean` - Whether the control panel should be draggable
|
|
216
|
+
* - `disableSoftPhone?: boolean` - Whether to disable the soft phone iframe
|
|
217
|
+
* - `disableConferenceButton?: boolean` - Whether to disable the conference button
|
|
218
|
+
* - `disabled?: SxProps` - Custom styles for disabled button states
|
|
219
|
+
* - `enabled?: SxProps` - Custom styles for enabled button states
|
|
220
|
+
* - `outlined?: SxProps` - Custom styles for outlined button states
|
|
940
221
|
*
|
|
941
222
|
* @since 1.0.0
|
|
942
223
|
* @author CTI SDK Team
|
|
943
224
|
*/
|
|
944
|
-
|
|
225
|
+
interface SDKConfig {
|
|
226
|
+
disableEndCallButton?: boolean;
|
|
227
|
+
disabledDialButton?: boolean;
|
|
228
|
+
disableCallTransferButton?: boolean;
|
|
229
|
+
isDraggable?: boolean;
|
|
230
|
+
disableSoftPhone?: boolean;
|
|
231
|
+
disableConferenceButton?: boolean;
|
|
232
|
+
disabled?: any;
|
|
233
|
+
enabled?: any;
|
|
234
|
+
outlined?: any;
|
|
235
|
+
}
|
|
945
236
|
|
|
946
237
|
/**
|
|
947
|
-
*
|
|
238
|
+
* 🎭 Call Control Panel Props Interface
|
|
948
239
|
*
|
|
949
240
|
* @interface CallControlPanelProps
|
|
950
|
-
* @description
|
|
951
|
-
*
|
|
241
|
+
* @description Props interface for the CallControlPanel component.
|
|
242
|
+
* Defines the properties passed to the call control panel.
|
|
952
243
|
*
|
|
953
244
|
* @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
|
-
* ```
|
|
245
|
+
* - `onDataChange?: (data: CallData) => void` - Callback for call data changes
|
|
965
246
|
*
|
|
966
247
|
* @since 1.0.0
|
|
967
248
|
* @author CTI SDK Team
|
|
968
249
|
*/
|
|
969
250
|
interface CallControlPanelProps {
|
|
970
|
-
|
|
971
|
-
onDataChange?: DataChangeCallback;
|
|
251
|
+
onDataChange?: (data: CallData) => void;
|
|
972
252
|
}
|
|
973
253
|
|
|
254
|
+
// =============================================================================
|
|
255
|
+
// 🔧 HOOK EXPORTS
|
|
256
|
+
// =============================================================================
|
|
257
|
+
|
|
974
258
|
/**
|
|
975
|
-
*
|
|
259
|
+
* 🚪 Logout Hook
|
|
976
260
|
*
|
|
977
|
-
* @
|
|
978
|
-
* @description
|
|
979
|
-
*
|
|
261
|
+
* @function useLogout
|
|
262
|
+
* @description Custom hook for handling agent logout functionality.
|
|
263
|
+
* Provides logout functionality with proper cleanup and state management.
|
|
980
264
|
*
|
|
981
|
-
* @
|
|
982
|
-
* @returns {JSX.Element} React component element
|
|
265
|
+
* @returns {Function} Logout function
|
|
983
266
|
*
|
|
984
267
|
* @example
|
|
985
268
|
* ```typescript
|
|
986
|
-
* const
|
|
987
|
-
*
|
|
988
|
-
* });
|
|
269
|
+
* const logout = useLogout();
|
|
270
|
+
* logout();
|
|
989
271
|
* ```
|
|
990
272
|
*
|
|
991
273
|
* @since 1.0.0
|
|
992
274
|
* @author CTI SDK Team
|
|
993
275
|
*/
|
|
994
|
-
|
|
995
|
-
type CallControlPanelComponent = React.MemoExoticComponent<
|
|
996
|
-
(props: CallControlPanelProps) => React.ReactElement
|
|
997
|
-
>;
|
|
276
|
+
declare function useLogout(): () => void;
|
|
998
277
|
|
|
999
278
|
/**
|
|
1000
|
-
*
|
|
279
|
+
* 🔚 End Call Hook
|
|
1001
280
|
*
|
|
1002
|
-
* @function
|
|
1003
|
-
* @description
|
|
1004
|
-
*
|
|
281
|
+
* @function useEndCall
|
|
282
|
+
* @description Custom hook for handling call termination functionality.
|
|
283
|
+
* Provides end call functionality with proper state management and cleanup.
|
|
1005
284
|
*
|
|
1006
|
-
* @
|
|
1007
|
-
* @returns {JSX.Element} React component providing complete call control interface
|
|
285
|
+
* @returns {Function} End call function
|
|
1008
286
|
*
|
|
1009
287
|
* @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
|
-
* />
|
|
288
|
+
* ```typescript
|
|
289
|
+
* const endCall = useEndCall();
|
|
290
|
+
* endCall();
|
|
1021
291
|
* ```
|
|
1022
292
|
*
|
|
1023
|
-
* @
|
|
1024
|
-
*
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
293
|
+
* @since 1.0.0
|
|
294
|
+
* @author CTI SDK Team
|
|
295
|
+
*/
|
|
296
|
+
declare function useEndCall(): () => void;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* 📞 Click to Call Hook
|
|
300
|
+
*
|
|
301
|
+
* @function useClickToCall
|
|
302
|
+
* @description Custom hook for handling click-to-call functionality.
|
|
303
|
+
* Provides dialing functionality with proper state management and error handling.
|
|
1031
304
|
*
|
|
1032
|
-
* @
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
*
|
|
1036
|
-
*
|
|
1037
|
-
*
|
|
305
|
+
* @returns {Function} Click to call function
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* const clickToCall = useClickToCall();
|
|
310
|
+
* clickToCall("1234567890");
|
|
311
|
+
* ```
|
|
1038
312
|
*
|
|
1039
313
|
* @since 1.0.0
|
|
1040
314
|
* @author CTI SDK Team
|
|
1041
315
|
*/
|
|
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;
|
|
316
|
+
declare function useClickToCall(): (phoneNumber: string) => void;
|
|
1202
317
|
|
|
1203
|
-
export { CallControlPanel, type CallControlPanelProps
|
|
318
|
+
export { CallControlPanel, type CallControlPanelProps, type CallData, type InitSDKParams, type SDKConfig, getSDKVersion, initSDK, isSDKInitialized, useClickToCall, useEndCall, useLogout };
|