ahs-cti 1.0.0-beta.7 → 1.0.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -3,34 +3,409 @@ import React from 'react';
3
3
  /**
4
4
  * @fileoverview TypeScript Declaration File for SDK State Manager
5
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
6
11
  */
7
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
+ enableSmsServices?: boolean;
20
+ enableQueueName?: boolean;
21
+ enableRingtone?: boolean;
22
+ disabledMoreOptionsButton?: boolean;
23
+ disabledDialButton?: boolean;
24
+ disableCallTransferButton?: boolean;
25
+ disableBlindTransfer?: boolean;
26
+ disableAttendedTransfer?: boolean;
27
+ disableWarmTransfer?: boolean;
28
+ isDraggable?: boolean;
29
+ disableSoftPhone?: boolean;
30
+ disableConferenceButton?: boolean;
31
+ disableHoldButton?: boolean;
32
+ disableMuteButton?: boolean;
33
+ disabled?: any;
34
+ enabled?: any;
35
+ outlined?: any;
36
+ auto_wrapup_time?: number;
37
+ break_time?: number;
38
+ sdkPosition?: "horizontal" | "vertical";
39
+ };
40
+
41
+ type CallStatus =
42
+ | "IDLE"
43
+ | "READY"
44
+ | "BREAK"
45
+ | "ONCALL"
46
+ | "WRAPUP"
47
+ | "RINGING"
48
+ | "DIALING"
49
+ | "MISSED"
50
+ | "HOLD"
51
+ | "UNHOLD"
52
+ | "MUTE"
53
+ | "UNMUTE"
54
+ | "DISCONNECTED"
55
+ | "CONFERENCE"
56
+ | string;
57
+
58
+ type CallData$1 = {
59
+ mode?: string;
60
+ queue_name?: string;
61
+ mobileNumber?: string;
62
+ callReferenceId?: string;
63
+ convoxId?: string;
64
+ type?: string;
65
+ status: string;
66
+ agent_id: number;
67
+ phone_number?: string;
68
+ event_time?: string;
69
+ convox_id?: string;
70
+ process_id?: string;
71
+ process_name?: string;
72
+ mute?: number;
73
+ hold?: number;
74
+ };
75
+
76
+ type ConferenceLineTypes = {
77
+ line: number;
78
+ status: string;
79
+ type: "external" | "internal" | "";
80
+ phone: string;
81
+ isMute: boolean;
82
+ isHold: boolean;
83
+ isCallStart: boolean;
84
+ isMergeCall: boolean;
85
+ };
86
+
87
+ type SDKState$1 = {
88
+ authorization: any;
89
+ openConferenceDialog: boolean;
90
+ openCallTransferDialog: boolean;
91
+ process?: { process_id: number; process_name: string } | null;
92
+ agentId: string;
93
+ sessionId?: string;
94
+ sdkConfig: SDKConfig$1 | null;
95
+ urlConfig: any | null;
96
+ isInitialized: boolean;
97
+ convox_id?: string;
98
+ process_id?: number;
99
+ callStartTime: number | null;
100
+ position?: { x: number; y: number };
101
+ controlPanelPosition: { x: number; y: number };
102
+ iframePosition: { x: number; y: number };
103
+ callData: CallData$1;
104
+ conferenceLine: ConferenceLineTypes[];
105
+ hold: number;
106
+ mute: number;
107
+ agentStatus: string;
108
+ sdk: any | null;
109
+ isPermissionsLoaded: boolean;
110
+ userPermissions: string[] | null;
111
+ menuEntitlements: Array<{ code: string; name: string; enabled: boolean }> | null;
112
+ consultInfo: any | null;
113
+ };
114
+
115
+ /**
116
+ * @interface SDKStateManager
117
+ * @description Interface for the SDK state manager class
118
+ */
8
119
  interface SDKStateManager {
9
- initialize(apiKey: string, tenantId: string, agentId: string, urlConfig?: any, res?: any, callControlConfig?: any): void;
10
- getState(): any;
120
+ /**
121
+ * Initialize the SDK with API key, tenant ID, agent ID, and optional configuration
122
+ * @param apiKey - API key for authentication
123
+ * @param tenantId - Tenant identifier
124
+ * @param agentId - Agent identifier
125
+ * @param urlConfig - Optional URL configuration
126
+ * @param res - Optional initialization response
127
+ * @param callControlConfig - Optional call control configuration
128
+ */
129
+ initialize(apiKey: string, tenantId: string, agentId: string, urlConfig?: any, res?: any, callControlConfig?: SDKConfig$1): void;
130
+
131
+ /**
132
+ * Get the current state
133
+ * @returns Current SDK state
134
+ */
135
+ getState(): SDKState$1;
136
+
137
+ /**
138
+ * Subscribe to state changes
139
+ * @param listener - Callback function to be called on state changes
140
+ * @returns Unsubscribe function
141
+ */
11
142
  subscribe(listener: () => void): () => void;
143
+
144
+ /**
145
+ * Set holding state
146
+ * @param isHolding - Whether call is on hold
147
+ */
12
148
  setHolding(isHolding: boolean): void;
149
+
150
+ /**
151
+ * Set muted state
152
+ * @param isMuted - Whether call is muted
153
+ */
13
154
  setMuted(isMuted: boolean): void;
14
- setStatus(status: string): void;
155
+
156
+ /**
157
+ * Set call status
158
+ * @param status - Current call status
159
+ */
160
+ setStatus(status: CallStatus): void;
161
+
162
+ /**
163
+ * Set process information
164
+ * @param process - Process data with ID and name
165
+ */
15
166
  setProcess(process: { process_id: number; process_name: string }): void;
167
+
168
+ /**
169
+ * Set control panel position
170
+ * @param position - X and Y coordinates
171
+ */
16
172
  setControlPanelPosition(position: { x: number; y: number }): void;
173
+
174
+ /**
175
+ * Set iframe position
176
+ * @param position - X and Y coordinates
177
+ */
17
178
  setIframePosition(position: { x: number; y: number }): void;
179
+
180
+ /**
181
+ * Start a call (set start time and status)
182
+ */
18
183
  startCall(): void;
184
+
185
+ /**
186
+ * End a call (reset call state)
187
+ */
19
188
  endCall(): void;
189
+
190
+ /**
191
+ * Set initialization check flag
192
+ */
20
193
  setInitCheck(): void;
194
+
195
+ /**
196
+ * Set conference dialog open state
197
+ * @param open - Whether conference dialog is open
198
+ */
21
199
  setOpenConferenceDialog(open: boolean): void;
200
+
201
+ /**
202
+ * Set call transfer dialog open state
203
+ * @param open - Whether call transfer dialog is open
204
+ */
22
205
  setOpenCallTransferDialog(open: boolean): void;
23
- updateCallData(data: Record<string, any>): void;
24
- updateConferenceData(data: any[]): void;
25
- setConferenceLine(line: any): void;
206
+
207
+ /**
208
+ * Update call data
209
+ * @param data - Partial call data to update
210
+ */
211
+ updateCallData(data: Partial<CallData$1>): void;
212
+
213
+ /**
214
+ * Update conference data
215
+ * @param data - Array of conference line data
216
+ */
217
+ updateConferenceData(data: ConferenceLineTypes[]): void;
218
+
219
+ /**
220
+ * Set specific conference line
221
+ * @param line - Conference line data
222
+ */
223
+ setConferenceLine(line: ConferenceLineTypes): void;
224
+
225
+ /**
226
+ * Reset conference lines to initial state
227
+ */
26
228
  resetConferenceLines(): void;
229
+
230
+ /**
231
+ * Clear storage and reset to initial state
232
+ */
27
233
  clearStorageAndReset(): void;
234
+
235
+ /**
236
+ * Debug storage data
237
+ */
28
238
  debugStorage(): void;
29
- getConferenceLines(): any[];
239
+
240
+ /**
241
+ * Get conference lines
242
+ * @returns Array of conference line data
243
+ */
244
+ getConferenceLines(): ConferenceLineTypes[];
245
+
246
+ /**
247
+ * Set SDK permissions from user info
248
+ * @param userInfo - User info object from init response
249
+ */
30
250
  setSDKPermissions(userInfo: any): void;
31
- getControlsConfig(): Record<string, any>;
251
+
252
+ /**
253
+ * Get entitlement-based controls configuration
254
+ * @returns Controls configuration derived from permissions
255
+ */
256
+ getControlsConfig(): Partial<SDKConfig$1>;
32
257
  }
33
258
 
259
+ /**
260
+ * @class SDKStateManager
261
+ * @description Centralized state management class for the Call Control SDK.
262
+ * Handles state persistence, subscriptions, and provides methods for state updates.
263
+ */
264
+ declare class SDKStateManager implements SDKStateManager {
265
+ /**
266
+ * Initialize the SDK with API key, tenant ID, agent ID, and optional configuration
267
+ * @param apiKey - API key for authentication
268
+ * @param tenantId - Tenant identifier
269
+ * @param agentId - Agent identifier
270
+ * @param urlConfig - Optional URL configuration
271
+ * @param res - Optional initialization response
272
+ * @param callControlConfig - Optional call control configuration
273
+ */
274
+ public initialize(apiKey: string, tenantId: string, agentId: string, urlConfig?: any, res?: any, callControlConfig?: SDKConfig$1): void;
275
+
276
+ /**
277
+ * Get the current state
278
+ * @returns Current SDK state
279
+ */
280
+ public getState(): SDKState$1;
281
+
282
+ /**
283
+ * Subscribe to state changes
284
+ * @param listener - Callback function to be called on state changes
285
+ * @returns Unsubscribe function
286
+ */
287
+ public subscribe(listener: () => void): () => void;
288
+
289
+ /**
290
+ * Set holding state
291
+ * @param isHolding - Whether call is on hold
292
+ */
293
+ public setHolding(isHolding: boolean): void;
294
+
295
+ /**
296
+ * Set muted state
297
+ * @param isMuted - Whether call is muted
298
+ */
299
+ public setMuted(isMuted: boolean): void;
300
+
301
+ /**
302
+ * Set call status
303
+ * @param status - Current call status
304
+ */
305
+ public setStatus(status: CallStatus): void;
306
+
307
+ /**
308
+ * Set process information
309
+ * @param process - Process data with ID and name
310
+ */
311
+ public setProcess(process: { process_id: number; process_name: string }): void;
312
+
313
+ /**
314
+ * Set control panel position
315
+ * @param position - X and Y coordinates
316
+ */
317
+ public setControlPanelPosition(position: { x: number; y: number }): void;
318
+
319
+ /**
320
+ * Set iframe position
321
+ * @param position - X and Y coordinates
322
+ */
323
+ public setIframePosition(position: { x: number; y: number }): void;
324
+
325
+ /**
326
+ * Start a call (set start time and status)
327
+ */
328
+ public startCall(): void;
329
+
330
+ /**
331
+ * End a call (reset call state)
332
+ */
333
+ public endCall(): void;
334
+
335
+ /**
336
+ * Set initialization check flag
337
+ */
338
+ public setInitCheck(): void;
339
+
340
+ /**
341
+ * Set conference dialog open state
342
+ * @param open - Whether conference dialog is open
343
+ */
344
+ public setOpenConferenceDialog(open: boolean): void;
345
+
346
+ /**
347
+ * Set call transfer dialog open state
348
+ * @param open - Whether call transfer dialog is open
349
+ */
350
+ public setOpenCallTransferDialog(open: boolean): void;
351
+
352
+ /**
353
+ * Update call data
354
+ * @param data - Partial call data to update
355
+ */
356
+ public updateCallData(data: Partial<CallData$1>): void;
357
+
358
+ /**
359
+ * Update conference data
360
+ * @param data - Array of conference line data
361
+ */
362
+ public updateConferenceData(data: ConferenceLineTypes[]): void;
363
+
364
+ /**
365
+ * Set specific conference line
366
+ * @param line - Conference line data
367
+ */
368
+ public setConferenceLine(line: ConferenceLineTypes): void;
369
+
370
+ /**
371
+ * Reset conference lines to initial state
372
+ */
373
+ public resetConferenceLines(): void;
374
+
375
+ /**
376
+ * Clear storage and reset to initial state
377
+ */
378
+ public clearStorageAndReset(): void;
379
+
380
+ /**
381
+ * Debug storage data
382
+ */
383
+ public debugStorage(): void;
384
+
385
+ /**
386
+ * Get conference lines
387
+ * @returns Array of conference line data
388
+ */
389
+ public getConferenceLines(): ConferenceLineTypes[];
390
+
391
+ /**
392
+ * Set SDK permissions from user info
393
+ * @param userInfo - User info object from init response
394
+ */
395
+ public setSDKPermissions(userInfo: any): void;
396
+
397
+ /**
398
+ * Get entitlement-based controls configuration
399
+ * @returns Controls configuration derived from permissions
400
+ */
401
+ public getControlsConfig(): Partial<SDKConfig$1>;
402
+ }
403
+
404
+ /**
405
+ * @constant sdkStateManager
406
+ * @description Singleton instance of the SDK state manager
407
+ * @type {SDKStateManager}
408
+ */
34
409
  declare const sdkStateManager: SDKStateManager;
35
410
 
36
411
  /**
@@ -1838,6 +2213,48 @@ interface ErrorResponse {
1838
2213
  * @type {any}
1839
2214
  */
1840
2215
  details?: any;
1841
- }
2216
+ }
2217
+
2218
+
2219
+ // =============================================================================
2220
+ // ⚡ FRAMEWORK-AGNOSTIC ACTION EXPORTS (for Angular / non-React consumers)
2221
+ // =============================================================================
2222
+
2223
+ interface EndCallOptions {
2224
+ disposition?: string;
2225
+ followUp?: string;
2226
+ callbackDate?: string;
2227
+ callbackHrs?: string;
2228
+ callbackMins?: string;
2229
+ isBreak?: boolean;
2230
+ patientLog?: any;
2231
+ }
2232
+
2233
+ type SupervisorMonitorMode = "listen" | "whisper" | "barge";
2234
+
2235
+ interface StartMonitoringPayload {
2236
+ call_id: string;
2237
+ mode: SupervisorMonitorMode;
2238
+ supervisor_extension?: string;
2239
+ agent_extension?: string;
2240
+ }
2241
+
2242
+ interface StopMonitoringPayload {
2243
+ call_uuid: string;
2244
+ session_id?: string;
2245
+ }
2246
+
2247
+ interface ChangeModePayload {
2248
+ call_uuid: string;
2249
+ mode: SupervisorMonitorMode;
2250
+ session_id?: string;
2251
+ }
2252
+
2253
+ declare function clickToCall(payload: StartCallPayload): Promise<any>;
2254
+ declare function endCall(options?: EndCallOptions): Promise<any>;
2255
+ declare function logout(): Promise<void>;
2256
+ declare function startMonitoring(payload: StartMonitoringPayload): Promise<any>;
2257
+ declare function stopMonitoring(payload: StopMonitoringPayload): Promise<any>;
2258
+ declare function changeMonitorMode(payload: ChangeModePayload): Promise<any>;
1842
2259
 
