ahs-cti 0.0.2-beta.1

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.
@@ -0,0 +1,1782 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * @fileoverview 📦 TypeScript Declaration File for Call Control SDK
5
+ * @description Comprehensive CTI (Computer Telephony Integration) SDK for agent platform applications.
6
+ * Provides complete call control functionality including dialing, conferencing, transferring,
7
+ * and real-time call management with WebSocket integration.
8
+ *
9
+ * @author CTI SDK Team
10
+ * @version 6.x.x
11
+ * @since 2024
12
+ */
13
+
14
+ // =============================================================================
15
+ // 🎯 MAIN SDK FUNCTIONS
16
+ // =============================================================================
17
+
18
+ /**
19
+ * 🚀 SDK Initialization Parameters Interface
20
+ *
21
+ * @interface InitSDKParams
22
+ * @description Parameters required for SDK initialization
23
+ *
24
+ * @properties
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
29
+ *
30
+ * @example
31
+ * ```typescript
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
+ * }
40
+ * };
41
+ * ```
42
+ *
43
+ * @since 1.0.0
44
+ * @author CTI SDK Team
45
+ */
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;
55
+ }
56
+
57
+ /**
58
+ * 🚀 Initialize the Call Control SDK
59
+ *
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.
63
+ *
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
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * // Basic initialization
70
+ * await initSDK({
71
+ * apiKey: "your-api-key",
72
+ * tenantId: "tenant-123",
73
+ * agentId: "agent-456"
74
+ * });
75
+ *
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
+ * });
87
+ * ```
88
+ *
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
93
+ *
94
+ * @since 1.0.0
95
+ * @author CTI SDK Team
96
+ */
97
+ declare function initSDK(params: InitSDKParams): Promise<void>;
98
+
99
+ /**
100
+ * 📋 Get SDK Version
101
+ *
102
+ * @function getSDKVersion
103
+ * @description Returns the current version of the Call Control SDK
104
+ *
105
+ * @returns {string} Current SDK version string
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const version = getSDKVersion();
110
+ * console.log(`Using Call Control SDK version: ${version}`);
111
+ * ```
112
+ *
113
+ * @since 1.0.0
114
+ * @author CTI SDK Team
115
+ */
116
+ declare function getSDKVersion(): string;
117
+
118
+ /**
119
+ * ✅ Check SDK Initialization Status
120
+ *
121
+ * @function isSDKInitialized
122
+ * @description Checks if the SDK has been successfully initialized
123
+ *
124
+ * @returns {boolean} True if SDK is initialized, false otherwise
125
+ *
126
+ * @example
127
+ * ```typescript
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
+ * }
134
+ * ```
135
+ *
136
+ * @since 1.0.0
137
+ * @author CTI SDK Team
138
+ */
139
+ declare function isSDKInitialized(): boolean;
140
+
141
+ // =============================================================================
142
+ // 🎭 COMPONENT EXPORTS
143
+ // =============================================================================
144
+
145
+ /**
146
+ * 🎭 Call Control Panel Component
147
+ *
148
+ * @component CallControlPanel
149
+ * @description Main call control panel component for the CTI SDK.
150
+ * Provides comprehensive call management interface with all necessary controls.
151
+ *
152
+ * @param {CallControlPanelProps} props - Component props
153
+ * @returns {JSX.Element} Call control panel interface
154
+ *
155
+ * @example
156
+ * ```tsx
157
+ * <CallControlPanel onDataChange={handleDataChange} />
158
+ *
159
+ * <CallControlPanel onDataChange={(data) => {
160
+ * console.log('Call Data:', data);
161
+ * }} />
162
+ * ```
163
+ *
164
+ * @since 1.0.0
165
+ * @author CTI SDK Team
166
+ */
167
+ declare const CallControlPanel: React.ComponentType<CallControlPanelProps>;
168
+
169
+ // =============================================================================
170
+ // 🗃️ TYPE EXPORTS
171
+ // =============================================================================
172
+
173
+ /**
174
+ * 📞 Call Data Interface
175
+ *
176
+ * @interface CallData
177
+ * @description Comprehensive interface defining call-related data structure for CTI operations.
178
+ * Contains all necessary information about active calls, including metadata, status, and references.
179
+ *
180
+ * @properties
181
+ * - `callReferenceId?: string` - Unique reference identifier for the call
182
+ * - `status?: string` - Current status of the call (ONCALL, RINGING, WRAPUP, etc.)
183
+ * - `agent_id?: string` - Agent identifier associated with the call
184
+ * - `phone_number?: string` - Phone number involved in the call
185
+ * - `process_id?: string` - Process identifier for the call
186
+ * - `process_name?: string` - Name of the process handling the call
187
+ *
188
+ * @since 1.0.0
189
+ * @author CTI SDK Team
190
+ */
191
+ interface CallData {
192
+ callReferenceId?: string;
193
+ status?: string;
194
+ agent_id?: string;
195
+ phone_number?: string;
196
+ process_id?: string;
197
+ process_name?: string;
198
+ }
199
+
200
+ /**
201
+ * ⚙️ SDK Configuration Interface
202
+ *
203
+ * @interface SDKConfig
204
+ * @description Configuration interface for customizing the Call Control SDK behavior.
205
+ * Allows disabling specific features and customizing the visual appearance of components.
206
+ *
207
+ * @properties
208
+ * - `disableEndCallButton?: boolean` - Whether to disable the end call button
209
+ * - `disabledDialButton?: boolean` - Whether to disable the dial button
210
+ * - `disableCallTransferButton?: boolean` - Whether to disable the call transfer button
211
+ * - `isDraggable?: boolean` - Whether the control panel should be draggable
212
+ * - `disableSoftPhone?: boolean` - Whether to disable the soft phone iframe
213
+ * - `disableConferenceButton?: boolean` - Whether to disable the conference button
214
+ * - `disabled?: SxProps` - Custom styles for disabled button states
215
+ * - `enabled?: SxProps` - Custom styles for enabled button states
216
+ * - `outlined?: SxProps` - Custom styles for outlined button states
217
+ *
218
+ * @since 1.0.0
219
+ * @author CTI SDK Team
220
+ */
221
+ interface SDKConfig {
222
+ disableEndCallButton?: boolean;
223
+ disabledDialButton?: boolean;
224
+ enableSmsServices?: boolean;
225
+ enableQueueName?: boolean;
226
+ disableCallTransferButton?: boolean;
227
+ isDraggable?: boolean;
228
+ disableSoftPhone?: boolean;
229
+ disableConferenceButton?: boolean;
230
+ disabled?: any;
231
+ enabled?: any;
232
+ outlined?: any;
233
+ }
234
+
235
+ /**
236
+ * 🎭 Call Control Panel Props Interface
237
+ *
238
+ * @interface CallControlPanelProps
239
+ * @description Props interface for the CallControlPanel component.
240
+ * Defines the properties passed to the call control panel.
241
+ *
242
+ * @properties
243
+ * - `onDataChange?: (data: CallData) => void` - Callback for call data changes
244
+ *
245
+ * @since 1.0.0
246
+ * @author CTI SDK Team
247
+ */
248
+ interface CallControlPanelProps {
249
+ onDataChange?: (data: CallData) => void;
250
+ }
251
+
252
+ // =============================================================================
253
+ // 🔧 HOOK EXPORTS
254
+ // =============================================================================
255
+
256
+ /**
257
+ *
258
+ * This file contains TypeScript type definitions for the useEndCall custom hook
259
+ * and its related interfaces. It provides comprehensive type safety and IntelliSense
260
+ * support for developers using the CTI SDK call termination functionality.
261
+ *
262
+ * 🎯 Key Type Definitions:
263
+ * - 📞 EndCallPayload interface for call termination API data
264
+ * - 📞 useEndCall hook return type
265
+ * - 🔄 Call termination function signature
266
+ * - 📊 State management types
267
+ * - 📅 Callback scheduling types
268
+ *
269
+ * @author CTI SDK Team
270
+ * @version 6.x.x
271
+ * @since 1.0.0
272
+ */
273
+
274
+ /**
275
+ * 📞 End Call Payload Interface
276
+ *
277
+ * @interface EndCallPayload
278
+ * @description 📊 Defines the structure for call termination API payload data
279
+ * Contains all necessary information for ending a call with proper disposition
280
+ *
281
+ * @properties
282
+ * - `action: string` - 🎯 API action type ("ENDCALL")
283
+ * - `disposition: string` - 📝 Call outcome classification
284
+ * - `userId: string` - 👤 Agent identifier
285
+ * - `processid: string` - ⚙️ Process identifier
286
+ * - `mobile_number: string` - 📱 Customer phone number
287
+ * - `set_followUp: string` - 📅 Follow-up requirement ("Y" or "N")
288
+ * - `callback_date: string` - 📅 Scheduled callback date
289
+ * - `callback_hrs: string` - 🕐 Scheduled callback hour
290
+ * - `callback_mins: string` - 🕐 Scheduled callback minute
291
+ * - `refno?: string` - 🔗 Optional call reference number
292
+ *
293
+ * @example
294
+ * ```typescript
295
+ * // Basic end call payload
296
+ * const endCallPayload: EndCallPayload = {
297
+ * action: "ENDCALL",
298
+ * disposition: "RES",
299
+ * userId: "agent123",
300
+ * processid: "proc001",
301
+ * mobile_number: "1234567890",
302
+ * set_followUp: "N",
303
+ * callback_date: "",
304
+ * callback_hrs: "",
305
+ * callback_mins: ""
306
+ * };
307
+ *
308
+ * // With callback scheduling
309
+ * const endCallWithCallback: EndCallPayload = {
310
+ * action: "ENDCALL",
311
+ * disposition: "RES",
312
+ * userId: "agent123",
313
+ * processid: "proc001",
314
+ * mobile_number: "1234567890",
315
+ * set_followUp: "Y",
316
+ * callback_date: "2024-01-15",
317
+ * callback_hrs: "14",
318
+ * callback_mins: "30"
319
+ * };
320
+ * ```
321
+ *
322
+ * @since 1.0.0
323
+ * @author CTI SDK Team
324
+ */
325
+ interface EndCallPayload {
326
+ /**
327
+ * 🎯 API action type
328
+ * @description The action type for the API call
329
+ * @type {string}
330
+ */
331
+ action: string;
332
+
333
+ /**
334
+ * 📝 Call outcome classification
335
+ * @description Classification of how the call ended
336
+ * @type {string}
337
+ */
338
+ disposition: string;
339
+
340
+ /**
341
+ * 👤 Agent identifier
342
+ * @description Unique identifier for the agent ending the call
343
+ * @type {string}
344
+ */
345
+ userId: string;
346
+
347
+ /**
348
+ * ⚙️ Process identifier
349
+ * @description Unique identifier for the process
350
+ * @type {string}
351
+ */
352
+ processid: string;
353
+
354
+ /**
355
+ * 📱 Customer phone number
356
+ * @description Phone number of the customer
357
+ * @type {string}
358
+ */
359
+ mobile_number: string;
360
+
361
+ /**
362
+ * 📅 Follow-up requirement
363
+ * @description Whether a follow-up is required ("Y" or "N")
364
+ * @type {string}
365
+ */
366
+ set_followUp: string;
367
+
368
+ /**
369
+ * 📅 Scheduled callback date
370
+ * @description Date for scheduled callback (YYYY-MM-DD format)
371
+ * @type {string}
372
+ */
373
+ callback_date: string;
374
+
375
+ /**
376
+ * 🕐 Scheduled callback hour
377
+ * @description Hour for scheduled callback (0-23)
378
+ * @type {string}
379
+ */
380
+ callback_hrs: string;
381
+
382
+ /**
383
+ * 🕐 Scheduled callback minute
384
+ * @description Minute for scheduled callback (0-59)
385
+ * @type {string}
386
+ */
387
+ callback_mins: string;
388
+
389
+ /**
390
+ * 🔗 Optional call reference number
391
+ * @description Optional reference number for the call
392
+ * @type {string | undefined}
393
+ */
394
+ refno?: string;
395
+ }
396
+
397
+ /**
398
+ * 📅 End Call Data Interface
399
+ *
400
+ * @interface EndCallData
401
+ * @description 📊 Defines the structure for call termination input data
402
+ * Contains disposition and callback information for ending calls
403
+ *
404
+ * @properties
405
+ * - `disposition?: string` - 📝 Call outcome classification (default: "RES")
406
+ * - `followUp?: string` - 📅 Follow-up requirement (default: "N")
407
+ * - `callbackDate?: string` - 📅 Scheduled callback date (default: "")
408
+ * - `callbackHrs?: string` - 🕐 Scheduled callback hour (default: "")
409
+ * - `callbackMins?: string` - 🕐 Scheduled callback minute (default: "")
410
+ *
411
+ * @example
412
+ * ```typescript
413
+ * // Basic end call data
414
+ * const endCallData: EndCallData = {
415
+ * disposition: "RES",
416
+ * followUp: "N"
417
+ * };
418
+ *
419
+ * // With callback scheduling
420
+ * const endCallWithCallback: EndCallData = {
421
+ * disposition: "RES",
422
+ * followUp: "Y",
423
+ * callbackDate: "2024-01-15",
424
+ * callbackHrs: "14",
425
+ * callbackMins: "30"
426
+ * };
427
+ * ```
428
+ *
429
+ * @since 1.0.0
430
+ * @author CTI SDK Team
431
+ */
432
+ interface EndCallData {
433
+ /**
434
+ * 📝 Call outcome classification
435
+ * @description How the call ended (default: "RES" for Resolved)
436
+ * @type {string | undefined}
437
+ */
438
+ disposition?: string;
439
+
440
+ /**
441
+ * 📅 Follow-up requirement
442
+ * @description Whether follow-up is required (default: "N" for No)
443
+ * @type {string | undefined}
444
+ */
445
+ followUp?: string;
446
+
447
+ /**
448
+ * 📅 Scheduled callback date
449
+ * @description Date for callback scheduling (YYYY-MM-DD format)
450
+ * @type {string | undefined}
451
+ */
452
+ callbackDate?: string;
453
+
454
+ /**
455
+ * 🕐 Scheduled callback hour
456
+ * @description Hour for callback scheduling (0-23)
457
+ * @type {string | undefined}
458
+ */
459
+ callbackHrs?: string;
460
+
461
+ /**
462
+ * 🕐 Scheduled callback minute
463
+ * @description Minute for callback scheduling (0-59)
464
+ * @type {string | undefined}
465
+ */
466
+ callbackMins?: string;
467
+ }
468
+
469
+ /**
470
+ * 📞 Call Termination Function Type
471
+ *
472
+ * @type CallTerminationFunction
473
+ * @description 🎯 Type definition for the call termination function
474
+ * Handles call termination with disposition tracking and callback scheduling
475
+ *
476
+ * @param {EndCallData} data - 📊 Call termination data containing disposition and callback info
477
+ * @returns {Promise<any>} Promise that resolves with API response data or rejects with error
478
+ *
479
+ * @example
480
+ * ```typescript
481
+ * const handleEndCall: CallTerminationFunction = async (data) => {
482
+ * // Call termination logic
483
+ * return await apiCall(data);
484
+ * };
485
+ * ```
486
+ *
487
+ * @since 1.0.0
488
+ * @author CTI SDK Team
489
+ */
490
+ type CallTerminationFunction = (data: EndCallData) => Promise<any>;
491
+
492
+ /**
493
+ * 📊 Hook State Management Types
494
+ *
495
+ * @type HookStateTypes
496
+ * @description 🎛️ Type definitions for all hook state variables
497
+ * Provides type safety for loading, success, error, and data states
498
+ *
499
+ * @since 1.0.0
500
+ * @author CTI SDK Team
501
+ */
502
+ type HookStateTypes = {
503
+ /**
504
+ * ⏳ Loading state indicator
505
+ * @description Boolean flag indicating if a call termination operation is in progress
506
+ * @type {boolean}
507
+ */
508
+ isLoading: boolean;
509
+
510
+ /**
511
+ * ✅ Success state indicator
512
+ * @description Boolean flag indicating if the last call termination was successful
513
+ * @type {boolean}
514
+ */
515
+ isSuccess: boolean;
516
+
517
+ /**
518
+ * ❌ Error state indicator
519
+ * @description Boolean flag indicating if the last call termination encountered an error
520
+ * @type {boolean}
521
+ */
522
+ isError: boolean;
523
+
524
+ /**
525
+ * 🛡️ Error object
526
+ * @description Contains the error object when a call termination fails
527
+ * @type {any}
528
+ */
529
+ error: any;
530
+
531
+ /**
532
+ * 📊 Response data
533
+ * @description Contains the response data from successful call terminations
534
+ * @type {any}
535
+ */
536
+ data: any;
537
+ };
538
+
539
+ /**
540
+ * 📞 useEndCall Hook Return Type
541
+ *
542
+ * @interface UseEndCallReturn
543
+ * @description 🎯 Complete return type for the useEndCall hook
544
+ * Contains all functions and state for call termination functionality
545
+ *
546
+ * @properties
547
+ * - `handleEndCall: CallTerminationFunction` - 📞 Call termination function
548
+ * - `isLoading: boolean` - ⏳ Loading state indicator
549
+ * - `isSuccess: boolean` - ✅ Success state indicator
550
+ * - `isError: boolean` - ❌ Error state indicator
551
+ * - `error: any` - 🛡️ Error object when call fails
552
+ * - `data: any` - 📊 Response data from successful calls
553
+ *
554
+ * @example
555
+ * ```typescript
556
+ * const EndCallButton = () => {
557
+ * const hookReturn: UseEndCallReturn = useEndCall();
558
+ * const {
559
+ * handleEndCall,
560
+ * isLoading,
561
+ * isSuccess,
562
+ * isError,
563
+ * error
564
+ * } = hookReturn;
565
+ *
566
+ * // Use the hook functionality
567
+ * };
568
+ * ```
569
+ *
570
+ * @since 1.0.0
571
+ * @author CTI SDK Team
572
+ */
573
+ interface UseEndCallReturn extends HookStateTypes {
574
+ /**
575
+ * 📞 Call termination function
576
+ * @description Handles call termination with disposition tracking and callback scheduling
577
+ * @type {CallTerminationFunction}
578
+ */
579
+ handleEndCall: CallTerminationFunction;
580
+ }
581
+
582
+ /**
583
+ * 📞 End Call Custom Hook
584
+ *
585
+ * @function useEndCall
586
+ * @description 🎯 Custom hook that provides comprehensive call termination functionality
587
+ * for the CTI SDK. It handles call disposition capture, callback scheduling,
588
+ * and proper call cleanup with intelligent state management and error handling.
589
+ *
590
+ * @returns {UseEndCallReturn} Hook return object containing:
591
+ * - `handleEndCall: CallTerminationFunction` - 📞 Call termination function
592
+ * - `isLoading: boolean` - ⏳ Loading state indicator
593
+ * - `isSuccess: boolean` - ✅ Success state indicator
594
+ * - `isError: boolean` - ❌ Error state indicator
595
+ * - `error: any` - 🛡️ Error object when call fails
596
+ * - `data: any` - 📊 Response data from successful calls
597
+ *
598
+ * @example
599
+ * ```typescript
600
+ * // Basic usage in a component
601
+ * const EndCallButton = () => {
602
+ * const {
603
+ * handleEndCall,
604
+ * isLoading,
605
+ * isSuccess,
606
+ * isError,
607
+ * error
608
+ * } = useEndCall();
609
+ *
610
+ * const endCall = async () => {
611
+ * try {
612
+ * const result = await handleEndCall({
613
+ * disposition: "RES",
614
+ * followUp: "N"
615
+ * });
616
+ * console.log('📞 Call ended:', result);
617
+ * } catch (err) {
618
+ * console.error('❌ End call failed:', err);
619
+ * }
620
+ * };
621
+ *
622
+ * return (
623
+ * <button
624
+ * onClick={endCall}
625
+ * disabled={isLoading}
626
+ * >
627
+ * {isLoading ? 'Ending...' : 'End Call'}
628
+ * </button>
629
+ * );
630
+ * };
631
+ * ```
632
+ *
633
+ * @features
634
+ * - 🎯 Comprehensive call termination with disposition tracking
635
+ * - 📅 Callback scheduling and follow-up management
636
+ * - 🔄 Intelligent state cleanup and reset
637
+ * - ⏳ Comprehensive loading state management
638
+ * - 🛡️ Robust error handling and recovery
639
+ * - 📊 Real-time state updates via SDK manager
640
+ * - 🔄 Automatic call state management
641
+ *
642
+ * @since 1.0.0
643
+ * @author CTI SDK Team
644
+ */
645
+ declare const useEndCall: () => UseEndCallReturn;
646
+
647
+ /**
648
+ * 📝 Disposition Types
649
+ *
650
+ * @type DispositionType
651
+ * @description 🎯 Type definitions for call disposition values
652
+ * Used for call outcome classification
653
+ *
654
+ * @since 1.0.0
655
+ * @author CTI SDK Team
656
+ */
657
+ type DispositionType = string;
658
+
659
+ /**
660
+ * 📅 Follow-up Types
661
+ *
662
+ * @type FollowUpType
663
+ * @description 🎯 Type definitions for follow-up requirement values
664
+ * Used for callback scheduling
665
+ *
666
+ * @since 1.0.0
667
+ * @author CTI SDK Team
668
+ */
669
+ type FollowUpType = string;
670
+
671
+ /**
672
+ * ⚙️ Process Data Interface
673
+ *
674
+ * @interface ProcessData
675
+ * @description 📊 Type definition for process data structure
676
+ * Contains information about the current process
677
+ *
678
+ * @properties
679
+ * - `process_id: number` - 🔢 Process identifier
680
+ * - `process_name: string` - 📝 Process name
681
+ *
682
+ * @since 1.0.0
683
+ * @author CTI SDK Team
684
+ */
685
+ interface ProcessData {
686
+ /**
687
+ * 🔢 Process identifier
688
+ * @description Unique identifier for the process
689
+ * @type {number}
690
+ */
691
+ process_id: number;
692
+
693
+ /**
694
+ * 📝 Process name
695
+ * @description Human-readable name of the process
696
+ * @type {string}
697
+ */
698
+ process_name: string;
699
+ }
700
+
701
+ /**
702
+ * 📞 Call Data Interface
703
+ *
704
+ * @interface EndCallPayLoadData
705
+ * @description 📊 Type definition for call data structure
706
+ * Contains information about the current call
707
+ *
708
+ * @properties
709
+ * - `convox_id: string` - 🔗 Call reference identifier
710
+ * - `phone_number: string` - 📱 Customer phone number
711
+ *
712
+ * @since 1.0.0
713
+ * @author CTI SDK Team
714
+ */
715
+ interface EndCallPayLoadData {
716
+ /**
717
+ * 🔗 Call reference identifier
718
+ * @description Unique identifier for the call
719
+ * @type {string}
720
+ */
721
+ convox_id: string;
722
+
723
+ /**
724
+ * 📱 Customer phone number
725
+ * @description Phone number of the customer
726
+ * @type {string}
727
+ */
728
+ phone_number: string;
729
+ }
730
+
731
+ /**
732
+ * 📋 Comprehensive Type Exports
733
+ *
734
+ * @description 📦 Re-exports all types for easy importing
735
+ * Provides a single import point for all hook-related types
736
+ *
737
+ * @example
738
+ * ```typescript
739
+ * import {
740
+ * EndCallPayload,
741
+ * UseEndCallReturn,
742
+ * CallTerminationFunction,
743
+ * EndCallData
744
+ * } from './useEndCall';
745
+ * ```
746
+ *
747
+ * @since 1.0.0
748
+ * @author CTI SDK Team
749
+ */
750
+
751
+ /**
752
+ *
753
+ * This file contains TypeScript type definitions for the useLogout custom hook
754
+ * and its related interfaces. It provides comprehensive type safety and IntelliSense
755
+ * support for developers using the CTI SDK logout functionality.
756
+ *
757
+ * 🎯 Key Type Definitions:
758
+ * - 🚪 LogoutPayload interface for logout API data
759
+ * - 🚪 useLogout hook return type
760
+ * - 🔄 Logout function signature
761
+ * - 📊 State management types
762
+ * - 🗑️ Cleanup and storage management types
763
+ *
764
+ * @author CTI SDK Team
765
+ * @version 6.x.x
766
+ * @since 1.0.0
767
+ */
768
+
769
+ /**
770
+ * 🚪 Logout Payload Interface
771
+ *
772
+ * @interface LogoutPayload
773
+ * @description 📊 Defines the structure for agent logout API payload data
774
+ * Contains all necessary information for secure agent logout
775
+ *
776
+ * @properties
777
+ * - `action: string` - 🎯 API action type ("LOGOUTUSER")
778
+ * - `userId: string` - 👤 Agent identifier for logout
779
+ *
780
+ * @example
781
+ * ```typescript
782
+ * // Basic logout payload
783
+ * const logoutPayload: LogoutPayload = {
784
+ * action: "LOGOUTUSER",
785
+ * userId: "agent123"
786
+ * };
787
+ *
788
+ * // Usage in component
789
+ * const { logout } = useLogout();
790
+ * await logout();
791
+ * ```
792
+ *
793
+ * @since 1.0.0
794
+ * @author CTI SDK Team
795
+ */
796
+ interface LogoutPayload {
797
+ /**
798
+ * 🎯 API action type
799
+ * @description The action type for the logout API call
800
+ * @type {string}
801
+ */
802
+ action: string;
803
+
804
+ /**
805
+ * 👤 Agent identifier
806
+ * @description Unique identifier for the agent being logged out
807
+ * @type {string}
808
+ */
809
+ userId: string;
810
+ }
811
+
812
+ /**
813
+ * 🚪 Logout Function Type
814
+ *
815
+ * @type LogoutFunction
816
+ * @description 🎯 Type definition for the logout function
817
+ * Handles secure agent logout with comprehensive cleanup procedures
818
+ *
819
+ * @returns {Promise<any>} Promise that resolves with API response data or rejects with error
820
+ *
821
+ * @example
822
+ * ```typescript
823
+ * const logout();
824
+ * ```
825
+ *
826
+ * @since 1.0.0
827
+ * @author CTI SDK Team
828
+ */
829
+ type LogoutFunction = () => Promise<any>;
830
+
831
+ /**
832
+ * 📊 Hook State Management Types
833
+ *
834
+ * @type LogoutHookStateTypes
835
+ * @description 🎛️ Type definitions for all hook state variables
836
+ * Provides type safety for loading, success, error, and data states
837
+ *
838
+ * @since 1.0.0
839
+ * @author CTI SDK Team
840
+ */
841
+ type LogoutHookStateTypes = {
842
+ /**
843
+ * ⏳ Loading state indicator
844
+ * @description Boolean flag indicating if a logout operation is in progress
845
+ * @type {boolean}
846
+ */
847
+ isLoading: boolean;
848
+
849
+ /**
850
+ * ✅ Success state indicator
851
+ * @description Boolean flag indicating if the last logout was successful
852
+ * @type {boolean}
853
+ */
854
+ isSuccess: boolean;
855
+
856
+ /**
857
+ * ❌ Error state indicator
858
+ * @description Boolean flag indicating if the last logout encountered an error
859
+ * @type {boolean}
860
+ */
861
+ isError: boolean;
862
+
863
+ /**
864
+ * 🛡️ Error object
865
+ * @description Contains the error object when a logout fails
866
+ * @type {any}
867
+ */
868
+ error: any;
869
+
870
+ /**
871
+ * 📊 Response data
872
+ * @description Contains the response data from successful logout
873
+ * @type {any}
874
+ */
875
+ data: any;
876
+ };
877
+
878
+ /**
879
+ * 🚪 useLogout Hook Return Type
880
+ *
881
+ * @interface UseLogoutReturn
882
+ * @description 🎯 Complete return type for the useLogout hook
883
+ * Contains all functions and state for logout functionality
884
+ *
885
+ * @properties
886
+ * - `logout: LogoutFunction` - 🚪 Logout function
887
+ * - `isLoading: boolean` - ⏳ Loading state indicator
888
+ * - `isSuccess: boolean` - ✅ Success state indicator
889
+ * - `isError: boolean` - ❌ Error state indicator
890
+ * - `error: any` - 🛡️ Error object when logout fails
891
+ * - `data: any` - 📊 Response data from successful logout
892
+ *
893
+ * @example
894
+ * ```typescript
895
+ * const LogoutButton = () => {
896
+ * const hookReturn: UseLogoutReturn = useLogout();
897
+ * const {
898
+ * logout,
899
+ * isLoading,
900
+ * isSuccess,
901
+ * isError,
902
+ * error
903
+ * } = hookReturn;
904
+ *
905
+ * // Use the hook functionality
906
+ * };
907
+ * ```
908
+ *
909
+ * @since 1.0.0
910
+ * @author CTI SDK Team
911
+ */
912
+ interface UseLogoutReturn extends LogoutHookStateTypes {
913
+ /**
914
+ * 🚪 Logout function
915
+ * @description Handles secure agent logout with comprehensive cleanup procedures
916
+ * @type {LogoutFunction}
917
+ */
918
+ logout: LogoutFunction;
919
+ }
920
+
921
+ /**
922
+ * 🚪 Logout Custom Hook
923
+ *
924
+ * @function useLogout
925
+ * @description 🎯 Custom hook that provides comprehensive agent logout functionality
926
+ * for the CTI SDK. It handles secure logout procedures, complete state cleanup,
927
+ * and storage management with intelligent error handling and proper cleanup.
928
+ *
929
+ * @returns {UseLogoutReturn} Hook return object containing:
930
+ * - `logout: LogoutFunction` - 🚪 Logout function
931
+ * - `isLoading: boolean` - ⏳ Loading state indicator
932
+ * - `isSuccess: boolean` - ✅ Success state indicator
933
+ * - `isError: boolean` - ❌ Error state indicator
934
+ * - `error: any` - 🛡️ Error object when logout fails
935
+ * - `data: any` - 📊 Response data from successful logout
936
+ *
937
+ * @example
938
+ * ```typescript
939
+ * // Basic usage in a component
940
+ * const LogoutButton = () => {
941
+ * const {
942
+ * logout,
943
+ * isLoading,
944
+ * isSuccess,
945
+ * isError,
946
+ * error
947
+ * } = useLogout();
948
+ *
949
+ * const handleLogout = async () => {
950
+ * try {
951
+ * const result = await logout();
952
+ * console.log('🚪 Logout successful:', result);
953
+ * // Redirect to login page or handle success
954
+ * } catch (err) {
955
+ * console.error('❌ Logout failed:', err);
956
+ * }
957
+ * };
958
+ *
959
+ * return (
960
+ * <button
961
+ * onClick={handleLogout}
962
+ * disabled={isLoading}
963
+ * >
964
+ * {isLoading ? 'Logging out...' : 'Logout'}
965
+ * </button>
966
+ * );
967
+ * };
968
+ * ```
969
+ *
970
+ * @features
971
+ * - 🚪 Secure agent logout with API validation
972
+ * - 🗑️ Complete state cleanup and reset
973
+ * - 💾 Storage management (localStorage & sessionStorage)
974
+ * - ⏳ Comprehensive loading state management
975
+ * - 🛡️ Robust error handling and recovery
976
+ * - 📊 Real-time state updates via SDK manager
977
+ * - 🔄 Automatic storage cleanup
978
+ *
979
+ * @since 1.0.0
980
+ * @author CTI SDK Team
981
+ */
982
+ declare const useLogout: () => UseLogoutReturn;
983
+
984
+ /**
985
+ * 🔐 Authorization Token Custom Hook
986
+ *
987
+ * @function useGetAuthorizationToken
988
+ * @description 🎯 Custom hook that provides reactive access to the current SDK authorization token.
989
+ * Automatically updates when the token changes, making it perfect for external API calls
990
+ * and authentication headers.
991
+ *
992
+ * @returns {string | undefined} Current authorization token or undefined if not available
993
+ *
994
+ * @example
995
+ * ```typescript
996
+ * // Basic usage in a component
997
+ * const ApiCallComponent = () => {
998
+ * const token = useGetAuthorizationToken();
999
+ *
1000
+ * const makeExternalApiCall = async () => {
1001
+ * if (!token) {
1002
+ * console.error('No authorization token available');
1003
+ * return;
1004
+ * }
1005
+ *
1006
+ * try {
1007
+ * const response = await fetch('/api/external', {
1008
+ * headers: {
1009
+ * 'Authorization': `Bearer ${token}`,
1010
+ * 'Content-Type': 'application/json'
1011
+ * }
1012
+ * });
1013
+ * const data = await response.json();
1014
+ * console.log('External API response:', data);
1015
+ * } catch (error) {
1016
+ * console.error('API call failed:', error);
1017
+ * }
1018
+ * };
1019
+ *
1020
+ * return (
1021
+ * <button onClick={makeExternalApiCall} disabled={!token}>
1022
+ * {token ? 'Make API Call' : 'No Token Available'}
1023
+ * </button>
1024
+ * );
1025
+ * };
1026
+ * ```
1027
+ *
1028
+ * @example
1029
+ * ```typescript
1030
+ * // Usage with axios
1031
+ * const ApiService = () => {
1032
+ * const token = useGetAuthorizationToken();
1033
+ *
1034
+ * useEffect(() => {
1035
+ * if (token) {
1036
+ * // Configure axios with the token
1037
+ * axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
1038
+ * }
1039
+ * }, [token]);
1040
+ *
1041
+ * return null; // This is just for token management
1042
+ * };
1043
+ * ```
1044
+ *
1045
+ *
1046
+ * @since 1.0.0
1047
+ * @author CTI SDK Team
1048
+ */
1049
+ declare const useGetAuthorizationToken: () => string | undefined;
1050
+
1051
+ /**
1052
+ * 📞 Caller Data Custom Hook
1053
+ *
1054
+ * @function useGetCallerData
1055
+ * @description 🎯 Custom hook that provides reactive access to current call data.
1056
+ * This is an independent alternative to the CallControlPanel's onDataChange prop,
1057
+ * allowing you to access call information anywhere in your application without
1058
+ * depending on the CallControlPanel component.
1059
+ *
1060
+ * @returns {CallData} Current call data object containing all available call information
1061
+ *
1062
+ * @example
1063
+ * ```typescript
1064
+ * // Basic usage in a component
1065
+ * const CallStatusWidget = () => {
1066
+ * const callerData = useGetCallerData();
1067
+ *
1068
+ * return (
1069
+ * <div className="call-status-widget">
1070
+ * <h3>Current Call Status</h3>
1071
+ * {callerData.status === "ONCALL" ? (
1072
+ * <div>
1073
+ * <p>📞 Active Call: {callerData.phone_number}</p>
1074
+ * <p>Agent: {callerData.agent_id}</p>
1075
+ * <p>Process: {callerData.process_name}</p>
1076
+ * <p>Call ID: {callerData.callReferenceId}</p>
1077
+ * </div>
1078
+ * ) : (
1079
+ * <p>No active call</p>
1080
+ * )}
1081
+ * </div>
1082
+ * );
1083
+ * };
1084
+ * ```
1085
+ *
1086
+ * @example
1087
+ * ```typescript
1088
+ * // Usage for call analytics
1089
+ * const CallAnalytics = () => {
1090
+ * const callerData = useGetCallerData();
1091
+ *
1092
+ * useEffect(() => {
1093
+ * if (callerData.status === "ONCALL") {
1094
+ * // Track call start
1095
+ * analytics.track('call_started', {
1096
+ * phone_number: callerData.phone_number,
1097
+ * agent_id: callerData.agent_id,
1098
+ * process_name: callerData.process_name
1099
+ * });
1100
+ * }
1101
+ * }, [callerData.status]);
1102
+ *
1103
+ * return null; // This is just for analytics
1104
+ * };
1105
+ * ```
1106
+ *
1107
+ *
1108
+ *
1109
+ * @returns_data_structure
1110
+ * ```typescript
1111
+ * {
1112
+ * phone_number: string, // Phone number involved in the call
1113
+ * status: string, // Current call status (ONCALL, RINGING, WRAPUP, etc.)
1114
+ * callReferenceId: string, // Unique identifier for the call
1115
+ * agent_id: string, // ID of the agent handling the call
1116
+ * process_id: string, // Process identifier for the call
1117
+ * process_name: string // Name of the process handling the call
1118
+ * }
1119
+ * ```
1120
+ *
1121
+ * @since 1.0.0
1122
+ * @author CTI SDK Team
1123
+ */
1124
+ declare const useGetCallerData: () => CallData;
1125
+
1126
+ /**
1127
+ * 🗃️ SDK State Interface
1128
+ *
1129
+ * @interface SDKState
1130
+ * @description 📊 Type definition for the SDK state structure
1131
+ * Used internally by the hook to access agent and call data
1132
+ *
1133
+ * @properties
1134
+ * - `agentId: string` - 👤 Agent identifier
1135
+ * - `process: ProcessData` - ⚙️ Process information
1136
+ * - `callData: EndCallData` - 📞 Current call data
1137
+ *
1138
+ * @since 1.0.0
1139
+ * @author CTI SDK Team
1140
+ */
1141
+ interface SDKState {
1142
+ /**
1143
+ * 👤 Agent identifier
1144
+ * @description Unique identifier for the current agent
1145
+ * @type {string}
1146
+ */
1147
+ agentId: string;
1148
+
1149
+ /**
1150
+ * ⚙️ Process information
1151
+ * @description Information about the current process
1152
+ * @type {ProcessData}
1153
+ */
1154
+ process: ProcessData;
1155
+
1156
+ /**
1157
+ * 📞 Current call data
1158
+ * @description Data about the current call
1159
+ * @type {EndCallData}
1160
+ */
1161
+ callData: EndCallData;
1162
+ }
1163
+
1164
+ /**
1165
+ * 🗃️ SDK State Interface
1166
+ *
1167
+ * @interface SDKState
1168
+ * @description 📊 Type definition for the SDK state structure
1169
+ * Used internally by the hook to access agent data
1170
+ *
1171
+ * @properties
1172
+ * - `agentId: string` - 👤 Agent identifier
1173
+ *
1174
+ * @since 1.0.0
1175
+ * @author CTI SDK Team
1176
+ */
1177
+ interface SDKState {
1178
+ /**
1179
+ * 👤 Agent identifier
1180
+ * @description Unique identifier for the current agent
1181
+ * @type {string}
1182
+ */
1183
+ agentId: string;
1184
+ }
1185
+
1186
+ /**
1187
+ * 🗑️ Storage Management Types
1188
+ *
1189
+ * @type StorageType
1190
+ * @description 🎯 Type definitions for storage management
1191
+ * Used for localStorage and sessionStorage operations
1192
+ *
1193
+ * @since 1.0.0
1194
+ * @author CTI SDK Team
1195
+ */
1196
+ type StorageType = "localStorage" | "sessionStorage";
1197
+
1198
+ /**
1199
+ * 🔄 Cleanup Operation Types
1200
+ *
1201
+ * @type CleanupOperation
1202
+ * @description 🎯 Type definitions for cleanup operations
1203
+ * Used for state and storage cleanup procedures
1204
+ *
1205
+ * @since 1.0.0
1206
+ * @author CTI SDK Team
1207
+ */
1208
+ type CleanupOperation = "clearStorage" | "resetState" | "clearAll";
1209
+
1210
+ /**
1211
+ * 📋 Comprehensive Type Exports
1212
+ *
1213
+ * @description 📦 Re-exports all types for easy importing
1214
+ * Provides a single import point for all hook-related types
1215
+ *
1216
+ * @example
1217
+ * ```typescript
1218
+ * import {
1219
+ * LogoutPayload,
1220
+ * UseLogoutReturn,
1221
+ * LogoutFunction,
1222
+ * SDKState
1223
+ * } from './useLogout';
1224
+ * ```
1225
+ *
1226
+ * @since 1.0.0
1227
+ * @author CTI SDK Team
1228
+ */
1229
+
1230
+ /**
1231
+ * @fileoverview 📞 TypeScript Declaration File for useClickToCall Hook
1232
+ *
1233
+ * This file contains TypeScript type definitions for the useClickToCall custom hook
1234
+ * and its related interfaces. It provides comprehensive type safety and IntelliSense
1235
+ * support for developers using the CTI SDK.
1236
+ *
1237
+ * 🎯 Key Type Definitions:
1238
+ * - 📱 StartCallPayload interface for call initiation data
1239
+ * - 📞 useClickToCall hook return type
1240
+ * - 🔄 Call initiation function signature
1241
+ * - 📊 State management types
1242
+ *
1243
+ * @author CTI SDK Team
1244
+ * @version 6.x.x
1245
+ * @since 1.0.0
1246
+ */
1247
+
1248
+ /**
1249
+ * 📱 Start Call Payload Interface
1250
+ *
1251
+ * @interface StartCallPayload
1252
+ * @description 📊 Defines the structure for call initiation payload data
1253
+ * Contains the mobile number required to initiate a call
1254
+ *
1255
+ * @properties
1256
+ * - `mobileNumber: string` - 📱 The phone number to call (required)
1257
+ *
1258
+ * @example
1259
+ * ```typescript
1260
+ * // Basic call initiation payload
1261
+ * const callPayload: StartCallPayload = {
1262
+ * mobileNumber: "1234567890"
1263
+ * };
1264
+ *
1265
+ * // Usage in component
1266
+ * const { handleStartCall } = useClickToCall();
1267
+ * await handleStartCall({ mobileNumber: "9876543210" });
1268
+ * ```
1269
+ *
1270
+ * @since 1.0.0
1271
+ * @author CTI SDK Team
1272
+ */
1273
+ interface StartCallPayload {
1274
+ /**
1275
+ * 📱 Phone number to call
1276
+ * @description The mobile number that will be called
1277
+ * @type {string}
1278
+ */
1279
+ mobileNumber: string;
1280
+ }
1281
+
1282
+ /**
1283
+ * 📞 Call Initiation Function Type
1284
+ *
1285
+ * @type CallInitiationFunction
1286
+ * @description 🎯 Type definition for the call initiation function
1287
+ * Handles both regular calls and conference calls based on agent state
1288
+ *
1289
+ * @param {StartCallPayload} data - 📊 Call initiation data containing mobile number
1290
+ * @returns {Promise<any>} Promise that resolves with API response data or rejects with error
1291
+ *
1292
+ * @example
1293
+ * ```typescript
1294
+ * const handleStartCall({
1295
+ * mobileNumber: "1234567890"
1296
+ * })
1297
+ * ```
1298
+ *
1299
+ * @since 1.0.0
1300
+ * @author CTI SDK Team
1301
+ */
1302
+ type CallInitiationFunction = (data: StartCallPayload) => Promise<any>;
1303
+
1304
+ /**
1305
+ * 📊 Hook State Management Types
1306
+ *
1307
+ * @type StartCalltHookStateTypes
1308
+ * @description 🎛️ Type definitions for all hook state variables
1309
+ * Provides type safety for loading, success, error, and data states
1310
+ *
1311
+ * @since 1.0.0
1312
+ * @author CTI SDK Team
1313
+ */
1314
+ type StartCalltHookStateTypes = {
1315
+ /**
1316
+ * ⏳ Loading state indicator
1317
+ * @description Boolean flag indicating if a call operation is currently in progress
1318
+ * @type {boolean}
1319
+ */
1320
+ isLoading: boolean;
1321
+
1322
+ /**
1323
+ * ✅ Success state indicator
1324
+ * @description Boolean flag indicating if the last call operation was successful
1325
+ * @type {boolean}
1326
+ */
1327
+ isSuccess: boolean;
1328
+
1329
+ /**
1330
+ * ❌ Error state indicator
1331
+ * @description Boolean flag indicating if the last call operation encountered an error
1332
+ * @type {boolean}
1333
+ */
1334
+ isError: boolean;
1335
+
1336
+ /**
1337
+ * 🛡️ Error object
1338
+ * @description Contains the error object when a call operation fails
1339
+ * @type {any}
1340
+ */
1341
+ error: any;
1342
+
1343
+ /**
1344
+ * 📊 Response data
1345
+ * @description Contains the response data from successful call operations
1346
+ * @type {any}
1347
+ */
1348
+ data: any;
1349
+ };
1350
+
1351
+ /**
1352
+ * 📞 useClickToCall Hook Return Type
1353
+ *
1354
+ * @interface UseClickToCallReturn
1355
+ * @description 🎯 Complete return type for the useClickToCall hook
1356
+ * Contains all functions and state for call initiation functionality
1357
+ *
1358
+ * @properties
1359
+ * - `handleStartCall: CallInitiationFunction` - 📞 Call initiation function
1360
+ * - `isLoading: boolean` - ⏳ Loading state indicator
1361
+ * - `isSuccess: boolean` - ✅ Success state indicator
1362
+ * - `isError: boolean` - ❌ Error state indicator
1363
+ * - `error: any` - 🛡️ Error object when call fails
1364
+ * - `data: any` - 📊 Response data from successful calls
1365
+ *
1366
+ * @example
1367
+ * ```typescript
1368
+ * const CallButton = () => {
1369
+ * const hookReturn: UseClickToCallReturn = useClickToCall();
1370
+ * const {
1371
+ * handleStartCall,
1372
+ * isLoading,
1373
+ * isSuccess,
1374
+ * isError,
1375
+ * error
1376
+ * } = hookReturn;
1377
+ *
1378
+ * // Use the hook functionality
1379
+ * };
1380
+ * ```
1381
+ *
1382
+ * @since 1.0.0
1383
+ * @author CTI SDK Team
1384
+ */
1385
+ interface UseClickToCallReturn extends StartCalltHookStateTypes {
1386
+ /**
1387
+ * 📞 Call initiation function
1388
+ * @description Handles call initiation with intelligent routing based on agent state
1389
+ * @type {CallInitiationFunction}
1390
+ */
1391
+ handleStartCall: CallInitiationFunction;
1392
+ }
1393
+
1394
+ /**
1395
+ * 📞 Click-to-Call Custom Hook
1396
+ *
1397
+ * @function useClickToCall
1398
+ * @description 🎯 Custom hook that provides comprehensive call initiation functionality
1399
+ * for the CTI SDK. It intelligently handles both regular calls and conference calls
1400
+ * based on the current agent state, with proper loading states and error handling.
1401
+ *
1402
+ * @returns {UseClickToCallReturn} Hook return object containing:
1403
+ * - `handleStartCall: CallInitiationFunction` - 📞 Call initiation function
1404
+ * - `isLoading: boolean` - ⏳ Loading state indicator
1405
+ * - `isSuccess: boolean` - ✅ Success state indicator
1406
+ * - `isError: boolean` - ❌ Error state indicator
1407
+ * - `error: any` - 🛡️ Error object when call fails
1408
+ * - `data: any` - 📊 Response data from successful calls
1409
+ *
1410
+ * @example
1411
+ * ```typescript
1412
+ * // Basic usage in a component
1413
+ * const CallButton = () => {
1414
+ * const {
1415
+ * handleStartCall,
1416
+ * isLoading,
1417
+ * isSuccess,
1418
+ * isError,
1419
+ * error
1420
+ * } = useClickToCall();
1421
+ *
1422
+ * const makeCall = async () => {
1423
+ * try {
1424
+ * const result = await handleStartCall({
1425
+ * mobileNumber: "1234567890"
1426
+ * });
1427
+ * console.log('📞 Call initiated:', result);
1428
+ * } catch (err) {
1429
+ * console.error('❌ Call failed:', err);
1430
+ * }
1431
+ * };
1432
+ *
1433
+ * return (
1434
+ * <button
1435
+ * onClick={makeCall}
1436
+ * disabled={isLoading}
1437
+ * >
1438
+ * {isLoading ? 'Calling...' : 'Make Call'}
1439
+ * </button>
1440
+ * );
1441
+ * };
1442
+ * ```
1443
+ *
1444
+ * @features
1445
+ * - 🎯 Intelligent call routing based on agent state
1446
+ * - 📱 Regular call initiation for idle agents
1447
+ * - 👥 Conference call initiation for busy agents
1448
+ * - ⏳ Comprehensive loading state management
1449
+ * - 🛡️ Robust error handling and recovery
1450
+ * - 📊 Real-time state updates via SDK manager
1451
+ * - 🔄 Automatic conference dialog management
1452
+ *
1453
+ * @since 1.0.0
1454
+ * @author CTI SDK Team
1455
+ */
1456
+ declare const useClickToCall: () => UseClickToCallReturn;
1457
+
1458
+ /**
1459
+ * 📊 Agent State Types
1460
+ *
1461
+ * @type AgentStatus
1462
+ * @description 🎯 Type definitions for agent status values
1463
+ * Used internally by the hook to determine call routing logic
1464
+ *
1465
+ * @since 1.0.0
1466
+ * @author CTI SDK Team
1467
+ */
1468
+ type AgentStatus = string;
1469
+
1470
+ /**
1471
+ * 📞 Conference Line Interface
1472
+ *
1473
+ * @interface ConferenceLine
1474
+ * @description 📊 Type definition for conference line data structure
1475
+ * Used internally by the hook for conference call management
1476
+ *
1477
+ * @properties
1478
+ * - `line: number` - 📞 Line number identifier
1479
+ * - `status: AgentStatus` - 📊 Current line status
1480
+ * - `isCallStart: boolean` - ✅ Whether call is active on this line
1481
+ * - `phone?: string` - 📱 Phone number for this line (optional)
1482
+ *
1483
+ * @since 1.0.0
1484
+ * @author CTI SDK Team
1485
+ */
1486
+ interface ConferenceLine {
1487
+ /**
1488
+ * 📞 Line number identifier
1489
+ * @description Unique identifier for the conference line
1490
+ * @type {number}
1491
+ */
1492
+ line: number;
1493
+
1494
+ /**
1495
+ * 📊 Current line status
1496
+ * @description Status of the conference line
1497
+ * @type {AgentStatus}
1498
+ */
1499
+ status: AgentStatus;
1500
+
1501
+ /**
1502
+ * ✅ Whether call is active on this line
1503
+ * @description Flag indicating if a call is currently active
1504
+ * @type {boolean}
1505
+ */
1506
+ isCallStart: boolean;
1507
+
1508
+ /**
1509
+ * 📱 Phone number for this line
1510
+ * @description Phone number associated with this line (optional)
1511
+ * @type {string | undefined}
1512
+ */
1513
+ phone?: string;
1514
+ }
1515
+
1516
+ /**
1517
+ * 📞 Call Data Interface
1518
+ *
1519
+ * @interface StartCalltData
1520
+ * @description 📊 Type definition for call data structure
1521
+ * Contains information about the current call
1522
+ *
1523
+ * @properties
1524
+ * - `status: AgentStatus` - 📊 Current call status
1525
+ * - `agent_id: string` - 👤 Agent identifier
1526
+ * - `process_name: string` - ⚙️ Process name
1527
+ *
1528
+ * @since 1.0.0
1529
+ * @author CTI SDK Team
1530
+ */
1531
+ interface StartCalltData {
1532
+ /**
1533
+ * 📊 Current call status
1534
+ * @description Status of the current call
1535
+ * @type {AgentStatus}
1536
+ */
1537
+ status: AgentStatus;
1538
+
1539
+ /**
1540
+ * 👤 Agent identifier
1541
+ * @description Unique identifier for the agent
1542
+ * @type {string}
1543
+ */
1544
+ agent_id: string;
1545
+
1546
+ /**
1547
+ * ⚙️ Process name
1548
+ * @description Name of the current process
1549
+ * @type {string}
1550
+ */
1551
+ process_name: string;
1552
+ }
1553
+
1554
+ /**
1555
+ * 📡 API Response Interface
1556
+ *
1557
+ * @interface APIResponse
1558
+ * @description 📊 Type definition for API response structure
1559
+ * Used for type safety in API call responses
1560
+ *
1561
+ * @properties
1562
+ * - `data: any` - 📊 Response data
1563
+ * - `status: number` - 📊 HTTP status code
1564
+ * - `message?: string` - 📝 Optional response message
1565
+ *
1566
+ * @since 1.0.0
1567
+ * @author CTI SDK Team
1568
+ */
1569
+ interface APIResponse {
1570
+ /**
1571
+ * 📊 Response data
1572
+ * @description The main response data from the API
1573
+ * @type {any}
1574
+ */
1575
+ data: any;
1576
+
1577
+ /**
1578
+ * 📊 HTTP status code
1579
+ * @description HTTP status code of the response
1580
+ * @type {number}
1581
+ */
1582
+ status: number;
1583
+
1584
+ /**
1585
+ * 📝 Optional response message
1586
+ * @description Optional message from the API response
1587
+ * @type {string | undefined}
1588
+ */
1589
+ message?: string;
1590
+ }
1591
+
1592
+ /**
1593
+ * 📡 API Response Interface
1594
+ *
1595
+ * @interface APIResponse
1596
+ * @description 📊 Type definition for API response structure
1597
+ * Used for type safety in API call responses
1598
+ *
1599
+ * @properties
1600
+ * - `data: any` - 📊 Response data
1601
+ * - `status: number` - 📊 HTTP status code
1602
+ * - `message?: string` - 📝 Optional response message
1603
+ *
1604
+ * @since 1.0.0
1605
+ * @author CTI SDK Team
1606
+ */
1607
+ interface APIResponse {
1608
+ /**
1609
+ * 📊 Response data
1610
+ * @description The main response data from the API
1611
+ * @type {any}
1612
+ */
1613
+ data: any;
1614
+
1615
+ /**
1616
+ * 📊 HTTP status code
1617
+ * @description HTTP status code of the response
1618
+ * @type {number}
1619
+ */
1620
+ status: number;
1621
+
1622
+ /**
1623
+ * 📝 Optional response message
1624
+ * @description Optional message from the API response
1625
+ * @type {string | undefined}
1626
+ */
1627
+ message?: string;
1628
+ }
1629
+
1630
+ /**
1631
+ * 📡 API Response Interface
1632
+ *
1633
+ * @interface APIResponse
1634
+ * @description 📊 Type definition for API response structure
1635
+ * Used for type safety in API call responses
1636
+ *
1637
+ * @properties
1638
+ * - `data: any` - 📊 Response data
1639
+ * - `status: number` - 📊 HTTP status code
1640
+ * - `message?: string` - 📝 Optional response message
1641
+ *
1642
+ * @since 1.0.0
1643
+ * @author CTI SDK Team
1644
+ */
1645
+ interface APIResponse {
1646
+ /**
1647
+ * 📊 Response data
1648
+ * @description The main response data from the API
1649
+ * @type {any}
1650
+ */
1651
+ data: any;
1652
+
1653
+ /**
1654
+ * 📊 HTTP status code
1655
+ * @description HTTP status code of the response
1656
+ * @type {number}
1657
+ */
1658
+ status: number;
1659
+
1660
+ /**
1661
+ * 📝 Optional response message
1662
+ * @description Optional message from the API response
1663
+ * @type {string | undefined}
1664
+ */
1665
+ message?: string;
1666
+ }
1667
+
1668
+ /**
1669
+ * 🛡️ Error Response Interface
1670
+ *
1671
+ * @interface ErrorResponse
1672
+ * @description 📊 Type definition for error response structure
1673
+ * Used for type safety in error handling
1674
+ *
1675
+ * @properties
1676
+ * - `message: string` - 📝 Error message
1677
+ * - `code?: string` - 🔢 Optional error code
1678
+ * - `details?: any` - 📊 Optional error details
1679
+ *
1680
+ * @since 1.0.0
1681
+ * @author CTI SDK Team
1682
+ */
1683
+ interface ErrorResponse {
1684
+ /**
1685
+ * 📝 Error message
1686
+ * @description Human-readable error message
1687
+ * @type {string}
1688
+ */
1689
+ message: string;
1690
+
1691
+ /**
1692
+ * 🔢 Optional error code
1693
+ * @description Optional error code for programmatic handling
1694
+ * @type {string | undefined}
1695
+ */
1696
+ code?: string;
1697
+
1698
+ /**
1699
+ * 📊 Optional error details
1700
+ * @description Optional additional error details
1701
+ * @type {any}
1702
+ */
1703
+ details?: any;
1704
+ }
1705
+
1706
+ /**
1707
+ * 🛡️ Error Response Interface
1708
+ *
1709
+ * @interface ErrorResponse
1710
+ * @description 📊 Type definition for error response structure
1711
+ * Used for type safety in error handling
1712
+ *
1713
+ * @properties
1714
+ * - `message: string` - 📝 Error message
1715
+ * - `code?: string` - 🔢 Optional error code
1716
+ * - `details?: any` - 📊 Optional error details
1717
+ *
1718
+ * @since 1.0.0
1719
+ * @author CTI SDK Team
1720
+ */
1721
+ interface ErrorResponse {
1722
+ /**
1723
+ * 📝 Error message
1724
+ * @description Human-readable error message
1725
+ * @type {string}
1726
+ */
1727
+ message: string;
1728
+
1729
+ /**
1730
+ * 🔢 Optional error code
1731
+ * @description Optional error code for programmatic handling
1732
+ * @type {string | undefined}
1733
+ */
1734
+ code?: string;
1735
+
1736
+ /**
1737
+ * 📊 Optional error details
1738
+ * @description Optional additional error details
1739
+ * @type {any}
1740
+ */
1741
+ details?: any;
1742
+ }
1743
+
1744
+ /**
1745
+ * 🛡️ Error Response Interface
1746
+ *
1747
+ * @interface ErrorResponse
1748
+ * @description 📊 Type definition for error response structure
1749
+ * Used for type safety in error handling
1750
+ *
1751
+ * @properties
1752
+ * - `message: string` - 📝 Error message
1753
+ * - `code?: string` - 🔢 Optional error code
1754
+ * - `details?: any` - 📊 Optional error details
1755
+ *
1756
+ * @since 1.0.0
1757
+ * @author CTI SDK Team
1758
+ */
1759
+ interface ErrorResponse {
1760
+ /**
1761
+ * 📝 Error message
1762
+ * @description Human-readable error message
1763
+ * @type {string}
1764
+ */
1765
+ message: string;
1766
+
1767
+ /**
1768
+ * 🔢 Optional error code
1769
+ * @description Optional error code for programmatic handling
1770
+ * @type {string | undefined}
1771
+ */
1772
+ code?: string;
1773
+
1774
+ /**
1775
+ * 📊 Optional error details
1776
+ * @description Optional additional error details
1777
+ * @type {any}
1778
+ */
1779
+ details?: any;
1780
+ }
1781
+
1782
+ export { type APIResponse, type AgentStatus, CallControlPanel, type CallControlPanelProps, type CallData, type CallInitiationFunction, type CallTerminationFunction, type CleanupOperation, type ConferenceLine, type DispositionType, type EndCallData, type EndCallPayLoadData, type EndCallPayload, type ErrorResponse, type FollowUpType, type HookStateTypes, type InitSDKParams, type LogoutFunction, type LogoutHookStateTypes, type LogoutPayload, type ProcessData, type SDKConfig, type SDKState, type StartCallPayload, type StartCalltData, type StartCalltHookStateTypes, type StorageType, type UseClickToCallReturn, type UseEndCallReturn, type UseLogoutReturn, getSDKVersion, initSDK, isSDKInitialized, useClickToCall, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout };