ahs-cti 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agentDetailReport-F44HMQ5O.mjs +27 -0
- package/dist/agentDetailReport-F44HMQ5O.mjs.map +1 -0
- package/dist/{agentPerformanceReport-JZK5DN5E.mjs → agentPerformanceReport-TTOMNENK.mjs} +25 -15
- package/dist/{agentPerformanceReport-JZK5DN5E.mjs.map → agentPerformanceReport-TTOMNENK.mjs.map} +1 -1
- package/dist/auditReport-QTMAKVTN.mjs +26 -0
- package/dist/auditReport-QTMAKVTN.mjs.map +1 -0
- package/dist/{callHistory-T3M76D4B.mjs → callHistory-4J4J2XHA.mjs} +20 -10
- package/dist/{callHistory-T3M76D4B.mjs.map → callHistory-4J4J2XHA.mjs.map} +1 -1
- package/dist/{campaigns-5PVHXBSD.mjs → campaigns-N3UNUGQP.mjs} +23 -13
- package/dist/{campaigns-5PVHXBSD.mjs.map → campaigns-N3UNUGQP.mjs.map} +1 -1
- package/dist/{caroQualityAuditDashboard-EUDYZ3QY.mjs → caroQualityAuditDashboard-TNS4L2NR.mjs} +12 -2
- package/dist/{caroQualityAuditDashboard-EUDYZ3QY.mjs.map → caroQualityAuditDashboard-TNS4L2NR.mjs.map} +1 -1
- package/dist/{caroVoiceAI-GGJCVUIQ.mjs → caroVoiceAI-OUTAAIFE.mjs} +12 -2
- package/dist/{caroVoiceAI-GGJCVUIQ.mjs.map → caroVoiceAI-OUTAAIFE.mjs.map} +1 -1
- package/dist/{cdrReport-ZMDHSZUW.mjs → cdrReport-Z35OLYUL.mjs} +26 -16
- package/dist/{cdrReport-ZMDHSZUW.mjs.map → cdrReport-Z35OLYUL.mjs.map} +1 -1
- package/dist/chunk-3PNP6G5P.mjs +92 -0
- package/dist/chunk-3PNP6G5P.mjs.map +1 -0
- package/dist/{chunk-DF5EFKXC.mjs → chunk-45MLTWV7.mjs} +12 -2
- package/dist/{chunk-DF5EFKXC.mjs.map → chunk-45MLTWV7.mjs.map} +1 -1
- package/dist/chunk-635IIVZE.mjs +24 -0
- package/dist/{chunk-FRKV2U3I.mjs.map → chunk-635IIVZE.mjs.map} +1 -1
- package/dist/chunk-677RFPP5.mjs +24 -0
- package/dist/{chunk-7LE2VTAI.mjs.map → chunk-677RFPP5.mjs.map} +1 -1
- package/dist/{chunk-Q6G3MPS7.mjs → chunk-ERSNXW5X.mjs} +11 -1
- package/dist/{chunk-Q6G3MPS7.mjs.map → chunk-ERSNXW5X.mjs.map} +1 -1
- package/dist/{chunk-H7GRWLYI.mjs → chunk-G6KRLGGC.mjs} +13 -3
- package/dist/{chunk-H7GRWLYI.mjs.map → chunk-G6KRLGGC.mjs.map} +1 -1
- package/dist/chunk-GFVR3HLK.mjs +24 -0
- package/dist/{chunk-6WLG2PXL.mjs.map → chunk-GFVR3HLK.mjs.map} +1 -1
- package/dist/{chunk-E6KYWWAI.mjs → chunk-GTI2ZVQX.mjs} +12 -2
- package/dist/{chunk-E6KYWWAI.mjs.map → chunk-GTI2ZVQX.mjs.map} +1 -1
- package/dist/chunk-H22TUCN3.mjs +24 -0
- package/dist/{chunk-AOJRUZTO.mjs.map → chunk-H22TUCN3.mjs.map} +1 -1
- package/dist/{chunk-YAQYTUTX.mjs → chunk-HAOFUADN.mjs} +12 -2
- package/dist/{chunk-YAQYTUTX.mjs.map → chunk-HAOFUADN.mjs.map} +1 -1
- package/dist/{chunk-33QNSXP7.mjs → chunk-JHC7OUQG.mjs} +21 -11
- package/dist/chunk-JHC7OUQG.mjs.map +1 -0
- package/dist/chunk-KSVNZKRD.mjs +10930 -0
- package/dist/chunk-KSVNZKRD.mjs.map +1 -0
- package/dist/{chunk-VVDJLUYT.mjs → chunk-M7FJYZF6.mjs} +12 -2
- package/dist/{chunk-VVDJLUYT.mjs.map → chunk-M7FJYZF6.mjs.map} +1 -1
- package/dist/{chunk-DNTGBNZD.mjs → chunk-NDZDJWXY.mjs} +13 -3
- package/dist/{chunk-DNTGBNZD.mjs.map → chunk-NDZDJWXY.mjs.map} +1 -1
- package/dist/chunk-S2SMCH2C.mjs +71 -0
- package/dist/chunk-S2SMCH2C.mjs.map +1 -0
- package/dist/{chunk-IDZWA6HG.mjs → chunk-S34CQVTF.mjs} +14 -4
- package/dist/{chunk-IDZWA6HG.mjs.map → chunk-S34CQVTF.mjs.map} +1 -1
- package/dist/{chunk-2M3YEXYA.mjs → chunk-SUS5RUCA.mjs} +17 -7
- package/dist/{chunk-2M3YEXYA.mjs.map → chunk-SUS5RUCA.mjs.map} +1 -1
- package/dist/{chunk-3J7KQNEU.mjs → chunk-TCYBXDAP.mjs} +13 -3
- package/dist/{chunk-3J7KQNEU.mjs.map → chunk-TCYBXDAP.mjs.map} +1 -1
- package/dist/chunk-VII5JNA6.mjs +24 -0
- package/dist/{chunk-WTBVFN4H.mjs.map → chunk-VII5JNA6.mjs.map} +1 -1
- package/dist/chunk-W3ECDLUB.mjs +24 -0
- package/dist/{chunk-OHJIW3I3.mjs.map → chunk-W3ECDLUB.mjs.map} +1 -1
- package/dist/{chunk-VBIDPX5Z.mjs → chunk-Y4PAUTZ4.mjs} +13 -3
- package/dist/{chunk-VBIDPX5Z.mjs.map → chunk-Y4PAUTZ4.mjs.map} +1 -1
- package/dist/{chunk-NAZO4HKB.mjs → chunk-ZSRD3ZXF.mjs} +12 -2
- package/dist/{chunk-NAZO4HKB.mjs.map → chunk-ZSRD3ZXF.mjs.map} +1 -1
- package/dist/index.mjs +33 -23
- package/dist/index.mjs.map +1 -1
- package/dist/{liveStatus-YSBYSVOO.mjs → liveStatus-PRDEL7CK.mjs} +16 -6
- package/dist/{liveStatus-YSBYSVOO.mjs.map → liveStatus-PRDEL7CK.mjs.map} +1 -1
- package/dist/{loginReport-YIVBJVJD.mjs → loginReport-47QNACQU.mjs} +22 -12
- package/dist/{loginReport-YIVBJVJD.mjs.map → loginReport-47QNACQU.mjs.map} +1 -1
- package/dist/{managementDashboard-7EMQC2UA.mjs → managementDashboard-SZFYULKA.mjs} +22 -12
- package/dist/{managementDashboard-7EMQC2UA.mjs.map → managementDashboard-SZFYULKA.mjs.map} +1 -1
- package/dist/{qualityAuditDashboard-ENGQN2WQ.mjs → qualityAuditDashboard-FHRGB77R.mjs} +12 -2
- package/dist/{qualityAuditDashboard-ENGQN2WQ.mjs.map → qualityAuditDashboard-FHRGB77R.mjs.map} +1 -1
- package/dist-react/agentDetailReport-PDKQKJNL.mjs +23 -0
- package/dist-react/agentPerformanceReport-MU2FASNN.mjs +544 -0
- package/dist-react/agentPerformanceReport-MU2FASNN.mjs.map +1 -0
- package/dist-react/auditReport-WH2KDNYT.mjs +25 -0
- package/{dist/auditReport-6ZUJ4UFO.mjs.map → dist-react/auditReport-WH2KDNYT.mjs.map} +1 -1
- package/dist-react/callHistory-HXXRYUIV.mjs +832 -0
- package/dist-react/callHistory-HXXRYUIV.mjs.map +1 -0
- package/dist-react/campaigns-J7KIAATE.mjs +3139 -0
- package/dist-react/campaigns-J7KIAATE.mjs.map +1 -0
- package/dist-react/caroQualityAuditDashboard-THYPVOCP.mjs +76 -0
- package/dist-react/caroQualityAuditDashboard-THYPVOCP.mjs.map +1 -0
- package/dist-react/caroVoiceAI-XGDUETXI.mjs +31 -0
- package/dist-react/caroVoiceAI-XGDUETXI.mjs.map +1 -0
- package/dist-react/cdrReport-SX2FZAO6.mjs +858 -0
- package/dist-react/cdrReport-SX2FZAO6.mjs.map +1 -0
- package/dist-react/chunk-4YF4IDV6.mjs +72 -0
- package/dist-react/chunk-4YF4IDV6.mjs.map +1 -0
- package/dist-react/chunk-ADM2JJCP.mjs +190 -0
- package/dist-react/chunk-ADM2JJCP.mjs.map +1 -0
- package/dist-react/chunk-EN7HM2MD.mjs +688 -0
- package/dist-react/chunk-EN7HM2MD.mjs.map +1 -0
- package/{dist/chunk-LHE4QGJJ.mjs → dist-react/chunk-F7G2XFRU.mjs} +12 -2
- package/{dist/chunk-LHE4QGJJ.mjs.map → dist-react/chunk-F7G2XFRU.mjs.map} +1 -1
- package/{dist/chunk-DJP744FF.mjs → dist-react/chunk-GUMGXVIT.mjs} +12 -2
- package/{dist/chunk-DJP744FF.mjs.map → dist-react/chunk-GUMGXVIT.mjs.map} +1 -1
- package/dist-react/chunk-KRXHK4AU.mjs +127 -0
- package/dist-react/chunk-KRXHK4AU.mjs.map +1 -0
- package/{dist/chunk-U2UDKXMB.mjs → dist-react/chunk-LWDAC6QU.mjs} +12 -2
- package/{dist/chunk-U2UDKXMB.mjs.map → dist-react/chunk-LWDAC6QU.mjs.map} +1 -1
- package/dist-react/chunk-LX6I32Y4.mjs +106 -0
- package/dist-react/chunk-LX6I32Y4.mjs.map +1 -0
- package/dist-react/chunk-MCD5FQNY.mjs +428 -0
- package/dist-react/chunk-MCD5FQNY.mjs.map +1 -0
- package/dist-react/chunk-MD472UKG.mjs +757 -0
- package/{dist/chunk-33QNSXP7.mjs.map → dist-react/chunk-MD472UKG.mjs.map} +1 -1
- package/dist-react/chunk-ORNNWQI6.mjs +67 -0
- package/dist-react/chunk-ORNNWQI6.mjs.map +1 -0
- package/dist-react/chunk-S4J35V4B.mjs +126 -0
- package/dist-react/chunk-S4J35V4B.mjs.map +1 -0
- package/dist-react/chunk-T53WMN5A.mjs +126 -0
- package/dist-react/chunk-T53WMN5A.mjs.map +1 -0
- package/dist-react/chunk-UTSRABCL.mjs +96 -0
- package/dist-react/chunk-UTSRABCL.mjs.map +1 -0
- package/dist-react/incoming-4WP3FJI4.mp3 +0 -0
- package/dist-react/incoming.mp3 +0 -0
- package/dist-react/index.d.mts +2476 -0
- package/dist-react/index.d.ts +2477 -0
- package/dist-react/index.js +26713 -0
- package/dist-react/index.js.map +1 -0
- package/dist-react/index.mjs +4675 -0
- package/dist-react/index.mjs.map +1 -0
- package/dist-react/liveStatus-IDZ7CPYK.mjs +1087 -0
- package/dist-react/liveStatus-IDZ7CPYK.mjs.map +1 -0
- package/dist-react/loginReport-F47GUU53.mjs +990 -0
- package/dist-react/loginReport-F47GUU53.mjs.map +1 -0
- package/dist-react/managementDashboard-GC5E7NEL.mjs +540 -0
- package/dist-react/managementDashboard-GC5E7NEL.mjs.map +1 -0
- package/dist-react/qualityAuditDashboard-ZAM7HRNH.mjs +76 -0
- package/dist-react/qualityAuditDashboard-ZAM7HRNH.mjs.map +1 -0
- package/package.json +17 -2
- package/dist/agentDetailReport-ZR7U2LLB.mjs +0 -17
- package/dist/auditReport-6ZUJ4UFO.mjs +0 -16
- package/dist/chunk-6WLG2PXL.mjs +0 -14
- package/dist/chunk-7LE2VTAI.mjs +0 -14
- package/dist/chunk-AOJRUZTO.mjs +0 -14
- package/dist/chunk-FRKV2U3I.mjs +0 -14
- package/dist/chunk-OHJIW3I3.mjs +0 -14
- package/dist/chunk-WTBVFN4H.mjs +0 -14
- /package/{dist/agentDetailReport-ZR7U2LLB.mjs.map → dist-react/agentDetailReport-PDKQKJNL.mjs.map} +0 -0
|
@@ -0,0 +1,2476 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview TypeScript Declaration File for SDK State Manager
|
|
5
|
+
* @description Type declarations for the SDK state management system.
|
|
6
|
+
* Provides type definitions for centralized state management in the Call Control SDK.
|
|
7
|
+
*
|
|
8
|
+
* @author CTI SDK Team
|
|
9
|
+
* @version 6.x.x
|
|
10
|
+
* @since 2024
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Inline type definitions to avoid Rollup DTS bundler resolution issues
|
|
15
|
+
* with relative imports from handwritten .d.ts files.
|
|
16
|
+
*/
|
|
17
|
+
type SDKConfig$1 = {
|
|
18
|
+
disableEndCallButton?: boolean;
|
|
19
|
+
disableEndConference?: boolean;
|
|
20
|
+
enableSmsServices?: boolean;
|
|
21
|
+
enableQueueName?: boolean;
|
|
22
|
+
enableRingtone?: boolean;
|
|
23
|
+
disabledMoreOptionsButton?: boolean;
|
|
24
|
+
disabledDialButton?: boolean;
|
|
25
|
+
disableCallTransferButton?: boolean;
|
|
26
|
+
disableBlindTransfer?: boolean;
|
|
27
|
+
disableAttendedTransfer?: boolean;
|
|
28
|
+
disableWarmTransfer?: boolean;
|
|
29
|
+
isDraggable?: boolean;
|
|
30
|
+
disableSoftPhone?: boolean;
|
|
31
|
+
disableConferenceButton?: boolean;
|
|
32
|
+
disableHoldButton?: boolean;
|
|
33
|
+
disableMuteButton?: boolean;
|
|
34
|
+
disabled?: any;
|
|
35
|
+
enabled?: any;
|
|
36
|
+
outlined?: any;
|
|
37
|
+
auto_wrapup_time?: number;
|
|
38
|
+
break_time?: number;
|
|
39
|
+
sdkPosition?: "horizontal" | "vertical";
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
type CallStatus =
|
|
43
|
+
| "IDLE"
|
|
44
|
+
| "READY"
|
|
45
|
+
| "BREAK"
|
|
46
|
+
| "ONCALL"
|
|
47
|
+
| "WRAPUP"
|
|
48
|
+
| "RINGING"
|
|
49
|
+
| "DIALING"
|
|
50
|
+
| "MISSED"
|
|
51
|
+
| "HOLD"
|
|
52
|
+
| "UNHOLD"
|
|
53
|
+
| "MUTE"
|
|
54
|
+
| "UNMUTE"
|
|
55
|
+
| "DISCONNECTED"
|
|
56
|
+
| "CONFERENCE"
|
|
57
|
+
| string;
|
|
58
|
+
|
|
59
|
+
type CallData$1 = {
|
|
60
|
+
mode?: string;
|
|
61
|
+
queue_name?: string;
|
|
62
|
+
mobileNumber?: string;
|
|
63
|
+
callReferenceId?: string;
|
|
64
|
+
callId?: string;
|
|
65
|
+
type?: string;
|
|
66
|
+
status: string;
|
|
67
|
+
agent_id: number;
|
|
68
|
+
phone_number?: string;
|
|
69
|
+
event_time?: string;
|
|
70
|
+
call_id?: string;
|
|
71
|
+
process_id?: string;
|
|
72
|
+
process_name?: string;
|
|
73
|
+
mute?: number;
|
|
74
|
+
hold?: number;
|
|
75
|
+
auto_wrapup_time?: number | null;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type ConferenceLineTypes = {
|
|
79
|
+
line: number;
|
|
80
|
+
status: string;
|
|
81
|
+
type: "external" | "internal" | "";
|
|
82
|
+
phone: string;
|
|
83
|
+
isMute: boolean;
|
|
84
|
+
isHold: boolean;
|
|
85
|
+
isCallStart: boolean;
|
|
86
|
+
isMergeCall: boolean;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
type SDKState$1 = {
|
|
90
|
+
authorization: any;
|
|
91
|
+
openConferenceDialog: boolean;
|
|
92
|
+
openCallTransferDialog: boolean;
|
|
93
|
+
process?: { process_id: number; process_name: string } | null;
|
|
94
|
+
agentId: string;
|
|
95
|
+
sessionId?: string;
|
|
96
|
+
sdkConfig: SDKConfig$1 | null;
|
|
97
|
+
urlConfig: any | null;
|
|
98
|
+
isInitialized: boolean;
|
|
99
|
+
call_id?: string;
|
|
100
|
+
process_id?: number;
|
|
101
|
+
callStartTime: number | null;
|
|
102
|
+
position?: { x: number; y: number };
|
|
103
|
+
controlPanelPosition: { x: number; y: number };
|
|
104
|
+
iframePosition: { x: number; y: number };
|
|
105
|
+
callData: CallData$1;
|
|
106
|
+
conferenceLine: ConferenceLineTypes[];
|
|
107
|
+
hold: number;
|
|
108
|
+
mute: number;
|
|
109
|
+
agentStatus: string;
|
|
110
|
+
sdk: any | null;
|
|
111
|
+
isPermissionsLoaded: boolean;
|
|
112
|
+
userPermissions: string[] | null;
|
|
113
|
+
menuEntitlements: Array<{ code: string; name: string; enabled: boolean }> | null;
|
|
114
|
+
consultInfo: any | null;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @interface SDKStateManager
|
|
119
|
+
* @description Interface for the SDK state manager class
|
|
120
|
+
*/
|
|
121
|
+
interface SDKStateManager {
|
|
122
|
+
/**
|
|
123
|
+
* Initialize the SDK with API key, tenant ID, agent ID, and optional configuration
|
|
124
|
+
* @param apiKey - API key for authentication
|
|
125
|
+
* @param tenantId - Tenant identifier
|
|
126
|
+
* @param agentId - Agent identifier
|
|
127
|
+
* @param urlConfig - Optional URL configuration
|
|
128
|
+
* @param res - Optional initialization response
|
|
129
|
+
* @param callControlConfig - Optional call control configuration
|
|
130
|
+
*/
|
|
131
|
+
initialize(apiKey: string, tenantId: string, agentId: string, urlConfig?: any, res?: any, callControlConfig?: SDKConfig$1): void;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get the current state
|
|
135
|
+
* @returns Current SDK state
|
|
136
|
+
*/
|
|
137
|
+
getState(): SDKState$1;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Subscribe to state changes
|
|
141
|
+
* @param listener - Callback function to be called on state changes
|
|
142
|
+
* @returns Unsubscribe function
|
|
143
|
+
*/
|
|
144
|
+
subscribe(listener: () => void): () => void;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Set holding state
|
|
148
|
+
* @param isHolding - Whether call is on hold
|
|
149
|
+
*/
|
|
150
|
+
setHolding(isHolding: boolean): void;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Set muted state
|
|
154
|
+
* @param isMuted - Whether call is muted
|
|
155
|
+
*/
|
|
156
|
+
setMuted(isMuted: boolean): void;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Set call status
|
|
160
|
+
* @param status - Current call status
|
|
161
|
+
*/
|
|
162
|
+
setStatus(status: CallStatus): void;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Set process information
|
|
166
|
+
* @param process - Process data with ID and name
|
|
167
|
+
*/
|
|
168
|
+
setProcess(process: { process_id: number; process_name: string }): void;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Set control panel position
|
|
172
|
+
* @param position - X and Y coordinates
|
|
173
|
+
*/
|
|
174
|
+
setControlPanelPosition(position: { x: number; y: number }): void;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Set iframe position
|
|
178
|
+
* @param position - X and Y coordinates
|
|
179
|
+
*/
|
|
180
|
+
setIframePosition(position: { x: number; y: number }): void;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Start a call (set start time and status)
|
|
184
|
+
*/
|
|
185
|
+
startCall(): void;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* End a call (reset call state)
|
|
189
|
+
*/
|
|
190
|
+
endCall(): void;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Set initialization check flag
|
|
194
|
+
*/
|
|
195
|
+
setInitCheck(): void;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Set conference dialog open state
|
|
199
|
+
* @param open - Whether conference dialog is open
|
|
200
|
+
*/
|
|
201
|
+
setOpenConferenceDialog(open: boolean): void;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Set call transfer dialog open state
|
|
205
|
+
* @param open - Whether call transfer dialog is open
|
|
206
|
+
*/
|
|
207
|
+
setOpenCallTransferDialog(open: boolean): void;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Update call data
|
|
211
|
+
* @param data - Partial call data to update
|
|
212
|
+
*/
|
|
213
|
+
updateCallData(data: Partial<CallData$1>): void;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Update conference data
|
|
217
|
+
* @param data - Array of conference line data
|
|
218
|
+
*/
|
|
219
|
+
updateConferenceData(data: ConferenceLineTypes[]): void;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Set specific conference line
|
|
223
|
+
* @param line - Conference line data
|
|
224
|
+
*/
|
|
225
|
+
setConferenceLine(line: ConferenceLineTypes): void;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Reset conference lines to initial state
|
|
229
|
+
*/
|
|
230
|
+
resetConferenceLines(): void;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Clear storage and reset to initial state
|
|
234
|
+
*/
|
|
235
|
+
clearStorageAndReset(): void;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Debug storage data
|
|
239
|
+
*/
|
|
240
|
+
debugStorage(): void;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Get conference lines
|
|
244
|
+
* @returns Array of conference line data
|
|
245
|
+
*/
|
|
246
|
+
getConferenceLines(): ConferenceLineTypes[];
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Set SDK permissions from user info
|
|
250
|
+
* @param userInfo - User info object from init response
|
|
251
|
+
*/
|
|
252
|
+
setSDKPermissions(userInfo: any): void;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Get entitlement-based controls configuration
|
|
256
|
+
* @returns Controls configuration derived from permissions
|
|
257
|
+
*/
|
|
258
|
+
getControlsConfig(): Partial<SDKConfig$1>;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @class SDKStateManager
|
|
263
|
+
* @description Centralized state management class for the Call Control SDK.
|
|
264
|
+
* Handles state persistence, subscriptions, and provides methods for state updates.
|
|
265
|
+
*/
|
|
266
|
+
declare class SDKStateManager implements SDKStateManager {
|
|
267
|
+
/**
|
|
268
|
+
* Initialize the SDK with API key, tenant ID, agent ID, and optional configuration
|
|
269
|
+
* @param apiKey - API key for authentication
|
|
270
|
+
* @param tenantId - Tenant identifier
|
|
271
|
+
* @param agentId - Agent identifier
|
|
272
|
+
* @param urlConfig - Optional URL configuration
|
|
273
|
+
* @param res - Optional initialization response
|
|
274
|
+
* @param callControlConfig - Optional call control configuration
|
|
275
|
+
*/
|
|
276
|
+
public initialize(apiKey: string, tenantId: string, agentId: string, urlConfig?: any, res?: any, callControlConfig?: SDKConfig$1): void;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Get the current state
|
|
280
|
+
* @returns Current SDK state
|
|
281
|
+
*/
|
|
282
|
+
public getState(): SDKState$1;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Subscribe to state changes
|
|
286
|
+
* @param listener - Callback function to be called on state changes
|
|
287
|
+
* @returns Unsubscribe function
|
|
288
|
+
*/
|
|
289
|
+
public subscribe(listener: () => void): () => void;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Store lead data to be attached as lead_data in the transfer API payload.
|
|
293
|
+
* Call this whenever lead details change in the host application.
|
|
294
|
+
*/
|
|
295
|
+
public setTransferLeadData(data: any): void;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Get the currently stored lead data.
|
|
299
|
+
*/
|
|
300
|
+
public getTransferLeadData(): any;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Clear stored lead data (called automatically when call goes IDLE).
|
|
304
|
+
*/
|
|
305
|
+
public clearTransferLeadData(): void;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Set holding state
|
|
309
|
+
* @param isHolding - Whether call is on hold
|
|
310
|
+
*/
|
|
311
|
+
public setHolding(isHolding: boolean): void;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Set muted state
|
|
315
|
+
* @param isMuted - Whether call is muted
|
|
316
|
+
*/
|
|
317
|
+
public setMuted(isMuted: boolean): void;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Set call status
|
|
321
|
+
* @param status - Current call status
|
|
322
|
+
*/
|
|
323
|
+
public setStatus(status: CallStatus): void;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Set process information
|
|
327
|
+
* @param process - Process data with ID and name
|
|
328
|
+
*/
|
|
329
|
+
public setProcess(process: { process_id: number; process_name: string }): void;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Set control panel position
|
|
333
|
+
* @param position - X and Y coordinates
|
|
334
|
+
*/
|
|
335
|
+
public setControlPanelPosition(position: { x: number; y: number }): void;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Set iframe position
|
|
339
|
+
* @param position - X and Y coordinates
|
|
340
|
+
*/
|
|
341
|
+
public setIframePosition(position: { x: number; y: number }): void;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Start a call (set start time and status)
|
|
345
|
+
*/
|
|
346
|
+
public startCall(): void;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* End a call (reset call state)
|
|
350
|
+
*/
|
|
351
|
+
public endCall(): void;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Set initialization check flag
|
|
355
|
+
*/
|
|
356
|
+
public setInitCheck(): void;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Set conference dialog open state
|
|
360
|
+
* @param open - Whether conference dialog is open
|
|
361
|
+
*/
|
|
362
|
+
public setOpenConferenceDialog(open: boolean): void;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Set call transfer dialog open state
|
|
366
|
+
* @param open - Whether call transfer dialog is open
|
|
367
|
+
*/
|
|
368
|
+
public setOpenCallTransferDialog(open: boolean): void;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Update call data
|
|
372
|
+
* @param data - Partial call data to update
|
|
373
|
+
*/
|
|
374
|
+
public updateCallData(data: Partial<CallData$1>): void;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Update conference data
|
|
378
|
+
* @param data - Array of conference line data
|
|
379
|
+
*/
|
|
380
|
+
public updateConferenceData(data: ConferenceLineTypes[]): void;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Set specific conference line
|
|
384
|
+
* @param line - Conference line data
|
|
385
|
+
*/
|
|
386
|
+
public setConferenceLine(line: ConferenceLineTypes): void;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Reset conference lines to initial state
|
|
390
|
+
*/
|
|
391
|
+
public resetConferenceLines(): void;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Clear storage and reset to initial state
|
|
395
|
+
*/
|
|
396
|
+
public clearStorageAndReset(): void;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Debug storage data
|
|
400
|
+
*/
|
|
401
|
+
public debugStorage(): void;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Get conference lines
|
|
405
|
+
* @returns Array of conference line data
|
|
406
|
+
*/
|
|
407
|
+
public getConferenceLines(): ConferenceLineTypes[];
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Set SDK permissions from user info
|
|
411
|
+
* @param userInfo - User info object from init response
|
|
412
|
+
*/
|
|
413
|
+
public setSDKPermissions(userInfo: any): void;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Get entitlement-based controls configuration
|
|
417
|
+
* @returns Controls configuration derived from permissions
|
|
418
|
+
*/
|
|
419
|
+
public getControlsConfig(): Partial<SDKConfig$1>;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* @constant sdkStateManager
|
|
424
|
+
* @description Singleton instance of the SDK state manager
|
|
425
|
+
* @type {SDKStateManager}
|
|
426
|
+
*/
|
|
427
|
+
declare const sdkStateManager: SDKStateManager;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* @fileoverview 📦 TypeScript Declaration File for Call Control SDK
|
|
431
|
+
* @description Comprehensive CTI (Computer Telephony Integration) SDK for agent platform applications.
|
|
432
|
+
* Provides complete call control functionality including dialing, conferencing, transferring,
|
|
433
|
+
* and real-time call management with WebSocket integration.
|
|
434
|
+
*
|
|
435
|
+
* @author CTI SDK Team
|
|
436
|
+
* @version 6.x.x
|
|
437
|
+
* @since 2024
|
|
438
|
+
*/
|
|
439
|
+
|
|
440
|
+
// =============================================================================
|
|
441
|
+
// 🎯 MAIN SDK FUNCTIONS
|
|
442
|
+
// =============================================================================
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* 🚀 SDK Initialization Parameters Interface
|
|
446
|
+
*
|
|
447
|
+
* @interface InitSDKParams
|
|
448
|
+
* @description Parameters required for SDK initialization
|
|
449
|
+
*
|
|
450
|
+
* @properties
|
|
451
|
+
* - `apiKey: string` - Authentication key for SDK access
|
|
452
|
+
* - `tenantId: string` - Tenant identifier for multi-tenancy support
|
|
453
|
+
* - `agentId: string` - Agent identifier for call management
|
|
454
|
+
* - `sdkConfig?: SDKConfig` - Optional SDK configuration for customizing behavior
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```typescript
|
|
458
|
+
* const initParams: InitSDKParams = {
|
|
459
|
+
* apiKey: "your-api-key",
|
|
460
|
+
* tenantId: "tenant-123",
|
|
461
|
+
* agentId: "agent-456",
|
|
462
|
+
* sdkConfig: {
|
|
463
|
+
* isDraggable: true,
|
|
464
|
+
* disableSoftPhone: false
|
|
465
|
+
* }
|
|
466
|
+
* };
|
|
467
|
+
* ```
|
|
468
|
+
*
|
|
469
|
+
* @since 1.0.0
|
|
470
|
+
* @author CTI SDK Team
|
|
471
|
+
*/
|
|
472
|
+
interface InitSDKParams {
|
|
473
|
+
/** Authentication key for SDK access */
|
|
474
|
+
apiKey: string;
|
|
475
|
+
/** Tenant identifier for multi-tenancy support */
|
|
476
|
+
tenantId: string;
|
|
477
|
+
/** Agent identifier for call management */
|
|
478
|
+
agentId: string;
|
|
479
|
+
/** Optional SDK configuration for customizing behavior */
|
|
480
|
+
sdkConfig?: SDKConfig;
|
|
481
|
+
/** Optional URL configuration for SDK endpoints */
|
|
482
|
+
urlConfig?: URLConfig;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* 🚀 Initialize the Call Control SDK
|
|
487
|
+
*
|
|
488
|
+
* @function initSDK
|
|
489
|
+
* @description Initializes the Call Control SDK with authentication credentials and configuration.
|
|
490
|
+
* Sets up event tracking, state management, and establishes connection to the CTI system.
|
|
491
|
+
*
|
|
492
|
+
* @param {InitSDKParams} params - Object containing API key, tenant ID, agent ID, and optional config
|
|
493
|
+
* @returns {Promise<void>} Promise that resolves when initialization is complete
|
|
494
|
+
*
|
|
495
|
+
* @example
|
|
496
|
+
* ```typescript
|
|
497
|
+
* // Basic initialization
|
|
498
|
+
* await initSDK({
|
|
499
|
+
* apiKey: "your-api-key",
|
|
500
|
+
* tenantId: "tenant-123",
|
|
501
|
+
* agentId: "agent-456"
|
|
502
|
+
* });
|
|
503
|
+
*
|
|
504
|
+
* // With custom configuration
|
|
505
|
+
* await initSDK({
|
|
506
|
+
* apiKey: "your-api-key",
|
|
507
|
+
* tenantId: "tenant-123",
|
|
508
|
+
* agentId: "agent-456",
|
|
509
|
+
* sdkConfig: {
|
|
510
|
+
* isDraggable: true,
|
|
511
|
+
* disableSoftPhone: false,
|
|
512
|
+
* disableEndCallButton: false
|
|
513
|
+
* }
|
|
514
|
+
* });
|
|
515
|
+
* ```
|
|
516
|
+
*
|
|
517
|
+
* @throws {Error} When API key is missing or invalid
|
|
518
|
+
* @throws {Error} When tenant ID is missing or invalid
|
|
519
|
+
* @throws {Error} When agent ID is missing or invalid
|
|
520
|
+
* @throws {Error} When initialization fails due to network or authentication issues
|
|
521
|
+
*
|
|
522
|
+
* @since 1.0.0
|
|
523
|
+
* @author CTI SDK Team
|
|
524
|
+
*/
|
|
525
|
+
interface SDKInitResult {
|
|
526
|
+
accessToken: string;
|
|
527
|
+
expiration: string;
|
|
528
|
+
ticketId: string;
|
|
529
|
+
callControls: any;
|
|
530
|
+
userInfo: any;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
declare function initSDK(params: InitSDKParams): Promise<SDKInitResult>;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* 📋 Get SDK Version
|
|
537
|
+
*
|
|
538
|
+
* @function getSDKVersion
|
|
539
|
+
* @description Returns the current version of the Call Control SDK
|
|
540
|
+
*
|
|
541
|
+
* @returns {string} Current SDK version string
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```typescript
|
|
545
|
+
* const version = getSDKVersion();
|
|
546
|
+
* console.log(`Using Call Control SDK version: ${version}`);
|
|
547
|
+
* ```
|
|
548
|
+
*
|
|
549
|
+
* @since 1.0.0
|
|
550
|
+
* @author CTI SDK Team
|
|
551
|
+
*/
|
|
552
|
+
declare function getSDKVersion(): string;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* ✅ Check SDK Initialization Status
|
|
556
|
+
*
|
|
557
|
+
* @function isSDKInitialized
|
|
558
|
+
* @description Checks if the SDK has been successfully initialized
|
|
559
|
+
*
|
|
560
|
+
* @returns {boolean} True if SDK is initialized, false otherwise
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```typescript
|
|
564
|
+
* if (isSDKInitialized()) {
|
|
565
|
+
* // SDK is ready to use
|
|
566
|
+
* console.log("SDK is initialized and ready");
|
|
567
|
+
* } else {
|
|
568
|
+
* console.log("SDK needs to be initialized first");
|
|
569
|
+
* }
|
|
570
|
+
* ```
|
|
571
|
+
*
|
|
572
|
+
* @since 1.0.0
|
|
573
|
+
* @author CTI SDK Team
|
|
574
|
+
*/
|
|
575
|
+
declare function isSDKInitialized(): boolean;
|
|
576
|
+
|
|
577
|
+
// =============================================================================
|
|
578
|
+
// 🎭 COMPONENT EXPORTS
|
|
579
|
+
// =============================================================================
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* 🎭 Call Control Panel Component
|
|
583
|
+
*
|
|
584
|
+
* @component CallControlPanel
|
|
585
|
+
* @description Main call control panel component for the CTI SDK.
|
|
586
|
+
* Provides comprehensive call management interface with all necessary controls.
|
|
587
|
+
*
|
|
588
|
+
* @param {CallControlPanelProps} props - Component props
|
|
589
|
+
* @returns {JSX.Element} Call control panel interface
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* ```tsx
|
|
593
|
+
* <CallControlPanel onDataChange={handleDataChange} />
|
|
594
|
+
*
|
|
595
|
+
* <CallControlPanel onDataChange={(data) => {
|
|
596
|
+
* console.log('Call Data:', data);
|
|
597
|
+
* }} />
|
|
598
|
+
* ```
|
|
599
|
+
*
|
|
600
|
+
* @since 1.0.0
|
|
601
|
+
* @author CTI SDK Team
|
|
602
|
+
*/
|
|
603
|
+
declare const CallControlPanel: React.ComponentType<CallControlPanelProps>;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* 📄 SDK Pages
|
|
607
|
+
*
|
|
608
|
+
* @description Pre-built pages provided by the SDK, automatically protected by permission guards.
|
|
609
|
+
*
|
|
610
|
+
* @properties
|
|
611
|
+
* - `CallHistory` - Call History page component
|
|
612
|
+
* - `Campaigns` - Campaigns / Call Scheduling page component
|
|
613
|
+
* - `LoginReport` - Agent Login Report page component
|
|
614
|
+
* - `CdrReports` - CDR (Call Detail Records) Report page component
|
|
615
|
+
* - `AuditReportPage` - Stand-alone (full-tab) audit report page component
|
|
616
|
+
* - `AgentPerformanceReport` - Agent Performance Report page component
|
|
617
|
+
* - `AgentDetailReport` - Agent Detail Report page component
|
|
618
|
+
* - `LiveStatus` - Supervisor Live Status / Wallboard page component
|
|
619
|
+
*
|
|
620
|
+
* @since 1.0.0
|
|
621
|
+
* @author CTI SDK Team
|
|
622
|
+
*/
|
|
623
|
+
|
|
624
|
+
interface LiveStatusPageProps {
|
|
625
|
+
/** When true, renders the TV/wallboard variant: shows the top bar with clock, hides monitor action buttons */
|
|
626
|
+
isTvDashboard?: boolean;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
declare const SDKPages: {
|
|
630
|
+
readonly CallHistory: React.ComponentType<any>;
|
|
631
|
+
readonly Campaigns: React.ComponentType<any>;
|
|
632
|
+
readonly LoginReport: React.ComponentType<any>;
|
|
633
|
+
readonly CdrReports: React.ComponentType<any>;
|
|
634
|
+
readonly AuditReportPage: React.ComponentType<{ callUuid?: string }>;
|
|
635
|
+
readonly AgentPerformanceReport: React.ComponentType<any>;
|
|
636
|
+
readonly AgentDetailReport: React.ComponentType<any>;
|
|
637
|
+
readonly LiveStatus: React.ComponentType<LiveStatusPageProps>;
|
|
638
|
+
readonly ManagementDashboard: React.ComponentType<any>;
|
|
639
|
+
readonly CaroVoiceAI: React.ComponentType<any>;
|
|
640
|
+
readonly QualityAuditDashboard: React.ComponentType<any>;
|
|
641
|
+
readonly CaroQualityAuditDashboard: React.ComponentType<any>;
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
// =============================================================================
|
|
645
|
+
// 🗃️ TYPE EXPORTS
|
|
646
|
+
// =============================================================================
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* 📞 Call Data Interface
|
|
650
|
+
*
|
|
651
|
+
* @interface CallData
|
|
652
|
+
* @description Comprehensive interface defining call-related data structure for CTI operations.
|
|
653
|
+
* Contains all necessary information about active calls, including metadata, status, and references.
|
|
654
|
+
*
|
|
655
|
+
* @properties
|
|
656
|
+
* - `callReferenceId?: string` - Unique reference identifier for the call
|
|
657
|
+
* - `status?: string` - Current status of the call (ONCALL, RINGING, WRAPUP, etc.)
|
|
658
|
+
* - `agent_id?: string` - Agent identifier associated with the call
|
|
659
|
+
* - `phone_number?: string` - Phone number involved in the call
|
|
660
|
+
* - `process_id?: string` - Process identifier for the call
|
|
661
|
+
* - `process_name?: string` - Name of the process handling the call
|
|
662
|
+
*
|
|
663
|
+
* @since 1.0.0
|
|
664
|
+
* @author CTI SDK Team
|
|
665
|
+
*/
|
|
666
|
+
interface CallData {
|
|
667
|
+
mode?: string;
|
|
668
|
+
queue_name?: string;
|
|
669
|
+
mobileNumber?: string;
|
|
670
|
+
callReferenceId?: string;
|
|
671
|
+
convoxId?: string;
|
|
672
|
+
type?: string;
|
|
673
|
+
status: string;
|
|
674
|
+
agent_id: number;
|
|
675
|
+
phone_number?: string;
|
|
676
|
+
event_time?: string;
|
|
677
|
+
call_id?: string;
|
|
678
|
+
process_id?: string;
|
|
679
|
+
process_name?: string;
|
|
680
|
+
mute?: number;
|
|
681
|
+
hold?: number;
|
|
682
|
+
auto_wrapup_time?: number | null;
|
|
683
|
+
call_details?: {
|
|
684
|
+
extension?: string;
|
|
685
|
+
call_type?: string;
|
|
686
|
+
caller_direction?: string;
|
|
687
|
+
agent_id?: number;
|
|
688
|
+
queue_name?: string;
|
|
689
|
+
did_number?: string;
|
|
690
|
+
call_uuid?: string;
|
|
691
|
+
[key: string]: any;
|
|
692
|
+
};
|
|
693
|
+
/** Lead data set by the host app; attached when available */
|
|
694
|
+
lead_data?: any;
|
|
695
|
+
/** Raw socket payload from the most recent WebSocket message */
|
|
696
|
+
socket_info?: any;
|
|
697
|
+
break_details?: {
|
|
698
|
+
type: string;
|
|
699
|
+
value: string;
|
|
700
|
+
} | null;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* ⚙️ SDK Configuration Interface
|
|
705
|
+
*
|
|
706
|
+
* @interface SDKConfig
|
|
707
|
+
* @description Configuration interface for customizing the Call Control SDK behavior.
|
|
708
|
+
* Allows disabling specific features and customizing the visual appearance of components.
|
|
709
|
+
*
|
|
710
|
+
* @properties
|
|
711
|
+
* - `disableEndCallButton?: boolean` - Whether to disable the end call button
|
|
712
|
+
* - `disabledDialButton?: boolean` - Whether to disable the dial button
|
|
713
|
+
* - `disableCallTransferButton?: boolean` - Whether to disable the call transfer button
|
|
714
|
+
* - `isDraggable?: boolean` - Whether the control panel should be draggable
|
|
715
|
+
* - `disableSoftPhone?: boolean` - Whether to disable the soft phone iframe
|
|
716
|
+
* - `disableConferenceButton?: boolean` - Whether to disable the conference button
|
|
717
|
+
* - `disabled?: SxProps` - Custom styles for disabled button states
|
|
718
|
+
* - `enabled?: SxProps` - Custom styles for enabled button states
|
|
719
|
+
* - `outlined?: SxProps` - Custom styles for outlined button states
|
|
720
|
+
*
|
|
721
|
+
* @since 1.0.0
|
|
722
|
+
* @author CTI SDK Team
|
|
723
|
+
*/
|
|
724
|
+
interface SDKConfig {
|
|
725
|
+
disableEndCallButton?: boolean;
|
|
726
|
+
disableEndConference?: boolean;
|
|
727
|
+
disabledDialButton?: boolean;
|
|
728
|
+
enableSmsServices?: boolean;
|
|
729
|
+
enableQueueName?: boolean;
|
|
730
|
+
disableCallTransferButton?: boolean;
|
|
731
|
+
isDraggable?: boolean;
|
|
732
|
+
disableSoftPhone?: boolean;
|
|
733
|
+
disableConferenceButton?: boolean;
|
|
734
|
+
disabled?: any;
|
|
735
|
+
enabled?: any;
|
|
736
|
+
outlined?: any;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
interface URLConfig {
|
|
740
|
+
id?: string;
|
|
741
|
+
baseURL: string;
|
|
742
|
+
iframeURL: string;
|
|
743
|
+
iframeAPIURL: string;
|
|
744
|
+
password: string;
|
|
745
|
+
webSocketURL: string;
|
|
746
|
+
coreBaseURL: string;
|
|
747
|
+
accessToken?: string;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* 🎭 Call Control Panel Props Interface
|
|
752
|
+
*
|
|
753
|
+
* @interface CallControlPanelProps
|
|
754
|
+
* @description Props interface for the CallControlPanel component.
|
|
755
|
+
* Defines the properties passed to the call control panel.
|
|
756
|
+
*
|
|
757
|
+
* @properties
|
|
758
|
+
* - `onDataChange?: (data: CallData) => void` - Callback for call data changes
|
|
759
|
+
*
|
|
760
|
+
* @since 1.0.0
|
|
761
|
+
* @author CTI SDK Team
|
|
762
|
+
*/
|
|
763
|
+
interface CallControlPanelProps {
|
|
764
|
+
onDataChange?: (data: CallData) => void;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// =============================================================================
|
|
768
|
+
// 🔧 HOOK EXPORTS
|
|
769
|
+
// =============================================================================
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
*
|
|
773
|
+
* This file contains TypeScript type definitions for the useEndCall custom hook
|
|
774
|
+
* and its related interfaces. It provides comprehensive type safety and IntelliSense
|
|
775
|
+
* support for developers using the CTI SDK call termination functionality.
|
|
776
|
+
*
|
|
777
|
+
* 🎯 Key Type Definitions:
|
|
778
|
+
* - 📞 EndCallPayload interface for call termination API data
|
|
779
|
+
* - 📞 useEndCall hook return type
|
|
780
|
+
* - 🔄 Call termination function signature
|
|
781
|
+
* - 📊 State management types
|
|
782
|
+
* - 📅 Callback scheduling types
|
|
783
|
+
*
|
|
784
|
+
* @author CTI SDK Team
|
|
785
|
+
* @version 6.x.x
|
|
786
|
+
* @since 1.0.0
|
|
787
|
+
*/
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* End Call Payload Interface
|
|
791
|
+
*
|
|
792
|
+
* @interface EndCallPayload
|
|
793
|
+
* @description Defines the options for ending a call. All fields are optional —
|
|
794
|
+
* any omitted field falls back to the current session/call state automatically.
|
|
795
|
+
*
|
|
796
|
+
* @properties
|
|
797
|
+
* - `call_id?: string` - Convox call ID (defaults to active call's call_id)
|
|
798
|
+
* - `agent_id?: string` - Agent identifier (defaults to logged-in agent)
|
|
799
|
+
* - `set_followUp?: string` - Whether a follow-up is required: "Y" or "N" (default: "N")
|
|
800
|
+
* - `callback_date?: string` - Scheduled callback date (YYYY-MM-DD)
|
|
801
|
+
* - `callback_hrs?: number` - Scheduled callback hour (0–23)
|
|
802
|
+
* - `callback_mins?: number` - Scheduled callback minute (0–59)
|
|
803
|
+
* - `mobile_number?: string` - Customer phone number (defaults to active call's phone_number)
|
|
804
|
+
* - `list_comments?: string` - Optional comments for the call log
|
|
805
|
+
* - `call_reference_id?: string` - Call reference ID (defaults to active call's call_id)
|
|
806
|
+
* - `disposition?: string` - Call outcome code (default: "RES")
|
|
807
|
+
* - `line_number?: number` - Conference line number (default: 0)
|
|
808
|
+
* - `reason?: string` - End reason sent to server (default: "normal")
|
|
809
|
+
* - `is_mark_as_break?: boolean` - Whether agent is going on break after the call (sent in request body)
|
|
810
|
+
* - `patientLog?: any` - Optional patient/contact log data
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```typescript
|
|
814
|
+
* // Minimal — all defaults applied from session state
|
|
815
|
+
* await endCall();
|
|
816
|
+
*
|
|
817
|
+
* // With disposition and follow-up callback
|
|
818
|
+
* await endCall({
|
|
819
|
+
* disposition: "RES",
|
|
820
|
+
* set_followUp: "Y",
|
|
821
|
+
* callback_date: "2026-05-20",
|
|
822
|
+
* callback_hrs: 10,
|
|
823
|
+
* callback_mins: 30,
|
|
824
|
+
* });
|
|
825
|
+
*
|
|
826
|
+
* // Agent going on break after call
|
|
827
|
+
* await endCall({ disposition: "RES", is_mark_as_break: true });
|
|
828
|
+
* ```
|
|
829
|
+
*
|
|
830
|
+
* @since 1.0.0
|
|
831
|
+
* @author CTI SDK Team
|
|
832
|
+
*/
|
|
833
|
+
interface EndCallPayload {
|
|
834
|
+
call_id?: string;
|
|
835
|
+
agent_id?: string;
|
|
836
|
+
set_followUp?: string;
|
|
837
|
+
callback_date?: string;
|
|
838
|
+
callback_hrs?: number;
|
|
839
|
+
callback_mins?: number;
|
|
840
|
+
mobile_number?: string;
|
|
841
|
+
list_comments?: string;
|
|
842
|
+
call_reference_id?: string;
|
|
843
|
+
is_mark_as_break?: boolean;
|
|
844
|
+
disposition?: string;
|
|
845
|
+
line_number?: number;
|
|
846
|
+
reason?: string;
|
|
847
|
+
patientLog?: any;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* 📅 End Call Data Interface
|
|
852
|
+
*
|
|
853
|
+
* @interface EndCallData
|
|
854
|
+
* @description 📊 Defines the structure for call termination input data
|
|
855
|
+
* Contains disposition and callback information for ending calls
|
|
856
|
+
*
|
|
857
|
+
* @properties
|
|
858
|
+
* - `disposition?: string` - 📝 Call outcome classification (default: "RES")
|
|
859
|
+
* - `followUp?: string` - 📅 Follow-up requirement (default: "N")
|
|
860
|
+
* - `callbackDate?: string` - 📅 Scheduled callback date (default: "")
|
|
861
|
+
* - `callbackHrs?: string` - 🕐 Scheduled callback hour (default: "")
|
|
862
|
+
* - `callbackMins?: string` - 🕐 Scheduled callback minute (default: "")
|
|
863
|
+
*
|
|
864
|
+
* @example
|
|
865
|
+
* ```typescript
|
|
866
|
+
* // Basic end call data
|
|
867
|
+
* const endCallData: EndCallData = {
|
|
868
|
+
* disposition: "RES",
|
|
869
|
+
* followUp: "N"
|
|
870
|
+
* };
|
|
871
|
+
*
|
|
872
|
+
* // With callback scheduling
|
|
873
|
+
* const endCallWithCallback: EndCallData = {
|
|
874
|
+
* disposition: "RES",
|
|
875
|
+
* followUp: "Y",
|
|
876
|
+
* callbackDate: "2024-01-15",
|
|
877
|
+
* callbackHrs: "14",
|
|
878
|
+
* callbackMins: "30"
|
|
879
|
+
* };
|
|
880
|
+
* ```
|
|
881
|
+
*
|
|
882
|
+
* @since 1.0.0
|
|
883
|
+
* @author CTI SDK Team
|
|
884
|
+
*/
|
|
885
|
+
interface EndCallData {
|
|
886
|
+
/**
|
|
887
|
+
* 📝 Call outcome classification
|
|
888
|
+
* @description How the call ended (default: "RES" for Resolved)
|
|
889
|
+
* @type {string | undefined}
|
|
890
|
+
*/
|
|
891
|
+
disposition?: string;
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* 📅 Follow-up requirement
|
|
895
|
+
* @description Whether follow-up is required (default: "N" for No)
|
|
896
|
+
* @type {string | undefined}
|
|
897
|
+
*/
|
|
898
|
+
followUp?: string;
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* 📅 Scheduled callback date
|
|
902
|
+
* @description Date for callback scheduling (YYYY-MM-DD format)
|
|
903
|
+
* @type {string | undefined}
|
|
904
|
+
*/
|
|
905
|
+
callbackDate?: string;
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* 🕐 Scheduled callback hour
|
|
909
|
+
* @description Hour for callback scheduling (0-23)
|
|
910
|
+
* @type {string | undefined}
|
|
911
|
+
*/
|
|
912
|
+
callbackHrs?: string;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* 🕐 Scheduled callback minute
|
|
916
|
+
* @description Minute for callback scheduling (0-59)
|
|
917
|
+
* @type {string | undefined}
|
|
918
|
+
*/
|
|
919
|
+
callbackMins?: string;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* 📞 Call Termination Function Type
|
|
924
|
+
*
|
|
925
|
+
* @type CallTerminationFunction
|
|
926
|
+
* @description 🎯 Type definition for the call termination function
|
|
927
|
+
* Handles call termination with disposition tracking and callback scheduling
|
|
928
|
+
*
|
|
929
|
+
* @param {EndCallData} data - 📊 Call termination data containing disposition and callback info
|
|
930
|
+
* @returns {Promise<any>} Promise that resolves with API response data or rejects with error
|
|
931
|
+
*
|
|
932
|
+
* @example
|
|
933
|
+
* ```typescript
|
|
934
|
+
* const handleEndCall: CallTerminationFunction = async (data) => {
|
|
935
|
+
* // Call termination logic
|
|
936
|
+
* return await apiCall(data);
|
|
937
|
+
* };
|
|
938
|
+
* ```
|
|
939
|
+
*
|
|
940
|
+
* @since 1.0.0
|
|
941
|
+
* @author CTI SDK Team
|
|
942
|
+
*/
|
|
943
|
+
type CallTerminationFunction = (data: EndCallData) => Promise<any>;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* 📊 Hook State Management Types
|
|
947
|
+
*
|
|
948
|
+
* @type HookStateTypes
|
|
949
|
+
* @description 🎛️ Type definitions for all hook state variables
|
|
950
|
+
* Provides type safety for loading, success, error, and data states
|
|
951
|
+
*
|
|
952
|
+
* @since 1.0.0
|
|
953
|
+
* @author CTI SDK Team
|
|
954
|
+
*/
|
|
955
|
+
type HookStateTypes = {
|
|
956
|
+
/**
|
|
957
|
+
* ⏳ Loading state indicator
|
|
958
|
+
* @description Boolean flag indicating if a call termination operation is in progress
|
|
959
|
+
* @type {boolean}
|
|
960
|
+
*/
|
|
961
|
+
isLoading: boolean;
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* ✅ Success state indicator
|
|
965
|
+
* @description Boolean flag indicating if the last call termination was successful
|
|
966
|
+
* @type {boolean}
|
|
967
|
+
*/
|
|
968
|
+
isSuccess: boolean;
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* ❌ Error state indicator
|
|
972
|
+
* @description Boolean flag indicating if the last call termination encountered an error
|
|
973
|
+
* @type {boolean}
|
|
974
|
+
*/
|
|
975
|
+
isError: boolean;
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* 🛡️ Error object
|
|
979
|
+
* @description Contains the error object when a call termination fails
|
|
980
|
+
* @type {any}
|
|
981
|
+
*/
|
|
982
|
+
error: any;
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* 📊 Response data
|
|
986
|
+
* @description Contains the response data from successful call terminations
|
|
987
|
+
* @type {any}
|
|
988
|
+
*/
|
|
989
|
+
data: any;
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* 📞 useEndCall Hook Return Type
|
|
994
|
+
*
|
|
995
|
+
* @interface UseEndCallReturn
|
|
996
|
+
* @description 🎯 Complete return type for the useEndCall hook
|
|
997
|
+
* Contains all functions and state for call termination functionality
|
|
998
|
+
*
|
|
999
|
+
* @properties
|
|
1000
|
+
* - `handleEndCall: CallTerminationFunction` - 📞 Call termination function
|
|
1001
|
+
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
1002
|
+
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
1003
|
+
* - `isError: boolean` - ❌ Error state indicator
|
|
1004
|
+
* - `error: any` - 🛡️ Error object when call fails
|
|
1005
|
+
* - `data: any` - 📊 Response data from successful calls
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* ```typescript
|
|
1009
|
+
* const EndCallButton = () => {
|
|
1010
|
+
* const hookReturn: UseEndCallReturn = useEndCall();
|
|
1011
|
+
* const {
|
|
1012
|
+
* handleEndCall,
|
|
1013
|
+
* isLoading,
|
|
1014
|
+
* isSuccess,
|
|
1015
|
+
* isError,
|
|
1016
|
+
* error
|
|
1017
|
+
* } = hookReturn;
|
|
1018
|
+
*
|
|
1019
|
+
* // Use the hook functionality
|
|
1020
|
+
* };
|
|
1021
|
+
* ```
|
|
1022
|
+
*
|
|
1023
|
+
* @since 1.0.0
|
|
1024
|
+
* @author CTI SDK Team
|
|
1025
|
+
*/
|
|
1026
|
+
interface UseEndCallReturn extends HookStateTypes {
|
|
1027
|
+
/**
|
|
1028
|
+
* 📞 Call termination function
|
|
1029
|
+
* @description Handles call termination with disposition tracking and callback scheduling
|
|
1030
|
+
* @type {CallTerminationFunction}
|
|
1031
|
+
*/
|
|
1032
|
+
handleEndCall: CallTerminationFunction;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* 📞 End Call Custom Hook
|
|
1037
|
+
*
|
|
1038
|
+
* @function useEndCall
|
|
1039
|
+
* @description 🎯 Custom hook that provides comprehensive call termination functionality
|
|
1040
|
+
* for the CTI SDK. It handles call disposition capture, callback scheduling,
|
|
1041
|
+
* and proper call cleanup with intelligent state management and error handling.
|
|
1042
|
+
*
|
|
1043
|
+
* @returns {UseEndCallReturn} Hook return object containing:
|
|
1044
|
+
* - `handleEndCall: CallTerminationFunction` - 📞 Call termination function
|
|
1045
|
+
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
1046
|
+
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
1047
|
+
* - `isError: boolean` - ❌ Error state indicator
|
|
1048
|
+
* - `error: any` - 🛡️ Error object when call fails
|
|
1049
|
+
* - `data: any` - 📊 Response data from successful calls
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```typescript
|
|
1053
|
+
* // Basic usage in a component
|
|
1054
|
+
* const EndCallButton = () => {
|
|
1055
|
+
* const {
|
|
1056
|
+
* handleEndCall,
|
|
1057
|
+
* isLoading,
|
|
1058
|
+
* isSuccess,
|
|
1059
|
+
* isError,
|
|
1060
|
+
* error
|
|
1061
|
+
* } = useEndCall();
|
|
1062
|
+
*
|
|
1063
|
+
* const endCall = async () => {
|
|
1064
|
+
* try {
|
|
1065
|
+
* const result = await handleEndCall({
|
|
1066
|
+
* disposition: "RES",
|
|
1067
|
+
* followUp: "N"
|
|
1068
|
+
* });
|
|
1069
|
+
* console.log('📞 Call ended:', result);
|
|
1070
|
+
* } catch (err) {
|
|
1071
|
+
* console.error('❌ End call failed:', err);
|
|
1072
|
+
* }
|
|
1073
|
+
* };
|
|
1074
|
+
*
|
|
1075
|
+
* return (
|
|
1076
|
+
* <button
|
|
1077
|
+
* onClick={endCall}
|
|
1078
|
+
* disabled={isLoading}
|
|
1079
|
+
* >
|
|
1080
|
+
* {isLoading ? 'Ending...' : 'End Call'}
|
|
1081
|
+
* </button>
|
|
1082
|
+
* );
|
|
1083
|
+
* };
|
|
1084
|
+
* ```
|
|
1085
|
+
*
|
|
1086
|
+
* @features
|
|
1087
|
+
* - 🎯 Comprehensive call termination with disposition tracking
|
|
1088
|
+
* - 📅 Callback scheduling and follow-up management
|
|
1089
|
+
* - 🔄 Intelligent state cleanup and reset
|
|
1090
|
+
* - ⏳ Comprehensive loading state management
|
|
1091
|
+
* - 🛡️ Robust error handling and recovery
|
|
1092
|
+
* - 📊 Real-time state updates via SDK manager
|
|
1093
|
+
* - 🔄 Automatic call state management
|
|
1094
|
+
*
|
|
1095
|
+
* @since 1.0.0
|
|
1096
|
+
* @author CTI SDK Team
|
|
1097
|
+
*/
|
|
1098
|
+
declare const useEndCall: () => UseEndCallReturn;
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* 📝 Disposition Types
|
|
1102
|
+
*
|
|
1103
|
+
* @type DispositionType
|
|
1104
|
+
* @description 🎯 Type definitions for call disposition values
|
|
1105
|
+
* Used for call outcome classification
|
|
1106
|
+
*
|
|
1107
|
+
* @since 1.0.0
|
|
1108
|
+
* @author CTI SDK Team
|
|
1109
|
+
*/
|
|
1110
|
+
type DispositionType = string;
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* 📅 Follow-up Types
|
|
1114
|
+
*
|
|
1115
|
+
* @type FollowUpType
|
|
1116
|
+
* @description 🎯 Type definitions for follow-up requirement values
|
|
1117
|
+
* Used for callback scheduling
|
|
1118
|
+
*
|
|
1119
|
+
* @since 1.0.0
|
|
1120
|
+
* @author CTI SDK Team
|
|
1121
|
+
*/
|
|
1122
|
+
type FollowUpType = string;
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* ⚙️ Process Data Interface
|
|
1126
|
+
*
|
|
1127
|
+
* @interface ProcessData
|
|
1128
|
+
* @description 📊 Type definition for process data structure
|
|
1129
|
+
* Contains information about the current process
|
|
1130
|
+
*
|
|
1131
|
+
* @properties
|
|
1132
|
+
* - `process_id: number` - 🔢 Process identifier
|
|
1133
|
+
* - `process_name: string` - 📝 Process name
|
|
1134
|
+
*
|
|
1135
|
+
* @since 1.0.0
|
|
1136
|
+
* @author CTI SDK Team
|
|
1137
|
+
*/
|
|
1138
|
+
interface ProcessData {
|
|
1139
|
+
/**
|
|
1140
|
+
* 🔢 Process identifier
|
|
1141
|
+
* @description Unique identifier for the process
|
|
1142
|
+
* @type {number}
|
|
1143
|
+
*/
|
|
1144
|
+
process_id: number;
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* 📝 Process name
|
|
1148
|
+
* @description Human-readable name of the process
|
|
1149
|
+
* @type {string}
|
|
1150
|
+
*/
|
|
1151
|
+
process_name: string;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* 📞 Call Data Interface
|
|
1156
|
+
*
|
|
1157
|
+
* @interface EndCallPayLoadData
|
|
1158
|
+
* @description 📊 Type definition for call data structure
|
|
1159
|
+
* Contains information about the current call
|
|
1160
|
+
*
|
|
1161
|
+
* @properties
|
|
1162
|
+
* - `call_id: string` - 🔗 Call reference identifier
|
|
1163
|
+
* - `phone_number: string` - 📱 Customer phone number
|
|
1164
|
+
*
|
|
1165
|
+
* @since 1.0.0
|
|
1166
|
+
* @author CTI SDK Team
|
|
1167
|
+
*/
|
|
1168
|
+
interface EndCallPayLoadData {
|
|
1169
|
+
/**
|
|
1170
|
+
* 🔗 Call reference identifier
|
|
1171
|
+
* @description Unique identifier for the call
|
|
1172
|
+
* @type {string}
|
|
1173
|
+
*/
|
|
1174
|
+
call_id: string;
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* 📱 Customer phone number
|
|
1178
|
+
* @description Phone number of the customer
|
|
1179
|
+
* @type {string}
|
|
1180
|
+
*/
|
|
1181
|
+
phone_number: string;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* 📋 Comprehensive Type Exports
|
|
1186
|
+
*
|
|
1187
|
+
* @description 📦 Re-exports all types for easy importing
|
|
1188
|
+
* Provides a single import point for all hook-related types
|
|
1189
|
+
*
|
|
1190
|
+
* @example
|
|
1191
|
+
* ```typescript
|
|
1192
|
+
* import {
|
|
1193
|
+
* EndCallPayload,
|
|
1194
|
+
* UseEndCallReturn,
|
|
1195
|
+
* CallTerminationFunction,
|
|
1196
|
+
* EndCallData
|
|
1197
|
+
* } from './useEndCall';
|
|
1198
|
+
* ```
|
|
1199
|
+
*
|
|
1200
|
+
* @since 1.0.0
|
|
1201
|
+
* @author CTI SDK Team
|
|
1202
|
+
*/
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
*
|
|
1206
|
+
* This file contains TypeScript type definitions for the useLogout custom hook
|
|
1207
|
+
* and its related interfaces. It provides comprehensive type safety and IntelliSense
|
|
1208
|
+
* support for developers using the CTI SDK logout functionality.
|
|
1209
|
+
*
|
|
1210
|
+
* 🎯 Key Type Definitions:
|
|
1211
|
+
* - 🚪 LogoutPayload interface for logout API data
|
|
1212
|
+
* - 🚪 useLogout hook return type
|
|
1213
|
+
* - 🔄 Logout function signature
|
|
1214
|
+
* - 📊 State management types
|
|
1215
|
+
* - 🗑️ Cleanup and storage management types
|
|
1216
|
+
*
|
|
1217
|
+
* @author CTI SDK Team
|
|
1218
|
+
* @version 6.x.x
|
|
1219
|
+
* @since 1.0.0
|
|
1220
|
+
*/
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* 🚪 Logout Payload Interface
|
|
1224
|
+
*
|
|
1225
|
+
* @interface LogoutPayload
|
|
1226
|
+
* @description 📊 Defines the structure for agent logout API payload data
|
|
1227
|
+
* Contains all necessary information for secure agent logout
|
|
1228
|
+
*
|
|
1229
|
+
* @properties
|
|
1230
|
+
* - `action: string` - 🎯 API action type ("LOGOUTUSER")
|
|
1231
|
+
* - `userId: string` - 👤 Agent identifier for logout
|
|
1232
|
+
*
|
|
1233
|
+
* @example
|
|
1234
|
+
* ```typescript
|
|
1235
|
+
* // Basic logout payload
|
|
1236
|
+
* const logoutPayload: LogoutPayload = {
|
|
1237
|
+
* action: "LOGOUTUSER",
|
|
1238
|
+
* userId: "agent123"
|
|
1239
|
+
* };
|
|
1240
|
+
*
|
|
1241
|
+
* // Usage in component
|
|
1242
|
+
* const { logout } = useLogout();
|
|
1243
|
+
* await logout();
|
|
1244
|
+
* ```
|
|
1245
|
+
*
|
|
1246
|
+
* @since 1.0.0
|
|
1247
|
+
* @author CTI SDK Team
|
|
1248
|
+
*/
|
|
1249
|
+
interface LogoutPayload {
|
|
1250
|
+
/**
|
|
1251
|
+
* 🎯 API action type
|
|
1252
|
+
* @description The action type for the logout API call
|
|
1253
|
+
* @type {string}
|
|
1254
|
+
*/
|
|
1255
|
+
action: string;
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* 👤 Agent identifier
|
|
1259
|
+
* @description Unique identifier for the agent being logged out
|
|
1260
|
+
* @type {string}
|
|
1261
|
+
*/
|
|
1262
|
+
userId: string;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* 🚪 Logout Function Type
|
|
1267
|
+
*
|
|
1268
|
+
* @type LogoutFunction
|
|
1269
|
+
* @description 🎯 Type definition for the logout function
|
|
1270
|
+
* Handles secure agent logout with comprehensive cleanup procedures
|
|
1271
|
+
*
|
|
1272
|
+
* @returns {Promise<any>} Promise that resolves with API response data or rejects with error
|
|
1273
|
+
*
|
|
1274
|
+
* @example
|
|
1275
|
+
* ```typescript
|
|
1276
|
+
* const logout();
|
|
1277
|
+
* ```
|
|
1278
|
+
*
|
|
1279
|
+
* @since 1.0.0
|
|
1280
|
+
* @author CTI SDK Team
|
|
1281
|
+
*/
|
|
1282
|
+
type LogoutFunction = () => Promise<any>;
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* 📊 Hook State Management Types
|
|
1286
|
+
*
|
|
1287
|
+
* @type LogoutHookStateTypes
|
|
1288
|
+
* @description 🎛️ Type definitions for all hook state variables
|
|
1289
|
+
* Provides type safety for loading, success, error, and data states
|
|
1290
|
+
*
|
|
1291
|
+
* @since 1.0.0
|
|
1292
|
+
* @author CTI SDK Team
|
|
1293
|
+
*/
|
|
1294
|
+
type LogoutHookStateTypes = {
|
|
1295
|
+
/**
|
|
1296
|
+
* ⏳ Loading state indicator
|
|
1297
|
+
* @description Boolean flag indicating if a logout operation is in progress
|
|
1298
|
+
* @type {boolean}
|
|
1299
|
+
*/
|
|
1300
|
+
isLoading: boolean;
|
|
1301
|
+
|
|
1302
|
+
/**
|
|
1303
|
+
* ✅ Success state indicator
|
|
1304
|
+
* @description Boolean flag indicating if the last logout was successful
|
|
1305
|
+
* @type {boolean}
|
|
1306
|
+
*/
|
|
1307
|
+
isSuccess: boolean;
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* ❌ Error state indicator
|
|
1311
|
+
* @description Boolean flag indicating if the last logout encountered an error
|
|
1312
|
+
* @type {boolean}
|
|
1313
|
+
*/
|
|
1314
|
+
isError: boolean;
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* 🛡️ Error object
|
|
1318
|
+
* @description Contains the error object when a logout fails
|
|
1319
|
+
* @type {any}
|
|
1320
|
+
*/
|
|
1321
|
+
error: any;
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* 📊 Response data
|
|
1325
|
+
* @description Contains the response data from successful logout
|
|
1326
|
+
* @type {any}
|
|
1327
|
+
*/
|
|
1328
|
+
data: any;
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* 🚪 useLogout Hook Return Type
|
|
1333
|
+
*
|
|
1334
|
+
* @interface UseLogoutReturn
|
|
1335
|
+
* @description 🎯 Complete return type for the useLogout hook
|
|
1336
|
+
* Contains all functions and state for logout functionality
|
|
1337
|
+
*
|
|
1338
|
+
* @properties
|
|
1339
|
+
* - `logout: LogoutFunction` - 🚪 Logout function
|
|
1340
|
+
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
1341
|
+
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
1342
|
+
* - `isError: boolean` - ❌ Error state indicator
|
|
1343
|
+
* - `error: any` - 🛡️ Error object when logout fails
|
|
1344
|
+
* - `data: any` - 📊 Response data from successful logout
|
|
1345
|
+
*
|
|
1346
|
+
* @example
|
|
1347
|
+
* ```typescript
|
|
1348
|
+
* const LogoutButton = () => {
|
|
1349
|
+
* const hookReturn: UseLogoutReturn = useLogout();
|
|
1350
|
+
* const {
|
|
1351
|
+
* logout,
|
|
1352
|
+
* isLoading,
|
|
1353
|
+
* isSuccess,
|
|
1354
|
+
* isError,
|
|
1355
|
+
* error
|
|
1356
|
+
* } = hookReturn;
|
|
1357
|
+
*
|
|
1358
|
+
* // Use the hook functionality
|
|
1359
|
+
* };
|
|
1360
|
+
* ```
|
|
1361
|
+
*
|
|
1362
|
+
* @since 1.0.0
|
|
1363
|
+
* @author CTI SDK Team
|
|
1364
|
+
*/
|
|
1365
|
+
interface UseLogoutReturn extends LogoutHookStateTypes {
|
|
1366
|
+
/**
|
|
1367
|
+
* 🚪 Logout function
|
|
1368
|
+
* @description Handles secure agent logout with comprehensive cleanup procedures
|
|
1369
|
+
* @type {LogoutFunction}
|
|
1370
|
+
*/
|
|
1371
|
+
logout: LogoutFunction;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* 🚪 Logout Custom Hook
|
|
1376
|
+
*
|
|
1377
|
+
* @function useLogout
|
|
1378
|
+
* @description 🎯 Custom hook that provides comprehensive agent logout functionality
|
|
1379
|
+
* for the CTI SDK. It handles secure logout procedures, complete state cleanup,
|
|
1380
|
+
* and storage management with intelligent error handling and proper cleanup.
|
|
1381
|
+
*
|
|
1382
|
+
* @returns {UseLogoutReturn} Hook return object containing:
|
|
1383
|
+
* - `logout: LogoutFunction` - 🚪 Logout function
|
|
1384
|
+
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
1385
|
+
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
1386
|
+
* - `isError: boolean` - ❌ Error state indicator
|
|
1387
|
+
* - `error: any` - 🛡️ Error object when logout fails
|
|
1388
|
+
* - `data: any` - 📊 Response data from successful logout
|
|
1389
|
+
*
|
|
1390
|
+
* @example
|
|
1391
|
+
* ```typescript
|
|
1392
|
+
* // Basic usage in a component
|
|
1393
|
+
* const LogoutButton = () => {
|
|
1394
|
+
* const {
|
|
1395
|
+
* logout,
|
|
1396
|
+
* isLoading,
|
|
1397
|
+
* isSuccess,
|
|
1398
|
+
* isError,
|
|
1399
|
+
* error
|
|
1400
|
+
* } = useLogout();
|
|
1401
|
+
*
|
|
1402
|
+
* const handleLogout = async () => {
|
|
1403
|
+
* try {
|
|
1404
|
+
* const result = await logout();
|
|
1405
|
+
* console.log('🚪 Logout successful:', result);
|
|
1406
|
+
* // Redirect to login page or handle success
|
|
1407
|
+
* } catch (err) {
|
|
1408
|
+
* console.error('❌ Logout failed:', err);
|
|
1409
|
+
* }
|
|
1410
|
+
* };
|
|
1411
|
+
*
|
|
1412
|
+
* return (
|
|
1413
|
+
* <button
|
|
1414
|
+
* onClick={handleLogout}
|
|
1415
|
+
* disabled={isLoading}
|
|
1416
|
+
* >
|
|
1417
|
+
* {isLoading ? 'Logging out...' : 'Logout'}
|
|
1418
|
+
* </button>
|
|
1419
|
+
* );
|
|
1420
|
+
* };
|
|
1421
|
+
* ```
|
|
1422
|
+
*
|
|
1423
|
+
* @features
|
|
1424
|
+
* - 🚪 Secure agent logout with API validation
|
|
1425
|
+
* - 🗑️ Complete state cleanup and reset
|
|
1426
|
+
* - 💾 Storage management (localStorage & sessionStorage)
|
|
1427
|
+
* - ⏳ Comprehensive loading state management
|
|
1428
|
+
* - 🛡️ Robust error handling and recovery
|
|
1429
|
+
* - 📊 Real-time state updates via SDK manager
|
|
1430
|
+
* - 🔄 Automatic storage cleanup
|
|
1431
|
+
*
|
|
1432
|
+
* @since 1.0.0
|
|
1433
|
+
* @author CTI SDK Team
|
|
1434
|
+
*/
|
|
1435
|
+
declare const useLogout: () => UseLogoutReturn;
|
|
1436
|
+
|
|
1437
|
+
/**
|
|
1438
|
+
* 🔐 Authorization Token Custom Hook
|
|
1439
|
+
*
|
|
1440
|
+
* @function useGetAuthorizationToken
|
|
1441
|
+
* @description 🎯 Custom hook that provides reactive access to the current SDK authorization token.
|
|
1442
|
+
* Automatically updates when the token changes, making it perfect for external API calls
|
|
1443
|
+
* and authentication headers.
|
|
1444
|
+
*
|
|
1445
|
+
* @returns {string | undefined} Current authorization token or undefined if not available
|
|
1446
|
+
*
|
|
1447
|
+
* @example
|
|
1448
|
+
* ```typescript
|
|
1449
|
+
* // Basic usage in a component
|
|
1450
|
+
* const ApiCallComponent = () => {
|
|
1451
|
+
* const token = useGetAuthorizationToken();
|
|
1452
|
+
*
|
|
1453
|
+
* const makeExternalApiCall = async () => {
|
|
1454
|
+
* if (!token) {
|
|
1455
|
+
* console.error('No authorization token available');
|
|
1456
|
+
* return;
|
|
1457
|
+
* }
|
|
1458
|
+
*
|
|
1459
|
+
* try {
|
|
1460
|
+
* const response = await fetch('/api/external', {
|
|
1461
|
+
* headers: {
|
|
1462
|
+
* 'Authorization': `Bearer ${token}`,
|
|
1463
|
+
* 'Content-Type': 'application/json'
|
|
1464
|
+
* }
|
|
1465
|
+
* });
|
|
1466
|
+
* const data = await response.json();
|
|
1467
|
+
* console.log('External API response:', data);
|
|
1468
|
+
* } catch (error) {
|
|
1469
|
+
* console.error('API call failed:', error);
|
|
1470
|
+
* }
|
|
1471
|
+
* };
|
|
1472
|
+
*
|
|
1473
|
+
* return (
|
|
1474
|
+
* <button onClick={makeExternalApiCall} disabled={!token}>
|
|
1475
|
+
* {token ? 'Make API Call' : 'No Token Available'}
|
|
1476
|
+
* </button>
|
|
1477
|
+
* );
|
|
1478
|
+
* };
|
|
1479
|
+
* ```
|
|
1480
|
+
*
|
|
1481
|
+
* @example
|
|
1482
|
+
* ```typescript
|
|
1483
|
+
* // Usage with axios
|
|
1484
|
+
* const ApiService = () => {
|
|
1485
|
+
* const token = useGetAuthorizationToken();
|
|
1486
|
+
*
|
|
1487
|
+
* useEffect(() => {
|
|
1488
|
+
* if (token) {
|
|
1489
|
+
* // Configure axios with the token
|
|
1490
|
+
* axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
|
1491
|
+
* }
|
|
1492
|
+
* }, [token]);
|
|
1493
|
+
*
|
|
1494
|
+
* return null; // This is just for token management
|
|
1495
|
+
* };
|
|
1496
|
+
* ```
|
|
1497
|
+
*
|
|
1498
|
+
*
|
|
1499
|
+
* @since 1.0.0
|
|
1500
|
+
* @author CTI SDK Team
|
|
1501
|
+
*/
|
|
1502
|
+
declare const useGetAuthorizationToken: () => string | undefined;
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* 📞 Caller Data Custom Hook
|
|
1506
|
+
*
|
|
1507
|
+
* @function useGetCallerData
|
|
1508
|
+
* @description 🎯 Custom hook that provides reactive access to current call data.
|
|
1509
|
+
* This is an independent alternative to the CallControlPanel's onDataChange prop,
|
|
1510
|
+
* allowing you to access call information anywhere in your application without
|
|
1511
|
+
* depending on the CallControlPanel component.
|
|
1512
|
+
*
|
|
1513
|
+
* @returns {CallData} Current call data object containing all available call information
|
|
1514
|
+
*
|
|
1515
|
+
* @example
|
|
1516
|
+
* ```typescript
|
|
1517
|
+
* // Basic usage in a component
|
|
1518
|
+
* const CallStatusWidget = () => {
|
|
1519
|
+
* const callerData = useGetCallerData();
|
|
1520
|
+
*
|
|
1521
|
+
* return (
|
|
1522
|
+
* <div className="call-status-widget">
|
|
1523
|
+
* <h3>Current Call Status</h3>
|
|
1524
|
+
* {callerData.status === "ONCALL" ? (
|
|
1525
|
+
* <div>
|
|
1526
|
+
* <p>📞 Active Call: {callerData.phone_number}</p>
|
|
1527
|
+
* <p>Agent: {callerData.agent_id}</p>
|
|
1528
|
+
* <p>Process: {callerData.process_name}</p>
|
|
1529
|
+
* <p>Call ID: {callerData.callReferenceId}</p>
|
|
1530
|
+
* </div>
|
|
1531
|
+
* ) : (
|
|
1532
|
+
* <p>No active call</p>
|
|
1533
|
+
* )}
|
|
1534
|
+
* </div>
|
|
1535
|
+
* );
|
|
1536
|
+
* };
|
|
1537
|
+
* ```
|
|
1538
|
+
*
|
|
1539
|
+
* @example
|
|
1540
|
+
* ```typescript
|
|
1541
|
+
* // Usage for call analytics
|
|
1542
|
+
* const CallAnalytics = () => {
|
|
1543
|
+
* const callerData = useGetCallerData();
|
|
1544
|
+
*
|
|
1545
|
+
* useEffect(() => {
|
|
1546
|
+
* if (callerData.status === "ONCALL") {
|
|
1547
|
+
* // Track call start
|
|
1548
|
+
* analytics.track('call_started', {
|
|
1549
|
+
* phone_number: callerData.phone_number,
|
|
1550
|
+
* agent_id: callerData.agent_id,
|
|
1551
|
+
* process_name: callerData.process_name
|
|
1552
|
+
* });
|
|
1553
|
+
* }
|
|
1554
|
+
* }, [callerData.status]);
|
|
1555
|
+
*
|
|
1556
|
+
* return null; // This is just for analytics
|
|
1557
|
+
* };
|
|
1558
|
+
* ```
|
|
1559
|
+
*
|
|
1560
|
+
*
|
|
1561
|
+
*
|
|
1562
|
+
* @returns_data_structure
|
|
1563
|
+
* ```typescript
|
|
1564
|
+
* {
|
|
1565
|
+
* phone_number: string, // Phone number involved in the call
|
|
1566
|
+
* status: string, // Current call status (ONCALL, RINGING, WRAPUP, etc.)
|
|
1567
|
+
* callReferenceId: string, // Unique identifier for the call
|
|
1568
|
+
* agent_id: string, // ID of the agent handling the call
|
|
1569
|
+
* process_id: string, // Process identifier for the call
|
|
1570
|
+
* process_name: string // Name of the process handling the call
|
|
1571
|
+
* }
|
|
1572
|
+
* ```
|
|
1573
|
+
*
|
|
1574
|
+
* @since 1.0.0
|
|
1575
|
+
* @author CTI SDK Team
|
|
1576
|
+
*/
|
|
1577
|
+
declare const useGetCallerData: () => CallData;
|
|
1578
|
+
|
|
1579
|
+
/**
|
|
1580
|
+
* 🗃️ SDK State Interface
|
|
1581
|
+
*
|
|
1582
|
+
* @interface SDKState
|
|
1583
|
+
* @description 📊 Type definition for the SDK state structure
|
|
1584
|
+
* Used internally by the hook to access agent and call data
|
|
1585
|
+
*
|
|
1586
|
+
* @properties
|
|
1587
|
+
* - `agentId: string` - 👤 Agent identifier
|
|
1588
|
+
* - `process: ProcessData` - ⚙️ Process information
|
|
1589
|
+
* - `callData: EndCallData` - 📞 Current call data
|
|
1590
|
+
*
|
|
1591
|
+
* @since 1.0.0
|
|
1592
|
+
* @author CTI SDK Team
|
|
1593
|
+
*/
|
|
1594
|
+
interface SDKState {
|
|
1595
|
+
/**
|
|
1596
|
+
* 👤 Agent identifier
|
|
1597
|
+
* @description Unique identifier for the current agent
|
|
1598
|
+
* @type {string}
|
|
1599
|
+
*/
|
|
1600
|
+
agentId: string;
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* ⚙️ Process information
|
|
1604
|
+
* @description Information about the current process
|
|
1605
|
+
* @type {ProcessData}
|
|
1606
|
+
*/
|
|
1607
|
+
process: ProcessData;
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* 📞 Current call data
|
|
1611
|
+
* @description Data about the current call
|
|
1612
|
+
* @type {EndCallData}
|
|
1613
|
+
*/
|
|
1614
|
+
callData: EndCallData;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* 🗃️ SDK State Interface
|
|
1619
|
+
*
|
|
1620
|
+
* @interface SDKState
|
|
1621
|
+
* @description 📊 Type definition for the SDK state structure
|
|
1622
|
+
* Used internally by the hook to access agent data
|
|
1623
|
+
*
|
|
1624
|
+
* @properties
|
|
1625
|
+
* - `agentId: string` - 👤 Agent identifier
|
|
1626
|
+
*
|
|
1627
|
+
* @since 1.0.0
|
|
1628
|
+
* @author CTI SDK Team
|
|
1629
|
+
*/
|
|
1630
|
+
interface SDKState {
|
|
1631
|
+
/**
|
|
1632
|
+
* 👤 Agent identifier
|
|
1633
|
+
* @description Unique identifier for the current agent
|
|
1634
|
+
* @type {string}
|
|
1635
|
+
*/
|
|
1636
|
+
agentId: string;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
/**
|
|
1640
|
+
* 🗑️ Storage Management Types
|
|
1641
|
+
*
|
|
1642
|
+
* @type StorageType
|
|
1643
|
+
* @description 🎯 Type definitions for storage management
|
|
1644
|
+
* Used for localStorage and sessionStorage operations
|
|
1645
|
+
*
|
|
1646
|
+
* @since 1.0.0
|
|
1647
|
+
* @author CTI SDK Team
|
|
1648
|
+
*/
|
|
1649
|
+
type StorageType = "localStorage" | "sessionStorage";
|
|
1650
|
+
|
|
1651
|
+
/**
|
|
1652
|
+
* 🔄 Cleanup Operation Types
|
|
1653
|
+
*
|
|
1654
|
+
* @type CleanupOperation
|
|
1655
|
+
* @description 🎯 Type definitions for cleanup operations
|
|
1656
|
+
* Used for state and storage cleanup procedures
|
|
1657
|
+
*
|
|
1658
|
+
* @since 1.0.0
|
|
1659
|
+
* @author CTI SDK Team
|
|
1660
|
+
*/
|
|
1661
|
+
type CleanupOperation = "clearStorage" | "resetState" | "clearAll";
|
|
1662
|
+
|
|
1663
|
+
/**
|
|
1664
|
+
* 📋 Comprehensive Type Exports
|
|
1665
|
+
*
|
|
1666
|
+
* @description 📦 Re-exports all types for easy importing
|
|
1667
|
+
* Provides a single import point for all hook-related types
|
|
1668
|
+
*
|
|
1669
|
+
* @example
|
|
1670
|
+
* ```typescript
|
|
1671
|
+
* import {
|
|
1672
|
+
* LogoutPayload,
|
|
1673
|
+
* UseLogoutReturn,
|
|
1674
|
+
* LogoutFunction,
|
|
1675
|
+
* SDKState
|
|
1676
|
+
* } from './useLogout';
|
|
1677
|
+
* ```
|
|
1678
|
+
*
|
|
1679
|
+
* @since 1.0.0
|
|
1680
|
+
* @author CTI SDK Team
|
|
1681
|
+
*/
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* @fileoverview 📞 TypeScript Declaration File for useClickToCall Hook
|
|
1685
|
+
*
|
|
1686
|
+
* This file contains TypeScript type definitions for the useClickToCall custom hook
|
|
1687
|
+
* and its related interfaces. It provides comprehensive type safety and IntelliSense
|
|
1688
|
+
* support for developers using the CTI SDK.
|
|
1689
|
+
*
|
|
1690
|
+
* 🎯 Key Type Definitions:
|
|
1691
|
+
* - 📱 StartCallPayload interface for call initiation data
|
|
1692
|
+
* - 📞 useClickToCall hook return type
|
|
1693
|
+
* - 🔄 Call initiation function signature
|
|
1694
|
+
* - 📊 State management types
|
|
1695
|
+
*
|
|
1696
|
+
* @author CTI SDK Team
|
|
1697
|
+
* @version 6.x.x
|
|
1698
|
+
* @since 1.0.0
|
|
1699
|
+
*/
|
|
1700
|
+
|
|
1701
|
+
/**
|
|
1702
|
+
* 📱 Start Call Payload Interface
|
|
1703
|
+
*
|
|
1704
|
+
* @interface StartCallPayload
|
|
1705
|
+
* @description 📊 Defines the structure for call initiation payload data
|
|
1706
|
+
* Contains the mobile number required to initiate a call
|
|
1707
|
+
*
|
|
1708
|
+
* @properties
|
|
1709
|
+
* - `mobileNumber: string` - 📱 The phone number to call (required)
|
|
1710
|
+
*
|
|
1711
|
+
* @example
|
|
1712
|
+
* ```typescript
|
|
1713
|
+
* // Basic call initiation payload
|
|
1714
|
+
* const callPayload: StartCallPayload = {
|
|
1715
|
+
* mobileNumber: "1234567890"
|
|
1716
|
+
* };
|
|
1717
|
+
*
|
|
1718
|
+
* // Usage in component
|
|
1719
|
+
* const { handleStartCall } = useClickToCall();
|
|
1720
|
+
* await handleStartCall({ mobileNumber: "9876543210" });
|
|
1721
|
+
* ```
|
|
1722
|
+
*
|
|
1723
|
+
* @since 1.0.0
|
|
1724
|
+
* @author CTI SDK Team
|
|
1725
|
+
*/
|
|
1726
|
+
interface StartCallPayload {
|
|
1727
|
+
/**
|
|
1728
|
+
* 📱 Phone number to call
|
|
1729
|
+
* @description The mobile number that will be called
|
|
1730
|
+
* @type {string}
|
|
1731
|
+
*/
|
|
1732
|
+
mobileNumber: string;
|
|
1733
|
+
/** Optional user id; defaults to the logged-in agent id when omitted. */
|
|
1734
|
+
user?: string;
|
|
1735
|
+
/** Optional auto-answer flag; defaults to false when omitted. */
|
|
1736
|
+
auto_answer?: boolean;
|
|
1737
|
+
/** Optional Convox call id passthrough. */
|
|
1738
|
+
call_id?: string;
|
|
1739
|
+
/** Optional caller-provided reference id. */
|
|
1740
|
+
reference_id?: string;
|
|
1741
|
+
/** Optional source identifier (e.g. campaign, dialpad). */
|
|
1742
|
+
call_source?: string;
|
|
1743
|
+
/** Optional case id passthrough. */
|
|
1744
|
+
caseId?: string;
|
|
1745
|
+
/** Whether the call is being made during wrap-up. */
|
|
1746
|
+
isWrapup?: boolean;
|
|
1747
|
+
/** Convox call UUID of the parent call; used for wrap-up chaining. */
|
|
1748
|
+
parentCallUuid?: string;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
interface ConferenceCallPayload {
|
|
1752
|
+
mobileNumber: string;
|
|
1753
|
+
lineNumber?: number;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
/**
|
|
1757
|
+
* 📞 Call Initiation Function Type
|
|
1758
|
+
*
|
|
1759
|
+
* @type CallInitiationFunction
|
|
1760
|
+
* @description 🎯 Type definition for the call initiation function
|
|
1761
|
+
* Handles both regular calls and conference calls based on agent state
|
|
1762
|
+
*
|
|
1763
|
+
* @param {StartCallPayload} data - 📊 Call initiation data containing mobile number
|
|
1764
|
+
* @returns {Promise<any>} Promise that resolves with API response data or rejects with error
|
|
1765
|
+
*
|
|
1766
|
+
* @example
|
|
1767
|
+
* ```typescript
|
|
1768
|
+
* const handleStartCall({
|
|
1769
|
+
* mobileNumber: "1234567890"
|
|
1770
|
+
* })
|
|
1771
|
+
* ```
|
|
1772
|
+
*
|
|
1773
|
+
* @since 1.0.0
|
|
1774
|
+
* @author CTI SDK Team
|
|
1775
|
+
*/
|
|
1776
|
+
type CallInitiationFunction = (data: StartCallPayload) => Promise<any>;
|
|
1777
|
+
|
|
1778
|
+
/**
|
|
1779
|
+
* 📊 Hook State Management Types
|
|
1780
|
+
*
|
|
1781
|
+
* @type StartCalltHookStateTypes
|
|
1782
|
+
* @description 🎛️ Type definitions for all hook state variables
|
|
1783
|
+
* Provides type safety for loading, success, error, and data states
|
|
1784
|
+
*
|
|
1785
|
+
* @since 1.0.0
|
|
1786
|
+
* @author CTI SDK Team
|
|
1787
|
+
*/
|
|
1788
|
+
type StartCalltHookStateTypes = {
|
|
1789
|
+
/**
|
|
1790
|
+
* ⏳ Loading state indicator
|
|
1791
|
+
* @description Boolean flag indicating if a call operation is currently in progress
|
|
1792
|
+
* @type {boolean}
|
|
1793
|
+
*/
|
|
1794
|
+
isLoading: boolean;
|
|
1795
|
+
|
|
1796
|
+
/**
|
|
1797
|
+
* ✅ Success state indicator
|
|
1798
|
+
* @description Boolean flag indicating if the last call operation was successful
|
|
1799
|
+
* @type {boolean}
|
|
1800
|
+
*/
|
|
1801
|
+
isSuccess: boolean;
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* ❌ Error state indicator
|
|
1805
|
+
* @description Boolean flag indicating if the last call operation encountered an error
|
|
1806
|
+
* @type {boolean}
|
|
1807
|
+
*/
|
|
1808
|
+
isError: boolean;
|
|
1809
|
+
|
|
1810
|
+
/**
|
|
1811
|
+
* 🛡️ Error object
|
|
1812
|
+
* @description Contains the error object when a call operation fails
|
|
1813
|
+
* @type {any}
|
|
1814
|
+
*/
|
|
1815
|
+
error: any;
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* 📊 Response data
|
|
1819
|
+
* @description Contains the response data from successful call operations
|
|
1820
|
+
* @type {any}
|
|
1821
|
+
*/
|
|
1822
|
+
data: any;
|
|
1823
|
+
};
|
|
1824
|
+
|
|
1825
|
+
/**
|
|
1826
|
+
* 📞 useClickToCall Hook Return Type
|
|
1827
|
+
*
|
|
1828
|
+
* @interface UseClickToCallReturn
|
|
1829
|
+
* @description 🎯 Complete return type for the useClickToCall hook
|
|
1830
|
+
* Contains all functions and state for call initiation functionality
|
|
1831
|
+
*
|
|
1832
|
+
* @properties
|
|
1833
|
+
* - `handleStartCall: CallInitiationFunction` - 📞 Call initiation function
|
|
1834
|
+
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
1835
|
+
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
1836
|
+
* - `isError: boolean` - ❌ Error state indicator
|
|
1837
|
+
* - `error: any` - 🛡️ Error object when call fails
|
|
1838
|
+
* - `data: any` - 📊 Response data from successful calls
|
|
1839
|
+
*
|
|
1840
|
+
* @example
|
|
1841
|
+
* ```typescript
|
|
1842
|
+
* const CallButton = () => {
|
|
1843
|
+
* const hookReturn: UseClickToCallReturn = useClickToCall();
|
|
1844
|
+
* const {
|
|
1845
|
+
* handleStartCall,
|
|
1846
|
+
* isLoading,
|
|
1847
|
+
* isSuccess,
|
|
1848
|
+
* isError,
|
|
1849
|
+
* error
|
|
1850
|
+
* } = hookReturn;
|
|
1851
|
+
*
|
|
1852
|
+
* // Use the hook functionality
|
|
1853
|
+
* };
|
|
1854
|
+
* ```
|
|
1855
|
+
*
|
|
1856
|
+
* @since 1.0.0
|
|
1857
|
+
* @author CTI SDK Team
|
|
1858
|
+
*/
|
|
1859
|
+
interface UseClickToCallReturn extends StartCalltHookStateTypes {
|
|
1860
|
+
/**
|
|
1861
|
+
* 📞 Call initiation function
|
|
1862
|
+
* @description Handles call initiation with intelligent routing based on agent state
|
|
1863
|
+
* @type {CallInitiationFunction}
|
|
1864
|
+
*/
|
|
1865
|
+
handleStartCall: CallInitiationFunction;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* 📞 Click-to-Call Custom Hook
|
|
1870
|
+
*
|
|
1871
|
+
* @function useClickToCall
|
|
1872
|
+
* @description 🎯 Custom hook that provides comprehensive call initiation functionality
|
|
1873
|
+
* for the CTI SDK. It intelligently handles both regular calls and conference calls
|
|
1874
|
+
* based on the current agent state, with proper loading states and error handling.
|
|
1875
|
+
*
|
|
1876
|
+
* @returns {UseClickToCallReturn} Hook return object containing:
|
|
1877
|
+
* - `handleStartCall: CallInitiationFunction` - 📞 Call initiation function
|
|
1878
|
+
* - `isLoading: boolean` - ⏳ Loading state indicator
|
|
1879
|
+
* - `isSuccess: boolean` - ✅ Success state indicator
|
|
1880
|
+
* - `isError: boolean` - ❌ Error state indicator
|
|
1881
|
+
* - `error: any` - 🛡️ Error object when call fails
|
|
1882
|
+
* - `data: any` - 📊 Response data from successful calls
|
|
1883
|
+
*
|
|
1884
|
+
* @example
|
|
1885
|
+
* ```typescript
|
|
1886
|
+
* // Basic usage in a component
|
|
1887
|
+
* const CallButton = () => {
|
|
1888
|
+
* const {
|
|
1889
|
+
* handleStartCall,
|
|
1890
|
+
* isLoading,
|
|
1891
|
+
* isSuccess,
|
|
1892
|
+
* isError,
|
|
1893
|
+
* error
|
|
1894
|
+
* } = useClickToCall();
|
|
1895
|
+
*
|
|
1896
|
+
* const makeCall = async () => {
|
|
1897
|
+
* try {
|
|
1898
|
+
* const result = await handleStartCall({
|
|
1899
|
+
* mobileNumber: "1234567890"
|
|
1900
|
+
* });
|
|
1901
|
+
* console.log('📞 Call initiated:', result);
|
|
1902
|
+
* } catch (err) {
|
|
1903
|
+
* console.error('❌ Call failed:', err);
|
|
1904
|
+
* }
|
|
1905
|
+
* };
|
|
1906
|
+
*
|
|
1907
|
+
* return (
|
|
1908
|
+
* <button
|
|
1909
|
+
* onClick={makeCall}
|
|
1910
|
+
* disabled={isLoading}
|
|
1911
|
+
* >
|
|
1912
|
+
* {isLoading ? 'Calling...' : 'Make Call'}
|
|
1913
|
+
* </button>
|
|
1914
|
+
* );
|
|
1915
|
+
* };
|
|
1916
|
+
* ```
|
|
1917
|
+
*
|
|
1918
|
+
* @features
|
|
1919
|
+
* - 🎯 Intelligent call routing based on agent state
|
|
1920
|
+
* - 📱 Regular call initiation for idle agents
|
|
1921
|
+
* - 👥 Conference call initiation for busy agents
|
|
1922
|
+
* - ⏳ Comprehensive loading state management
|
|
1923
|
+
* - 🛡️ Robust error handling and recovery
|
|
1924
|
+
* - 📊 Real-time state updates via SDK manager
|
|
1925
|
+
* - 🔄 Automatic conference dialog management
|
|
1926
|
+
*
|
|
1927
|
+
* @since 1.0.0
|
|
1928
|
+
* @author CTI SDK Team
|
|
1929
|
+
*/
|
|
1930
|
+
declare const useClickToCall: () => UseClickToCallReturn;
|
|
1931
|
+
|
|
1932
|
+
/**
|
|
1933
|
+
* 📊 Agent State Types
|
|
1934
|
+
*
|
|
1935
|
+
* @type AgentStatus
|
|
1936
|
+
* @description 🎯 Type definitions for agent status values
|
|
1937
|
+
* Used internally by the hook to determine call routing logic
|
|
1938
|
+
*
|
|
1939
|
+
* @since 1.0.0
|
|
1940
|
+
* @author CTI SDK Team
|
|
1941
|
+
*/
|
|
1942
|
+
type AgentStatus = string;
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* 📞 Conference Line Interface
|
|
1946
|
+
*
|
|
1947
|
+
* @interface ConferenceLine
|
|
1948
|
+
* @description 📊 Type definition for conference line data structure
|
|
1949
|
+
* Used internally by the hook for conference call management
|
|
1950
|
+
*
|
|
1951
|
+
* @properties
|
|
1952
|
+
* - `line: number` - 📞 Line number identifier
|
|
1953
|
+
* - `status: AgentStatus` - 📊 Current line status
|
|
1954
|
+
* - `isCallStart: boolean` - ✅ Whether call is active on this line
|
|
1955
|
+
* - `phone?: string` - 📱 Phone number for this line (optional)
|
|
1956
|
+
*
|
|
1957
|
+
* @since 1.0.0
|
|
1958
|
+
* @author CTI SDK Team
|
|
1959
|
+
*/
|
|
1960
|
+
interface ConferenceLine {
|
|
1961
|
+
/**
|
|
1962
|
+
* 📞 Line number identifier
|
|
1963
|
+
* @description Unique identifier for the conference line
|
|
1964
|
+
* @type {number}
|
|
1965
|
+
*/
|
|
1966
|
+
line: number;
|
|
1967
|
+
|
|
1968
|
+
/**
|
|
1969
|
+
* 📊 Current line status
|
|
1970
|
+
* @description Status of the conference line
|
|
1971
|
+
* @type {AgentStatus}
|
|
1972
|
+
*/
|
|
1973
|
+
status: AgentStatus;
|
|
1974
|
+
|
|
1975
|
+
/**
|
|
1976
|
+
* ✅ Whether call is active on this line
|
|
1977
|
+
* @description Flag indicating if a call is currently active
|
|
1978
|
+
* @type {boolean}
|
|
1979
|
+
*/
|
|
1980
|
+
isCallStart: boolean;
|
|
1981
|
+
|
|
1982
|
+
/**
|
|
1983
|
+
* 📱 Phone number for this line
|
|
1984
|
+
* @description Phone number associated with this line (optional)
|
|
1985
|
+
* @type {string | undefined}
|
|
1986
|
+
*/
|
|
1987
|
+
phone?: string;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
/**
|
|
1991
|
+
* 📞 Call Data Interface
|
|
1992
|
+
*
|
|
1993
|
+
* @interface StartCalltData
|
|
1994
|
+
* @description 📊 Type definition for call data structure
|
|
1995
|
+
* Contains information about the current call
|
|
1996
|
+
*
|
|
1997
|
+
* @properties
|
|
1998
|
+
* - `status: AgentStatus` - 📊 Current call status
|
|
1999
|
+
* - `agent_id: string` - 👤 Agent identifier
|
|
2000
|
+
* - `process_name: string` - ⚙️ Process name
|
|
2001
|
+
*
|
|
2002
|
+
* @since 1.0.0
|
|
2003
|
+
* @author CTI SDK Team
|
|
2004
|
+
*/
|
|
2005
|
+
interface StartCalltData {
|
|
2006
|
+
/**
|
|
2007
|
+
* 📊 Current call status
|
|
2008
|
+
* @description Status of the current call
|
|
2009
|
+
* @type {AgentStatus}
|
|
2010
|
+
*/
|
|
2011
|
+
status: AgentStatus;
|
|
2012
|
+
|
|
2013
|
+
/**
|
|
2014
|
+
* 👤 Agent identifier
|
|
2015
|
+
* @description Unique identifier for the agent
|
|
2016
|
+
* @type {string}
|
|
2017
|
+
*/
|
|
2018
|
+
agent_id: string;
|
|
2019
|
+
|
|
2020
|
+
/**
|
|
2021
|
+
* ⚙️ Process name
|
|
2022
|
+
* @description Name of the current process
|
|
2023
|
+
* @type {string}
|
|
2024
|
+
*/
|
|
2025
|
+
process_name: string;
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
/**
|
|
2029
|
+
* 📡 API Response Interface
|
|
2030
|
+
*
|
|
2031
|
+
* @interface APIResponse
|
|
2032
|
+
* @description 📊 Type definition for API response structure
|
|
2033
|
+
* Used for type safety in API call responses
|
|
2034
|
+
*
|
|
2035
|
+
* @properties
|
|
2036
|
+
* - `data: any` - 📊 Response data
|
|
2037
|
+
* - `status: number` - 📊 HTTP status code
|
|
2038
|
+
* - `message?: string` - 📝 Optional response message
|
|
2039
|
+
*
|
|
2040
|
+
* @since 1.0.0
|
|
2041
|
+
* @author CTI SDK Team
|
|
2042
|
+
*/
|
|
2043
|
+
interface APIResponse {
|
|
2044
|
+
/**
|
|
2045
|
+
* 📊 Response data
|
|
2046
|
+
* @description The main response data from the API
|
|
2047
|
+
* @type {any}
|
|
2048
|
+
*/
|
|
2049
|
+
data: any;
|
|
2050
|
+
|
|
2051
|
+
/**
|
|
2052
|
+
* 📊 HTTP status code
|
|
2053
|
+
* @description HTTP status code of the response
|
|
2054
|
+
* @type {number}
|
|
2055
|
+
*/
|
|
2056
|
+
status: number;
|
|
2057
|
+
|
|
2058
|
+
/**
|
|
2059
|
+
* 📝 Optional response message
|
|
2060
|
+
* @description Optional message from the API response
|
|
2061
|
+
* @type {string | undefined}
|
|
2062
|
+
*/
|
|
2063
|
+
message?: string;
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
* 📡 API Response Interface
|
|
2068
|
+
*
|
|
2069
|
+
* @interface APIResponse
|
|
2070
|
+
* @description 📊 Type definition for API response structure
|
|
2071
|
+
* Used for type safety in API call responses
|
|
2072
|
+
*
|
|
2073
|
+
* @properties
|
|
2074
|
+
* - `data: any` - 📊 Response data
|
|
2075
|
+
* - `status: number` - 📊 HTTP status code
|
|
2076
|
+
* - `message?: string` - 📝 Optional response message
|
|
2077
|
+
*
|
|
2078
|
+
* @since 1.0.0
|
|
2079
|
+
* @author CTI SDK Team
|
|
2080
|
+
*/
|
|
2081
|
+
interface APIResponse {
|
|
2082
|
+
/**
|
|
2083
|
+
* 📊 Response data
|
|
2084
|
+
* @description The main response data from the API
|
|
2085
|
+
* @type {any}
|
|
2086
|
+
*/
|
|
2087
|
+
data: any;
|
|
2088
|
+
|
|
2089
|
+
/**
|
|
2090
|
+
* 📊 HTTP status code
|
|
2091
|
+
* @description HTTP status code of the response
|
|
2092
|
+
* @type {number}
|
|
2093
|
+
*/
|
|
2094
|
+
status: number;
|
|
2095
|
+
|
|
2096
|
+
/**
|
|
2097
|
+
* 📝 Optional response message
|
|
2098
|
+
* @description Optional message from the API response
|
|
2099
|
+
* @type {string | undefined}
|
|
2100
|
+
*/
|
|
2101
|
+
message?: string;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* 📡 API Response Interface
|
|
2106
|
+
*
|
|
2107
|
+
* @interface APIResponse
|
|
2108
|
+
* @description 📊 Type definition for API response structure
|
|
2109
|
+
* Used for type safety in API call responses
|
|
2110
|
+
*
|
|
2111
|
+
* @properties
|
|
2112
|
+
* - `data: any` - 📊 Response data
|
|
2113
|
+
* - `status: number` - 📊 HTTP status code
|
|
2114
|
+
* - `message?: string` - 📝 Optional response message
|
|
2115
|
+
*
|
|
2116
|
+
* @since 1.0.0
|
|
2117
|
+
* @author CTI SDK Team
|
|
2118
|
+
*/
|
|
2119
|
+
interface APIResponse {
|
|
2120
|
+
/**
|
|
2121
|
+
* 📊 Response data
|
|
2122
|
+
* @description The main response data from the API
|
|
2123
|
+
* @type {any}
|
|
2124
|
+
*/
|
|
2125
|
+
data: any;
|
|
2126
|
+
|
|
2127
|
+
/**
|
|
2128
|
+
* 📊 HTTP status code
|
|
2129
|
+
* @description HTTP status code of the response
|
|
2130
|
+
* @type {number}
|
|
2131
|
+
*/
|
|
2132
|
+
status: number;
|
|
2133
|
+
|
|
2134
|
+
/**
|
|
2135
|
+
* 📝 Optional response message
|
|
2136
|
+
* @description Optional message from the API response
|
|
2137
|
+
* @type {string | undefined}
|
|
2138
|
+
*/
|
|
2139
|
+
message?: string;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
/**
|
|
2143
|
+
* 🛡️ Error Response Interface
|
|
2144
|
+
*
|
|
2145
|
+
* @interface ErrorResponse
|
|
2146
|
+
* @description 📊 Type definition for error response structure
|
|
2147
|
+
* Used for type safety in error handling
|
|
2148
|
+
*
|
|
2149
|
+
* @properties
|
|
2150
|
+
* - `message: string` - 📝 Error message
|
|
2151
|
+
* - `code?: string` - 🔢 Optional error code
|
|
2152
|
+
* - `details?: any` - 📊 Optional error details
|
|
2153
|
+
*
|
|
2154
|
+
* @since 1.0.0
|
|
2155
|
+
* @author CTI SDK Team
|
|
2156
|
+
*/
|
|
2157
|
+
interface ErrorResponse {
|
|
2158
|
+
/**
|
|
2159
|
+
* 📝 Error message
|
|
2160
|
+
* @description Human-readable error message
|
|
2161
|
+
* @type {string}
|
|
2162
|
+
*/
|
|
2163
|
+
message: string;
|
|
2164
|
+
|
|
2165
|
+
/**
|
|
2166
|
+
* 🔢 Optional error code
|
|
2167
|
+
* @description Optional error code for programmatic handling
|
|
2168
|
+
* @type {string | undefined}
|
|
2169
|
+
*/
|
|
2170
|
+
code?: string;
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* 📊 Optional error details
|
|
2174
|
+
* @description Optional additional error details
|
|
2175
|
+
* @type {any}
|
|
2176
|
+
*/
|
|
2177
|
+
details?: any;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
/**
|
|
2181
|
+
* 🛡️ Error Response Interface
|
|
2182
|
+
*
|
|
2183
|
+
* @interface ErrorResponse
|
|
2184
|
+
* @description 📊 Type definition for error response structure
|
|
2185
|
+
* Used for type safety in error handling
|
|
2186
|
+
*
|
|
2187
|
+
* @properties
|
|
2188
|
+
* - `message: string` - 📝 Error message
|
|
2189
|
+
* - `code?: string` - 🔢 Optional error code
|
|
2190
|
+
* - `details?: any` - 📊 Optional error details
|
|
2191
|
+
*
|
|
2192
|
+
* @since 1.0.0
|
|
2193
|
+
* @author CTI SDK Team
|
|
2194
|
+
*/
|
|
2195
|
+
interface ErrorResponse {
|
|
2196
|
+
/**
|
|
2197
|
+
* 📝 Error message
|
|
2198
|
+
* @description Human-readable error message
|
|
2199
|
+
* @type {string}
|
|
2200
|
+
*/
|
|
2201
|
+
message: string;
|
|
2202
|
+
|
|
2203
|
+
/**
|
|
2204
|
+
* 🔢 Optional error code
|
|
2205
|
+
* @description Optional error code for programmatic handling
|
|
2206
|
+
* @type {string | undefined}
|
|
2207
|
+
*/
|
|
2208
|
+
code?: string;
|
|
2209
|
+
|
|
2210
|
+
/**
|
|
2211
|
+
* 📊 Optional error details
|
|
2212
|
+
* @description Optional additional error details
|
|
2213
|
+
* @type {any}
|
|
2214
|
+
*/
|
|
2215
|
+
details?: any;
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
/**
|
|
2219
|
+
* 🛡️ Error Response Interface
|
|
2220
|
+
*
|
|
2221
|
+
* @interface ErrorResponse
|
|
2222
|
+
* @description 📊 Type definition for error response structure
|
|
2223
|
+
* Used for type safety in error handling
|
|
2224
|
+
*
|
|
2225
|
+
* @properties
|
|
2226
|
+
* - `message: string` - 📝 Error message
|
|
2227
|
+
* - `code?: string` - 🔢 Optional error code
|
|
2228
|
+
* - `details?: any` - 📊 Optional error details
|
|
2229
|
+
*
|
|
2230
|
+
* @since 1.0.0
|
|
2231
|
+
* @author CTI SDK Team
|
|
2232
|
+
*/
|
|
2233
|
+
interface ErrorResponse {
|
|
2234
|
+
/**
|
|
2235
|
+
* 📝 Error message
|
|
2236
|
+
* @description Human-readable error message
|
|
2237
|
+
* @type {string}
|
|
2238
|
+
*/
|
|
2239
|
+
message: string;
|
|
2240
|
+
|
|
2241
|
+
/**
|
|
2242
|
+
* 🔢 Optional error code
|
|
2243
|
+
* @description Optional error code for programmatic handling
|
|
2244
|
+
* @type {string | undefined}
|
|
2245
|
+
*/
|
|
2246
|
+
code?: string;
|
|
2247
|
+
|
|
2248
|
+
/**
|
|
2249
|
+
* 📊 Optional error details
|
|
2250
|
+
* @description Optional additional error details
|
|
2251
|
+
* @type {any}
|
|
2252
|
+
*/
|
|
2253
|
+
details?: any;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
|
|
2257
|
+
// =============================================================================
|
|
2258
|
+
// ⚡ FRAMEWORK-AGNOSTIC ACTION EXPORTS (for Angular / non-React consumers)
|
|
2259
|
+
// =============================================================================
|
|
2260
|
+
|
|
2261
|
+
type SupervisorMonitorMode = "listen" | "whisper" | "barge";
|
|
2262
|
+
|
|
2263
|
+
interface StartMonitoringPayload {
|
|
2264
|
+
call_id: string;
|
|
2265
|
+
mode: SupervisorMonitorMode;
|
|
2266
|
+
supervisor_extension?: string;
|
|
2267
|
+
agent_extension?: string;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
interface StopMonitoringPayload {
|
|
2271
|
+
call_uuid: string;
|
|
2272
|
+
session_id?: string;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
interface ChangeModePayload {
|
|
2276
|
+
call_uuid: string;
|
|
2277
|
+
mode: SupervisorMonitorMode;
|
|
2278
|
+
session_id?: string;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
declare function clickToCall(payload: StartCallPayload): Promise<any>;
|
|
2282
|
+
declare function clickToConference(payload: ConferenceCallPayload): Promise<any>;
|
|
2283
|
+
declare function endCall(options?: EndCallPayload): Promise<any>;
|
|
2284
|
+
declare function logout(): Promise<void>;
|
|
2285
|
+
declare function startMonitoring(payload: StartMonitoringPayload): Promise<any>;
|
|
2286
|
+
declare function stopMonitoring(payload: StopMonitoringPayload): Promise<any>;
|
|
2287
|
+
declare function changeMonitorMode(payload: ChangeModePayload): Promise<any>;
|
|
2288
|
+
declare function setTransferLeadData(data: any): void;
|
|
2289
|
+
|
|
2290
|
+
// =============================================================================
|
|
2291
|
+
// ⚛️ REACT HOOKS
|
|
2292
|
+
// =============================================================================
|
|
2293
|
+
|
|
2294
|
+
interface UseClickToConferenceReturn {
|
|
2295
|
+
handleStartConferenceCall: (payload: ConferenceCallPayload) => Promise<any>;
|
|
2296
|
+
isLoading: boolean;
|
|
2297
|
+
isSuccess: boolean;
|
|
2298
|
+
isError: boolean;
|
|
2299
|
+
error: any;
|
|
2300
|
+
data: any;
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
declare function useClickToConference(): UseClickToConferenceReturn;
|
|
2304
|
+
|
|
2305
|
+
// =============================================================================
|
|
2306
|
+
// 📊 CALL MONITORING HOOK
|
|
2307
|
+
// =============================================================================
|
|
2308
|
+
|
|
2309
|
+
interface UseCallMonitoringReturn {
|
|
2310
|
+
startMonitoring: (payload: StartMonitoringPayload) => Promise<any>;
|
|
2311
|
+
stopMonitoring: (payload: StopMonitoringPayload) => Promise<any>;
|
|
2312
|
+
changeMode: (payload: ChangeModePayload) => Promise<any>;
|
|
2313
|
+
isLoading: boolean;
|
|
2314
|
+
isSuccess: boolean;
|
|
2315
|
+
isError: boolean;
|
|
2316
|
+
error: any;
|
|
2317
|
+
data: any;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
declare const useCallMonitoring: () => UseCallMonitoringReturn;
|
|
2321
|
+
|
|
2322
|
+
// =============================================================================
|
|
2323
|
+
// 🗃️ SDK STATE HOOK
|
|
2324
|
+
// =============================================================================
|
|
2325
|
+
|
|
2326
|
+
declare const useSDKState: () => any;
|
|
2327
|
+
|
|
2328
|
+
// =============================================================================
|
|
2329
|
+
// 🛡️ ENTITLEMENTS / PERMISSIONS
|
|
2330
|
+
// =============================================================================
|
|
2331
|
+
|
|
2332
|
+
/** "*" wildcard literal used in permission and menu codes. */
|
|
2333
|
+
declare const SDK_WILDCARD: "*";
|
|
2334
|
+
|
|
2335
|
+
/** Menu entitlement codes (used by SDKPages and SDKPermissionGuard). */
|
|
2336
|
+
declare const SDK_MENU_CODES: {
|
|
2337
|
+
readonly WILDCARD: "*";
|
|
2338
|
+
readonly CALL_HISTORY: "call_history";
|
|
2339
|
+
readonly CAMPAIGNS: "dialer_auto";
|
|
2340
|
+
readonly LOGIN_REPORT: "login_report";
|
|
2341
|
+
readonly CDR_REPORT: "cdr_report";
|
|
2342
|
+
readonly AGENT_PERFORMANCE_REPORT: "agent_performance";
|
|
2343
|
+
readonly AGENT_DETAIL_REPORT: "agent_detail";
|
|
2344
|
+
readonly LIVE_STATUS: "live_status";
|
|
2345
|
+
readonly MANAGEMENT_DASHBOARD: "management_dashboard";
|
|
2346
|
+
readonly CARO_VOICE_AI: "caro_voice_ai";
|
|
2347
|
+
readonly QUALITY_AUDIT_DASHBOARD: "management_dashboard";
|
|
2348
|
+
readonly CARO_QUALITY_AUDIT_DASHBOARD: "management_dashboard";
|
|
2349
|
+
};
|
|
2350
|
+
|
|
2351
|
+
/** SDK permission codes — feature-level entitlements. */
|
|
2352
|
+
declare const SDK_PERMISSIONS: {
|
|
2353
|
+
readonly WILDCARD: "*";
|
|
2354
|
+
readonly CALLS: "calls";
|
|
2355
|
+
readonly CALL_TRANSFER: "call_transfer";
|
|
2356
|
+
readonly CALL_CONFERENCE: "call_conference";
|
|
2357
|
+
readonly CALL_INBOUND: "call_inbound";
|
|
2358
|
+
readonly CALL_OUTBOUND: "call_outbound";
|
|
2359
|
+
readonly CONFERENCE: "call_conference";
|
|
2360
|
+
readonly TRANSFER_BLIND: "call_transfer_blind";
|
|
2361
|
+
readonly TRANSFER_ATTENDED: "call_transfer_attended";
|
|
2362
|
+
readonly TRANSFER_WARM: "call_transfer_warm";
|
|
2363
|
+
readonly CAMPAIGNS_CREATE: "campaigns:create";
|
|
2364
|
+
readonly CAMPAIGNS_READ: "campaigns:read";
|
|
2365
|
+
readonly CAMPAIGNS_UPDATE: "campaigns:update";
|
|
2366
|
+
readonly CAMPAIGNS_DELETE: "campaigns:delete";
|
|
2367
|
+
readonly CAMPAIGNS_MANAGE: "campaigns:manage";
|
|
2368
|
+
readonly CAMPAIGNS_CONTROL: "campaigns:control";
|
|
2369
|
+
readonly CAMPAIGNS_LEADS_CREATE: "leads:create";
|
|
2370
|
+
readonly CAMPAIGNS_LEADS_READ: "leads:read";
|
|
2371
|
+
readonly CAMPAIGNS_LEADS_DELETE: "leads:delete";
|
|
2372
|
+
readonly CAMPAIGNS_LEADS_IMPORT: "leads:import";
|
|
2373
|
+
readonly REPORTS_AGENT_LOGIN_READ: "reports:agent_login:read";
|
|
2374
|
+
readonly REPORTS_AGENT_LOGIN_EXPORT: "reports:agent_login:export";
|
|
2375
|
+
readonly REPORTS_AGENT_LOGIN_MANAGE: "reports:agent_login:manage";
|
|
2376
|
+
readonly REPORTS_CDR_READ: "reports:cdr:read";
|
|
2377
|
+
readonly REPORTS_CDR_EXPORT: "reports:cdr:export";
|
|
2378
|
+
readonly REPORTS_CDR_MANAGE: "reports:cdr:manage";
|
|
2379
|
+
readonly REPORTS_AGENT_PERFORMANCE_READ: "reports:agent_performance:read";
|
|
2380
|
+
readonly REPORTS_AGENT_PERFORMANCE_EXPORT: "reports:agent_performance:export";
|
|
2381
|
+
readonly REPORTS_AGENT_PERFORMANCE_MANAGE: "reports:agent_performance:manage";
|
|
2382
|
+
readonly SUPERVISOR_MONITOR_LISTEN: "supervisor:monitor:listen";
|
|
2383
|
+
readonly SUPERVISOR_MONITOR_WHISPER: "supervisor:monitor:whisper";
|
|
2384
|
+
readonly SUPERVISOR_MONITOR_BARGE: "supervisor:monitor:barge";
|
|
2385
|
+
};
|
|
2386
|
+
|
|
2387
|
+
// ─── Entitlement types ────────────────────────────────────────────────────────
|
|
2388
|
+
|
|
2389
|
+
interface SDKBit {
|
|
2390
|
+
code: string;
|
|
2391
|
+
enabled: boolean;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
interface SDKEntitlement {
|
|
2395
|
+
enabled: boolean;
|
|
2396
|
+
items: SDKBit[];
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
interface SDKEntitlements {
|
|
2400
|
+
calls?: SDKEntitlement;
|
|
2401
|
+
call_controls?: SDKEntitlement;
|
|
2402
|
+
call_transfer?: SDKEntitlement;
|
|
2403
|
+
call_conference?: SDKEntitlement;
|
|
2404
|
+
[key: string]: any;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
interface SDKPermissionState {
|
|
2408
|
+
sdk: SDKEntitlements | null;
|
|
2409
|
+
isLoaded: boolean;
|
|
2410
|
+
error: Error | null;
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
interface ControlsFromPermissions {
|
|
2414
|
+
disabledDialButton: boolean;
|
|
2415
|
+
disableEndCallButton: boolean;
|
|
2416
|
+
disableCallTransferButton: boolean;
|
|
2417
|
+
disableBlindTransfer: boolean;
|
|
2418
|
+
disableAttendedTransfer: boolean;
|
|
2419
|
+
disableWarmTransfer: boolean;
|
|
2420
|
+
disableConferenceButton: boolean;
|
|
2421
|
+
disableHoldButton: boolean;
|
|
2422
|
+
disableMuteButton: boolean;
|
|
2423
|
+
disabledMoreOptionsButton: boolean;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
interface SDKPermissionContextValue {
|
|
2427
|
+
state: SDKPermissionState;
|
|
2428
|
+
isBitEnabled: (category: keyof SDKEntitlements, bitCode: string) => boolean;
|
|
2429
|
+
getControlsConfig: () => ControlsFromPermissions;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
// ─── useSDKPermissions hook ───────────────────────────────────────────────────
|
|
2433
|
+
|
|
2434
|
+
interface SDKPermissionsHook {
|
|
2435
|
+
permissions: string[];
|
|
2436
|
+
menuEntitlements: Array<{ code: string; name: string; enabled: boolean }>;
|
|
2437
|
+
isLoaded: boolean;
|
|
2438
|
+
hasPermission: (permission: string) => boolean;
|
|
2439
|
+
hasAnyPermission: (permissions: string[]) => boolean;
|
|
2440
|
+
hasAllPermissions: (permissions: string[]) => boolean;
|
|
2441
|
+
hasMenuFeature: (code: string) => boolean;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
declare function useSDKPermissions(): SDKPermissionsHook;
|
|
2445
|
+
|
|
2446
|
+
// ─── Permission guard & access denied components ──────────────────────────────
|
|
2447
|
+
|
|
2448
|
+
interface SDKPermissionGuardProps {
|
|
2449
|
+
children?: React.ReactNode;
|
|
2450
|
+
/** Single permission code (e.g. "calls:inbound") */
|
|
2451
|
+
permission?: string;
|
|
2452
|
+
/** Multiple permission codes — ANY match grants access by default */
|
|
2453
|
+
permissions?: string[];
|
|
2454
|
+
/** When true, ALL permissions must be granted */
|
|
2455
|
+
requireAll?: boolean;
|
|
2456
|
+
/** One or more menu feature codes — ANY match grants access by default */
|
|
2457
|
+
menuFeature?: string | string[];
|
|
2458
|
+
/** When true, ALL menu features must be enabled */
|
|
2459
|
+
requireAllMenus?: boolean;
|
|
2460
|
+
/** Custom fallback rendered when access is denied */
|
|
2461
|
+
fallback?: React.ReactNode;
|
|
2462
|
+
/** Show the default Access Denied UI when denied. Defaults to true. */
|
|
2463
|
+
showFallback?: boolean;
|
|
2464
|
+
/** Callback fired when the guard denies access */
|
|
2465
|
+
onDenied?: () => void;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
declare const SDKPermissionGuard: React.FC<SDKPermissionGuardProps>;
|
|
2469
|
+
|
|
2470
|
+
interface SDKAccessDeniedProps {
|
|
2471
|
+
message?: string;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
declare const SDKAccessDenied: React.FC<SDKAccessDeniedProps>;
|
|
2475
|
+
|
|
2476
|
+
export { type APIResponse, type AgentStatus, CallControlPanel, type CallControlPanelProps, type CallData, type CallInitiationFunction, type CallTerminationFunction, type ChangeModePayload, type CleanupOperation, type ConferenceCallPayload, type ConferenceLine, type ControlsFromPermissions, type DispositionType, type EndCallData, type EndCallPayLoadData, type EndCallPayload, type ErrorResponse, type FollowUpType, type HookStateTypes, type InitSDKParams, type LiveStatusPageProps, type LogoutFunction, type LogoutHookStateTypes, type LogoutPayload, type ProcessData, SDKAccessDenied, type SDKAccessDeniedProps, type SDKBit, type SDKConfig, type SDKEntitlement, type SDKEntitlements, type SDKInitResult, SDKPages, type SDKPermissionContextValue, SDKPermissionGuard, type SDKPermissionGuardProps, type SDKPermissionState, type SDKPermissionsHook, type SDKState, SDKStateManager, SDK_MENU_CODES, SDK_PERMISSIONS, SDK_WILDCARD, type StartCallPayload, type StartCalltData, type StartCalltHookStateTypes, type StartMonitoringPayload, type StopMonitoringPayload, type StorageType, type SupervisorMonitorMode, type URLConfig, type UseCallMonitoringReturn, type UseClickToCallReturn, type UseClickToConferenceReturn, type UseEndCallReturn, type UseLogoutReturn, changeMonitorMode, clickToCall, clickToConference, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, setTransferLeadData, startMonitoring, stopMonitoring, useCallMonitoring, useClickToCall, useClickToConference, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout, useSDKPermissions, useSDKState };
|