1843
- export { type APIResponse, type AgentStatus, CallControlPanel, type CallControlPanelProps, type CallData, type CallInitiationFunction, type CallTerminationFunction, type CleanupOperation, type ConferenceLine, type DispositionType, type EndCallData, type EndCallPayLoadData, type EndCallPayload, type ErrorResponse, type FollowUpType, type HookStateTypes, type InitSDKParams, type LogoutFunction, type LogoutHookStateTypes, type LogoutPayload, type ProcessData, type SDKConfig, SDKPages, type SDKState, type SDKStateManager, type StartCallPayload, type StartCalltData, type StartCalltHookStateTypes, type StorageType, type URLConfig, type UseClickToCallReturn, type UseEndCallReturn, type UseLogoutReturn, getSDKVersion, initSDK, isSDKInitialized, sdkStateManager, useClickToCall, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout };
2260
+ export { type APIResponse, type AgentStatus, CallControlPanel, type CallControlPanelProps, type CallData, type CallInitiationFunction, type CallTerminationFunction, type ChangeModePayload, type CleanupOperation, type ConferenceLine, type DispositionType, type EndCallData, type EndCallOptions, type EndCallPayLoadData, type EndCallPayload, type ErrorResponse, type FollowUpType, type HookStateTypes, type InitSDKParams, type LogoutFunction, type LogoutHookStateTypes, type LogoutPayload, type ProcessData, type SDKConfig, SDKPages, type SDKState, SDKStateManager, type StartCallPayload, type StartCalltData, type StartCalltHookStateTypes, type StartMonitoringPayload, type StopMonitoringPayload, type StorageType, type SupervisorMonitorMode, type URLConfig, type UseClickToCallReturn, type UseEndCallReturn, type UseLogoutReturn, changeMonitorMode, clickToCall, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, startMonitoring, stopMonitoring, useClickToCall, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout };