ahs-cti 1.0.0-beta.2 → 1.0.0-beta.21

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.ts CHANGED
@@ -1,5 +1,413 @@
1
1
  import React from 'react';
2
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
+ 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
+ */
119
+ interface SDKStateManager {
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
+ */
142
+ subscribe(listener: () => void): () => void;
143
+
144
+ /**
145
+ * Set holding state
146
+ * @param isHolding - Whether call is on hold
147
+ */
148
+ setHolding(isHolding: boolean): void;
149
+
150
+ /**
151
+ * Set muted state
152
+ * @param isMuted - Whether call is muted
153
+ */
154
+ setMuted(isMuted: boolean): 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
+ */
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
+ */
172
+ setControlPanelPosition(position: { x: number; y: number }): void;
173
+
174
+ /**
175
+ * Set iframe position
176
+ * @param position - X and Y coordinates
177
+ */
178
+ setIframePosition(position: { x: number; y: number }): void;
179
+
180
+ /**
181
+ * Start a call (set start time and status)
182
+ */
183
+ startCall(): void;
184
+
185
+ /**
186
+ * End a call (reset call state)
187
+ */
188
+ endCall(): void;
189
+
190
+ /**
191
+ * Set initialization check flag
192
+ */
193
+ setInitCheck(): void;
194
+
195
+ /**
196
+ * Set conference dialog open state
197
+ * @param open - Whether conference dialog is open
198
+ */
199
+ setOpenConferenceDialog(open: boolean): void;
200
+
201
+ /**
202
+ * Set call transfer dialog open state
203
+ * @param open - Whether call transfer dialog is open
204
+ */
205
+ setOpenCallTransferDialog(open: boolean): 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
+ */
228
+ resetConferenceLines(): void;
229
+
230
+ /**
231
+ * Clear storage and reset to initial state
232
+ */
233
+ clearStorageAndReset(): void;
234
+
235
+ /**
236
+ * Debug storage data
237
+ */
238
+ debugStorage(): void;
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
+ */
250
+ setSDKPermissions(userInfo: any): void;
251
+
252
+ /**
253
+ * Get entitlement-based controls configuration
254
+ * @returns Controls configuration derived from permissions
255
+ */
256
+ getControlsConfig(): Partial<SDKConfig$1>;
257
+ }
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
+ */
409
+ declare const sdkStateManager: SDKStateManager;
410
+
3
411
  /**
4
412
  * @fileoverview 📦 TypeScript Declaration File for Call Control SDK
5
413
  * @description Comprehensive CTI (Computer Telephony Integration) SDK for agent platform applications.
@@ -168,6 +576,21 @@ declare function isSDKInitialized(): boolean;
168
576
  */
169
577
  declare const CallControlPanel: React.ComponentType<CallControlPanelProps>;
170
578
 
579
+ /**
580
+ * 📄 SDK Pages
581
+ *
582
+ * @description Pre-built pages provided by the SDK, automatically protected by permission guards.
583
+ *
584
+ * @properties
585
+ * - `CallHistory` - Call History page component
586
+ *
587
+ * @since 1.0.0
588
+ * @author CTI SDK Team
589
+ */
590
+ declare const SDKPages: {
591
+ readonly CallHistory: React.ComponentType<any>;
592
+ };
593
+
171
594
  // =============================================================================
172
595
  // 🗃️ TYPE EXPORTS
173
596
  // =============================================================================
@@ -235,14 +658,14 @@ interface SDKConfig {
235
658
  }
236
659
 
237
660
  interface URLConfig {
238
- id: string;
661
+ id?: string;
239
662
  baseURL: string;
240
663
  iframeURL: string;
241
664
  iframeAPIURL: string;
242
665
  password: string;
243
666
  webSocketURL: string;
244
667
  coreBaseURL: string;
245
- accessToken?: string;
668
+ accessToken: string;
246
669
  }
247
670
 
248
671
  /**
@@ -1292,6 +1715,11 @@ interface StartCallPayload {
1292
1715
  mobileNumber: string;
1293
1716
  }
1294
1717
 
1718
+ interface ConferenceCallPayload {
1719
+ mobileNumber: string;
1720
+ lineNumber?: number;
1721
+ }
1722
+
1295
1723
  /**
1296
1724
  * 📞 Call Initiation Function Type
1297
1725
  *
@@ -1790,6 +2218,65 @@ interface ErrorResponse {
1790
2218
  * @type {any}
1791
2219
  */
1792
2220
  details?: any;
1793
- }
2221
+ }
2222
+
2223
+
2224
+ // =============================================================================
2225
+ // ⚡ FRAMEWORK-AGNOSTIC ACTION EXPORTS (for Angular / non-React consumers)
2226
+ // =============================================================================
2227
+
2228
+ interface EndCallOptions {
2229
+ disposition?: string;
2230
+ followUp?: string;
2231
+ callbackDate?: string;
2232
+ callbackHrs?: string;
2233
+ callbackMins?: string;
2234
+ isBreak?: boolean;
2235
+ patientLog?: any;
2236
+ }
2237
+
2238
+ type SupervisorMonitorMode = "listen" | "whisper" | "barge";
2239
+
2240
+ interface StartMonitoringPayload {
2241
+ call_id: string;
2242
+ mode: SupervisorMonitorMode;
2243
+ supervisor_extension?: string;
2244
+ agent_extension?: string;
2245
+ }
2246
+
2247
+ interface StopMonitoringPayload {
2248
+ call_uuid: string;
2249
+ session_id?: string;
2250
+ }
2251
+
2252
+ interface ChangeModePayload {
2253
+ call_uuid: string;
2254
+ mode: SupervisorMonitorMode;
2255
+ session_id?: string;
2256
+ }
2257
+
2258
+ declare function clickToCall(payload: StartCallPayload): Promise<any>;
2259
+ declare function clickToConference(payload: ConferenceCallPayload): Promise<any>;
2260
+ declare function endCall(options?: EndCallOptions): Promise<any>;
2261
+ declare function logout(): Promise<void>;
2262
+ declare function startMonitoring(payload: StartMonitoringPayload): Promise<any>;
2263
+ declare function stopMonitoring(payload: StopMonitoringPayload): Promise<any>;
2264
+ declare function changeMonitorMode(payload: ChangeModePayload): Promise<any>;
2265
+
2266
+ // =============================================================================
2267
+ // ⚛️ REACT HOOKS
2268
+ // =============================================================================
2269
+
2270
+ interface UseClickToConferenceReturn {
2271
+ handleStartConferenceCall: (payload: ConferenceCallPayload) => Promise<any>;
2272
+ isLoading: boolean;
2273
+ isSuccess: boolean;
2274
+ isError: boolean;
2275
+ error: any;
2276
+ data: any;
2277
+ }
2278
+
2279
+ declare function useClickToConference(): UseClickToConferenceReturn;
1794
2280
 
1795
- export { type APIResponse, type AgentStatus, CallControlPanel, type CallControlPanelProps, type CallData, type CallInitiationFunction, type CallTerminationFunction, type CleanupOperation, type ConferenceLine, type DispositionType, type EndCallData, type EndCallPayLoadData, type EndCallPayload, type ErrorResponse, type FollowUpType, type HookStateTypes, type InitSDKParams, type LogoutFunction, type LogoutHookStateTypes, type LogoutPayload, type ProcessData, type SDKConfig, type SDKState, type StartCallPayload, type StartCalltData, type StartCalltHookStateTypes, type StorageType, type URLConfig, type UseClickToCallReturn, type UseEndCallReturn, type UseLogoutReturn, getSDKVersion, initSDK, isSDKInitialized, useClickToCall, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout };
2281
+ export type { APIResponse, AgentStatus, CallControlPanelProps, CallData, CallInitiationFunction, CallTerminationFunction, ChangeModePayload, CleanupOperation, ConferenceCallPayload, ConferenceLine, DispositionType, EndCallData, EndCallOptions, EndCallPayLoadData, EndCallPayload, ErrorResponse, FollowUpType, HookStateTypes, InitSDKParams, LogoutFunction, LogoutHookStateTypes, LogoutPayload, ProcessData, SDKConfig, SDKState, StartCallPayload, StartCalltData, StartCalltHookStateTypes, StartMonitoringPayload, StopMonitoringPayload, StorageType, SupervisorMonitorMode, URLConfig, UseClickToCallReturn, UseClickToConferenceReturn, UseEndCallReturn, UseLogoutReturn }
2282
+ export { CallControlPanel, SDKPages, SDKStateManager, changeMonitorMode, clickToCall, clickToConference, endCall, getSDKVersion, initSDK, isSDKInitialized, logout, sdkStateManager, startMonitoring, stopMonitoring, useClickToCall, useClickToConference, useEndCall, useGetAuthorizationToken, useGetCallerData, useLogout };