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/README.md +639 -639
- package/dist/callHistory-TZ7SSXSN.mjs +339 -0
- package/dist/callHistory-TZ7SSXSN.mjs.map +1 -0
- package/dist/chunk-6AM6THQM.mjs +920 -0
- package/dist/chunk-6AM6THQM.mjs.map +1 -0
- package/dist/index.d.mts +490 -4
- package/dist/index.d.ts +491 -4
- package/dist/index.js +2580 -1418
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1469 -1637
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -22,6 +22,9 @@ var __spreadValues = (a, b) => {
|
|
|
22
22
|
return a;
|
|
23
23
|
};
|
|
24
24
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __esm = (fn, res) => function __init() {
|
|
26
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
27
|
+
};
|
|
25
28
|
var __export = (target, all) => {
|
|
26
29
|
for (var name in all)
|
|
27
30
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -32,32 +35,1301 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
32
35
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
33
36
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
37
|
}
|
|
35
|
-
return to;
|
|
36
|
-
};
|
|
37
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
43
|
-
mod
|
|
44
|
-
));
|
|
45
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
|
+
return to;
|
|
39
|
+
};
|
|
40
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
41
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
42
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
43
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
44
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
45
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
46
|
+
mod
|
|
47
|
+
));
|
|
48
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
49
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
50
|
+
|
|
51
|
+
// call-control-sdk/lib/utils/storage.ts
|
|
52
|
+
var STORAGE_KEY;
|
|
53
|
+
var init_storage = __esm({
|
|
54
|
+
"call-control-sdk/lib/utils/storage.ts"() {
|
|
55
|
+
"use strict";
|
|
56
|
+
STORAGE_KEY = "call-control-sdk-state";
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// call-control-sdk/lib/permissions/sdk-constants.ts
|
|
61
|
+
var SDK_WILDCARD, SDK_MENU_CODES, SDK_PERMISSIONS;
|
|
62
|
+
var init_sdk_constants = __esm({
|
|
63
|
+
"call-control-sdk/lib/permissions/sdk-constants.ts"() {
|
|
64
|
+
"use strict";
|
|
65
|
+
SDK_WILDCARD = "*";
|
|
66
|
+
SDK_MENU_CODES = {
|
|
67
|
+
WILDCARD: SDK_WILDCARD,
|
|
68
|
+
CALL_HISTORY: "call_history"
|
|
69
|
+
};
|
|
70
|
+
SDK_PERMISSIONS = {
|
|
71
|
+
WILDCARD: SDK_WILDCARD,
|
|
72
|
+
// main object key constants
|
|
73
|
+
CALLS: "calls",
|
|
74
|
+
CALL_TRANSFER: "call_transfer",
|
|
75
|
+
CALL_CONFERENCE: "call_conference",
|
|
76
|
+
// in each object has items list of objects
|
|
77
|
+
CALL_INBOUND: "call_inbound",
|
|
78
|
+
CALL_OUTBOUND: "call_outbound",
|
|
79
|
+
CONFERENCE: "call_conference",
|
|
80
|
+
TRANSFER_BLIND: "call_transfer_blind",
|
|
81
|
+
TRANSFER_ATTENDED: "call_transfer_attended",
|
|
82
|
+
TRANSFER_WARM: "call_transfer_warm"
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// call-control-sdk/lib/permissions/index.ts
|
|
88
|
+
var init_permissions = __esm({
|
|
89
|
+
"call-control-sdk/lib/permissions/index.ts"() {
|
|
90
|
+
"use strict";
|
|
91
|
+
init_sdk_constants();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// call-control-sdk/lib/hooks/sdk-state.ts
|
|
96
|
+
var import_vault, SDKStateManager, sdkStateManager;
|
|
97
|
+
var init_sdk_state = __esm({
|
|
98
|
+
"call-control-sdk/lib/hooks/sdk-state.ts"() {
|
|
99
|
+
"use strict";
|
|
100
|
+
import_vault = require("@react-solutions/vault");
|
|
101
|
+
init_storage();
|
|
102
|
+
init_permissions();
|
|
103
|
+
SDKStateManager = class {
|
|
104
|
+
constructor() {
|
|
105
|
+
__publicField(this, "state");
|
|
106
|
+
__publicField(this, "listeners", []);
|
|
107
|
+
__publicField(this, "STORAGE_KEY", STORAGE_KEY);
|
|
108
|
+
__publicField(this, "apiKey");
|
|
109
|
+
__publicField(this, "tenantId");
|
|
110
|
+
this.state = this.getInitialState();
|
|
111
|
+
this.loadFromStorage();
|
|
112
|
+
}
|
|
113
|
+
getInitialState() {
|
|
114
|
+
var _a2, _b;
|
|
115
|
+
return {
|
|
116
|
+
authorization: void 0,
|
|
117
|
+
process: null,
|
|
118
|
+
agentId: "",
|
|
119
|
+
openConferenceDialog: false,
|
|
120
|
+
openCallTransferDialog: false,
|
|
121
|
+
isInitialized: false,
|
|
122
|
+
sdkConfig: {
|
|
123
|
+
disableEndCallButton: false,
|
|
124
|
+
disabledDialButton: false,
|
|
125
|
+
disabledMoreOptionsButton: false,
|
|
126
|
+
enableSmsServices: false,
|
|
127
|
+
enableQueueName: false,
|
|
128
|
+
disableCallTransferButton: false,
|
|
129
|
+
disableBlindTransfer: false,
|
|
130
|
+
disableAttendedTransfer: false,
|
|
131
|
+
disableWarmTransfer: false,
|
|
132
|
+
isDraggable: true,
|
|
133
|
+
disableSoftPhone: false,
|
|
134
|
+
disableConferenceButton: false,
|
|
135
|
+
disableHoldButton: false,
|
|
136
|
+
disableMuteButton: false,
|
|
137
|
+
disabled: {},
|
|
138
|
+
enabled: {},
|
|
139
|
+
outlined: {}
|
|
140
|
+
},
|
|
141
|
+
urlConfig: {
|
|
142
|
+
baseURL: "",
|
|
143
|
+
iframeURL: "",
|
|
144
|
+
iframeAPIURL: "",
|
|
145
|
+
webSocketURL: "",
|
|
146
|
+
coreBaseURL: "",
|
|
147
|
+
id: "",
|
|
148
|
+
password: ""
|
|
149
|
+
},
|
|
150
|
+
callStartTime: null,
|
|
151
|
+
controlPanelPosition: { x: 10, y: 10 },
|
|
152
|
+
iframePosition: {
|
|
153
|
+
x: ((_a2 = window.screen) == null ? void 0 : _a2.availWidth) - 460,
|
|
154
|
+
y: ((_b = window.screen) == null ? void 0 : _b.height) - 580
|
|
155
|
+
},
|
|
156
|
+
callData: {
|
|
157
|
+
agent_id: -1,
|
|
158
|
+
queue_name: "",
|
|
159
|
+
hold: 0,
|
|
160
|
+
mute: 0,
|
|
161
|
+
status: "",
|
|
162
|
+
type: "",
|
|
163
|
+
event_time: "",
|
|
164
|
+
phone_number: ""
|
|
165
|
+
},
|
|
166
|
+
conferenceLine: [
|
|
167
|
+
{
|
|
168
|
+
line: 1,
|
|
169
|
+
status: "IDLE",
|
|
170
|
+
type: "",
|
|
171
|
+
phone: "",
|
|
172
|
+
isMute: false,
|
|
173
|
+
isHold: false,
|
|
174
|
+
isCallStart: false,
|
|
175
|
+
isMergeCall: false
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
line: 2,
|
|
179
|
+
status: "IDLE",
|
|
180
|
+
type: "",
|
|
181
|
+
phone: "",
|
|
182
|
+
isMute: false,
|
|
183
|
+
isHold: false,
|
|
184
|
+
isCallStart: false,
|
|
185
|
+
isMergeCall: false
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
line: 3,
|
|
189
|
+
status: "IDLE",
|
|
190
|
+
type: "",
|
|
191
|
+
phone: "",
|
|
192
|
+
isMute: false,
|
|
193
|
+
isHold: false,
|
|
194
|
+
isCallStart: false,
|
|
195
|
+
isMergeCall: false
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
line: 4,
|
|
199
|
+
status: "IDLE",
|
|
200
|
+
type: "",
|
|
201
|
+
phone: "",
|
|
202
|
+
isMute: false,
|
|
203
|
+
isHold: false,
|
|
204
|
+
isCallStart: false,
|
|
205
|
+
isMergeCall: false
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
line: 5,
|
|
209
|
+
status: "IDLE",
|
|
210
|
+
type: "",
|
|
211
|
+
phone: "",
|
|
212
|
+
isMute: false,
|
|
213
|
+
isHold: false,
|
|
214
|
+
isCallStart: false,
|
|
215
|
+
isMergeCall: false
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
hold: 0,
|
|
219
|
+
mute: 0,
|
|
220
|
+
agentStatus: "",
|
|
221
|
+
sdk: null,
|
|
222
|
+
isPermissionsLoaded: false,
|
|
223
|
+
userPermissions: null,
|
|
224
|
+
menuEntitlements: null,
|
|
225
|
+
consultInfo: null
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
loadFromStorage() {
|
|
229
|
+
var _a2, _b;
|
|
230
|
+
try {
|
|
231
|
+
const stored = (0, import_vault.getSession)(this.STORAGE_KEY);
|
|
232
|
+
if (stored) {
|
|
233
|
+
const parsedState = stored;
|
|
234
|
+
this.state = __spreadProps(__spreadValues({}, this.state), {
|
|
235
|
+
agentId: parsedState.agentId || "",
|
|
236
|
+
authorization: parsedState.authorization || void 0,
|
|
237
|
+
process: parsedState.process || null,
|
|
238
|
+
openConferenceDialog: (parsedState == null ? void 0 : parsedState.openConferenceDialog) || false,
|
|
239
|
+
openCallTransferDialog: (parsedState == null ? void 0 : parsedState.openCallTransferDialog) || false,
|
|
240
|
+
isInitialized: parsedState.isInitialized || false,
|
|
241
|
+
sdkConfig: parsedState.sdkConfig || {
|
|
242
|
+
disableEndCallButton: false,
|
|
243
|
+
disabledMoreOptionsButton: false,
|
|
244
|
+
enableSmsServices: false,
|
|
245
|
+
enableQueueName: false,
|
|
246
|
+
disabledDialButton: false,
|
|
247
|
+
disableCallTransferButton: false,
|
|
248
|
+
disableBlindTransfer: false,
|
|
249
|
+
disableAttendedTransfer: false,
|
|
250
|
+
disableWarmTransfer: false,
|
|
251
|
+
isDraggable: true,
|
|
252
|
+
disableSoftPhone: false,
|
|
253
|
+
disableConferenceButton: false,
|
|
254
|
+
disableHoldButton: false,
|
|
255
|
+
disableMuteButton: false,
|
|
256
|
+
disabled: {},
|
|
257
|
+
enabled: {},
|
|
258
|
+
outlined: {}
|
|
259
|
+
},
|
|
260
|
+
urlConfig: parsedState.urlConfig || {
|
|
261
|
+
id: "",
|
|
262
|
+
baseURL: "",
|
|
263
|
+
iframeURL: "",
|
|
264
|
+
iframeAPIURL: "",
|
|
265
|
+
webSocketURL: "",
|
|
266
|
+
coreBaseURL: "",
|
|
267
|
+
password: ""
|
|
268
|
+
},
|
|
269
|
+
callStartTime: parsedState.callStartTime || null,
|
|
270
|
+
controlPanelPosition: parsedState.controlPanelPosition || {
|
|
271
|
+
x: 10,
|
|
272
|
+
y: 10
|
|
273
|
+
},
|
|
274
|
+
iframePosition: parsedState.iframePosition || {
|
|
275
|
+
x: ((_a2 = window.screen) == null ? void 0 : _a2.availWidth) - 460,
|
|
276
|
+
y: ((_b = window.screen) == null ? void 0 : _b.height) - 580
|
|
277
|
+
},
|
|
278
|
+
callData: parsedState.callData || {
|
|
279
|
+
mobileNumber: "",
|
|
280
|
+
callReferenceId: "",
|
|
281
|
+
agent_id: "",
|
|
282
|
+
status: "",
|
|
283
|
+
type: "",
|
|
284
|
+
event_time: "",
|
|
285
|
+
phone_number: ""
|
|
286
|
+
},
|
|
287
|
+
conferenceLine: parsedState.conferenceLine && Array.isArray(parsedState.conferenceLine) && parsedState.conferenceLine.length > 0 ? parsedState.conferenceLine : this.state.conferenceLine,
|
|
288
|
+
agentStatus: parsedState.agentStatus,
|
|
289
|
+
sdk: parsedState.sdk || null,
|
|
290
|
+
isPermissionsLoaded: parsedState.isPermissionsLoaded || false,
|
|
291
|
+
userPermissions: parsedState.userPermissions || null,
|
|
292
|
+
menuEntitlements: parsedState.menuEntitlements || null
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
} catch (error) {
|
|
296
|
+
console.warn("Failed to load SDK state:", error);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
saveToStorage() {
|
|
300
|
+
try {
|
|
301
|
+
const persistentState = {
|
|
302
|
+
agentId: this.state.agentId,
|
|
303
|
+
authorization: this.state.authorization,
|
|
304
|
+
process: this.state.process,
|
|
305
|
+
isInitialized: this.state.isInitialized,
|
|
306
|
+
openConferenceDialog: this.state.openConferenceDialog,
|
|
307
|
+
openCallTransferDialog: this.state.openCallTransferDialog,
|
|
308
|
+
sdkConfig: this.state.sdkConfig,
|
|
309
|
+
urlConfig: this.state.urlConfig,
|
|
310
|
+
callStartTime: this.state.callStartTime,
|
|
311
|
+
controlPanelPosition: this.state.controlPanelPosition,
|
|
312
|
+
iframePosition: this.state.iframePosition,
|
|
313
|
+
callData: this.state.callData,
|
|
314
|
+
conferenceLine: this.state.conferenceLine,
|
|
315
|
+
agentStatus: this.state.agentStatus,
|
|
316
|
+
sdk: this.state.sdk,
|
|
317
|
+
isPermissionsLoaded: this.state.isPermissionsLoaded,
|
|
318
|
+
userPermissions: this.state.userPermissions,
|
|
319
|
+
menuEntitlements: this.state.menuEntitlements
|
|
320
|
+
};
|
|
321
|
+
(0, import_vault.setSession)(this.STORAGE_KEY, persistentState);
|
|
322
|
+
} catch (error) {
|
|
323
|
+
console.warn("Failed to save SDK state:", error);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
notifyListeners() {
|
|
327
|
+
this.listeners.forEach((listener) => listener());
|
|
328
|
+
}
|
|
329
|
+
validateCredentials(apiKey, tenantId) {
|
|
330
|
+
if (!apiKey || typeof apiKey !== "string" || apiKey.trim().length === 0) {
|
|
331
|
+
throw new Error("API key not available");
|
|
332
|
+
}
|
|
333
|
+
if (!tenantId || typeof tenantId !== "string" || tenantId.trim().length === 0) {
|
|
334
|
+
throw new Error("Tenant ID not available");
|
|
335
|
+
}
|
|
336
|
+
this.apiKey = apiKey.trim();
|
|
337
|
+
this.tenantId = tenantId.trim();
|
|
338
|
+
}
|
|
339
|
+
initialize(apiKey, tenantId, agentId, urlConfig, initResult, sdkConfig) {
|
|
340
|
+
var _a2;
|
|
341
|
+
this.validateCredentials(apiKey, tenantId);
|
|
342
|
+
if (!agentId || typeof agentId !== "string" || agentId.trim().length === 0) {
|
|
343
|
+
throw new Error("Agent ID not available");
|
|
344
|
+
} else {
|
|
345
|
+
this.state.agentId = agentId;
|
|
346
|
+
this.state.openConferenceDialog = false;
|
|
347
|
+
this.state.openCallTransferDialog = false;
|
|
348
|
+
this.state.authorization = initResult;
|
|
349
|
+
this.state.sdkConfig = __spreadValues(__spreadValues({
|
|
350
|
+
disableEndCallButton: false,
|
|
351
|
+
disabledDialButton: false,
|
|
352
|
+
disabledMoreOptionsButton: false,
|
|
353
|
+
enableQueueName: false,
|
|
354
|
+
disableCallTransferButton: false,
|
|
355
|
+
disableBlindTransfer: false,
|
|
356
|
+
disableAttendedTransfer: false,
|
|
357
|
+
disableWarmTransfer: false,
|
|
358
|
+
isDraggable: true,
|
|
359
|
+
disableSoftPhone: false,
|
|
360
|
+
disableConferenceButton: false,
|
|
361
|
+
disableHoldButton: false,
|
|
362
|
+
disableMuteButton: false,
|
|
363
|
+
disabled: {},
|
|
364
|
+
enabled: {},
|
|
365
|
+
outlined: {}
|
|
366
|
+
}, sdkConfig), initResult == null ? void 0 : initResult.callControls);
|
|
367
|
+
this.state.urlConfig = {
|
|
368
|
+
baseURL: (urlConfig == null ? void 0 : urlConfig.baseURL) || "",
|
|
369
|
+
iframeURL: (urlConfig == null ? void 0 : urlConfig.iframeURL) || "",
|
|
370
|
+
iframeAPIURL: (urlConfig == null ? void 0 : urlConfig.iframeAPIURL) || "",
|
|
371
|
+
webSocketURL: (urlConfig == null ? void 0 : urlConfig.webSocketURL) || "",
|
|
372
|
+
coreBaseURL: (urlConfig == null ? void 0 : urlConfig.coreBaseURL) || "",
|
|
373
|
+
id: ((_a2 = initResult == null ? void 0 : initResult.userInfo) == null ? void 0 : _a2.id) ? String(initResult.userInfo.id) : "",
|
|
374
|
+
password: (urlConfig == null ? void 0 : urlConfig.password) || ""
|
|
375
|
+
};
|
|
376
|
+
this.state.isInitialized = true;
|
|
377
|
+
this.saveToStorage();
|
|
378
|
+
this.notifyListeners();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
getState() {
|
|
382
|
+
return __spreadValues({}, this.state);
|
|
383
|
+
}
|
|
384
|
+
getCredentials() {
|
|
385
|
+
return { apiKey: this.apiKey, tenantId: this.tenantId };
|
|
386
|
+
}
|
|
387
|
+
getSdkAuthToken() {
|
|
388
|
+
var _a2;
|
|
389
|
+
return (_a2 = this.state.authorization) == null ? void 0 : _a2.accessToken;
|
|
390
|
+
}
|
|
391
|
+
subscribe(listener) {
|
|
392
|
+
this.listeners.push(listener);
|
|
393
|
+
return () => {
|
|
394
|
+
const index = this.listeners.indexOf(listener);
|
|
395
|
+
if (index > -1) {
|
|
396
|
+
this.listeners.splice(index, 1);
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
// public setHolding(isHolding: boolean): void {
|
|
401
|
+
// this.state.isHolding = isHolding;
|
|
402
|
+
// this.saveToStorage();
|
|
403
|
+
// this.notifyListeners();
|
|
404
|
+
// }
|
|
405
|
+
// public setMuted(isMuted: boolean): void {
|
|
406
|
+
// this.state.isMuted = isMuted;
|
|
407
|
+
// this.saveToStorage();
|
|
408
|
+
// this.notifyListeners();
|
|
409
|
+
// }
|
|
410
|
+
setProcess(process) {
|
|
411
|
+
this.state.process = process;
|
|
412
|
+
this.saveToStorage();
|
|
413
|
+
this.notifyListeners();
|
|
414
|
+
}
|
|
415
|
+
setControlPanelPosition(position) {
|
|
416
|
+
this.state.controlPanelPosition = position;
|
|
417
|
+
this.saveToStorage();
|
|
418
|
+
this.notifyListeners();
|
|
419
|
+
}
|
|
420
|
+
setIframePosition(position) {
|
|
421
|
+
this.state.iframePosition = position;
|
|
422
|
+
this.saveToStorage();
|
|
423
|
+
this.notifyListeners();
|
|
424
|
+
}
|
|
425
|
+
startCall() {
|
|
426
|
+
this.state.callStartTime = Date.now();
|
|
427
|
+
this.saveToStorage();
|
|
428
|
+
this.notifyListeners();
|
|
429
|
+
}
|
|
430
|
+
endCall() {
|
|
431
|
+
this.state.callStartTime = null;
|
|
432
|
+
this.saveToStorage();
|
|
433
|
+
this.notifyListeners();
|
|
434
|
+
}
|
|
435
|
+
setInitCheck() {
|
|
436
|
+
this.state.isInitialized = false;
|
|
437
|
+
this.saveToStorage();
|
|
438
|
+
this.notifyListeners();
|
|
439
|
+
}
|
|
440
|
+
setOpenConferenceDialog(open) {
|
|
441
|
+
this.state.openConferenceDialog = open;
|
|
442
|
+
this.saveToStorage();
|
|
443
|
+
this.notifyListeners();
|
|
444
|
+
}
|
|
445
|
+
setOpenCallTransferDialog(open) {
|
|
446
|
+
this.state.openCallTransferDialog = open;
|
|
447
|
+
this.saveToStorage();
|
|
448
|
+
this.notifyListeners();
|
|
449
|
+
}
|
|
450
|
+
setConsultInfo(info) {
|
|
451
|
+
this.state.consultInfo = info;
|
|
452
|
+
this.notifyListeners();
|
|
453
|
+
}
|
|
454
|
+
setAgentStatus(status) {
|
|
455
|
+
this.state.agentStatus = status;
|
|
456
|
+
this.saveToStorage();
|
|
457
|
+
this.notifyListeners();
|
|
458
|
+
}
|
|
459
|
+
updateCallData(data) {
|
|
460
|
+
this.state.callData = __spreadValues(__spreadValues({}, this.state.callData), data);
|
|
461
|
+
this.saveToStorage();
|
|
462
|
+
this.notifyListeners();
|
|
463
|
+
}
|
|
464
|
+
updateConferenceData(data) {
|
|
465
|
+
this.state.conferenceLine = [...data];
|
|
466
|
+
this.saveToStorage();
|
|
467
|
+
this.notifyListeners();
|
|
468
|
+
}
|
|
469
|
+
setConferenceLine(line) {
|
|
470
|
+
var _a2;
|
|
471
|
+
if (!this.state.conferenceLine || !Array.isArray(this.state.conferenceLine)) {
|
|
472
|
+
this.state.conferenceLine = this.getInitialState().conferenceLine;
|
|
473
|
+
}
|
|
474
|
+
const conferenceLineData = (_a2 = this.state.conferenceLine) == null ? void 0 : _a2.map(
|
|
475
|
+
(each) => {
|
|
476
|
+
if (each.line === line.line) {
|
|
477
|
+
return line;
|
|
478
|
+
}
|
|
479
|
+
return each;
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
this.state.conferenceLine = conferenceLineData;
|
|
483
|
+
this.saveToStorage();
|
|
484
|
+
this.notifyListeners();
|
|
485
|
+
}
|
|
486
|
+
resetConferenceLines() {
|
|
487
|
+
this.state.conferenceLine = [
|
|
488
|
+
{
|
|
489
|
+
line: 1,
|
|
490
|
+
status: "IDLE",
|
|
491
|
+
type: "",
|
|
492
|
+
phone: "",
|
|
493
|
+
isMute: false,
|
|
494
|
+
isHold: false,
|
|
495
|
+
isCallStart: false,
|
|
496
|
+
isMergeCall: false
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
line: 2,
|
|
500
|
+
status: "IDLE",
|
|
501
|
+
type: "",
|
|
502
|
+
phone: "",
|
|
503
|
+
isMute: false,
|
|
504
|
+
isHold: false,
|
|
505
|
+
isCallStart: false,
|
|
506
|
+
isMergeCall: false
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
line: 3,
|
|
510
|
+
status: "IDLE",
|
|
511
|
+
type: "",
|
|
512
|
+
phone: "",
|
|
513
|
+
isMute: false,
|
|
514
|
+
isHold: false,
|
|
515
|
+
isCallStart: false,
|
|
516
|
+
isMergeCall: false
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
line: 4,
|
|
520
|
+
status: "IDLE",
|
|
521
|
+
type: "",
|
|
522
|
+
phone: "",
|
|
523
|
+
isMute: false,
|
|
524
|
+
isHold: false,
|
|
525
|
+
isCallStart: false,
|
|
526
|
+
isMergeCall: false
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
line: 5,
|
|
530
|
+
status: "IDLE",
|
|
531
|
+
type: "",
|
|
532
|
+
phone: "",
|
|
533
|
+
isMute: false,
|
|
534
|
+
isHold: false,
|
|
535
|
+
isCallStart: false,
|
|
536
|
+
isMergeCall: false
|
|
537
|
+
}
|
|
538
|
+
];
|
|
539
|
+
this.saveToStorage();
|
|
540
|
+
this.notifyListeners();
|
|
541
|
+
}
|
|
542
|
+
clearStorageAndReset() {
|
|
543
|
+
try {
|
|
544
|
+
(0, import_vault.removeSession)(this.STORAGE_KEY);
|
|
545
|
+
this.state = this.getInitialState();
|
|
546
|
+
this.notifyListeners();
|
|
547
|
+
} catch (error) {
|
|
548
|
+
console.warn("Failed to clear:", error);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
getConferenceLines() {
|
|
552
|
+
return this.state.conferenceLine || [];
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Update SDK config with permission-based controls.
|
|
556
|
+
* Merges the provided controls with existing config.
|
|
557
|
+
*/
|
|
558
|
+
updateSDKConfigFromPermissions(permissionControls) {
|
|
559
|
+
this.state.sdkConfig = __spreadValues(__spreadValues({}, this.state.sdkConfig), permissionControls);
|
|
560
|
+
this.saveToStorage();
|
|
561
|
+
this.notifyListeners();
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Revert call consult controls back to the base permission-derived values.
|
|
565
|
+
* Called when a CALL_STATE event arrives without call_consult_controls.
|
|
566
|
+
*/
|
|
567
|
+
resetConsultControls() {
|
|
568
|
+
const base = this.getControlsConfig();
|
|
569
|
+
this.state.sdkConfig = __spreadProps(__spreadValues({}, this.state.sdkConfig), {
|
|
570
|
+
disableEndCallButton: base.disableEndCallButton,
|
|
571
|
+
disableCallTransferButton: base.disableCallTransferButton,
|
|
572
|
+
disableConferenceButton: base.disableConferenceButton,
|
|
573
|
+
disableHoldButton: base.disableHoldButton,
|
|
574
|
+
disableMuteButton: base.disableMuteButton
|
|
575
|
+
});
|
|
576
|
+
this.saveToStorage();
|
|
577
|
+
this.notifyListeners();
|
|
578
|
+
}
|
|
579
|
+
// ============ Entitlement Logic (Ported from SDKPermissionManager) ============
|
|
580
|
+
/**
|
|
581
|
+
* Set user information (entitlements) from login response
|
|
582
|
+
*/
|
|
583
|
+
setSDKPermissions(userInfo) {
|
|
584
|
+
var _a2, _b;
|
|
585
|
+
if (!userInfo) return;
|
|
586
|
+
const sdk = (_a2 = userInfo.entitlements) == null ? void 0 : _a2.sdk;
|
|
587
|
+
const sdkPermissions = Array.isArray(userInfo.permissions) ? userInfo.permissions : null;
|
|
588
|
+
const sdkMenus = Array.isArray((_b = userInfo.entitlements) == null ? void 0 : _b.menus) ? userInfo.entitlements.menus : null;
|
|
589
|
+
this.state.sdk = sdk;
|
|
590
|
+
this.state.userPermissions = sdkPermissions;
|
|
591
|
+
this.state.menuEntitlements = sdkMenus;
|
|
592
|
+
this.state.isPermissionsLoaded = true;
|
|
593
|
+
const permissionControls = this.getControlsConfig();
|
|
594
|
+
this.updateSDKConfigFromPermissions(permissionControls);
|
|
595
|
+
this.saveToStorage();
|
|
596
|
+
this.notifyListeners();
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Check if a bit is enabled in entitlements
|
|
600
|
+
*/
|
|
601
|
+
isBitEnabled(category, bitCode) {
|
|
602
|
+
var _a2;
|
|
603
|
+
const sdk = this.state.sdk;
|
|
604
|
+
if (!sdk) return false;
|
|
605
|
+
const categoryEntitlement = sdk[category];
|
|
606
|
+
if (!categoryEntitlement) return false;
|
|
607
|
+
if (!categoryEntitlement.enabled) return false;
|
|
608
|
+
if (!bitCode) return true;
|
|
609
|
+
const bit = (_a2 = categoryEntitlement.items) == null ? void 0 : _a2.find(
|
|
610
|
+
(item) => item.code === bitCode
|
|
611
|
+
);
|
|
612
|
+
return bit ? bit.enabled : false;
|
|
613
|
+
}
|
|
614
|
+
/** Check if the user has a specific flat permission (e.g. "calls:inbound") */
|
|
615
|
+
hasPermission(permission) {
|
|
616
|
+
const perms = this.state.userPermissions;
|
|
617
|
+
if (!perms) return false;
|
|
618
|
+
return perms.includes("*") || perms.includes(permission);
|
|
619
|
+
}
|
|
620
|
+
/** Check if any of the provided permissions is granted */
|
|
621
|
+
hasAnyPermission(permissions) {
|
|
622
|
+
return permissions.some((p) => this.hasPermission(p));
|
|
623
|
+
}
|
|
624
|
+
/** Check if all of the provided permissions are granted */
|
|
625
|
+
hasAllPermissions(permissions) {
|
|
626
|
+
return permissions.every((p) => this.hasPermission(p));
|
|
627
|
+
}
|
|
628
|
+
/** Check if a menu entitlement is enabled (e.g. "campaign"). Supports "*" wildcard. */
|
|
629
|
+
hasMenuFeature(code) {
|
|
630
|
+
const menus = this.state.menuEntitlements;
|
|
631
|
+
if (!menus) return false;
|
|
632
|
+
if (menus.some((m) => m.code === "*" && m.enabled)) return true;
|
|
633
|
+
const entry = menus.find((m) => m.code === code);
|
|
634
|
+
return entry ? entry.enabled : false;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Get SDK controls configuration derived exclusively from structured entitlements.
|
|
638
|
+
*/
|
|
639
|
+
getControlsConfig() {
|
|
640
|
+
const { sdk, isPermissionsLoaded } = this.state;
|
|
641
|
+
if (!isPermissionsLoaded || !sdk) {
|
|
642
|
+
return {
|
|
643
|
+
disabledDialButton: true,
|
|
644
|
+
disableEndCallButton: true,
|
|
645
|
+
disableCallTransferButton: true,
|
|
646
|
+
disableBlindTransfer: true,
|
|
647
|
+
disableAttendedTransfer: true,
|
|
648
|
+
disableWarmTransfer: true,
|
|
649
|
+
disableConferenceButton: true,
|
|
650
|
+
disableHoldButton: true,
|
|
651
|
+
disableMuteButton: true,
|
|
652
|
+
disabledMoreOptionsButton: true
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
const isDialAllowed = this.isBitEnabled(
|
|
656
|
+
"calls",
|
|
657
|
+
SDK_PERMISSIONS.CALL_OUTBOUND
|
|
658
|
+
);
|
|
659
|
+
const isInboundAllowed = this.isBitEnabled(
|
|
660
|
+
"calls",
|
|
661
|
+
SDK_PERMISSIONS.CALL_INBOUND
|
|
662
|
+
);
|
|
663
|
+
const isAnyCallAllowed = isDialAllowed || isInboundAllowed;
|
|
664
|
+
const isHoldAllowed = isAnyCallAllowed;
|
|
665
|
+
const isMuteAllowed = isAnyCallAllowed;
|
|
666
|
+
const isEndCallAllowed = isAnyCallAllowed;
|
|
667
|
+
const isConferenceAllowed = this.isBitEnabled("call_conference", "");
|
|
668
|
+
const isTransferEnabled = this.isBitEnabled("call_transfer", "");
|
|
669
|
+
const isBlindAllowed = this.isBitEnabled(
|
|
670
|
+
"call_transfer",
|
|
671
|
+
SDK_PERMISSIONS.TRANSFER_BLIND
|
|
672
|
+
);
|
|
673
|
+
const isAttendedAllowed = this.isBitEnabled(
|
|
674
|
+
"call_transfer",
|
|
675
|
+
SDK_PERMISSIONS.TRANSFER_ATTENDED
|
|
676
|
+
);
|
|
677
|
+
const isWarmAllowed = this.isBitEnabled(
|
|
678
|
+
"call_transfer",
|
|
679
|
+
SDK_PERMISSIONS.TRANSFER_WARM
|
|
680
|
+
);
|
|
681
|
+
return {
|
|
682
|
+
disabledDialButton: !isDialAllowed,
|
|
683
|
+
disableEndCallButton: !isEndCallAllowed,
|
|
684
|
+
disableCallTransferButton: !isTransferEnabled,
|
|
685
|
+
disableBlindTransfer: !isBlindAllowed,
|
|
686
|
+
disableAttendedTransfer: !isAttendedAllowed,
|
|
687
|
+
disableWarmTransfer: !isWarmAllowed,
|
|
688
|
+
disableConferenceButton: !isConferenceAllowed,
|
|
689
|
+
disableHoldButton: !isHoldAllowed,
|
|
690
|
+
disableMuteButton: !isMuteAllowed,
|
|
691
|
+
disabledMoreOptionsButton: false
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
sdkStateManager = new SDKStateManager();
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
// call-control-sdk/lib/services/endPoint.ts
|
|
700
|
+
var getBaseURL, getCoreURL, BASE_URL, CORE_URL, VERSION, END_POINT;
|
|
701
|
+
var init_endPoint = __esm({
|
|
702
|
+
"call-control-sdk/lib/services/endPoint.ts"() {
|
|
703
|
+
"use strict";
|
|
704
|
+
init_sdk_state();
|
|
705
|
+
getBaseURL = () => {
|
|
706
|
+
var _a2, _b, _c;
|
|
707
|
+
return ((_c = (_b = (_a2 = sdkStateManager) == null ? void 0 : _a2.getState()) == null ? void 0 : _b.urlConfig) == null ? void 0 : _c.baseURL) || "";
|
|
708
|
+
};
|
|
709
|
+
getCoreURL = () => {
|
|
710
|
+
var _a2, _b, _c;
|
|
711
|
+
return ((_c = (_b = (_a2 = sdkStateManager) == null ? void 0 : _a2.getState()) == null ? void 0 : _b.urlConfig) == null ? void 0 : _c.coreBaseURL) || "";
|
|
712
|
+
};
|
|
713
|
+
BASE_URL = getBaseURL();
|
|
714
|
+
CORE_URL = getCoreURL();
|
|
715
|
+
VERSION = {
|
|
716
|
+
v1: "/api/v1"
|
|
717
|
+
};
|
|
718
|
+
END_POINT = {
|
|
719
|
+
get LOGIN() {
|
|
720
|
+
return `${getBaseURL()}${VERSION.v1}/cti/login?provider=convox`;
|
|
721
|
+
},
|
|
722
|
+
get READY_AGENT() {
|
|
723
|
+
return `${getCoreURL()}${VERSION.v1}/agents/ready`;
|
|
724
|
+
},
|
|
725
|
+
get UPDATE_AGENT_BREAK() {
|
|
726
|
+
return `${getCoreURL()}${VERSION.v1}/agents/status`;
|
|
727
|
+
},
|
|
728
|
+
get CLICK_TO_CALL() {
|
|
729
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/dial`;
|
|
730
|
+
},
|
|
731
|
+
get HOLD_CALL() {
|
|
732
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/hold`;
|
|
733
|
+
},
|
|
734
|
+
get MUTE_CALL() {
|
|
735
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/mute`;
|
|
736
|
+
},
|
|
737
|
+
get UNMUTE_CALL() {
|
|
738
|
+
return `${getCoreURL()}${VERSION.v1}/cti/mute`;
|
|
739
|
+
},
|
|
740
|
+
get END_CALL() {
|
|
741
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/hangup`;
|
|
742
|
+
},
|
|
743
|
+
get LOGOUT() {
|
|
744
|
+
return `${getBaseURL()}${VERSION.v1}/cti/logout?provider=convox`;
|
|
745
|
+
},
|
|
746
|
+
get CONFERENCE_CALL() {
|
|
747
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/conference/add`;
|
|
748
|
+
},
|
|
749
|
+
get CONFERENCE_MERGE_CALL() {
|
|
750
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/conference/merge`;
|
|
751
|
+
},
|
|
752
|
+
get CONFERENCE_CALL_HOLD_OR_UN_HOLD() {
|
|
753
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/hold`;
|
|
754
|
+
},
|
|
755
|
+
get CONFERENCE_CALL_MUTE_OT_UN_MUTE() {
|
|
756
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/mute`;
|
|
757
|
+
},
|
|
758
|
+
get CONFERENCE_CALL_END() {
|
|
759
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/hangup`;
|
|
760
|
+
},
|
|
761
|
+
get CONFERENCE_CALL_END_ALL() {
|
|
762
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/hangup`;
|
|
763
|
+
},
|
|
764
|
+
get CONFERENCE_CALL_TRANSFER() {
|
|
765
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/conference/transfer`;
|
|
766
|
+
},
|
|
767
|
+
get TRANSFER_CALL() {
|
|
768
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/transfer-call`;
|
|
769
|
+
},
|
|
770
|
+
get TRANSFER_COMPLETE() {
|
|
771
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/transfer/complete`;
|
|
772
|
+
},
|
|
773
|
+
get TRANSFER_CANCEL() {
|
|
774
|
+
return `${getCoreURL()}${VERSION.v1}/cti/calls/transfer/cancel`;
|
|
775
|
+
},
|
|
776
|
+
get AGENTS_LIST() {
|
|
777
|
+
return `${getBaseURL()}${VERSION.v1}/cti/users`;
|
|
778
|
+
},
|
|
779
|
+
get PROCESS_LIST() {
|
|
780
|
+
return `${getBaseURL()}${VERSION.v1}/cti/processes-list`;
|
|
781
|
+
},
|
|
782
|
+
get BREAKS_LIST() {
|
|
783
|
+
return `${getBaseURL()}${VERSION.v1}/cti/breaks`;
|
|
784
|
+
},
|
|
785
|
+
get TRANSFER_TO_DETAILS() {
|
|
786
|
+
return `${getBaseURL()}${VERSION.v1}/cti/transfer-to-details?provider=convox`;
|
|
787
|
+
},
|
|
788
|
+
get SEND_NOTIFICATIONS() {
|
|
789
|
+
return `${getBaseURL()}${VERSION.v1}/cti/notifications/send`;
|
|
790
|
+
},
|
|
791
|
+
get CALL_HISTORY() {
|
|
792
|
+
return `${getBaseURL()}${VERSION.v1}/dashboard/call-history`;
|
|
793
|
+
},
|
|
794
|
+
get SENTIMENTAL_ANALYSIS() {
|
|
795
|
+
return `${getBaseURL()}${VERSION.v1}/users/get_sentiment_analysis`;
|
|
796
|
+
},
|
|
797
|
+
get DISPOSITIONS() {
|
|
798
|
+
return `${getBaseURL()}${VERSION.v1}/cti/calls/dispositions`;
|
|
799
|
+
},
|
|
800
|
+
SET_CALL_DISPOSITION: (callUuid) => `${getBaseURL()}${VERSION.v1}/calls/${callUuid}/disposition`,
|
|
801
|
+
get HOSPITALS_SERVICES() {
|
|
802
|
+
return `${getBaseURL()}${VERSION.v1}/cti/hospital/services`;
|
|
803
|
+
},
|
|
804
|
+
get BLIEND_TRANSFER() {
|
|
805
|
+
return `${getBaseURL()}${VERSION.v1}/cti/calls/blind_transfer?provider=convox`;
|
|
806
|
+
},
|
|
807
|
+
get AUTH_LOGOUT() {
|
|
808
|
+
return `${getBaseURL()}${VERSION.v1}/auth/logout`;
|
|
809
|
+
},
|
|
810
|
+
// Permissions
|
|
811
|
+
get USER_PERMISSIONS() {
|
|
812
|
+
return `${getBaseURL()}${VERSION.v1}/rbac/users/me/permissions`;
|
|
813
|
+
},
|
|
814
|
+
// Supervisor Call Monitoring (Listen / Whisper / Barge via ChanSpy)
|
|
815
|
+
get SUPERVISOR_CALL_LISTEN() {
|
|
816
|
+
return `${getBaseURL()}${VERSION.v1}/cti/supervisor/listen`;
|
|
817
|
+
},
|
|
818
|
+
get SUPERVISOR_CALL_LEAVE() {
|
|
819
|
+
return `${getBaseURL()}${VERSION.v1}/cti/supervisor/leave`;
|
|
820
|
+
},
|
|
821
|
+
get SUPERVISOR_CALL_CHANGE_MODE() {
|
|
822
|
+
return `${getBaseURL()}${VERSION.v1}/cti/supervisor/mode`;
|
|
823
|
+
},
|
|
824
|
+
// Call History pages
|
|
825
|
+
get CALLS_HISTORY() {
|
|
826
|
+
return `${getBaseURL()}${VERSION.v1}/calls/history`;
|
|
827
|
+
},
|
|
828
|
+
get MISSED_CALLS() {
|
|
829
|
+
return `${getBaseURL()}${VERSION.v1}/supervisor/missed-calls`;
|
|
830
|
+
},
|
|
831
|
+
RECORDING_BY_CALL: (call_uuid) => `${getBaseURL()}${VERSION.v1}/recordings/call/${call_uuid}`
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
// call-control-sdk/lib/services/axios.ts
|
|
837
|
+
function getAuthToken() {
|
|
838
|
+
var _a2;
|
|
839
|
+
return (_a2 = sdkStateManager.getSdkAuthToken()) != null ? _a2 : "";
|
|
840
|
+
}
|
|
841
|
+
function createAxiosInstance() {
|
|
842
|
+
var _a2, _b, _c, _d;
|
|
843
|
+
const instance = import_axios.default.create({
|
|
844
|
+
// baseURL: sdkStateManager.getState()?.urlConfig?.baseURL,
|
|
845
|
+
headers: {
|
|
846
|
+
"Content-Type": "application/json",
|
|
847
|
+
Accept: "application/json",
|
|
848
|
+
"x-tenant-id": (_b = (_a2 = sdkStateManager.getCredentials()) == null ? void 0 : _a2.tenantId) != null ? _b : "",
|
|
849
|
+
"x-api-key": (_d = (_c = sdkStateManager.getCredentials()) == null ? void 0 : _c.apiKey) != null ? _d : "",
|
|
850
|
+
Authorization: DEFAULT_TOKEN ? DEFAULT_TOKEN.startsWith("Bearer ") ? DEFAULT_TOKEN : `Bearer ${DEFAULT_TOKEN}` : ""
|
|
851
|
+
},
|
|
852
|
+
timeout: REQUEST_TIMEOUT,
|
|
853
|
+
withCredentials: false
|
|
854
|
+
});
|
|
855
|
+
instance.interceptors.request.use(
|
|
856
|
+
(config) => {
|
|
857
|
+
const token = getAuthToken();
|
|
858
|
+
if (token && config.headers) {
|
|
859
|
+
const authToken = token.startsWith("Bearer ") ? token : `Bearer ${token}`;
|
|
860
|
+
config.headers.Authorization = authToken;
|
|
861
|
+
}
|
|
862
|
+
console.log("API Request:", {
|
|
863
|
+
url: config.url,
|
|
864
|
+
method: config.method,
|
|
865
|
+
hasToken: !!token,
|
|
866
|
+
tokenStartsWithBearer: token == null ? void 0 : token.startsWith("Bearer "),
|
|
867
|
+
headers: {
|
|
868
|
+
Authorization: config.headers.Authorization,
|
|
869
|
+
"x-tenant-id": config.headers["x-tenant-id"],
|
|
870
|
+
"x-api-key": config.headers["x-api-key"]
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
config.metadata = { startTime: (/* @__PURE__ */ new Date()).getTime() };
|
|
874
|
+
return config;
|
|
875
|
+
},
|
|
876
|
+
(error) => {
|
|
877
|
+
console.error("Request interceptor error:", error);
|
|
878
|
+
return Promise.reject(error);
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
instance.interceptors.response.use(
|
|
882
|
+
(response) => {
|
|
883
|
+
return response;
|
|
884
|
+
},
|
|
885
|
+
async (error) => {
|
|
886
|
+
var _a3;
|
|
887
|
+
const originalRequest = error.config;
|
|
888
|
+
if (((_a3 = error.response) == null ? void 0 : _a3.status) === 401 && !originalRequest._retry) {
|
|
889
|
+
sdkStateManager.setInitCheck();
|
|
890
|
+
console.warn("Unauthorized request, attempting retry...");
|
|
891
|
+
}
|
|
892
|
+
if (!error.response) {
|
|
893
|
+
console.error("Network error:", error.message);
|
|
894
|
+
error.message = "Network error: Please check your internet connection";
|
|
895
|
+
}
|
|
896
|
+
if (error.response && error.response.status >= 500) {
|
|
897
|
+
console.error("Server error:", error.response.status, error.response.data);
|
|
898
|
+
error.message = "Server error: Please try again later";
|
|
899
|
+
}
|
|
900
|
+
return Promise.reject(error);
|
|
901
|
+
}
|
|
902
|
+
);
|
|
903
|
+
return instance;
|
|
904
|
+
}
|
|
905
|
+
var import_axios, _a, DEFAULT_TOKEN, REQUEST_TIMEOUT, axiosInstance, axios_default;
|
|
906
|
+
var init_axios = __esm({
|
|
907
|
+
"call-control-sdk/lib/services/axios.ts"() {
|
|
908
|
+
"use strict";
|
|
909
|
+
import_axios = __toESM(require("axios"));
|
|
910
|
+
init_sdk_state();
|
|
911
|
+
DEFAULT_TOKEN = (_a = sdkStateManager.getSdkAuthToken()) != null ? _a : "";
|
|
912
|
+
REQUEST_TIMEOUT = 6e4;
|
|
913
|
+
axiosInstance = createAxiosInstance();
|
|
914
|
+
axios_default = axiosInstance;
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
// call-control-sdk/lib/services/toastMessage.tsx
|
|
919
|
+
var import_react, import_material, import_jsx_runtime, ToastContext, noopToast, useToast, ToastProvider;
|
|
920
|
+
var init_toastMessage = __esm({
|
|
921
|
+
"call-control-sdk/lib/services/toastMessage.tsx"() {
|
|
922
|
+
"use strict";
|
|
923
|
+
import_react = require("react");
|
|
924
|
+
import_material = require("@mui/material");
|
|
925
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
926
|
+
ToastContext = (0, import_react.createContext)(void 0);
|
|
927
|
+
noopToast = {
|
|
928
|
+
showToast: (message, severity) => {
|
|
929
|
+
console.warn(`[Toast outside provider] ${severity != null ? severity : "info"}: ${message}`);
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
useToast = () => {
|
|
933
|
+
const ctx = (0, import_react.useContext)(ToastContext);
|
|
934
|
+
return ctx != null ? ctx : noopToast;
|
|
935
|
+
};
|
|
936
|
+
ToastProvider = ({ children }) => {
|
|
937
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
938
|
+
const [message, setMessage] = (0, import_react.useState)("");
|
|
939
|
+
const [severity, setSeverity] = (0, import_react.useState)("info");
|
|
940
|
+
const showToast = (msg, sev = "info") => {
|
|
941
|
+
setMessage(msg);
|
|
942
|
+
setSeverity(sev);
|
|
943
|
+
setOpen(true);
|
|
944
|
+
};
|
|
945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ToastContext.Provider, { value: { showToast }, children: [
|
|
946
|
+
children,
|
|
947
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
948
|
+
import_material.Snackbar,
|
|
949
|
+
{
|
|
950
|
+
open,
|
|
951
|
+
color: severity,
|
|
952
|
+
autoHideDuration: 3e3,
|
|
953
|
+
onClose: () => setOpen(false),
|
|
954
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
956
|
+
import_material.Alert,
|
|
957
|
+
{
|
|
958
|
+
variant: "filled",
|
|
959
|
+
severity,
|
|
960
|
+
onClose: () => setOpen(false),
|
|
961
|
+
sx: { width: "100%" },
|
|
962
|
+
children: message
|
|
963
|
+
}
|
|
964
|
+
)
|
|
965
|
+
}
|
|
966
|
+
)
|
|
967
|
+
] });
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
|
|
972
|
+
// call-control-sdk/lib/components/SDKProvider.tsx
|
|
973
|
+
var import_react13, import_jsx_runtime4, SDKProvider;
|
|
974
|
+
var init_SDKProvider = __esm({
|
|
975
|
+
"call-control-sdk/lib/components/SDKProvider.tsx"() {
|
|
976
|
+
"use strict";
|
|
977
|
+
import_react13 = require("react");
|
|
978
|
+
init_toastMessage();
|
|
979
|
+
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
980
|
+
SDKProvider = (0, import_react13.memo)(({ children }) => {
|
|
981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ToastProvider, { children });
|
|
982
|
+
});
|
|
983
|
+
SDKProvider.displayName = "SDKProvider";
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
// call-control-sdk/lib/pages/callHistory/useCallHistory.ts
|
|
988
|
+
function useCallHistory() {
|
|
989
|
+
const [calls, setCalls] = (0, import_react16.useState)([]);
|
|
990
|
+
const [missedCalls, setMissedCalls] = (0, import_react16.useState)([]);
|
|
991
|
+
const [loading, setLoading] = (0, import_react16.useState)(false);
|
|
992
|
+
const fetchCallHistory = (0, import_react16.useCallback)(async () => {
|
|
993
|
+
var _a2;
|
|
994
|
+
setLoading(true);
|
|
995
|
+
try {
|
|
996
|
+
const res = await axios_default.post(END_POINT.CALLS_HISTORY, {});
|
|
997
|
+
setCalls(Array.isArray((_a2 = res.data) == null ? void 0 : _a2.records) ? res.data.records : []);
|
|
998
|
+
} catch (e) {
|
|
999
|
+
setCalls([]);
|
|
1000
|
+
} finally {
|
|
1001
|
+
setLoading(false);
|
|
1002
|
+
}
|
|
1003
|
+
}, []);
|
|
1004
|
+
const fetchMissedCalls = (0, import_react16.useCallback)(async () => {
|
|
1005
|
+
var _a2;
|
|
1006
|
+
setLoading(true);
|
|
1007
|
+
try {
|
|
1008
|
+
const res = await axios_default.get(END_POINT.MISSED_CALLS);
|
|
1009
|
+
setMissedCalls(Array.isArray((_a2 = res.data) == null ? void 0 : _a2.data) ? res.data.data : []);
|
|
1010
|
+
} catch (e) {
|
|
1011
|
+
setMissedCalls([]);
|
|
1012
|
+
} finally {
|
|
1013
|
+
setLoading(false);
|
|
1014
|
+
}
|
|
1015
|
+
}, []);
|
|
1016
|
+
const fetchRecording = (0, import_react16.useCallback)(async (call_uuid) => {
|
|
1017
|
+
const res = await axios_default.get(END_POINT.RECORDING_BY_CALL(call_uuid), {
|
|
1018
|
+
responseType: "blob"
|
|
1019
|
+
});
|
|
1020
|
+
return res.data;
|
|
1021
|
+
}, []);
|
|
1022
|
+
return {
|
|
1023
|
+
calls,
|
|
1024
|
+
missedCalls,
|
|
1025
|
+
loading,
|
|
1026
|
+
fetchCallHistory,
|
|
1027
|
+
fetchMissedCalls,
|
|
1028
|
+
fetchRecording
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
var import_react16;
|
|
1032
|
+
var init_useCallHistory = __esm({
|
|
1033
|
+
"call-control-sdk/lib/pages/callHistory/useCallHistory.ts"() {
|
|
1034
|
+
"use strict";
|
|
1035
|
+
import_react16 = require("react");
|
|
1036
|
+
init_axios();
|
|
1037
|
+
init_endPoint();
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
// call-control-sdk/lib/pages/callHistory/index.tsx
|
|
1042
|
+
var callHistory_exports = {};
|
|
1043
|
+
__export(callHistory_exports, {
|
|
1044
|
+
default: () => callHistory_default
|
|
1045
|
+
});
|
|
1046
|
+
function ExpandableRow({
|
|
1047
|
+
row,
|
|
1048
|
+
striped,
|
|
1049
|
+
fetchRecording,
|
|
1050
|
+
onError
|
|
1051
|
+
}) {
|
|
1052
|
+
var _a2, _b;
|
|
1053
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
1054
|
+
const [audioURL, setAudioURL] = (0, import_react17.useState)(null);
|
|
1055
|
+
const [loadingAudio, setLoadingAudio] = (0, import_react17.useState)(false);
|
|
1056
|
+
const handlePlay = async () => {
|
|
1057
|
+
if (!row.recording.available) return;
|
|
1058
|
+
setLoadingAudio(true);
|
|
1059
|
+
try {
|
|
1060
|
+
const blob = await fetchRecording(row.call_uuid);
|
|
1061
|
+
setAudioURL(URL.createObjectURL(blob));
|
|
1062
|
+
} catch (e) {
|
|
1063
|
+
onError("Recording not available");
|
|
1064
|
+
} finally {
|
|
1065
|
+
setLoadingAudio(false);
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
const bg = striped ? "#fafafa" : "white";
|
|
1069
|
+
const cellSx = { fontSize: "0.82rem", backgroundColor: bg };
|
|
1070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.TableRow, { hover: true, children: [
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { sx: __spreadProps(__spreadValues({}, cellSx), { maxWidth: 130 }), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Tooltip, { title: row.call_uuid, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1073
|
+
import_material6.Typography,
|
|
1074
|
+
{
|
|
1075
|
+
noWrap: true,
|
|
1076
|
+
sx: { fontSize: 13, maxWidth: 130, overflow: "hidden", textOverflow: "ellipsis" },
|
|
1077
|
+
children: row.call_uuid
|
|
1078
|
+
}
|
|
1079
|
+
) }) }),
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { sx: cellSx, children: row.mobile_no }),
|
|
1081
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { align: "center", sx: cellSx, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1082
|
+
import_material6.Chip,
|
|
1083
|
+
{
|
|
1084
|
+
size: "small",
|
|
1085
|
+
label: row.call_type,
|
|
1086
|
+
color: row.call_type === "INCOMING" ? "success" : "primary"
|
|
1087
|
+
}
|
|
1088
|
+
) }),
|
|
1089
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { sx: cellSx, children: new Date(row.start_time).toLocaleString() }),
|
|
1090
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { sx: cellSx, children: row.end_time ? new Date(row.end_time).toLocaleString() : "\u2014" }),
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { align: "center", sx: cellSx, children: row.recording.available ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1092
|
+
import_material6.IconButton,
|
|
1093
|
+
{
|
|
1094
|
+
color: "primary",
|
|
1095
|
+
onClick: handlePlay,
|
|
1096
|
+
disabled: loadingAudio,
|
|
1097
|
+
size: "small",
|
|
1098
|
+
children: loadingAudio ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.CircularProgress, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons_material3.PlayArrow, {})
|
|
1099
|
+
}
|
|
1100
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Chip, { size: "small", label: "No File" }) }),
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { align: "center", sx: cellSx, children: (_a2 = row.agent_id) != null ? _a2 : "\u2014" }),
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { align: "center", sx: cellSx, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.IconButton, { onClick: () => setOpen((o) => !o), size: "small", children: open ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons_material3.ExpandLess, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons_material3.KeyboardArrowDown, {}) }) })
|
|
1103
|
+
] }),
|
|
1104
|
+
audioURL && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { colSpan: 8, sx: { p: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Box, { p: 2, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1105
|
+
"audio",
|
|
1106
|
+
{
|
|
1107
|
+
controls: true,
|
|
1108
|
+
autoPlay: true,
|
|
1109
|
+
src: audioURL,
|
|
1110
|
+
onEnded: () => {
|
|
1111
|
+
URL.revokeObjectURL(audioURL);
|
|
1112
|
+
setAudioURL(null);
|
|
1113
|
+
},
|
|
1114
|
+
style: { width: "100%" }
|
|
1115
|
+
}
|
|
1116
|
+
) }) }) }),
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { colSpan: 8, sx: { p: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Collapse, { in: open, unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Box, { p: 2, bgcolor: "#f9fafc", borderTop: "1px solid #eee", children: [
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Typography, { fontWeight: 600, fontSize: "0.85rem", mb: 0.5, children: "Call Details" }),
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Typography, { variant: "body2", fontSize: "0.82rem", children: [
|
|
1120
|
+
"Call UID: ",
|
|
1121
|
+
row.call_uuid
|
|
1122
|
+
] }),
|
|
1123
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Typography, { variant: "body2", fontSize: "0.82rem", children: [
|
|
1124
|
+
"Agent: ",
|
|
1125
|
+
(_b = row.agent_id) != null ? _b : "Unassigned"
|
|
1126
|
+
] })
|
|
1127
|
+
] }) }) }) })
|
|
1128
|
+
] });
|
|
1129
|
+
}
|
|
1130
|
+
var import_react17, import_material6, import_icons_material3, import_jsx_runtime8, CALL_HISTORY_COLS, MISSED_CALLS_COLS, CENTER_COLS, CallHistoryContent, MissedCallRow, CallHistory, callHistory_default;
|
|
1131
|
+
var init_callHistory = __esm({
|
|
1132
|
+
"call-control-sdk/lib/pages/callHistory/index.tsx"() {
|
|
1133
|
+
"use strict";
|
|
1134
|
+
import_react17 = require("react");
|
|
1135
|
+
import_material6 = require("@mui/material");
|
|
1136
|
+
import_icons_material3 = require("@mui/icons-material");
|
|
1137
|
+
init_SDKProvider();
|
|
1138
|
+
init_toastMessage();
|
|
1139
|
+
init_useCallHistory();
|
|
1140
|
+
import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1141
|
+
CALL_HISTORY_COLS = ["Call UID", "Mobile", "Type", "Start Time", "End Time", "Recording", "Agent", "Details"];
|
|
1142
|
+
MISSED_CALLS_COLS = ["Agent ID", "Agent Name", "Mobile No", "Type", "Actions"];
|
|
1143
|
+
CENTER_COLS = /* @__PURE__ */ new Set(["Type", "Recording", "Agent", "Details", "Actions"]);
|
|
1144
|
+
CallHistoryContent = (0, import_react17.memo)(() => {
|
|
1145
|
+
const theme = (0, import_material6.useTheme)();
|
|
1146
|
+
const { showToast } = useToast();
|
|
1147
|
+
const { calls, missedCalls, loading, fetchCallHistory, fetchMissedCalls, fetchRecording } = useCallHistory();
|
|
1148
|
+
const [filter, setFilter] = (0, import_react17.useState)("ALL");
|
|
1149
|
+
const [search, setSearch] = (0, import_react17.useState)("");
|
|
1150
|
+
const [showMissedCalls, setShowMissedCalls] = (0, import_react17.useState)(false);
|
|
1151
|
+
(0, import_react17.useEffect)(() => {
|
|
1152
|
+
if (showMissedCalls) {
|
|
1153
|
+
fetchMissedCalls();
|
|
1154
|
+
} else {
|
|
1155
|
+
fetchCallHistory();
|
|
1156
|
+
}
|
|
1157
|
+
}, [showMissedCalls, fetchCallHistory, fetchMissedCalls]);
|
|
1158
|
+
const filteredCalls = calls.filter((c) => filter === "ALL" || c.call_type === filter).filter((c) => c.mobile_no.toLowerCase().includes(search.toLowerCase()));
|
|
1159
|
+
const filteredMissedCalls = missedCalls.filter((c) => {
|
|
1160
|
+
var _a2;
|
|
1161
|
+
return filter === "ALL" || ((_a2 = c.callType) == null ? void 0 : _a2.toUpperCase()) === filter;
|
|
1162
|
+
}).filter((c) => {
|
|
1163
|
+
var _a2, _b, _c;
|
|
1164
|
+
const q = search.toLowerCase();
|
|
1165
|
+
return ((_a2 = c.agentId) == null ? void 0 : _a2.toLowerCase().includes(q)) || ((_b = c.username) == null ? void 0 : _b.toLowerCase().includes(q)) || ((_c = c.mobileNumber) == null ? void 0 : _c.toLowerCase().includes(q));
|
|
1166
|
+
});
|
|
1167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Box, { children: [
|
|
1168
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1169
|
+
import_material6.Box,
|
|
1170
|
+
{
|
|
1171
|
+
display: "flex",
|
|
1172
|
+
alignItems: "center",
|
|
1173
|
+
justifyContent: "space-between",
|
|
1174
|
+
px: 2,
|
|
1175
|
+
py: 1.5,
|
|
1176
|
+
borderBottom: "1px solid #eee",
|
|
1177
|
+
children: [
|
|
1178
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Typography, { fontWeight: 700, fontSize: "1rem", children: "Call History" }),
|
|
1179
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1180
|
+
import_material6.OutlinedInput,
|
|
1181
|
+
{
|
|
1182
|
+
size: "small",
|
|
1183
|
+
value: search,
|
|
1184
|
+
onChange: (e) => setSearch(e.target.value),
|
|
1185
|
+
placeholder: "Search",
|
|
1186
|
+
sx: { width: 220, fontSize: "0.82rem", height: 36 },
|
|
1187
|
+
endAdornment: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.InputAdornment, { position: "end", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons_material3.Search, { sx: { fontSize: 18, color: "#999" } }) })
|
|
1188
|
+
}
|
|
1189
|
+
)
|
|
1190
|
+
]
|
|
1191
|
+
}
|
|
1192
|
+
),
|
|
1193
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Box, { py: 1.5, px: 2, children: [
|
|
1194
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Stack, { direction: "row", spacing: 2, alignItems: "center", mb: 2, children: [
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1196
|
+
import_material6.FormControlLabel,
|
|
1197
|
+
{
|
|
1198
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1199
|
+
import_material6.Switch,
|
|
1200
|
+
{
|
|
1201
|
+
size: "small",
|
|
1202
|
+
checked: showMissedCalls,
|
|
1203
|
+
onChange: (_, checked) => setShowMissedCalls(checked)
|
|
1204
|
+
}
|
|
1205
|
+
),
|
|
1206
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Typography, { sx: { fontSize: "0.8rem", color: "#555" }, children: "Missed Calls" }),
|
|
1207
|
+
sx: { ml: 0 }
|
|
1208
|
+
}
|
|
1209
|
+
),
|
|
1210
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1211
|
+
import_material6.ToggleButtonGroup,
|
|
1212
|
+
{
|
|
1213
|
+
value: filter,
|
|
1214
|
+
exclusive: true,
|
|
1215
|
+
onChange: (_, v) => v && setFilter(v),
|
|
1216
|
+
size: "small",
|
|
1217
|
+
sx: {
|
|
1218
|
+
border: "1px solid #ccc",
|
|
1219
|
+
borderRadius: "50px",
|
|
1220
|
+
overflow: "hidden",
|
|
1221
|
+
"& .MuiToggleButton-root": {
|
|
1222
|
+
border: "none",
|
|
1223
|
+
borderRight: "1px solid #ccc",
|
|
1224
|
+
color: "#555",
|
|
1225
|
+
fontWeight: 600,
|
|
1226
|
+
textTransform: "uppercase",
|
|
1227
|
+
fontSize: "0.72rem",
|
|
1228
|
+
px: 2,
|
|
1229
|
+
py: 0.5,
|
|
1230
|
+
borderRadius: 0,
|
|
1231
|
+
"&:last-of-type": { borderRight: "none" },
|
|
1232
|
+
"&.Mui-selected": {
|
|
1233
|
+
backgroundColor: theme.palette.primary.main,
|
|
1234
|
+
color: "#fff",
|
|
1235
|
+
"&:hover": { backgroundColor: theme.palette.primary.dark }
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
},
|
|
1239
|
+
children: [
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.ToggleButton, { value: "ALL", children: "All" }),
|
|
1241
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.ToggleButton, { value: "INCOMING", children: "Inbound" }),
|
|
1242
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.ToggleButton, { value: "OUTGOING", children: "Outbound" })
|
|
1243
|
+
]
|
|
1244
|
+
}
|
|
1245
|
+
)
|
|
1246
|
+
] }),
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableContainer, { component: import_material6.Paper, variant: "outlined", sx: { maxHeight: 600 }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Table, { stickyHeader: true, size: "small", children: showMissedCalls ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: MISSED_CALLS_COLS.map((col) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1249
|
+
import_material6.TableCell,
|
|
1250
|
+
{
|
|
1251
|
+
align: CENTER_COLS.has(col) ? "center" : "left",
|
|
1252
|
+
sx: { fontWeight: 600, backgroundColor: "#f1f1f1", fontSize: "0.8rem" },
|
|
1253
|
+
children: col
|
|
1254
|
+
},
|
|
1255
|
+
col
|
|
1256
|
+
)) }) }),
|
|
1257
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { colSpan: 5, align: "center", sx: { py: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.CircularProgress, { size: 24 }) }) }) : filteredMissedCalls.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { colSpan: 5, align: "center", sx: { py: 4, color: "#999", fontSize: "0.82rem" }, children: "No Records Found" }) }) : filteredMissedCalls.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MissedCallRow, { row }, `${row.agentId}-${row.mobileNumber}-${i}`)) })
|
|
1258
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1259
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: CALL_HISTORY_COLS.map((col) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1260
|
+
import_material6.TableCell,
|
|
1261
|
+
{
|
|
1262
|
+
align: CENTER_COLS.has(col) ? "center" : "left",
|
|
1263
|
+
sx: { fontWeight: 600, backgroundColor: "#f1f1f1", fontSize: "0.8rem" },
|
|
1264
|
+
children: col
|
|
1265
|
+
},
|
|
1266
|
+
col
|
|
1267
|
+
)) }) }),
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { colSpan: 8, align: "center", sx: { py: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.CircularProgress, {}) }) }) : filteredCalls.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { colSpan: 8, align: "center", sx: { py: 4, color: "#999", fontSize: "0.82rem" }, children: "No Records Found" }) }) : filteredCalls.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1269
|
+
ExpandableRow,
|
|
1270
|
+
{
|
|
1271
|
+
row,
|
|
1272
|
+
striped: i % 2 === 0,
|
|
1273
|
+
fetchRecording,
|
|
1274
|
+
onError: (msg) => showToast(msg, "error")
|
|
1275
|
+
},
|
|
1276
|
+
row.call_uuid
|
|
1277
|
+
)) })
|
|
1278
|
+
] }) }) })
|
|
1279
|
+
] })
|
|
1280
|
+
] });
|
|
1281
|
+
});
|
|
1282
|
+
CallHistoryContent.displayName = "CallHistoryContent";
|
|
1283
|
+
MissedCallRow = (0, import_react17.memo)(({ row }) => {
|
|
1284
|
+
const theme = (0, import_material6.useTheme)();
|
|
1285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.TableRow, { hover: true, children: [
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { sx: { fontSize: "0.82rem", color: theme.palette.primary.main }, children: row.agentId }),
|
|
1287
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { sx: { fontSize: "0.82rem" }, children: row.username }),
|
|
1288
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.TableCell, { sx: { fontSize: "0.82rem" }, children: [
|
|
1289
|
+
row.mobileNumber,
|
|
1290
|
+
" (",
|
|
1291
|
+
row.callCount,
|
|
1292
|
+
")"
|
|
1293
|
+
] }),
|
|
1294
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { sx: { fontSize: "0.82rem", textTransform: "uppercase" }, children: row.callType }),
|
|
1295
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableCell, { align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons_material3.Phone, { sx: { color: "#c0392b", fontSize: 20, cursor: "pointer" } }) })
|
|
1296
|
+
] });
|
|
1297
|
+
});
|
|
1298
|
+
MissedCallRow.displayName = "MissedCallRow";
|
|
1299
|
+
CallHistory = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SDKProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CallHistoryContent, {}) });
|
|
1300
|
+
callHistory_default = CallHistory;
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
47
1303
|
|
|
48
1304
|
// call-control-sdk/index.ts
|
|
49
1305
|
var index_exports = {};
|
|
50
1306
|
__export(index_exports, {
|
|
51
1307
|
CallControlPanel: () => CallControlPanel,
|
|
1308
|
+
SDKAccessDenied: () => SDKAccessDenied,
|
|
1309
|
+
SDKPages: () => SDKPages,
|
|
1310
|
+
SDKPermissionGuard: () => SDKPermissionGuard,
|
|
1311
|
+
SDK_MENU_CODES: () => SDK_MENU_CODES,
|
|
52
1312
|
SDK_PERMISSIONS: () => SDK_PERMISSIONS,
|
|
1313
|
+
SDK_WILDCARD: () => SDK_WILDCARD,
|
|
1314
|
+
changeMonitorMode: () => changeMonitorMode,
|
|
1315
|
+
clickToCall: () => clickToCall,
|
|
1316
|
+
clickToConference: () => clickToConference,
|
|
1317
|
+
endCall: () => endCall,
|
|
53
1318
|
getSDKVersion: () => getSDKVersion,
|
|
54
1319
|
initSDK: () => initSDK,
|
|
55
1320
|
isSDKInitialized: () => isSDKInitialized,
|
|
1321
|
+
logout: () => logout,
|
|
1322
|
+
sdkStateManager: () => sdkStateManager,
|
|
1323
|
+
startMonitoring: () => startMonitoring,
|
|
1324
|
+
stopMonitoring: () => stopMonitoring,
|
|
1325
|
+
useCallMonitoring: () => useCallMonitoring,
|
|
56
1326
|
useClickToCall: () => useClickToCall,
|
|
1327
|
+
useClickToConference: () => useClickToConference,
|
|
57
1328
|
useEndCall: () => useEndCall,
|
|
58
1329
|
useGetAuthorizationToken: () => useGetAuthorizationToken,
|
|
59
1330
|
useGetCallerData: () => useGetCallerData,
|
|
60
1331
|
useLogout: () => useLogout,
|
|
1332
|
+
useSDKPermissions: () => useSDKPermissions,
|
|
61
1333
|
useSDKState: () => useSDKState
|
|
62
1334
|
});
|
|
63
1335
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -130,600 +1402,51 @@ var EventTrackerSDK = class {
|
|
|
130
1402
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
131
1403
|
}
|
|
132
1404
|
}
|
|
133
|
-
throw new Error("Max retries exceeded");
|
|
134
|
-
}
|
|
135
|
-
startPeriodicFlush() {
|
|
136
|
-
if (this.flushTimer) {
|
|
137
|
-
clearInterval(this.flushTimer);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
var eventTracker = new EventTrackerSDK();
|
|
142
|
-
if (typeof window !== "undefined") {
|
|
143
|
-
window.EventTracker = eventTracker;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// call-control-sdk/lib/hooks/sdk-state.ts
|
|
147
|
-
var import_vault = require("@react-solutions/vault");
|
|
148
|
-
|
|
149
|
-
// call-control-sdk/lib/utils/storage.ts
|
|
150
|
-
var STORAGE_KEY = "call-control-sdk-state";
|
|
151
|
-
|
|
152
|
-
// call-control-sdk/lib/permissions/sdk-constants.ts
|
|
153
|
-
var SDK_PERMISSIONS = {
|
|
154
|
-
// main object key constants
|
|
155
|
-
CALLS: "calls",
|
|
156
|
-
CALL_TRANSFER: "call_transfer",
|
|
157
|
-
CALL_CONFERENCE: "call_conference",
|
|
158
|
-
// in each object has items list of objects
|
|
159
|
-
CALL_INBOUND: "call_inbound",
|
|
160
|
-
CALL_OUTBOUND: "call_outbound",
|
|
161
|
-
CONFERENCE: "call_conference",
|
|
162
|
-
TRANSFER_BLIND: "call_transfer_blind",
|
|
163
|
-
TRANSFER_ATTENDED: "call_transfer_attended",
|
|
164
|
-
TRANSFER_WARM: "call_transfer_warm"
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
// call-control-sdk/lib/hooks/sdk-state.ts
|
|
168
|
-
var SDKStateManager = class {
|
|
169
|
-
constructor() {
|
|
170
|
-
__publicField(this, "state");
|
|
171
|
-
__publicField(this, "listeners", []);
|
|
172
|
-
__publicField(this, "STORAGE_KEY", STORAGE_KEY);
|
|
173
|
-
__publicField(this, "apiKey");
|
|
174
|
-
__publicField(this, "tenantId");
|
|
175
|
-
this.state = this.getInitialState();
|
|
176
|
-
this.loadFromStorage();
|
|
177
|
-
}
|
|
178
|
-
getInitialState() {
|
|
179
|
-
var _a2, _b;
|
|
180
|
-
return {
|
|
181
|
-
authorization: void 0,
|
|
182
|
-
process: null,
|
|
183
|
-
agentId: "",
|
|
184
|
-
openConferenceDialog: false,
|
|
185
|
-
openCallTransferDialog: false,
|
|
186
|
-
isInitialized: false,
|
|
187
|
-
sdkConfig: {
|
|
188
|
-
disableEndCallButton: false,
|
|
189
|
-
disabledDialButton: false,
|
|
190
|
-
disabledMoreOptionsButton: false,
|
|
191
|
-
enableSmsServices: false,
|
|
192
|
-
enableQueueName: false,
|
|
193
|
-
disableCallTransferButton: false,
|
|
194
|
-
disableBlindTransfer: false,
|
|
195
|
-
disableAttendedTransfer: false,
|
|
196
|
-
disableWarmTransfer: false,
|
|
197
|
-
isDraggable: true,
|
|
198
|
-
disableSoftPhone: false,
|
|
199
|
-
disableConferenceButton: false,
|
|
200
|
-
disableHoldButton: false,
|
|
201
|
-
disableMuteButton: false,
|
|
202
|
-
disabled: {},
|
|
203
|
-
enabled: {},
|
|
204
|
-
outlined: {}
|
|
205
|
-
},
|
|
206
|
-
urlConfig: {
|
|
207
|
-
baseURL: "",
|
|
208
|
-
iframeURL: "",
|
|
209
|
-
iframeAPIURL: "",
|
|
210
|
-
webSocketURL: "",
|
|
211
|
-
coreBaseURL: "",
|
|
212
|
-
id: "",
|
|
213
|
-
password: ""
|
|
214
|
-
},
|
|
215
|
-
callStartTime: null,
|
|
216
|
-
controlPanelPosition: { x: 10, y: 10 },
|
|
217
|
-
iframePosition: {
|
|
218
|
-
x: ((_a2 = window.screen) == null ? void 0 : _a2.availWidth) - 460,
|
|
219
|
-
y: ((_b = window.screen) == null ? void 0 : _b.height) - 580
|
|
220
|
-
},
|
|
221
|
-
callData: {
|
|
222
|
-
agent_id: -1,
|
|
223
|
-
queue_name: "",
|
|
224
|
-
hold: 0,
|
|
225
|
-
mute: 0,
|
|
226
|
-
status: "",
|
|
227
|
-
type: "",
|
|
228
|
-
event_time: "",
|
|
229
|
-
phone_number: ""
|
|
230
|
-
},
|
|
231
|
-
conferenceLine: [
|
|
232
|
-
{
|
|
233
|
-
line: 1,
|
|
234
|
-
status: "IDLE",
|
|
235
|
-
type: "",
|
|
236
|
-
phone: "",
|
|
237
|
-
isMute: false,
|
|
238
|
-
isHold: false,
|
|
239
|
-
isCallStart: false,
|
|
240
|
-
isMergeCall: false
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
line: 2,
|
|
244
|
-
status: "IDLE",
|
|
245
|
-
type: "",
|
|
246
|
-
phone: "",
|
|
247
|
-
isMute: false,
|
|
248
|
-
isHold: false,
|
|
249
|
-
isCallStart: false,
|
|
250
|
-
isMergeCall: false
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
line: 3,
|
|
254
|
-
status: "IDLE",
|
|
255
|
-
type: "",
|
|
256
|
-
phone: "",
|
|
257
|
-
isMute: false,
|
|
258
|
-
isHold: false,
|
|
259
|
-
isCallStart: false,
|
|
260
|
-
isMergeCall: false
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
line: 4,
|
|
264
|
-
status: "IDLE",
|
|
265
|
-
type: "",
|
|
266
|
-
phone: "",
|
|
267
|
-
isMute: false,
|
|
268
|
-
isHold: false,
|
|
269
|
-
isCallStart: false,
|
|
270
|
-
isMergeCall: false
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
line: 5,
|
|
274
|
-
status: "IDLE",
|
|
275
|
-
type: "",
|
|
276
|
-
phone: "",
|
|
277
|
-
isMute: false,
|
|
278
|
-
isHold: false,
|
|
279
|
-
isCallStart: false,
|
|
280
|
-
isMergeCall: false
|
|
281
|
-
}
|
|
282
|
-
],
|
|
283
|
-
hold: 0,
|
|
284
|
-
mute: 0,
|
|
285
|
-
agentStatus: "",
|
|
286
|
-
sdk: null,
|
|
287
|
-
isPermissionsLoaded: false
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
loadFromStorage() {
|
|
291
|
-
var _a2, _b;
|
|
292
|
-
try {
|
|
293
|
-
const stored = (0, import_vault.getItem)(this.STORAGE_KEY);
|
|
294
|
-
if (stored) {
|
|
295
|
-
const parsedState = stored;
|
|
296
|
-
this.state = __spreadProps(__spreadValues({}, this.state), {
|
|
297
|
-
agentId: parsedState.agentId || "",
|
|
298
|
-
authorization: parsedState.authorization || void 0,
|
|
299
|
-
process: parsedState.process || null,
|
|
300
|
-
openConferenceDialog: (parsedState == null ? void 0 : parsedState.openConferenceDialog) || false,
|
|
301
|
-
openCallTransferDialog: (parsedState == null ? void 0 : parsedState.openCallTransferDialog) || false,
|
|
302
|
-
isInitialized: parsedState.isInitialized || false,
|
|
303
|
-
sdkConfig: parsedState.sdkConfig || {
|
|
304
|
-
disableEndCallButton: false,
|
|
305
|
-
disabledMoreOptionsButton: false,
|
|
306
|
-
enableSmsServices: false,
|
|
307
|
-
enableQueueName: false,
|
|
308
|
-
disabledDialButton: false,
|
|
309
|
-
disableCallTransferButton: false,
|
|
310
|
-
disableBlindTransfer: false,
|
|
311
|
-
disableAttendedTransfer: false,
|
|
312
|
-
disableWarmTransfer: false,
|
|
313
|
-
isDraggable: true,
|
|
314
|
-
disableSoftPhone: false,
|
|
315
|
-
disableConferenceButton: false,
|
|
316
|
-
disableHoldButton: false,
|
|
317
|
-
disableMuteButton: false,
|
|
318
|
-
disabled: {},
|
|
319
|
-
enabled: {},
|
|
320
|
-
outlined: {}
|
|
321
|
-
},
|
|
322
|
-
urlConfig: parsedState.urlConfig || {
|
|
323
|
-
id: "",
|
|
324
|
-
baseURL: "",
|
|
325
|
-
iframeURL: "",
|
|
326
|
-
iframeAPIURL: "",
|
|
327
|
-
webSocketURL: "",
|
|
328
|
-
coreBaseURL: "",
|
|
329
|
-
password: ""
|
|
330
|
-
},
|
|
331
|
-
callStartTime: parsedState.callStartTime || null,
|
|
332
|
-
controlPanelPosition: parsedState.controlPanelPosition || {
|
|
333
|
-
x: 10,
|
|
334
|
-
y: 10
|
|
335
|
-
},
|
|
336
|
-
iframePosition: parsedState.iframePosition || {
|
|
337
|
-
x: ((_a2 = window.screen) == null ? void 0 : _a2.availWidth) - 460,
|
|
338
|
-
y: ((_b = window.screen) == null ? void 0 : _b.height) - 580
|
|
339
|
-
},
|
|
340
|
-
callData: parsedState.callData || {
|
|
341
|
-
mobileNumber: "",
|
|
342
|
-
callReferenceId: "",
|
|
343
|
-
agent_id: "",
|
|
344
|
-
status: "",
|
|
345
|
-
type: "",
|
|
346
|
-
event_time: "",
|
|
347
|
-
phone_number: ""
|
|
348
|
-
},
|
|
349
|
-
conferenceLine: parsedState.conferenceLine && Array.isArray(parsedState.conferenceLine) && parsedState.conferenceLine.length > 0 ? parsedState.conferenceLine : this.state.conferenceLine,
|
|
350
|
-
agentStatus: parsedState.agentStatus,
|
|
351
|
-
sdk: parsedState.sdk || null,
|
|
352
|
-
isPermissionsLoaded: parsedState.isPermissionsLoaded || false
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
} catch (error) {
|
|
356
|
-
console.warn("Failed to load SDK state:", error);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
saveToStorage() {
|
|
360
|
-
try {
|
|
361
|
-
const persistentState = {
|
|
362
|
-
agentId: this.state.agentId,
|
|
363
|
-
authorization: this.state.authorization,
|
|
364
|
-
process: this.state.process,
|
|
365
|
-
isInitialized: this.state.isInitialized,
|
|
366
|
-
openConferenceDialog: this.state.openConferenceDialog,
|
|
367
|
-
openCallTransferDialog: this.state.openCallTransferDialog,
|
|
368
|
-
sdkConfig: this.state.sdkConfig,
|
|
369
|
-
urlConfig: this.state.urlConfig,
|
|
370
|
-
callStartTime: this.state.callStartTime,
|
|
371
|
-
controlPanelPosition: this.state.controlPanelPosition,
|
|
372
|
-
iframePosition: this.state.iframePosition,
|
|
373
|
-
callData: this.state.callData,
|
|
374
|
-
conferenceLine: this.state.conferenceLine,
|
|
375
|
-
agentStatus: this.state.agentStatus,
|
|
376
|
-
sdk: this.state.sdk,
|
|
377
|
-
isPermissionsLoaded: this.state.isPermissionsLoaded
|
|
378
|
-
};
|
|
379
|
-
(0, import_vault.setItem)(this.STORAGE_KEY, persistentState);
|
|
380
|
-
} catch (error) {
|
|
381
|
-
console.warn("Failed to save SDK state:", error);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
notifyListeners() {
|
|
385
|
-
this.listeners.forEach((listener) => listener());
|
|
386
|
-
}
|
|
387
|
-
validateCredentials(apiKey, tenantId) {
|
|
388
|
-
if (!apiKey || typeof apiKey !== "string" || apiKey.trim().length === 0) {
|
|
389
|
-
throw new Error("API key not available");
|
|
390
|
-
}
|
|
391
|
-
if (!tenantId || typeof tenantId !== "string" || tenantId.trim().length === 0) {
|
|
392
|
-
throw new Error("Tenant ID not available");
|
|
393
|
-
}
|
|
394
|
-
this.apiKey = apiKey.trim();
|
|
395
|
-
this.tenantId = tenantId.trim();
|
|
396
|
-
}
|
|
397
|
-
initialize(apiKey, tenantId, agentId, urlConfig, initResult, sdkConfig) {
|
|
398
|
-
this.validateCredentials(apiKey, tenantId);
|
|
399
|
-
if (!agentId || typeof agentId !== "string" || agentId.trim().length === 0) {
|
|
400
|
-
throw new Error("Agent ID not available");
|
|
401
|
-
} else {
|
|
402
|
-
this.state.agentId = agentId;
|
|
403
|
-
this.state.openConferenceDialog = false;
|
|
404
|
-
this.state.openCallTransferDialog = false;
|
|
405
|
-
this.state.authorization = initResult;
|
|
406
|
-
this.state.sdkConfig = __spreadValues(__spreadValues({
|
|
407
|
-
disableEndCallButton: false,
|
|
408
|
-
disabledDialButton: false,
|
|
409
|
-
disabledMoreOptionsButton: false,
|
|
410
|
-
enableQueueName: false,
|
|
411
|
-
disableCallTransferButton: false,
|
|
412
|
-
disableBlindTransfer: false,
|
|
413
|
-
disableAttendedTransfer: false,
|
|
414
|
-
disableWarmTransfer: false,
|
|
415
|
-
isDraggable: true,
|
|
416
|
-
disableSoftPhone: false,
|
|
417
|
-
disableConferenceButton: false,
|
|
418
|
-
disableHoldButton: false,
|
|
419
|
-
disableMuteButton: false,
|
|
420
|
-
disabled: {},
|
|
421
|
-
enabled: {},
|
|
422
|
-
outlined: {}
|
|
423
|
-
}, sdkConfig), initResult == null ? void 0 : initResult.callControls);
|
|
424
|
-
this.state.urlConfig = {
|
|
425
|
-
baseURL: (urlConfig == null ? void 0 : urlConfig.baseURL) || "",
|
|
426
|
-
iframeURL: (urlConfig == null ? void 0 : urlConfig.iframeURL) || "",
|
|
427
|
-
iframeAPIURL: (urlConfig == null ? void 0 : urlConfig.iframeAPIURL) || "",
|
|
428
|
-
webSocketURL: (urlConfig == null ? void 0 : urlConfig.webSocketURL) || "",
|
|
429
|
-
coreBaseURL: (urlConfig == null ? void 0 : urlConfig.coreBaseURL) || "",
|
|
430
|
-
id: (urlConfig == null ? void 0 : urlConfig.id) || "",
|
|
431
|
-
password: (urlConfig == null ? void 0 : urlConfig.password) || ""
|
|
432
|
-
};
|
|
433
|
-
this.state.isInitialized = true;
|
|
434
|
-
this.saveToStorage();
|
|
435
|
-
this.notifyListeners();
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
getState() {
|
|
439
|
-
return __spreadValues({}, this.state);
|
|
440
|
-
}
|
|
441
|
-
getCredentials() {
|
|
442
|
-
return { apiKey: this.apiKey, tenantId: this.tenantId };
|
|
443
|
-
}
|
|
444
|
-
getSdkAuthToken() {
|
|
445
|
-
var _a2;
|
|
446
|
-
return (_a2 = this.state.authorization) == null ? void 0 : _a2.accessToken;
|
|
447
|
-
}
|
|
448
|
-
subscribe(listener) {
|
|
449
|
-
this.listeners.push(listener);
|
|
450
|
-
return () => {
|
|
451
|
-
const index = this.listeners.indexOf(listener);
|
|
452
|
-
if (index > -1) {
|
|
453
|
-
this.listeners.splice(index, 1);
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
// public setHolding(isHolding: boolean): void {
|
|
458
|
-
// this.state.isHolding = isHolding;
|
|
459
|
-
// this.saveToStorage();
|
|
460
|
-
// this.notifyListeners();
|
|
461
|
-
// }
|
|
462
|
-
// public setMuted(isMuted: boolean): void {
|
|
463
|
-
// this.state.isMuted = isMuted;
|
|
464
|
-
// this.saveToStorage();
|
|
465
|
-
// this.notifyListeners();
|
|
466
|
-
// }
|
|
467
|
-
setProcess(process) {
|
|
468
|
-
this.state.process = process;
|
|
469
|
-
this.saveToStorage();
|
|
470
|
-
this.notifyListeners();
|
|
471
|
-
}
|
|
472
|
-
setControlPanelPosition(position) {
|
|
473
|
-
this.state.controlPanelPosition = position;
|
|
474
|
-
this.saveToStorage();
|
|
475
|
-
this.notifyListeners();
|
|
476
|
-
}
|
|
477
|
-
setIframePosition(position) {
|
|
478
|
-
this.state.iframePosition = position;
|
|
479
|
-
this.saveToStorage();
|
|
480
|
-
this.notifyListeners();
|
|
481
|
-
}
|
|
482
|
-
startCall() {
|
|
483
|
-
this.state.callStartTime = Date.now();
|
|
484
|
-
this.saveToStorage();
|
|
485
|
-
this.notifyListeners();
|
|
486
|
-
}
|
|
487
|
-
endCall() {
|
|
488
|
-
this.state.callStartTime = null;
|
|
489
|
-
this.saveToStorage();
|
|
490
|
-
this.notifyListeners();
|
|
491
|
-
}
|
|
492
|
-
setInitCheck() {
|
|
493
|
-
this.state.isInitialized = false;
|
|
494
|
-
this.saveToStorage();
|
|
495
|
-
this.notifyListeners();
|
|
496
|
-
}
|
|
497
|
-
setOpenConferenceDialog(open) {
|
|
498
|
-
this.state.openConferenceDialog = open;
|
|
499
|
-
this.saveToStorage();
|
|
500
|
-
this.notifyListeners();
|
|
501
|
-
}
|
|
502
|
-
setOpenCallTransferDialog(open) {
|
|
503
|
-
this.state.openCallTransferDialog = open;
|
|
504
|
-
this.saveToStorage();
|
|
505
|
-
this.notifyListeners();
|
|
506
|
-
}
|
|
507
|
-
setAgentStatus(status) {
|
|
508
|
-
this.state.agentStatus = status;
|
|
509
|
-
this.saveToStorage();
|
|
510
|
-
this.notifyListeners();
|
|
511
|
-
}
|
|
512
|
-
updateCallData(data) {
|
|
513
|
-
this.state.callData = __spreadValues(__spreadValues({}, this.state.callData), data);
|
|
514
|
-
this.saveToStorage();
|
|
515
|
-
this.notifyListeners();
|
|
516
|
-
}
|
|
517
|
-
updateConferenceData(data) {
|
|
518
|
-
this.state.conferenceLine = [...data];
|
|
519
|
-
this.saveToStorage();
|
|
520
|
-
this.notifyListeners();
|
|
521
|
-
}
|
|
522
|
-
setConferenceLine(line) {
|
|
523
|
-
var _a2;
|
|
524
|
-
if (!this.state.conferenceLine || !Array.isArray(this.state.conferenceLine)) {
|
|
525
|
-
this.state.conferenceLine = this.getInitialState().conferenceLine;
|
|
526
|
-
}
|
|
527
|
-
const conferenceLineData = (_a2 = this.state.conferenceLine) == null ? void 0 : _a2.map(
|
|
528
|
-
(each) => {
|
|
529
|
-
if (each.line === line.line) {
|
|
530
|
-
return line;
|
|
531
|
-
}
|
|
532
|
-
return each;
|
|
533
|
-
}
|
|
534
|
-
);
|
|
535
|
-
this.state.conferenceLine = conferenceLineData;
|
|
536
|
-
this.saveToStorage();
|
|
537
|
-
this.notifyListeners();
|
|
538
|
-
}
|
|
539
|
-
resetConferenceLines() {
|
|
540
|
-
this.state.conferenceLine = [
|
|
541
|
-
{
|
|
542
|
-
line: 1,
|
|
543
|
-
status: "IDLE",
|
|
544
|
-
type: "",
|
|
545
|
-
phone: "",
|
|
546
|
-
isMute: false,
|
|
547
|
-
isHold: false,
|
|
548
|
-
isCallStart: false,
|
|
549
|
-
isMergeCall: false
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
line: 2,
|
|
553
|
-
status: "IDLE",
|
|
554
|
-
type: "",
|
|
555
|
-
phone: "",
|
|
556
|
-
isMute: false,
|
|
557
|
-
isHold: false,
|
|
558
|
-
isCallStart: false,
|
|
559
|
-
isMergeCall: false
|
|
560
|
-
},
|
|
561
|
-
{
|
|
562
|
-
line: 3,
|
|
563
|
-
status: "IDLE",
|
|
564
|
-
type: "",
|
|
565
|
-
phone: "",
|
|
566
|
-
isMute: false,
|
|
567
|
-
isHold: false,
|
|
568
|
-
isCallStart: false,
|
|
569
|
-
isMergeCall: false
|
|
570
|
-
},
|
|
571
|
-
{
|
|
572
|
-
line: 4,
|
|
573
|
-
status: "IDLE",
|
|
574
|
-
type: "",
|
|
575
|
-
phone: "",
|
|
576
|
-
isMute: false,
|
|
577
|
-
isHold: false,
|
|
578
|
-
isCallStart: false,
|
|
579
|
-
isMergeCall: false
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
line: 5,
|
|
583
|
-
status: "IDLE",
|
|
584
|
-
type: "",
|
|
585
|
-
phone: "",
|
|
586
|
-
isMute: false,
|
|
587
|
-
isHold: false,
|
|
588
|
-
isCallStart: false,
|
|
589
|
-
isMergeCall: false
|
|
590
|
-
}
|
|
591
|
-
];
|
|
592
|
-
this.saveToStorage();
|
|
593
|
-
this.notifyListeners();
|
|
594
|
-
}
|
|
595
|
-
clearStorageAndReset() {
|
|
596
|
-
try {
|
|
597
|
-
(0, import_vault.removeItem)(this.STORAGE_KEY);
|
|
598
|
-
this.state = this.getInitialState();
|
|
599
|
-
this.notifyListeners();
|
|
600
|
-
} catch (error) {
|
|
601
|
-
console.warn("Failed to clear:", error);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
getConferenceLines() {
|
|
605
|
-
return this.state.conferenceLine || [];
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Update SDK config with permission-based controls.
|
|
609
|
-
* Merges the provided controls with existing config.
|
|
610
|
-
*/
|
|
611
|
-
updateSDKConfigFromPermissions(permissionControls) {
|
|
612
|
-
this.state.sdkConfig = __spreadValues(__spreadValues({}, this.state.sdkConfig), permissionControls);
|
|
613
|
-
this.saveToStorage();
|
|
614
|
-
this.notifyListeners();
|
|
615
|
-
}
|
|
616
|
-
// ============ Entitlement Logic (Ported from SDKPermissionManager) ============
|
|
617
|
-
/**
|
|
618
|
-
* Set user information (entitlements) from login response
|
|
619
|
-
*/
|
|
620
|
-
setSDKPermissions(userInfo) {
|
|
621
|
-
var _a2;
|
|
622
|
-
if (!userInfo) return;
|
|
623
|
-
const sdk = (_a2 = userInfo.entitlements) == null ? void 0 : _a2.sdk;
|
|
624
|
-
this.state.sdk = sdk;
|
|
625
|
-
this.state.isPermissionsLoaded = true;
|
|
626
|
-
const permissionControls = this.getControlsConfig();
|
|
627
|
-
this.updateSDKConfigFromPermissions(permissionControls);
|
|
628
|
-
this.saveToStorage();
|
|
629
|
-
this.notifyListeners();
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* Check if a bit is enabled in entitlements
|
|
633
|
-
*/
|
|
634
|
-
isBitEnabled(category, bitCode) {
|
|
635
|
-
var _a2;
|
|
636
|
-
const sdk = this.state.sdk;
|
|
637
|
-
if (!sdk) return false;
|
|
638
|
-
const categoryEntitlement = sdk[category];
|
|
639
|
-
if (!categoryEntitlement) return false;
|
|
640
|
-
if (!categoryEntitlement.enabled) return false;
|
|
641
|
-
if (!bitCode) return true;
|
|
642
|
-
const bit = (_a2 = categoryEntitlement.items) == null ? void 0 : _a2.find(
|
|
643
|
-
(item) => item.code === bitCode
|
|
644
|
-
);
|
|
645
|
-
return bit ? bit.enabled : false;
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Get SDK controls configuration derived exclusively from structured entitlements.
|
|
649
|
-
*/
|
|
650
|
-
getControlsConfig() {
|
|
651
|
-
const { sdk, isPermissionsLoaded } = this.state;
|
|
652
|
-
if (!isPermissionsLoaded || !sdk) {
|
|
653
|
-
return {
|
|
654
|
-
disabledDialButton: true,
|
|
655
|
-
disableEndCallButton: true,
|
|
656
|
-
disableCallTransferButton: true,
|
|
657
|
-
disableBlindTransfer: true,
|
|
658
|
-
disableAttendedTransfer: true,
|
|
659
|
-
disableWarmTransfer: true,
|
|
660
|
-
disableConferenceButton: true,
|
|
661
|
-
disableHoldButton: true,
|
|
662
|
-
disableMuteButton: true,
|
|
663
|
-
disabledMoreOptionsButton: true
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
const isDialAllowed = this.isBitEnabled(
|
|
667
|
-
"calls",
|
|
668
|
-
SDK_PERMISSIONS.CALL_OUTBOUND
|
|
669
|
-
);
|
|
670
|
-
const isInboundAllowed = this.isBitEnabled(
|
|
671
|
-
"calls",
|
|
672
|
-
SDK_PERMISSIONS.CALL_INBOUND
|
|
673
|
-
);
|
|
674
|
-
const isAnyCallAllowed = isDialAllowed || isInboundAllowed;
|
|
675
|
-
const isHoldAllowed = isAnyCallAllowed;
|
|
676
|
-
const isMuteAllowed = isAnyCallAllowed;
|
|
677
|
-
const isEndCallAllowed = isAnyCallAllowed;
|
|
678
|
-
const isConferenceAllowed = this.isBitEnabled("call_conference", "");
|
|
679
|
-
const isTransferEnabled = this.isBitEnabled("call_transfer", "");
|
|
680
|
-
const isBlindAllowed = this.isBitEnabled(
|
|
681
|
-
"call_transfer",
|
|
682
|
-
SDK_PERMISSIONS.TRANSFER_BLIND
|
|
683
|
-
);
|
|
684
|
-
const isAttendedAllowed = this.isBitEnabled(
|
|
685
|
-
"call_transfer",
|
|
686
|
-
SDK_PERMISSIONS.TRANSFER_ATTENDED
|
|
687
|
-
);
|
|
688
|
-
const isWarmAllowed = this.isBitEnabled(
|
|
689
|
-
"call_transfer",
|
|
690
|
-
SDK_PERMISSIONS.TRANSFER_WARM
|
|
691
|
-
);
|
|
692
|
-
return {
|
|
693
|
-
disabledDialButton: !isDialAllowed,
|
|
694
|
-
disableEndCallButton: !isEndCallAllowed,
|
|
695
|
-
disableCallTransferButton: !isTransferEnabled,
|
|
696
|
-
disableBlindTransfer: !isBlindAllowed,
|
|
697
|
-
disableAttendedTransfer: !isAttendedAllowed,
|
|
698
|
-
disableWarmTransfer: !isWarmAllowed,
|
|
699
|
-
disableConferenceButton: !isConferenceAllowed,
|
|
700
|
-
disableHoldButton: !isHoldAllowed,
|
|
701
|
-
disableMuteButton: !isMuteAllowed,
|
|
702
|
-
disabledMoreOptionsButton: false
|
|
703
|
-
};
|
|
1405
|
+
throw new Error("Max retries exceeded");
|
|
1406
|
+
}
|
|
1407
|
+
startPeriodicFlush() {
|
|
1408
|
+
if (this.flushTimer) {
|
|
1409
|
+
clearInterval(this.flushTimer);
|
|
1410
|
+
}
|
|
704
1411
|
}
|
|
705
1412
|
};
|
|
706
|
-
var
|
|
1413
|
+
var eventTracker = new EventTrackerSDK();
|
|
1414
|
+
if (typeof window !== "undefined") {
|
|
1415
|
+
window.EventTracker = eventTracker;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
// call-control-sdk/index.ts
|
|
1419
|
+
init_sdk_state();
|
|
707
1420
|
|
|
708
1421
|
// call-control-sdk/lib/hooks/useLogout.ts
|
|
709
|
-
var
|
|
1422
|
+
var import_react2 = require("react");
|
|
1423
|
+
init_endPoint();
|
|
1424
|
+
init_sdk_state();
|
|
1425
|
+
init_axios();
|
|
710
1426
|
var import_vault2 = require("@react-solutions/vault");
|
|
1427
|
+
init_storage();
|
|
1428
|
+
init_toastMessage();
|
|
711
1429
|
var useLogout = () => {
|
|
712
|
-
const [loading, setLoading] = (0,
|
|
713
|
-
const [success, setSuccess] = (0,
|
|
714
|
-
const [isError, setIsError] = (0,
|
|
715
|
-
const [error, setError] = (0,
|
|
716
|
-
const [data, setData] = (0,
|
|
717
|
-
const
|
|
718
|
-
|
|
1430
|
+
const [loading, setLoading] = (0, import_react2.useState)(false);
|
|
1431
|
+
const [success, setSuccess] = (0, import_react2.useState)(false);
|
|
1432
|
+
const [isError, setIsError] = (0, import_react2.useState)(false);
|
|
1433
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
1434
|
+
const [data, setData] = (0, import_react2.useState)(null);
|
|
1435
|
+
const { showToast } = useToast();
|
|
1436
|
+
const handleLogout = (0, import_react2.useCallback)(async () => {
|
|
1437
|
+
var _a2, _b;
|
|
719
1438
|
setLoading(true);
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
1439
|
+
try {
|
|
1440
|
+
await axios_default.post(END_POINT.AUTH_LOGOUT);
|
|
1441
|
+
} catch (err) {
|
|
1442
|
+
const message = ((_b = (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.message) || "Logout failed. Please try again.";
|
|
1443
|
+
showToast(message, "error");
|
|
1444
|
+
} finally {
|
|
1445
|
+
sdkStateManager.clearStorageAndReset();
|
|
1446
|
+
(0, import_vault2.removeSession)(STORAGE_KEY);
|
|
1447
|
+
setSuccess(true);
|
|
1448
|
+
setLoading(false);
|
|
1449
|
+
}
|
|
727
1450
|
}, []);
|
|
728
1451
|
return {
|
|
729
1452
|
logout: handleLogout,
|
|
@@ -736,199 +1459,22 @@ var useLogout = () => {
|
|
|
736
1459
|
};
|
|
737
1460
|
|
|
738
1461
|
// call-control-sdk/lib/hooks/useEndCall.ts
|
|
739
|
-
var
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
var _a2, _b, _c;
|
|
744
|
-
return ((_c = (_b = (_a2 = sdkStateManager) == null ? void 0 : _a2.getState()) == null ? void 0 : _b.urlConfig) == null ? void 0 : _c.baseURL) || "";
|
|
745
|
-
};
|
|
746
|
-
var getCoreURL = () => {
|
|
747
|
-
var _a2, _b, _c;
|
|
748
|
-
return ((_c = (_b = (_a2 = sdkStateManager) == null ? void 0 : _a2.getState()) == null ? void 0 : _b.urlConfig) == null ? void 0 : _c.coreBaseURL) || "";
|
|
749
|
-
};
|
|
750
|
-
var BASE_URL = getBaseURL();
|
|
751
|
-
var CORE_URL = getCoreURL();
|
|
752
|
-
var VERSION = {
|
|
753
|
-
v1: "/api/v1"
|
|
754
|
-
};
|
|
755
|
-
var END_POINT = {
|
|
756
|
-
get LOGIN() {
|
|
757
|
-
return `${getBaseURL()}${VERSION.v1}/cti/login?provider=convox`;
|
|
758
|
-
},
|
|
759
|
-
get READY_AGENT() {
|
|
760
|
-
return `${getCoreURL()}${VERSION.v1}/agents/ready`;
|
|
761
|
-
},
|
|
762
|
-
get UPDATE_AGENT_BREAK() {
|
|
763
|
-
return `${getCoreURL()}${VERSION.v1}/agents/status`;
|
|
764
|
-
},
|
|
765
|
-
get CLICK_TO_CALL() {
|
|
766
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/dial`;
|
|
767
|
-
},
|
|
768
|
-
get HOLD_CALL() {
|
|
769
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/hold`;
|
|
770
|
-
},
|
|
771
|
-
get MUTE_CALL() {
|
|
772
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/mute`;
|
|
773
|
-
},
|
|
774
|
-
get UNMUTE_CALL() {
|
|
775
|
-
return `${getCoreURL()}${VERSION.v1}/cti/mute`;
|
|
776
|
-
},
|
|
777
|
-
get END_CALL() {
|
|
778
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/hangup`;
|
|
779
|
-
},
|
|
780
|
-
get LOGOUT() {
|
|
781
|
-
return `${getBaseURL()}${VERSION.v1}/cti/logout?provider=convox`;
|
|
782
|
-
},
|
|
783
|
-
get CONFERENCE_CALL() {
|
|
784
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/conference/add`;
|
|
785
|
-
},
|
|
786
|
-
get CONFERENCE_MERGE_CALL() {
|
|
787
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/conference/merge`;
|
|
788
|
-
},
|
|
789
|
-
get CONFERENCE_CALL_HOLD_OR_UN_HOLD() {
|
|
790
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/hold`;
|
|
791
|
-
},
|
|
792
|
-
get CONFERENCE_CALL_MUTE_OT_UN_MUTE() {
|
|
793
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/mute`;
|
|
794
|
-
},
|
|
795
|
-
get CONFERENCE_CALL_END() {
|
|
796
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/hangup`;
|
|
797
|
-
},
|
|
798
|
-
get CONFERENCE_CALL_END_ALL() {
|
|
799
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/hangup`;
|
|
800
|
-
},
|
|
801
|
-
get CONFERENCE_CALL_TRANSFER() {
|
|
802
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/conference/transfer`;
|
|
803
|
-
},
|
|
804
|
-
get TRANSFER_CALL() {
|
|
805
|
-
return `${getCoreURL()}${VERSION.v1}/cti/calls/transfer-call`;
|
|
806
|
-
},
|
|
807
|
-
get AGENTS_LIST() {
|
|
808
|
-
return `${getBaseURL()}${VERSION.v1}/cti/users`;
|
|
809
|
-
},
|
|
810
|
-
get PROCESS_LIST() {
|
|
811
|
-
return `${getBaseURL()}${VERSION.v1}/cti/processes-list`;
|
|
812
|
-
},
|
|
813
|
-
get BREAKS_LIST() {
|
|
814
|
-
return `${getBaseURL()}${VERSION.v1}/cti/breaks`;
|
|
815
|
-
},
|
|
816
|
-
get TRANSFER_TO_DETAILS() {
|
|
817
|
-
return `${getBaseURL()}${VERSION.v1}/cti/transfer-to-details?provider=convox`;
|
|
818
|
-
},
|
|
819
|
-
get SEND_NOTIFICATIONS() {
|
|
820
|
-
return `${getBaseURL()}${VERSION.v1}/cti/notifications/send`;
|
|
821
|
-
},
|
|
822
|
-
get CALL_HISTORY() {
|
|
823
|
-
return `${getBaseURL()}${VERSION.v1}/dashboard/call-history`;
|
|
824
|
-
},
|
|
825
|
-
get SENTIMENTAL_ANALYSIS() {
|
|
826
|
-
return `${getBaseURL()}${VERSION.v1}/users/get_sentiment_analysis`;
|
|
827
|
-
},
|
|
828
|
-
get DISPOSITIONS() {
|
|
829
|
-
return `${getBaseURL()}${VERSION.v1}/cti/calls/dispositions`;
|
|
830
|
-
},
|
|
831
|
-
SET_CALL_DISPOSITION: (callUuid) => `${getBaseURL()}${VERSION.v1}/calls/${callUuid}/disposition`,
|
|
832
|
-
get HOSPITALS_SERVICES() {
|
|
833
|
-
return `${getBaseURL()}${VERSION.v1}/cti/hospital/services`;
|
|
834
|
-
},
|
|
835
|
-
get BLIEND_TRANSFER() {
|
|
836
|
-
return `${getBaseURL()}${VERSION.v1}/cti/calls/blind_transfer?provider=convox`;
|
|
837
|
-
},
|
|
838
|
-
// Permissions
|
|
839
|
-
get USER_PERMISSIONS() {
|
|
840
|
-
return `${getBaseURL()}${VERSION.v1}/rbac/users/me/permissions`;
|
|
841
|
-
}
|
|
842
|
-
};
|
|
843
|
-
|
|
844
|
-
// call-control-sdk/lib/services/axios.ts
|
|
845
|
-
var import_axios = __toESM(require("axios"));
|
|
846
|
-
var _a;
|
|
847
|
-
var DEFAULT_TOKEN = (_a = sdkStateManager.getSdkAuthToken()) != null ? _a : "";
|
|
848
|
-
var REQUEST_TIMEOUT = 6e4;
|
|
849
|
-
function getAuthToken() {
|
|
850
|
-
var _a2;
|
|
851
|
-
return (_a2 = sdkStateManager.getSdkAuthToken()) != null ? _a2 : "";
|
|
852
|
-
}
|
|
853
|
-
function createAxiosInstance() {
|
|
854
|
-
var _a2, _b, _c, _d;
|
|
855
|
-
const instance = import_axios.default.create({
|
|
856
|
-
// baseURL: sdkStateManager.getState()?.urlConfig?.baseURL,
|
|
857
|
-
headers: {
|
|
858
|
-
"Content-Type": "application/json",
|
|
859
|
-
Accept: "application/json",
|
|
860
|
-
"x-tenant-id": (_b = (_a2 = sdkStateManager.getCredentials()) == null ? void 0 : _a2.tenantId) != null ? _b : "",
|
|
861
|
-
"x-api-key": (_d = (_c = sdkStateManager.getCredentials()) == null ? void 0 : _c.apiKey) != null ? _d : "",
|
|
862
|
-
Authorization: DEFAULT_TOKEN ? DEFAULT_TOKEN.startsWith("Bearer ") ? DEFAULT_TOKEN : `Bearer ${DEFAULT_TOKEN}` : ""
|
|
863
|
-
},
|
|
864
|
-
timeout: REQUEST_TIMEOUT,
|
|
865
|
-
withCredentials: false
|
|
866
|
-
});
|
|
867
|
-
instance.interceptors.request.use(
|
|
868
|
-
(config) => {
|
|
869
|
-
const token = getAuthToken();
|
|
870
|
-
if (token && config.headers) {
|
|
871
|
-
const authToken = token.startsWith("Bearer ") ? token : `Bearer ${token}`;
|
|
872
|
-
config.headers.Authorization = authToken;
|
|
873
|
-
}
|
|
874
|
-
console.log("API Request:", {
|
|
875
|
-
url: config.url,
|
|
876
|
-
method: config.method,
|
|
877
|
-
hasToken: !!token,
|
|
878
|
-
tokenStartsWithBearer: token == null ? void 0 : token.startsWith("Bearer "),
|
|
879
|
-
headers: {
|
|
880
|
-
Authorization: config.headers.Authorization,
|
|
881
|
-
"x-tenant-id": config.headers["x-tenant-id"],
|
|
882
|
-
"x-api-key": config.headers["x-api-key"]
|
|
883
|
-
}
|
|
884
|
-
});
|
|
885
|
-
config.metadata = { startTime: (/* @__PURE__ */ new Date()).getTime() };
|
|
886
|
-
return config;
|
|
887
|
-
},
|
|
888
|
-
(error) => {
|
|
889
|
-
console.error("Request interceptor error:", error);
|
|
890
|
-
return Promise.reject(error);
|
|
891
|
-
}
|
|
892
|
-
);
|
|
893
|
-
instance.interceptors.response.use(
|
|
894
|
-
(response) => {
|
|
895
|
-
return response;
|
|
896
|
-
},
|
|
897
|
-
async (error) => {
|
|
898
|
-
var _a3;
|
|
899
|
-
const originalRequest = error.config;
|
|
900
|
-
if (((_a3 = error.response) == null ? void 0 : _a3.status) === 401 && !originalRequest._retry) {
|
|
901
|
-
sdkStateManager.setInitCheck();
|
|
902
|
-
console.warn("Unauthorized request, attempting retry...");
|
|
903
|
-
}
|
|
904
|
-
if (!error.response) {
|
|
905
|
-
console.error("Network error:", error.message);
|
|
906
|
-
error.message = "Network error: Please check your internet connection";
|
|
907
|
-
}
|
|
908
|
-
if (error.response && error.response.status >= 500) {
|
|
909
|
-
console.error("Server error:", error.response.status, error.response.data);
|
|
910
|
-
error.message = "Server error: Please try again later";
|
|
911
|
-
}
|
|
912
|
-
return Promise.reject(error);
|
|
913
|
-
}
|
|
914
|
-
);
|
|
915
|
-
return instance;
|
|
916
|
-
}
|
|
917
|
-
var axiosInstance = createAxiosInstance();
|
|
918
|
-
var axios_default = axiosInstance;
|
|
919
|
-
|
|
920
|
-
// call-control-sdk/lib/hooks/useEndCall.ts
|
|
1462
|
+
var import_react3 = require("react");
|
|
1463
|
+
init_endPoint();
|
|
1464
|
+
init_sdk_state();
|
|
1465
|
+
init_axios();
|
|
921
1466
|
var import_vault3 = require("@react-solutions/vault");
|
|
1467
|
+
init_storage();
|
|
922
1468
|
var useEndCall = () => {
|
|
923
|
-
const [loading, setLoading] = (0,
|
|
924
|
-
const [success, setSuccess] = (0,
|
|
925
|
-
const [isError, setIsError] = (0,
|
|
926
|
-
const [error, setError] = (0,
|
|
927
|
-
const [data, setData] = (0,
|
|
928
|
-
const handleEndCall = (0,
|
|
1469
|
+
const [loading, setLoading] = (0, import_react3.useState)(false);
|
|
1470
|
+
const [success, setSuccess] = (0, import_react3.useState)(false);
|
|
1471
|
+
const [isError, setIsError] = (0, import_react3.useState)(false);
|
|
1472
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
1473
|
+
const [data, setData] = (0, import_react3.useState)(null);
|
|
1474
|
+
const handleEndCall = (0, import_react3.useCallback)(
|
|
929
1475
|
async (data2) => {
|
|
930
1476
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
931
|
-
const state = (0, import_vault3.
|
|
1477
|
+
const state = (0, import_vault3.getSession)(STORAGE_KEY);
|
|
932
1478
|
setLoading(true);
|
|
933
1479
|
const payload = {
|
|
934
1480
|
action: "ENDCALL",
|
|
@@ -977,17 +1523,21 @@ var useEndCall = () => {
|
|
|
977
1523
|
};
|
|
978
1524
|
|
|
979
1525
|
// call-control-sdk/lib/hooks/useClickToCall.ts
|
|
980
|
-
var
|
|
1526
|
+
var import_react4 = require("react");
|
|
1527
|
+
init_endPoint();
|
|
1528
|
+
init_axios();
|
|
1529
|
+
init_sdk_state();
|
|
981
1530
|
var import_vault4 = require("@react-solutions/vault");
|
|
1531
|
+
init_storage();
|
|
982
1532
|
var useClickToCall = () => {
|
|
983
|
-
const [loading, setLoading] = (0,
|
|
984
|
-
const [success, setSuccess] = (0,
|
|
985
|
-
const [isError, setIsError] = (0,
|
|
986
|
-
const [error, setError] = (0,
|
|
987
|
-
const [data, setData] = (0,
|
|
988
|
-
const handleStartCall = (0,
|
|
1533
|
+
const [loading, setLoading] = (0, import_react4.useState)(false);
|
|
1534
|
+
const [success, setSuccess] = (0, import_react4.useState)(false);
|
|
1535
|
+
const [isError, setIsError] = (0, import_react4.useState)(false);
|
|
1536
|
+
const [error, setError] = (0, import_react4.useState)(null);
|
|
1537
|
+
const [data, setData] = (0, import_react4.useState)(null);
|
|
1538
|
+
const handleStartCall = (0, import_react4.useCallback)(async (data2) => {
|
|
989
1539
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
990
|
-
const state = (0, import_vault4.
|
|
1540
|
+
const state = (0, import_vault4.getSession)(STORAGE_KEY);
|
|
991
1541
|
setLoading(true);
|
|
992
1542
|
if (((_a2 = state == null ? void 0 : state.callData) == null ? void 0 : _a2.status) === "IDLE") {
|
|
993
1543
|
const payload = {
|
|
@@ -1046,7 +1596,8 @@ var useClickToCall = () => {
|
|
|
1046
1596
|
};
|
|
1047
1597
|
|
|
1048
1598
|
// call-control-sdk/lib/hooks/useGetCallerData.ts
|
|
1049
|
-
var
|
|
1599
|
+
var import_react5 = require("react");
|
|
1600
|
+
init_sdk_state();
|
|
1050
1601
|
var useGetCallerData = () => {
|
|
1051
1602
|
const { process_id, process_name, status, phone_number, agent_id, convox_id } = sdkStateManager.getState().callData;
|
|
1052
1603
|
const initialCallData = {
|
|
@@ -1057,8 +1608,8 @@ var useGetCallerData = () => {
|
|
|
1057
1608
|
process_id,
|
|
1058
1609
|
process_name
|
|
1059
1610
|
};
|
|
1060
|
-
const [callData, setCallData] = (0,
|
|
1061
|
-
(0,
|
|
1611
|
+
const [callData, setCallData] = (0, import_react5.useState)(initialCallData);
|
|
1612
|
+
(0, import_react5.useEffect)(() => {
|
|
1062
1613
|
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
1063
1614
|
const { process_id: process_id2, process_name: process_name2, status: status2, phone_number: phone_number2, agent_id: agent_id2, convox_id: convox_id2 } = sdkStateManager.getState().callData;
|
|
1064
1615
|
const currentCallData = {
|
|
@@ -1077,10 +1628,11 @@ var useGetCallerData = () => {
|
|
|
1077
1628
|
};
|
|
1078
1629
|
|
|
1079
1630
|
// call-control-sdk/lib/hooks/useGetAuthorizationToken.ts
|
|
1080
|
-
var
|
|
1631
|
+
var import_react6 = require("react");
|
|
1632
|
+
init_sdk_state();
|
|
1081
1633
|
var useGetAuthorizationToken = () => {
|
|
1082
|
-
const [token, setToken] = (0,
|
|
1083
|
-
(0,
|
|
1634
|
+
const [token, setToken] = (0, import_react6.useState)(sdkStateManager.getSdkAuthToken());
|
|
1635
|
+
(0, import_react6.useEffect)(() => {
|
|
1084
1636
|
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
1085
1637
|
setToken(sdkStateManager.getSdkAuthToken());
|
|
1086
1638
|
});
|
|
@@ -1090,10 +1642,11 @@ var useGetAuthorizationToken = () => {
|
|
|
1090
1642
|
};
|
|
1091
1643
|
|
|
1092
1644
|
// call-control-sdk/lib/hooks/useSDKState.ts
|
|
1093
|
-
var
|
|
1645
|
+
var import_react7 = require("react");
|
|
1646
|
+
init_sdk_state();
|
|
1094
1647
|
function useSDKState() {
|
|
1095
|
-
const [state, setState] = (0,
|
|
1096
|
-
(0,
|
|
1648
|
+
const [state, setState] = (0, import_react7.useState)(sdkStateManager.getState());
|
|
1649
|
+
(0, import_react7.useEffect)(() => {
|
|
1097
1650
|
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
1098
1651
|
setState(sdkStateManager.getState());
|
|
1099
1652
|
});
|
|
@@ -1102,67 +1655,102 @@ function useSDKState() {
|
|
|
1102
1655
|
return state;
|
|
1103
1656
|
}
|
|
1104
1657
|
|
|
1658
|
+
// call-control-sdk/lib/hooks/useCallMonitoring.ts
|
|
1659
|
+
var import_react8 = require("react");
|
|
1660
|
+
init_endPoint();
|
|
1661
|
+
init_axios();
|
|
1662
|
+
var useCallMonitoring = () => {
|
|
1663
|
+
const [loading, setLoading] = (0, import_react8.useState)(false);
|
|
1664
|
+
const [success, setSuccess] = (0, import_react8.useState)(false);
|
|
1665
|
+
const [isError, setIsError] = (0, import_react8.useState)(false);
|
|
1666
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
1667
|
+
const [data, setData] = (0, import_react8.useState)(null);
|
|
1668
|
+
const resetState = () => {
|
|
1669
|
+
setSuccess(false);
|
|
1670
|
+
setIsError(false);
|
|
1671
|
+
setError(null);
|
|
1672
|
+
};
|
|
1673
|
+
const startMonitoring2 = (0, import_react8.useCallback)(async (payload) => {
|
|
1674
|
+
resetState();
|
|
1675
|
+
setLoading(true);
|
|
1676
|
+
return axios_default.post(END_POINT.SUPERVISOR_CALL_LISTEN, payload).then((res) => {
|
|
1677
|
+
setData(res == null ? void 0 : res.data);
|
|
1678
|
+
setSuccess(true);
|
|
1679
|
+
return res == null ? void 0 : res.data;
|
|
1680
|
+
}).catch((err) => {
|
|
1681
|
+
var _a2;
|
|
1682
|
+
setIsError(true);
|
|
1683
|
+
setError(err);
|
|
1684
|
+
return (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data;
|
|
1685
|
+
}).finally(() => {
|
|
1686
|
+
setLoading(false);
|
|
1687
|
+
});
|
|
1688
|
+
}, []);
|
|
1689
|
+
const stopMonitoring2 = (0, import_react8.useCallback)(async (payload) => {
|
|
1690
|
+
resetState();
|
|
1691
|
+
setLoading(true);
|
|
1692
|
+
return axios_default.post(END_POINT.SUPERVISOR_CALL_LEAVE, payload).then((res) => {
|
|
1693
|
+
setData(res == null ? void 0 : res.data);
|
|
1694
|
+
setSuccess(true);
|
|
1695
|
+
return res == null ? void 0 : res.data;
|
|
1696
|
+
}).catch((err) => {
|
|
1697
|
+
var _a2;
|
|
1698
|
+
setIsError(true);
|
|
1699
|
+
setError(err);
|
|
1700
|
+
return (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data;
|
|
1701
|
+
}).finally(() => {
|
|
1702
|
+
setLoading(false);
|
|
1703
|
+
});
|
|
1704
|
+
}, []);
|
|
1705
|
+
const changeMode = (0, import_react8.useCallback)(async (payload) => {
|
|
1706
|
+
resetState();
|
|
1707
|
+
setLoading(true);
|
|
1708
|
+
return axios_default.post(END_POINT.SUPERVISOR_CALL_CHANGE_MODE, payload).then((res) => {
|
|
1709
|
+
setData(res == null ? void 0 : res.data);
|
|
1710
|
+
setSuccess(true);
|
|
1711
|
+
return res == null ? void 0 : res.data;
|
|
1712
|
+
}).catch((err) => {
|
|
1713
|
+
var _a2;
|
|
1714
|
+
setIsError(true);
|
|
1715
|
+
setError(err);
|
|
1716
|
+
return (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data;
|
|
1717
|
+
}).finally(() => {
|
|
1718
|
+
setLoading(false);
|
|
1719
|
+
});
|
|
1720
|
+
}, []);
|
|
1721
|
+
return {
|
|
1722
|
+
startMonitoring: startMonitoring2,
|
|
1723
|
+
stopMonitoring: stopMonitoring2,
|
|
1724
|
+
changeMode,
|
|
1725
|
+
isLoading: loading,
|
|
1726
|
+
isSuccess: success,
|
|
1727
|
+
isError,
|
|
1728
|
+
error,
|
|
1729
|
+
data
|
|
1730
|
+
};
|
|
1731
|
+
};
|
|
1732
|
+
|
|
1733
|
+
// call-control-sdk/index.ts
|
|
1734
|
+
init_permissions();
|
|
1735
|
+
|
|
1105
1736
|
// call-control-sdk/lib/components/callControlPanel.tsx
|
|
1106
|
-
var
|
|
1737
|
+
var import_react14 = require("react");
|
|
1107
1738
|
|
|
1108
1739
|
// call-control-sdk/lib/components/callControls.tsx
|
|
1109
1740
|
var import_icons_material2 = require("@mui/icons-material");
|
|
1110
1741
|
var import_material4 = require("@mui/material");
|
|
1111
|
-
var
|
|
1742
|
+
var import_react12 = require("react");
|
|
1112
1743
|
|
|
1113
1744
|
// call-control-sdk/lib/components/dialog.tsx
|
|
1114
1745
|
var import_icons_material = require("@mui/icons-material");
|
|
1115
1746
|
var import_material3 = require("@mui/material");
|
|
1116
|
-
var
|
|
1117
|
-
|
|
1118
|
-
// call-control-sdk/lib/services/request.ts
|
|
1119
|
-
var import_react8 = require("react");
|
|
1120
|
-
|
|
1121
|
-
// call-control-sdk/lib/services/toastMessage.tsx
|
|
1122
|
-
var import_react7 = require("react");
|
|
1123
|
-
var import_material = require("@mui/material");
|
|
1124
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1125
|
-
var ToastContext = (0, import_react7.createContext)(void 0);
|
|
1126
|
-
var useToast = () => {
|
|
1127
|
-
const ctx = (0, import_react7.useContext)(ToastContext);
|
|
1128
|
-
if (!ctx) throw new Error("useToast must be used inside ToastProvider");
|
|
1129
|
-
return ctx;
|
|
1130
|
-
};
|
|
1131
|
-
var ToastProvider = ({ children }) => {
|
|
1132
|
-
const [open, setOpen] = (0, import_react7.useState)(false);
|
|
1133
|
-
const [message, setMessage] = (0, import_react7.useState)("");
|
|
1134
|
-
const [severity, setSeverity] = (0, import_react7.useState)("info");
|
|
1135
|
-
const showToast = (msg, sev = "info") => {
|
|
1136
|
-
setMessage(msg);
|
|
1137
|
-
setSeverity(sev);
|
|
1138
|
-
setOpen(true);
|
|
1139
|
-
};
|
|
1140
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ToastContext.Provider, { value: { showToast }, children: [
|
|
1141
|
-
children,
|
|
1142
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1143
|
-
import_material.Snackbar,
|
|
1144
|
-
{
|
|
1145
|
-
open,
|
|
1146
|
-
color: severity,
|
|
1147
|
-
autoHideDuration: 3e3,
|
|
1148
|
-
onClose: () => setOpen(false),
|
|
1149
|
-
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
1150
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1151
|
-
import_material.Alert,
|
|
1152
|
-
{
|
|
1153
|
-
variant: "filled",
|
|
1154
|
-
severity,
|
|
1155
|
-
onClose: () => setOpen(false),
|
|
1156
|
-
sx: { width: "100%" },
|
|
1157
|
-
children: message
|
|
1158
|
-
}
|
|
1159
|
-
)
|
|
1160
|
-
}
|
|
1161
|
-
)
|
|
1162
|
-
] });
|
|
1163
|
-
};
|
|
1747
|
+
var import_react10 = require("react");
|
|
1748
|
+
init_sdk_state();
|
|
1164
1749
|
|
|
1165
1750
|
// call-control-sdk/lib/services/request.ts
|
|
1751
|
+
var import_react9 = require("react");
|
|
1752
|
+
init_axios();
|
|
1753
|
+
init_toastMessage();
|
|
1166
1754
|
var initialState = {
|
|
1167
1755
|
isLoading: false,
|
|
1168
1756
|
isSuccess: false,
|
|
@@ -1199,8 +1787,8 @@ var reducer = (state, action) => {
|
|
|
1199
1787
|
var useGetRequest = (props = {}) => {
|
|
1200
1788
|
const { onSuccess = null, onError = null } = props;
|
|
1201
1789
|
const { showToast } = useToast();
|
|
1202
|
-
const [state, dispatch] = (0,
|
|
1203
|
-
const getRequest = (0,
|
|
1790
|
+
const [state, dispatch] = (0, import_react9.useReducer)(reducer, initialState);
|
|
1791
|
+
const getRequest = (0, import_react9.useCallback)(
|
|
1204
1792
|
(url, config = {}) => {
|
|
1205
1793
|
dispatch({
|
|
1206
1794
|
type: "isLoading",
|
|
@@ -1252,8 +1840,8 @@ var useGetRequest = (props = {}) => {
|
|
|
1252
1840
|
var usePostRequest = (props = {}) => {
|
|
1253
1841
|
const { onSuccess = null, onError = null, disabledSuccessToast = false } = props;
|
|
1254
1842
|
const { showToast } = useToast();
|
|
1255
|
-
const [state, dispatch] = (0,
|
|
1256
|
-
const postRequest = (0,
|
|
1843
|
+
const [state, dispatch] = (0, import_react9.useReducer)(reducer, initialState);
|
|
1844
|
+
const postRequest = (0, import_react9.useCallback)(
|
|
1257
1845
|
async (url, payload, config = {}) => {
|
|
1258
1846
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1259
1847
|
dispatch({
|
|
@@ -1299,6 +1887,11 @@ var usePostRequest = (props = {}) => {
|
|
|
1299
1887
|
return [postRequest, state];
|
|
1300
1888
|
};
|
|
1301
1889
|
|
|
1890
|
+
// call-control-sdk/lib/components/dialog.tsx
|
|
1891
|
+
init_endPoint();
|
|
1892
|
+
init_axios();
|
|
1893
|
+
init_toastMessage();
|
|
1894
|
+
|
|
1302
1895
|
// call-control-sdk/lib/components/styles.ts
|
|
1303
1896
|
var import_material2 = require("@mui/material");
|
|
1304
1897
|
var useStyles = ({
|
|
@@ -1375,10 +1968,10 @@ var ConferenceTableRow = ({ each, isLineDialing }) => {
|
|
|
1375
1968
|
enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
|
|
1376
1969
|
outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
|
|
1377
1970
|
});
|
|
1378
|
-
const [conferenceCallStart, setConferenceCallStart] = (0,
|
|
1379
|
-
const [conferenceCallMerge, setConferenceCallMerge] = (0,
|
|
1380
|
-
const [conferenceCallHoldOrUnHold, setConferenceCallHoldOrUnHold] = (0,
|
|
1381
|
-
const [conferenceCallEnd, setConferenceCallEnd] = (0,
|
|
1971
|
+
const [conferenceCallStart, setConferenceCallStart] = (0, import_react10.useState)(false);
|
|
1972
|
+
const [conferenceCallMerge, setConferenceCallMerge] = (0, import_react10.useState)(false);
|
|
1973
|
+
const [conferenceCallHoldOrUnHold, setConferenceCallHoldOrUnHold] = (0, import_react10.useState)(false);
|
|
1974
|
+
const [conferenceCallEnd, setConferenceCallEnd] = (0, import_react10.useState)(false);
|
|
1382
1975
|
const isSameAsActiveCall = (each == null ? void 0 : each.phone) === ((_d = state.callData) == null ? void 0 : _d.phone_number) && !!(each == null ? void 0 : each.phone);
|
|
1383
1976
|
const isDuplicateInConference = !!(each == null ? void 0 : each.phone) && (each == null ? void 0 : each.line) !== 1 && ((_e = state.conferenceLine) == null ? void 0 : _e.some(
|
|
1384
1977
|
(line) => line.line < each.line && line.phone === (each == null ? void 0 : each.phone) && !!line.phone
|
|
@@ -1793,7 +2386,7 @@ function ConferenceDialog() {
|
|
|
1793
2386
|
var _a2, _b, _c, _d, _e, _f, _g;
|
|
1794
2387
|
const state = useSDKState();
|
|
1795
2388
|
const { showToast } = useToast();
|
|
1796
|
-
const [conferenceCallEndAll, setConferenceCallEndAll] = (0,
|
|
2389
|
+
const [conferenceCallEndAll, setConferenceCallEndAll] = (0, import_react10.useState)(false);
|
|
1797
2390
|
const handleClose = () => {
|
|
1798
2391
|
sdkStateManager.setOpenConferenceDialog(false);
|
|
1799
2392
|
};
|
|
@@ -1858,6 +2451,7 @@ function ConferenceDialog() {
|
|
|
1858
2451
|
"aria-labelledby": "alert-dialog-title",
|
|
1859
2452
|
"aria-describedby": "alert-dialog-description",
|
|
1860
2453
|
maxWidth: "md",
|
|
2454
|
+
slotProps: { paper: { sx: { minWidth: 800 } } },
|
|
1861
2455
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
|
|
1862
2456
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1863
2457
|
import_material3.Box,
|
|
@@ -1973,15 +2567,33 @@ function ConferenceDialog() {
|
|
|
1973
2567
|
) });
|
|
1974
2568
|
}
|
|
1975
2569
|
function CallTransferDialog({ open }) {
|
|
1976
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2570
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
1977
2571
|
const state = useSDKState();
|
|
1978
|
-
const [mobileNumber, setMobileNumber] = (0,
|
|
2572
|
+
const [mobileNumber, setMobileNumber] = (0, import_react10.useState)("");
|
|
1979
2573
|
const [transferCall, { isLoading: isTransferLoading }] = usePostRequest({
|
|
1980
2574
|
onSuccess: () => {
|
|
1981
2575
|
sdkStateManager.setOpenCallTransferDialog(false);
|
|
1982
2576
|
}
|
|
1983
2577
|
});
|
|
1984
|
-
const [
|
|
2578
|
+
const [initiateConsultCall] = usePostRequest({});
|
|
2579
|
+
const [completeConsultTransfer, { isLoading: isCompleteConsultLoading }] = usePostRequest({
|
|
2580
|
+
onSuccess: () => {
|
|
2581
|
+
sdkStateManager.setConsultInfo(null);
|
|
2582
|
+
sdkStateManager.setOpenCallTransferDialog(false);
|
|
2583
|
+
}
|
|
2584
|
+
});
|
|
2585
|
+
const [cancelConsultTransfer, { isLoading: isCancelConsultLoading }] = usePostRequest({
|
|
2586
|
+
onSuccess: () => {
|
|
2587
|
+
sdkStateManager.setConsultInfo(null);
|
|
2588
|
+
}
|
|
2589
|
+
});
|
|
2590
|
+
const [currentselecteTab, setCurrentselecteTab] = (0, import_react10.useState)("queues");
|
|
2591
|
+
const [transferMenuAnchor, setTransferMenuAnchor] = (0, import_react10.useState)(null);
|
|
2592
|
+
const [pendingTransferData, setPendingTransferData] = (0, import_react10.useState)(null);
|
|
2593
|
+
const blindEnabled = !((_a2 = state.sdkConfig) == null ? void 0 : _a2.disableBlindTransfer);
|
|
2594
|
+
const attendedEnabled = !((_b = state.sdkConfig) == null ? void 0 : _b.disableAttendedTransfer);
|
|
2595
|
+
const enabledTransferModeCount = (blindEnabled ? 1 : 0) + (attendedEnabled ? 1 : 0);
|
|
2596
|
+
const singleTransferMode = enabledTransferModeCount === 1 ? blindEnabled ? "DEFAULT" : "CONSULT" : null;
|
|
1985
2597
|
const [getIdelAgentsList, { data: idleAgentsList, isLoading: isIdleAgentsListLoading }] = usePostRequest({ disabledSuccessToast: true });
|
|
1986
2598
|
const [
|
|
1987
2599
|
getHospitalsServicesList,
|
|
@@ -1994,8 +2606,8 @@ function CallTransferDialog({ open }) {
|
|
|
1994
2606
|
const handleClose = () => {
|
|
1995
2607
|
sdkStateManager.setOpenCallTransferDialog(false);
|
|
1996
2608
|
};
|
|
1997
|
-
const handleTransferCall = (data, type) => {
|
|
1998
|
-
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2,
|
|
2609
|
+
const handleTransferCall = (data, type, mode = "DEFAULT") => {
|
|
2610
|
+
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2, _x2, _y2, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N;
|
|
1999
2611
|
if (type === "PROCESS") {
|
|
2000
2612
|
const payload = {
|
|
2001
2613
|
mobile_number: (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.phone_number) != null ? _b2 : "",
|
|
@@ -2020,207 +2632,189 @@ function CallTransferDialog({ open }) {
|
|
|
2020
2632
|
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
2021
2633
|
} else if (type === "AGENT") {
|
|
2022
2634
|
const payload = {
|
|
2023
|
-
mobile_number: (
|
|
2024
|
-
userid: (_z = (
|
|
2635
|
+
mobile_number: (_x2 = (_w2 = state.callData) == null ? void 0 : _w2.phone_number) != null ? _x2 : "",
|
|
2636
|
+
userid: (_z = (_y2 = state.callData) == null ? void 0 : _y2.agent_id) != null ? _z : "",
|
|
2025
2637
|
type: "AGENT",
|
|
2638
|
+
transfer_type: mode === "CONSULT" ? "ATTENDED" : "BLIND",
|
|
2026
2639
|
transfer_to: (_B = (_A = data == null ? void 0 : data.id) == null ? void 0 : _A.toString()) != null ? _B : "",
|
|
2027
2640
|
callreferenceid: (_D = (_C = state.callData) == null ? void 0 : _C.convox_id) != null ? _D : "",
|
|
2028
2641
|
processid: String((_F = (_E = state.callData) == null ? void 0 : _E.process_id) != null ? _F : ""),
|
|
2029
2642
|
process_name: (_H = (_G = state.callData) == null ? void 0 : _G.process_name) != null ? _H : ""
|
|
2030
2643
|
};
|
|
2031
|
-
|
|
2644
|
+
if (mode === "CONSULT") {
|
|
2645
|
+
initiateConsultCall(END_POINT.TRANSFER_CALL, payload);
|
|
2646
|
+
} else {
|
|
2647
|
+
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
2648
|
+
}
|
|
2032
2649
|
} else if (type === "OTHER") {
|
|
2033
2650
|
const payload = {
|
|
2034
|
-
action: "BLIND_TRANSFER",
|
|
2651
|
+
action: mode === "CONSULT" ? "ATTENDED" : "BLIND_TRANSFER",
|
|
2652
|
+
transfer_type: mode === "CONSULT" ? "ATTENDED" : "BLIND",
|
|
2035
2653
|
type: "OTHER",
|
|
2036
2654
|
transfer_to: (_I = data == null ? void 0 : data.mobile_number) != null ? _I : "",
|
|
2037
2655
|
userid: (_K = (_J = state.callData) == null ? void 0 : _J.agent_id) != null ? _K : -1,
|
|
2038
2656
|
callreferenceid: (_M = (_L = state.callData) == null ? void 0 : _L.convox_id) != null ? _M : "",
|
|
2039
2657
|
blind_transfer_no: (_N = data == null ? void 0 : data.mobile_number) != null ? _N : ""
|
|
2040
2658
|
};
|
|
2041
|
-
|
|
2659
|
+
if (mode === "CONSULT") {
|
|
2660
|
+
initiateConsultCall(END_POINT.TRANSFER_CALL, payload);
|
|
2661
|
+
} else {
|
|
2662
|
+
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
};
|
|
2666
|
+
const handleTransferClick = (e, data, type) => {
|
|
2667
|
+
if (singleTransferMode) {
|
|
2668
|
+
handleTransferCall(data, type, singleTransferMode);
|
|
2669
|
+
} else {
|
|
2670
|
+
setPendingTransferData({ data, type });
|
|
2671
|
+
setTransferMenuAnchor(e.currentTarget);
|
|
2042
2672
|
}
|
|
2043
2673
|
};
|
|
2044
|
-
(0,
|
|
2674
|
+
(0, import_react10.useEffect)(() => {
|
|
2045
2675
|
getIdelAgentsList(END_POINT.AGENTS_LIST, { status: "IDLE", active: true });
|
|
2046
2676
|
getProcessAndQueuesList(END_POINT.TRANSFER_TO_DETAILS, { status: "ACTIVE", active: true });
|
|
2047
2677
|
getHospitalsServicesList(END_POINT.HOSPITALS_SERVICES);
|
|
2048
2678
|
}, []);
|
|
2049
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2059
|
-
|
|
2060
|
-
{
|
|
2061
|
-
sx: {
|
|
2062
|
-
display: "flex",
|
|
2063
|
-
justifyContent: "space-between",
|
|
2064
|
-
alignItems: "center",
|
|
2065
|
-
padding: "4px 16px",
|
|
2066
|
-
boxShadow: "0px 1px 2px #f5f5f5ff"
|
|
2067
|
-
},
|
|
2068
|
-
children: [
|
|
2069
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Typography, { variant: "body1", children: " Call Transfer" }),
|
|
2070
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) })
|
|
2071
|
-
]
|
|
2072
|
-
}
|
|
2073
|
-
),
|
|
2074
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { margin: "10px", borderRadius: "10px" }, children: [
|
|
2075
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { display: "flex", gap: 1, margin: "10px" }, children: [
|
|
2076
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2077
|
-
import_material3.Button,
|
|
2078
|
-
{
|
|
2079
|
-
variant: currentselecteTab === "queues" ? "contained" : "outlined",
|
|
2080
|
-
onClick: () => setCurrentselecteTab("queues"),
|
|
2081
|
-
children: "Queues"
|
|
2082
|
-
}
|
|
2083
|
-
),
|
|
2084
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2085
|
-
import_material3.Button,
|
|
2086
|
-
{
|
|
2087
|
-
variant: currentselecteTab === "agents" ? "contained" : "outlined",
|
|
2088
|
-
onClick: () => {
|
|
2089
|
-
setCurrentselecteTab("agents");
|
|
2090
|
-
getIdelAgentsList(END_POINT.AGENTS_LIST, { status: "IDLE", active: true });
|
|
2091
|
-
},
|
|
2092
|
-
children: "Agents"
|
|
2093
|
-
}
|
|
2094
|
-
),
|
|
2095
|
-
!((_a2 = state.sdkConfig) == null ? void 0 : _a2.disableBlindTransfer) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2096
|
-
import_material3.Button,
|
|
2097
|
-
{
|
|
2098
|
-
variant: currentselecteTab === "others" ? "contained" : "outlined",
|
|
2099
|
-
onClick: () => setCurrentselecteTab("others"),
|
|
2100
|
-
children: "Others"
|
|
2101
|
-
}
|
|
2102
|
-
)
|
|
2103
|
-
] }),
|
|
2104
|
-
(isProcessAndQueuesListLoading || isIdleAgentsListLoading || isHospitalsServicesListLoading || isTransferLoading) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2105
|
-
import_material3.Box,
|
|
2106
|
-
{
|
|
2107
|
-
sx: {
|
|
2108
|
-
display: "flex",
|
|
2109
|
-
justifyContent: "center",
|
|
2110
|
-
alignItems: "center",
|
|
2111
|
-
height: "80px"
|
|
2112
|
-
},
|
|
2113
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.CircularProgress, {})
|
|
2114
|
-
}
|
|
2115
|
-
),
|
|
2116
|
-
!isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && !isTransferLoading && currentselecteTab === "process" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
2680
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2681
|
+
import_material3.Dialog,
|
|
2682
|
+
{
|
|
2683
|
+
open,
|
|
2684
|
+
"aria-labelledby": "alert-dialog-title",
|
|
2685
|
+
"aria-describedby": "alert-dialog-description",
|
|
2686
|
+
maxWidth: "md",
|
|
2687
|
+
slotProps: { paper: { sx: { minWidth: 600 } } },
|
|
2688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
|
|
2689
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2117
2690
|
import_material3.Box,
|
|
2118
2691
|
{
|
|
2119
|
-
sx: {
|
|
2120
|
-
display: "
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2692
|
+
sx: {
|
|
2693
|
+
display: "flex",
|
|
2694
|
+
alignItems: "center",
|
|
2695
|
+
padding: "4px 16px",
|
|
2696
|
+
boxShadow: "0px 1px 2px #f5f5f5ff",
|
|
2697
|
+
position: "relative"
|
|
2698
|
+
},
|
|
2699
|
+
children: [
|
|
2700
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Typography, { variant: "body1", sx: { flex: 1 }, children: " Call Transfer" }),
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { position: "absolute", left: "50%", transform: "translateX(-50%)" }, children: [
|
|
2702
|
+
state.consultInfo && ((_c = state.consultInfo.status) == null ? void 0 : _c.toUpperCase()) === "RINGING" /* RINGING */ && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Typography, { variant: "body1", sx: { whiteSpace: "nowrap" }, children: "Trying to consult" }),
|
|
2704
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { component: "span", sx: { display: "inline-flex", gap: "3px", alignItems: "flex-end", height: "14px" }, children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { component: "span", sx: {
|
|
2705
|
+
"@keyframes jumpDot": {
|
|
2706
|
+
"0%, 60%, 100%": { transform: "translateY(0)" },
|
|
2707
|
+
"30%": { transform: "translateY(-5px)" }
|
|
2708
|
+
},
|
|
2709
|
+
animation: "jumpDot 1s ease-in-out infinite",
|
|
2710
|
+
animationDelay: `${i * 0.15}s`,
|
|
2711
|
+
fontSize: "14px",
|
|
2712
|
+
fontWeight: 700,
|
|
2713
|
+
lineHeight: 1,
|
|
2714
|
+
display: "inline-block"
|
|
2715
|
+
}, children: "." }, i)) })
|
|
2716
|
+
] }),
|
|
2717
|
+
state.consultInfo && ((_d = state.consultInfo.status) == null ? void 0 : _d.toUpperCase()) === "ONCALL" /* ONCALL */ && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
2718
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2719
|
+
import_material3.Button,
|
|
2143
2720
|
{
|
|
2144
|
-
variant: "
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2721
|
+
variant: "outlined",
|
|
2722
|
+
size: "small",
|
|
2723
|
+
startIcon: isCompleteConsultLoading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.CircularProgress, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.TransferWithinAStation, { sx: { fontSize: 16 } }),
|
|
2724
|
+
disabled: isCompleteConsultLoading || isCancelConsultLoading,
|
|
2725
|
+
onClick: () => {
|
|
2726
|
+
if (state.consultInfo) {
|
|
2727
|
+
completeConsultTransfer(END_POINT.TRANSFER_COMPLETE, {}, {
|
|
2728
|
+
params: { call_uuid: state.consultInfo.call_uuid }
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2151
2731
|
},
|
|
2152
|
-
children:
|
|
2153
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MemoryOutlined, { sx: { marginRight: "4px" } }),
|
|
2154
|
-
process.process_name
|
|
2155
|
-
]
|
|
2732
|
+
children: "Transfer"
|
|
2156
2733
|
}
|
|
2157
2734
|
),
|
|
2158
2735
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2159
|
-
import_material3.
|
|
2736
|
+
import_material3.Button,
|
|
2160
2737
|
{
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2738
|
+
variant: "outlined",
|
|
2739
|
+
size: "small",
|
|
2740
|
+
color: "error",
|
|
2741
|
+
startIcon: isCancelConsultLoading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.CircularProgress, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.PhoneDisabled, { sx: { fontSize: 16 } }),
|
|
2742
|
+
disabled: isCancelConsultLoading || isCompleteConsultLoading,
|
|
2743
|
+
onClick: () => {
|
|
2744
|
+
if (state.consultInfo) {
|
|
2745
|
+
cancelConsultTransfer(END_POINT.TRANSFER_CANCEL, {
|
|
2746
|
+
status: state.consultInfo.status,
|
|
2747
|
+
participant_identifier: state.consultInfo.participant_identifier,
|
|
2748
|
+
channel_id: state.consultInfo.channel_id,
|
|
2749
|
+
call_uuid: state.consultInfo.call_uuid,
|
|
2750
|
+
bridge_id: state.consultInfo.bridge_id
|
|
2751
|
+
});
|
|
2752
|
+
}
|
|
2165
2753
|
},
|
|
2166
|
-
|
|
2167
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
|
|
2754
|
+
children: "Cancel"
|
|
2168
2755
|
}
|
|
2169
2756
|
)
|
|
2170
|
-
]
|
|
2171
|
-
},
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2757
|
+
] })
|
|
2758
|
+
] }),
|
|
2759
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1, display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.IconButton, { onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Close, {}) }) })
|
|
2760
|
+
]
|
|
2761
|
+
}
|
|
2762
|
+
),
|
|
2763
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { margin: "10px", borderRadius: "10px" }, children: [
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { display: "flex", gap: 1, margin: "10px" }, children: [
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2766
|
+
import_material3.Button,
|
|
2175
2767
|
{
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2768
|
+
variant: currentselecteTab === "queues" ? "contained" : "outlined",
|
|
2769
|
+
onClick: () => setCurrentselecteTab("queues"),
|
|
2770
|
+
children: "Queues"
|
|
2771
|
+
}
|
|
2772
|
+
),
|
|
2773
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2774
|
+
import_material3.Button,
|
|
2775
|
+
{
|
|
2776
|
+
variant: currentselecteTab === "agents" ? "contained" : "outlined",
|
|
2777
|
+
onClick: () => {
|
|
2778
|
+
setCurrentselecteTab("agents");
|
|
2779
|
+
getIdelAgentsList(END_POINT.AGENTS_LIST, { status: "IDLE", active: true });
|
|
2181
2780
|
},
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
letterSpacing: "0.02em",
|
|
2192
|
-
textTransform: "capitalize",
|
|
2193
|
-
display: "flex",
|
|
2194
|
-
alignItems: "center",
|
|
2195
|
-
justifyContent: "center",
|
|
2196
|
-
width: "100%",
|
|
2197
|
-
margin: "10px 0px",
|
|
2198
|
-
color: "primary.main",
|
|
2199
|
-
height: "20px"
|
|
2200
|
-
},
|
|
2201
|
-
children: "No Process Found"
|
|
2202
|
-
}
|
|
2203
|
-
)
|
|
2204
|
-
]
|
|
2781
|
+
children: "Agents"
|
|
2782
|
+
}
|
|
2783
|
+
),
|
|
2784
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2785
|
+
import_material3.Button,
|
|
2786
|
+
{
|
|
2787
|
+
variant: currentselecteTab === "others" ? "contained" : "outlined",
|
|
2788
|
+
onClick: () => setCurrentselecteTab("others"),
|
|
2789
|
+
children: "Others"
|
|
2205
2790
|
}
|
|
2206
2791
|
)
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2792
|
+
] }),
|
|
2793
|
+
(isProcessAndQueuesListLoading || isIdleAgentsListLoading || isHospitalsServicesListLoading || isTransferLoading) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2794
|
+
import_material3.Box,
|
|
2795
|
+
{
|
|
2796
|
+
sx: {
|
|
2797
|
+
display: "flex",
|
|
2798
|
+
justifyContent: "center",
|
|
2799
|
+
alignItems: "center",
|
|
2800
|
+
height: "80px"
|
|
2801
|
+
},
|
|
2802
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.CircularProgress, {})
|
|
2803
|
+
}
|
|
2804
|
+
),
|
|
2805
|
+
!isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && !isTransferLoading && currentselecteTab === "process" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2806
|
+
import_material3.Box,
|
|
2807
|
+
{
|
|
2808
|
+
sx: {
|
|
2809
|
+
display: "grid",
|
|
2810
|
+
gridTemplateColumns: ((_e = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _e.process) && ((_g = (_f = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _f.process) == null ? void 0 : _g.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)",
|
|
2811
|
+
gap: 1,
|
|
2812
|
+
padding: "10px",
|
|
2813
|
+
flexWrap: "wrap",
|
|
2814
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
2815
|
+
borderRadius: "10px"
|
|
2816
|
+
},
|
|
2817
|
+
children: ((_h = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _h.process) && ((_j = (_i = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _i.process) == null ? void 0 : _j.length) > 0 ? (_l = (_k = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _k.process) == null ? void 0 : _l.map((process, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2224
2818
|
import_material3.Box,
|
|
2225
2819
|
{
|
|
2226
2820
|
sx: {
|
|
@@ -2245,30 +2839,12 @@ function CallTransferDialog({ open }) {
|
|
|
2245
2839
|
alignItems: "center"
|
|
2246
2840
|
},
|
|
2247
2841
|
children: [
|
|
2248
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.
|
|
2249
|
-
|
|
2250
|
-
((_c2 = (_b2 = (_a3 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a3.process) == null ? void 0 : _b2.find(
|
|
2251
|
-
(process) => process.process_id === queue.process_id
|
|
2252
|
-
)) == null ? void 0 : _c2.process_name) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2253
|
-
import_material3.Typography,
|
|
2254
|
-
{
|
|
2255
|
-
variant: "body1",
|
|
2256
|
-
sx: {
|
|
2257
|
-
fontSize: "12px",
|
|
2258
|
-
fontWeight: "600",
|
|
2259
|
-
letterSpacing: "0.02em",
|
|
2260
|
-
textTransform: "capitalize",
|
|
2261
|
-
color: "gray"
|
|
2262
|
-
},
|
|
2263
|
-
children: "(" + ((_f2 = (_e2 = (_d2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d2.process) == null ? void 0 : _e2.find(
|
|
2264
|
-
(process) => process.process_id === queue.process_id
|
|
2265
|
-
)) == null ? void 0 : _f2.process_name) + ")"
|
|
2266
|
-
}
|
|
2267
|
-
) : ""
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MemoryOutlined, { sx: { marginRight: "4px" } }),
|
|
2843
|
+
process.process_name
|
|
2268
2844
|
]
|
|
2269
2845
|
}
|
|
2270
2846
|
),
|
|
2271
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: state.consultInfo ? "Please complete or cancel the ongoing consult transfer before proceeding." : "", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2272
2848
|
import_material3.IconButton,
|
|
2273
2849
|
{
|
|
2274
2850
|
color: "success",
|
|
@@ -2276,160 +2852,64 @@ function CallTransferDialog({ open }) {
|
|
|
2276
2852
|
bgcolor: "action.hover",
|
|
2277
2853
|
"&:hover": { bgcolor: "action.selected" }
|
|
2278
2854
|
},
|
|
2279
|
-
|
|
2855
|
+
disabled: !!state.consultInfo,
|
|
2856
|
+
onClick: () => handleTransferCall(process, "PROCESS"),
|
|
2280
2857
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
|
|
2281
2858
|
}
|
|
2282
|
-
)
|
|
2859
|
+
) }) })
|
|
2283
2860
|
]
|
|
2284
2861
|
},
|
|
2285
2862
|
index
|
|
2286
|
-
)
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
borderRadius: "10px"
|
|
2334
|
-
},
|
|
2335
|
-
children: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_s = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _s.length) > 0 ? (_t = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _t.map((agent, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2336
|
-
import_material3.Box,
|
|
2337
|
-
{
|
|
2338
|
-
sx: {
|
|
2339
|
-
p: 1,
|
|
2340
|
-
display: "flex",
|
|
2341
|
-
alignItems: "center",
|
|
2342
|
-
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
2343
|
-
padding: "6px",
|
|
2344
|
-
borderRadius: "10px",
|
|
2345
|
-
"&:hover": { bgcolor: "action.selected" }
|
|
2346
|
-
},
|
|
2347
|
-
children: [
|
|
2348
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2349
|
-
import_material3.Typography,
|
|
2350
|
-
{
|
|
2351
|
-
variant: "body1",
|
|
2352
|
-
sx: {
|
|
2353
|
-
mx: 1,
|
|
2354
|
-
width: "200px",
|
|
2355
|
-
maxWidth: "250px",
|
|
2356
|
-
display: "flex",
|
|
2357
|
-
alignItems: "center"
|
|
2358
|
-
},
|
|
2359
|
-
children: [
|
|
2360
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
|
|
2361
|
-
agent.name
|
|
2362
|
-
]
|
|
2363
|
-
}
|
|
2364
|
-
),
|
|
2365
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2366
|
-
import_material3.IconButton,
|
|
2367
|
-
{
|
|
2368
|
-
color: "success",
|
|
2369
|
-
sx: {
|
|
2370
|
-
bgcolor: "action.hover",
|
|
2371
|
-
"&:hover": { bgcolor: "action.selected" }
|
|
2372
|
-
},
|
|
2373
|
-
onClick: () => {
|
|
2374
|
-
handleTransferCall(agent, "AGENT");
|
|
2375
|
-
},
|
|
2376
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
|
|
2377
|
-
}
|
|
2378
|
-
)
|
|
2379
|
-
]
|
|
2863
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2864
|
+
import_material3.Box,
|
|
2865
|
+
{
|
|
2866
|
+
sx: {
|
|
2867
|
+
display: "flex",
|
|
2868
|
+
alignItems: "center",
|
|
2869
|
+
justifyContent: "center",
|
|
2870
|
+
flexDirection: "column"
|
|
2871
|
+
},
|
|
2872
|
+
p: 2,
|
|
2873
|
+
children: [
|
|
2874
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
|
|
2875
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2876
|
+
import_material3.Typography,
|
|
2877
|
+
{
|
|
2878
|
+
variant: "body1",
|
|
2879
|
+
sx: {
|
|
2880
|
+
fontSize: "16px",
|
|
2881
|
+
letterSpacing: "0.02em",
|
|
2882
|
+
textTransform: "capitalize",
|
|
2883
|
+
display: "flex",
|
|
2884
|
+
alignItems: "center",
|
|
2885
|
+
justifyContent: "center",
|
|
2886
|
+
width: "100%",
|
|
2887
|
+
margin: "10px 0px",
|
|
2888
|
+
color: "primary.main",
|
|
2889
|
+
height: "20px"
|
|
2890
|
+
},
|
|
2891
|
+
children: "No Process Found"
|
|
2892
|
+
}
|
|
2893
|
+
)
|
|
2894
|
+
]
|
|
2895
|
+
}
|
|
2896
|
+
)
|
|
2897
|
+
}
|
|
2898
|
+
),
|
|
2899
|
+
!isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && !isTransferLoading && currentselecteTab === "queues" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2900
|
+
import_material3.Box,
|
|
2901
|
+
{
|
|
2902
|
+
sx: {
|
|
2903
|
+
display: "grid",
|
|
2904
|
+
gridTemplateColumns: ((_m = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _m.queue) && ((_o = (_n = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _n.queue) == null ? void 0 : _o.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)",
|
|
2905
|
+
gap: 1,
|
|
2906
|
+
padding: "10px",
|
|
2907
|
+
flexWrap: "wrap",
|
|
2908
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
2909
|
+
borderRadius: "10px"
|
|
2380
2910
|
},
|
|
2381
|
-
index
|
|
2382
|
-
|
|
2383
|
-
import_material3.Box,
|
|
2384
|
-
{
|
|
2385
|
-
sx: {
|
|
2386
|
-
display: "flex",
|
|
2387
|
-
alignItems: "center",
|
|
2388
|
-
justifyContent: "center",
|
|
2389
|
-
flexDirection: "column"
|
|
2390
|
-
},
|
|
2391
|
-
p: 2,
|
|
2392
|
-
children: [
|
|
2393
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
|
|
2394
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2395
|
-
import_material3.Typography,
|
|
2396
|
-
{
|
|
2397
|
-
variant: "body1",
|
|
2398
|
-
sx: {
|
|
2399
|
-
fontSize: "16px",
|
|
2400
|
-
letterSpacing: "0.02em",
|
|
2401
|
-
textTransform: "capitalize",
|
|
2402
|
-
display: "flex",
|
|
2403
|
-
alignItems: "center",
|
|
2404
|
-
justifyContent: "center",
|
|
2405
|
-
width: "100%",
|
|
2406
|
-
margin: "10px 0px",
|
|
2407
|
-
color: "primary.main",
|
|
2408
|
-
height: "20px"
|
|
2409
|
-
},
|
|
2410
|
-
children: "No Agents Found"
|
|
2411
|
-
}
|
|
2412
|
-
)
|
|
2413
|
-
]
|
|
2414
|
-
}
|
|
2415
|
-
)
|
|
2416
|
-
}
|
|
2417
|
-
),
|
|
2418
|
-
!isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && !isTransferLoading && currentselecteTab === "others" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2419
|
-
import_material3.Box,
|
|
2420
|
-
{
|
|
2421
|
-
sx: {
|
|
2422
|
-
display: "grid",
|
|
2423
|
-
gridTemplateColumns: "repeat(2, 1fr)",
|
|
2424
|
-
gap: 1,
|
|
2425
|
-
padding: "10px",
|
|
2426
|
-
flexWrap: "wrap",
|
|
2427
|
-
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
2428
|
-
borderRadius: "10px"
|
|
2429
|
-
},
|
|
2430
|
-
children: [
|
|
2431
|
-
(hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) && ((_u = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _u.length) > 0 && ((_v = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _v.map((service, index) => {
|
|
2432
|
-
var _a3, _b2, _c2;
|
|
2911
|
+
children: ((_p = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _p.queue) && ((_r = (_q = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _q.queue) == null ? void 0 : _r.length) > 0 ? (_t = (_s = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _s.queue) == null ? void 0 : _t.map((queue, index) => {
|
|
2912
|
+
var _a3, _b2, _c2, _d2, _e2, _f2;
|
|
2433
2913
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2434
2914
|
import_material3.Box,
|
|
2435
2915
|
{
|
|
@@ -2455,31 +2935,30 @@ function CallTransferDialog({ open }) {
|
|
|
2455
2935
|
alignItems: "center"
|
|
2456
2936
|
},
|
|
2457
2937
|
children: [
|
|
2458
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
] }) })
|
|
2938
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Airlines, { sx: { marginRight: "4px" } }),
|
|
2939
|
+
queue.queue_name,
|
|
2940
|
+
((_c2 = (_b2 = (_a3 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a3.process) == null ? void 0 : _b2.find(
|
|
2941
|
+
(process) => process.process_id === queue.process_id
|
|
2942
|
+
)) == null ? void 0 : _c2.process_name) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2943
|
+
import_material3.Typography,
|
|
2944
|
+
{
|
|
2945
|
+
variant: "body1",
|
|
2946
|
+
sx: {
|
|
2947
|
+
fontSize: "12px",
|
|
2948
|
+
fontWeight: "600",
|
|
2949
|
+
letterSpacing: "0.02em",
|
|
2950
|
+
textTransform: "capitalize",
|
|
2951
|
+
color: "gray"
|
|
2952
|
+
},
|
|
2953
|
+
children: "(" + ((_f2 = (_e2 = (_d2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d2.process) == null ? void 0 : _e2.find(
|
|
2954
|
+
(process) => process.process_id === queue.process_id
|
|
2955
|
+
)) == null ? void 0 : _f2.process_name) + ")"
|
|
2956
|
+
}
|
|
2957
|
+
) : ""
|
|
2479
2958
|
]
|
|
2480
2959
|
}
|
|
2481
2960
|
),
|
|
2482
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title:
|
|
2961
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: state.consultInfo ? "Please complete or cancel the ongoing consult transfer before proceeding." : "", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2483
2962
|
import_material3.IconButton,
|
|
2484
2963
|
{
|
|
2485
2964
|
color: "success",
|
|
@@ -2487,104 +2966,355 @@ function CallTransferDialog({ open }) {
|
|
|
2487
2966
|
bgcolor: "action.hover",
|
|
2488
2967
|
"&:hover": { bgcolor: "action.selected" }
|
|
2489
2968
|
},
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
return handleTransferCall(
|
|
2493
|
-
{ mobile_number: (_a4 = service == null ? void 0 : service.phone_number) != null ? _a4 : "" },
|
|
2494
|
-
"OTHER"
|
|
2495
|
-
);
|
|
2496
|
-
},
|
|
2969
|
+
disabled: !!state.consultInfo,
|
|
2970
|
+
onClick: () => handleTransferCall(queue, "QUEUE"),
|
|
2497
2971
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
|
|
2498
2972
|
}
|
|
2499
|
-
) })
|
|
2973
|
+
) }) })
|
|
2500
2974
|
]
|
|
2501
2975
|
},
|
|
2502
2976
|
index
|
|
2503
2977
|
);
|
|
2504
|
-
}))
|
|
2505
|
-
|
|
2978
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2979
|
+
import_material3.Box,
|
|
2980
|
+
{
|
|
2981
|
+
sx: {
|
|
2982
|
+
display: "flex",
|
|
2983
|
+
alignItems: "center",
|
|
2984
|
+
justifyContent: "center",
|
|
2985
|
+
flexDirection: "column"
|
|
2986
|
+
},
|
|
2987
|
+
p: 2,
|
|
2988
|
+
children: [
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
|
|
2990
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2991
|
+
import_material3.Typography,
|
|
2992
|
+
{
|
|
2993
|
+
variant: "body1",
|
|
2994
|
+
sx: {
|
|
2995
|
+
fontSize: "16px",
|
|
2996
|
+
letterSpacing: "0.02em",
|
|
2997
|
+
textTransform: "capitalize",
|
|
2998
|
+
display: "flex",
|
|
2999
|
+
alignItems: "center",
|
|
3000
|
+
justifyContent: "center",
|
|
3001
|
+
width: "100%",
|
|
3002
|
+
margin: "10px 0px",
|
|
3003
|
+
color: "primary.main",
|
|
3004
|
+
height: "20px"
|
|
3005
|
+
},
|
|
3006
|
+
children: "No Queues Found"
|
|
3007
|
+
}
|
|
3008
|
+
)
|
|
3009
|
+
]
|
|
3010
|
+
}
|
|
3011
|
+
)
|
|
3012
|
+
}
|
|
3013
|
+
),
|
|
3014
|
+
!isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && !isTransferLoading && currentselecteTab === "agents" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3015
|
+
import_material3.Box,
|
|
3016
|
+
{
|
|
3017
|
+
sx: {
|
|
3018
|
+
display: "grid",
|
|
3019
|
+
gridTemplateColumns: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_u = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _u.length) > 0 ? "repeat(2, 1fr)" : "repeat(1, 1fr)",
|
|
3020
|
+
gap: 1,
|
|
3021
|
+
padding: "10px",
|
|
3022
|
+
flexWrap: "wrap",
|
|
3023
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
3024
|
+
borderRadius: "10px"
|
|
3025
|
+
},
|
|
3026
|
+
children: (idleAgentsList == null ? void 0 : idleAgentsList.data) && ((_v = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _v.length) > 0 ? (_w = idleAgentsList == null ? void 0 : idleAgentsList.data) == null ? void 0 : _w.map((agent, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3027
|
+
import_material3.Box,
|
|
3028
|
+
{
|
|
3029
|
+
sx: {
|
|
3030
|
+
p: 1,
|
|
3031
|
+
display: "flex",
|
|
3032
|
+
alignItems: "center",
|
|
3033
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
3034
|
+
padding: "6px",
|
|
3035
|
+
borderRadius: "10px",
|
|
3036
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
3037
|
+
},
|
|
3038
|
+
children: [
|
|
3039
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3040
|
+
import_material3.Typography,
|
|
3041
|
+
{
|
|
3042
|
+
variant: "body1",
|
|
3043
|
+
sx: {
|
|
3044
|
+
mx: 1,
|
|
3045
|
+
width: "200px",
|
|
3046
|
+
maxWidth: "250px",
|
|
3047
|
+
display: "flex",
|
|
3048
|
+
alignItems: "center"
|
|
3049
|
+
},
|
|
3050
|
+
children: [
|
|
3051
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.SupportAgent, { sx: { marginRight: "4px" } }),
|
|
3052
|
+
agent.name
|
|
3053
|
+
]
|
|
3054
|
+
}
|
|
3055
|
+
),
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: state.consultInfo ? "Please complete or cancel the ongoing consult transfer before proceeding." : "", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3057
|
+
import_material3.IconButton,
|
|
3058
|
+
{
|
|
3059
|
+
color: "success",
|
|
3060
|
+
sx: {
|
|
3061
|
+
bgcolor: "action.hover",
|
|
3062
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
3063
|
+
},
|
|
3064
|
+
disabled: !!state.consultInfo,
|
|
3065
|
+
onClick: (e) => handleTransferClick(e, agent, "AGENT"),
|
|
3066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
|
|
3067
|
+
}
|
|
3068
|
+
) }) })
|
|
3069
|
+
]
|
|
3070
|
+
},
|
|
3071
|
+
index
|
|
3072
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2506
3073
|
import_material3.Box,
|
|
2507
3074
|
{
|
|
2508
3075
|
sx: {
|
|
2509
|
-
p: 1,
|
|
2510
3076
|
display: "flex",
|
|
2511
3077
|
alignItems: "center",
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
borderRadius: "10px"
|
|
3078
|
+
justifyContent: "center",
|
|
3079
|
+
flexDirection: "column"
|
|
2515
3080
|
},
|
|
3081
|
+
p: 2,
|
|
2516
3082
|
children: [
|
|
3083
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Upcoming, { color: "primary" }),
|
|
2517
3084
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2518
3085
|
import_material3.Typography,
|
|
2519
3086
|
{
|
|
2520
3087
|
variant: "body1",
|
|
2521
3088
|
sx: {
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
3089
|
+
fontSize: "16px",
|
|
3090
|
+
letterSpacing: "0.02em",
|
|
3091
|
+
textTransform: "capitalize",
|
|
2525
3092
|
display: "flex",
|
|
2526
|
-
alignItems: "center"
|
|
3093
|
+
alignItems: "center",
|
|
3094
|
+
justifyContent: "center",
|
|
3095
|
+
width: "100%",
|
|
3096
|
+
margin: "10px 0px",
|
|
3097
|
+
color: "primary.main",
|
|
3098
|
+
height: "20px"
|
|
2527
3099
|
},
|
|
2528
|
-
children:
|
|
2529
|
-
|
|
3100
|
+
children: "No Agents Found"
|
|
3101
|
+
}
|
|
3102
|
+
)
|
|
3103
|
+
]
|
|
3104
|
+
}
|
|
3105
|
+
)
|
|
3106
|
+
}
|
|
3107
|
+
),
|
|
3108
|
+
!isProcessAndQueuesListLoading && !isIdleAgentsListLoading && !isHospitalsServicesListLoading && !isTransferLoading && currentselecteTab === "others" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3109
|
+
import_material3.Box,
|
|
3110
|
+
{
|
|
3111
|
+
sx: {
|
|
3112
|
+
display: "grid",
|
|
3113
|
+
gridTemplateColumns: "repeat(2, 1fr)",
|
|
3114
|
+
gap: 1,
|
|
3115
|
+
padding: "10px",
|
|
3116
|
+
flexWrap: "wrap",
|
|
3117
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
3118
|
+
borderRadius: "10px"
|
|
3119
|
+
},
|
|
3120
|
+
children: [
|
|
3121
|
+
(hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) && ((_x = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _x.length) > 0 && ((_y = hospitalsServicesList == null ? void 0 : hospitalsServicesList.data) == null ? void 0 : _y.map((service, index) => {
|
|
3122
|
+
var _a3, _b2, _c2;
|
|
3123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3124
|
+
import_material3.Box,
|
|
3125
|
+
{
|
|
3126
|
+
sx: {
|
|
3127
|
+
p: 1,
|
|
3128
|
+
display: "flex",
|
|
3129
|
+
alignItems: "center",
|
|
3130
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
3131
|
+
padding: "6px",
|
|
3132
|
+
borderRadius: "10px",
|
|
3133
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
3134
|
+
},
|
|
3135
|
+
children: [
|
|
3136
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3137
|
+
import_material3.Typography,
|
|
2530
3138
|
{
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
const v = e.target.value;
|
|
2539
|
-
if (/^\d*$/.test(v)) {
|
|
2540
|
-
setMobileNumber(v);
|
|
2541
|
-
}
|
|
2542
|
-
},
|
|
2543
|
-
slotProps: {
|
|
2544
|
-
htmlInput: {
|
|
2545
|
-
inputMode: "numeric",
|
|
2546
|
-
maxLength: 11
|
|
2547
|
-
}
|
|
3139
|
+
variant: "body1",
|
|
3140
|
+
sx: {
|
|
3141
|
+
mx: 1,
|
|
3142
|
+
width: "200px",
|
|
3143
|
+
maxWidth: "250px",
|
|
3144
|
+
display: "flex",
|
|
3145
|
+
alignItems: "center"
|
|
2548
3146
|
},
|
|
2549
|
-
|
|
2550
|
-
|
|
3147
|
+
children: [
|
|
3148
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Roofing, { sx: { marginRight: "4px" } }),
|
|
3149
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: `${(_a3 = service == null ? void 0 : service.description) != null ? _a3 : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { color: "text.secondary" }, children: [
|
|
3150
|
+
service.name,
|
|
3151
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3152
|
+
import_material3.Box,
|
|
3153
|
+
{
|
|
3154
|
+
sx: {
|
|
3155
|
+
fontSize: "9px",
|
|
3156
|
+
fontWeight: "600",
|
|
3157
|
+
letterSpacing: "0.02em",
|
|
3158
|
+
textTransform: "capitalize",
|
|
3159
|
+
color: "gray",
|
|
3160
|
+
textOverflow: "ellipsis",
|
|
3161
|
+
whiteSpace: "nowrap",
|
|
3162
|
+
overflow: "hidden",
|
|
3163
|
+
maxWidth: "160px"
|
|
3164
|
+
},
|
|
3165
|
+
children: (_b2 = service == null ? void 0 : service.description) != null ? _b2 : ""
|
|
3166
|
+
}
|
|
3167
|
+
)
|
|
3168
|
+
] }) })
|
|
3169
|
+
]
|
|
2551
3170
|
}
|
|
2552
|
-
)
|
|
2553
|
-
|
|
2554
|
-
),
|
|
2555
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2556
|
-
import_material3.Tooltip,
|
|
2557
|
-
{
|
|
2558
|
-
title: mobileNumber ? `Call To - ${mobileNumber}` : "Enter mobile number",
|
|
2559
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3171
|
+
),
|
|
3172
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: state.consultInfo ? "Please complete or cancel the ongoing consult transfer before proceeding." : (_c2 = service == null ? void 0 : service.phone_number) != null ? _c2 : "", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2560
3173
|
import_material3.IconButton,
|
|
2561
3174
|
{
|
|
2562
3175
|
color: "success",
|
|
3176
|
+
disabled: !!state.consultInfo,
|
|
2563
3177
|
sx: {
|
|
2564
3178
|
bgcolor: "action.hover",
|
|
2565
3179
|
"&:hover": { bgcolor: "action.selected" }
|
|
2566
3180
|
},
|
|
2567
|
-
onClick: () =>
|
|
3181
|
+
onClick: (e) => {
|
|
3182
|
+
var _a4;
|
|
3183
|
+
return handleTransferClick(e, { mobile_number: (_a4 = service == null ? void 0 : service.phone_number) != null ? _a4 : "" }, "OTHER");
|
|
3184
|
+
},
|
|
2568
3185
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
|
|
2569
3186
|
}
|
|
2570
|
-
)
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
3187
|
+
) }) })
|
|
3188
|
+
]
|
|
3189
|
+
},
|
|
3190
|
+
index
|
|
3191
|
+
);
|
|
3192
|
+
})),
|
|
3193
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3194
|
+
import_material3.Box,
|
|
3195
|
+
{
|
|
3196
|
+
sx: {
|
|
3197
|
+
p: 1,
|
|
3198
|
+
display: "flex",
|
|
3199
|
+
alignItems: "center",
|
|
3200
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
3201
|
+
padding: "6px",
|
|
3202
|
+
borderRadius: "10px"
|
|
3203
|
+
},
|
|
3204
|
+
children: [
|
|
3205
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3206
|
+
import_material3.Typography,
|
|
3207
|
+
{
|
|
3208
|
+
variant: "body1",
|
|
3209
|
+
sx: {
|
|
3210
|
+
mx: 1,
|
|
3211
|
+
width: "200px",
|
|
3212
|
+
maxWidth: "250px",
|
|
3213
|
+
display: "flex",
|
|
3214
|
+
alignItems: "center"
|
|
3215
|
+
},
|
|
3216
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3217
|
+
import_material3.TextField,
|
|
3218
|
+
{
|
|
3219
|
+
size: "small",
|
|
3220
|
+
name: "others",
|
|
3221
|
+
label: "Mobile number",
|
|
3222
|
+
variant: "outlined",
|
|
3223
|
+
type: "tel",
|
|
3224
|
+
value: mobileNumber,
|
|
3225
|
+
onChange: (e) => {
|
|
3226
|
+
const v = e.target.value;
|
|
3227
|
+
if (/^\d*$/.test(v)) {
|
|
3228
|
+
setMobileNumber(v);
|
|
3229
|
+
}
|
|
3230
|
+
},
|
|
3231
|
+
slotProps: {
|
|
3232
|
+
htmlInput: {
|
|
3233
|
+
inputMode: "numeric",
|
|
3234
|
+
maxLength: 11
|
|
3235
|
+
}
|
|
3236
|
+
},
|
|
3237
|
+
placeholder: "Enter mobile number",
|
|
3238
|
+
autoComplete: "off"
|
|
3239
|
+
}
|
|
3240
|
+
)
|
|
3241
|
+
}
|
|
3242
|
+
),
|
|
3243
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3244
|
+
import_material3.Tooltip,
|
|
3245
|
+
{
|
|
3246
|
+
title: state.consultInfo ? "Please complete or cancel the ongoing consult transfer before proceeding." : mobileNumber ? `Call To - ${mobileNumber}` : "Enter mobile number",
|
|
3247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3248
|
+
import_material3.IconButton,
|
|
3249
|
+
{
|
|
3250
|
+
color: "success",
|
|
3251
|
+
disabled: !!state.consultInfo,
|
|
3252
|
+
sx: {
|
|
3253
|
+
bgcolor: "action.hover",
|
|
3254
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
3255
|
+
},
|
|
3256
|
+
onClick: (e) => handleTransferClick(e, { mobile_number: mobileNumber != null ? mobileNumber : "" }, "OTHER"),
|
|
3257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Call, {})
|
|
3258
|
+
}
|
|
3259
|
+
) })
|
|
3260
|
+
}
|
|
3261
|
+
)
|
|
3262
|
+
]
|
|
3263
|
+
}
|
|
3264
|
+
)
|
|
3265
|
+
]
|
|
3266
|
+
}
|
|
3267
|
+
)
|
|
3268
|
+
] })
|
|
3269
|
+
] })
|
|
3270
|
+
}
|
|
3271
|
+
),
|
|
3272
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3273
|
+
import_material3.Menu,
|
|
3274
|
+
{
|
|
3275
|
+
anchorEl: transferMenuAnchor,
|
|
3276
|
+
open: Boolean(transferMenuAnchor),
|
|
3277
|
+
onClose: () => setTransferMenuAnchor(null),
|
|
3278
|
+
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
3279
|
+
transformOrigin: { vertical: "bottom", horizontal: "left" },
|
|
3280
|
+
children: [
|
|
3281
|
+
blindEnabled && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3282
|
+
import_material3.MenuItem,
|
|
3283
|
+
{
|
|
3284
|
+
onClick: () => {
|
|
3285
|
+
if (pendingTransferData) handleTransferCall(pendingTransferData.data, pendingTransferData.type, "DEFAULT");
|
|
3286
|
+
setTransferMenuAnchor(null);
|
|
3287
|
+
},
|
|
3288
|
+
sx: { gap: 1 },
|
|
3289
|
+
children: [
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.TransferWithinAStation, { fontSize: "small", color: "primary" }),
|
|
3291
|
+
"Transfer"
|
|
3292
|
+
]
|
|
3293
|
+
}
|
|
3294
|
+
),
|
|
3295
|
+
attendedEnabled && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3296
|
+
import_material3.MenuItem,
|
|
3297
|
+
{
|
|
3298
|
+
onClick: () => {
|
|
3299
|
+
if (pendingTransferData) handleTransferCall(pendingTransferData.data, pendingTransferData.type, "CONSULT");
|
|
3300
|
+
setTransferMenuAnchor(null);
|
|
3301
|
+
},
|
|
3302
|
+
sx: { gap: 1 },
|
|
3303
|
+
children: [
|
|
3304
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.RecordVoiceOver, { fontSize: "small", color: "primary" }),
|
|
3305
|
+
"Consult then Transfer"
|
|
2576
3306
|
]
|
|
2577
3307
|
}
|
|
2578
3308
|
)
|
|
2579
|
-
]
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
3309
|
+
]
|
|
3310
|
+
}
|
|
3311
|
+
)
|
|
3312
|
+
] });
|
|
2583
3313
|
}
|
|
2584
3314
|
function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
2585
3315
|
var _a2, _b, _c, _d, _e;
|
|
2586
3316
|
const [getDispositions, data] = useGetRequest();
|
|
2587
|
-
const [formData, setFormData] = (0,
|
|
3317
|
+
const [formData, setFormData] = (0, import_react10.useState)({
|
|
2588
3318
|
disposition: { label: "", value: "", id: 0 },
|
|
2589
3319
|
followUp: { label: "No", value: "N" },
|
|
2590
3320
|
callbackDate: "",
|
|
@@ -2615,10 +3345,10 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2615
3345
|
handleReset();
|
|
2616
3346
|
setOpen(false);
|
|
2617
3347
|
};
|
|
2618
|
-
(0,
|
|
3348
|
+
(0, import_react10.useEffect)(() => {
|
|
2619
3349
|
getDispositions(END_POINT.DISPOSITIONS);
|
|
2620
3350
|
}, []);
|
|
2621
|
-
const dispositionsOptions = (0,
|
|
3351
|
+
const dispositionsOptions = (0, import_react10.useMemo)(() => {
|
|
2622
3352
|
var _a3, _b2, _c2, _d2;
|
|
2623
3353
|
return ((_d2 = (_c2 = (_b2 = (_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.data) == null ? void 0 : _b2.filter((item) => item.name !== "Resolved")) == null ? void 0 : _c2.map((item) => ({
|
|
2624
3354
|
label: item.name,
|
|
@@ -2632,8 +3362,8 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2632
3362
|
open,
|
|
2633
3363
|
"aria-labelledby": "alert-dialog-title",
|
|
2634
3364
|
"aria-describedby": "alert-dialog-description",
|
|
2635
|
-
fullWidth: true,
|
|
2636
3365
|
maxWidth: "xs",
|
|
3366
|
+
slotProps: { paper: { sx: { minWidth: 500 } } },
|
|
2637
3367
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
|
|
2638
3368
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2639
3369
|
import_material3.Box,
|
|
@@ -2874,6 +3604,7 @@ function ProcessorListDialog({
|
|
|
2874
3604
|
"aria-labelledby": "alert-dialog-title",
|
|
2875
3605
|
"aria-describedby": "alert-dialog-description",
|
|
2876
3606
|
maxWidth: "xs",
|
|
3607
|
+
slotProps: { paper: { sx: { minWidth: 500 } } },
|
|
2877
3608
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
|
|
2878
3609
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2879
3610
|
import_material3.Box,
|
|
@@ -2953,8 +3684,8 @@ function CallHistoryDialog({ open, setOpen }) {
|
|
|
2953
3684
|
open,
|
|
2954
3685
|
"aria-labelledby": "alert-dialog-title",
|
|
2955
3686
|
"aria-describedby": "alert-dialog-description",
|
|
2956
|
-
fullWidth: true,
|
|
2957
3687
|
maxWidth: "md",
|
|
3688
|
+
slotProps: { paper: { sx: { minWidth: 500 } } },
|
|
2958
3689
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
|
|
2959
3690
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2960
3691
|
import_material3.Box,
|
|
@@ -2992,15 +3723,18 @@ function CallHistoryDialog({ open, setOpen }) {
|
|
|
2992
3723
|
) });
|
|
2993
3724
|
}
|
|
2994
3725
|
|
|
3726
|
+
// call-control-sdk/lib/components/callControls.tsx
|
|
3727
|
+
init_sdk_state();
|
|
3728
|
+
|
|
2995
3729
|
// call-control-sdk/lib/hooks/useDraggable.ts
|
|
2996
|
-
var
|
|
3730
|
+
var import_react11 = require("react");
|
|
2997
3731
|
function useDraggable(initialPosition, onPositionChange) {
|
|
2998
|
-
const [position, setPosition] = (0,
|
|
2999
|
-
const [isDragging, setIsDragging] = (0,
|
|
3000
|
-
const dragRef = (0,
|
|
3001
|
-
const dragStart = (0,
|
|
3002
|
-
const elementStart = (0,
|
|
3003
|
-
const updatePosition = (0,
|
|
3732
|
+
const [position, setPosition] = (0, import_react11.useState)(initialPosition);
|
|
3733
|
+
const [isDragging, setIsDragging] = (0, import_react11.useState)(false);
|
|
3734
|
+
const dragRef = (0, import_react11.useRef)();
|
|
3735
|
+
const dragStart = (0, import_react11.useRef)({ x: 0, y: 0 });
|
|
3736
|
+
const elementStart = (0, import_react11.useRef)({ x: 0, y: 0 });
|
|
3737
|
+
const updatePosition = (0, import_react11.useCallback)(
|
|
3004
3738
|
(newPosition) => {
|
|
3005
3739
|
const element = dragRef.current;
|
|
3006
3740
|
if (!element) return;
|
|
@@ -3016,7 +3750,7 @@ function useDraggable(initialPosition, onPositionChange) {
|
|
|
3016
3750
|
},
|
|
3017
3751
|
[onPositionChange]
|
|
3018
3752
|
);
|
|
3019
|
-
const handleStart = (0,
|
|
3753
|
+
const handleStart = (0, import_react11.useCallback)(
|
|
3020
3754
|
(clientX, clientY) => {
|
|
3021
3755
|
setIsDragging(true);
|
|
3022
3756
|
dragStart.current = { x: clientX, y: clientY };
|
|
@@ -3056,14 +3790,14 @@ function useDraggable(initialPosition, onPositionChange) {
|
|
|
3056
3790
|
},
|
|
3057
3791
|
[position, updatePosition]
|
|
3058
3792
|
);
|
|
3059
|
-
const handleMouseDown = (0,
|
|
3793
|
+
const handleMouseDown = (0, import_react11.useCallback)(
|
|
3060
3794
|
(e) => {
|
|
3061
3795
|
e.preventDefault();
|
|
3062
3796
|
handleStart(e.clientX, e.clientY);
|
|
3063
3797
|
},
|
|
3064
3798
|
[handleStart]
|
|
3065
3799
|
);
|
|
3066
|
-
const handleTouchStart = (0,
|
|
3800
|
+
const handleTouchStart = (0, import_react11.useCallback)(
|
|
3067
3801
|
(e) => {
|
|
3068
3802
|
e.preventDefault();
|
|
3069
3803
|
const touch = e.touches[0];
|
|
@@ -3082,6 +3816,11 @@ function useDraggable(initialPosition, onPositionChange) {
|
|
|
3082
3816
|
};
|
|
3083
3817
|
}
|
|
3084
3818
|
|
|
3819
|
+
// call-control-sdk/lib/components/callControls.tsx
|
|
3820
|
+
init_endPoint();
|
|
3821
|
+
init_axios();
|
|
3822
|
+
init_toastMessage();
|
|
3823
|
+
|
|
3085
3824
|
// call-control-sdk/lib/services/micController.ts
|
|
3086
3825
|
function createMicController(constraints = { audio: true }) {
|
|
3087
3826
|
let stream = null;
|
|
@@ -3212,6 +3951,7 @@ function cleanupAudioResources() {
|
|
|
3212
3951
|
|
|
3213
3952
|
// call-control-sdk/lib/components/callControls.tsx
|
|
3214
3953
|
var import_vault5 = require("@react-solutions/vault");
|
|
3954
|
+
init_storage();
|
|
3215
3955
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3216
3956
|
var getCombineConfrenceData = (localState, apiData) => {
|
|
3217
3957
|
const localConfrenceData = localState == null ? void 0 : localState.conferenceLine;
|
|
@@ -3247,7 +3987,7 @@ var formatDuration = (seconds) => {
|
|
|
3247
3987
|
return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
|
|
3248
3988
|
};
|
|
3249
3989
|
function CallControls({ onDataChange }) {
|
|
3250
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab;
|
|
3990
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb;
|
|
3251
3991
|
const theme = (0, import_material4.useTheme)();
|
|
3252
3992
|
const state = useSDKState();
|
|
3253
3993
|
const { showToast } = useToast();
|
|
@@ -3256,35 +3996,35 @@ function CallControls({ onDataChange }) {
|
|
|
3256
3996
|
enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
|
|
3257
3997
|
outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
|
|
3258
3998
|
});
|
|
3259
|
-
const micRef = (0,
|
|
3260
|
-
const webSocketRef = (0,
|
|
3261
|
-
const audioRef = (0,
|
|
3262
|
-
const reconnectTimeoutRef = (0,
|
|
3263
|
-
const pingIntervalRef = (0,
|
|
3264
|
-
const reconnectAttemptsRef = (0,
|
|
3265
|
-
const hasFlashedRef = (0,
|
|
3266
|
-
const lastEventTimeRef = (0,
|
|
3267
|
-
const holdStartTimeRef = (0,
|
|
3268
|
-
const muteStartTimeRef = (0,
|
|
3999
|
+
const micRef = (0, import_react12.useRef)(null);
|
|
4000
|
+
const webSocketRef = (0, import_react12.useRef)(null);
|
|
4001
|
+
const audioRef = (0, import_react12.useRef)(null);
|
|
4002
|
+
const reconnectTimeoutRef = (0, import_react12.useRef)(null);
|
|
4003
|
+
const pingIntervalRef = (0, import_react12.useRef)(null);
|
|
4004
|
+
const reconnectAttemptsRef = (0, import_react12.useRef)(0);
|
|
4005
|
+
const hasFlashedRef = (0, import_react12.useRef)(false);
|
|
4006
|
+
const lastEventTimeRef = (0, import_react12.useRef)(null);
|
|
4007
|
+
const holdStartTimeRef = (0, import_react12.useRef)(null);
|
|
4008
|
+
const muteStartTimeRef = (0, import_react12.useRef)(null);
|
|
3269
4009
|
const maxReconnectAttempts = 60;
|
|
3270
4010
|
const baseReconnectDelay = 2e3;
|
|
3271
4011
|
const maxReconnectDelay = 3e4;
|
|
3272
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
3273
|
-
const [statusAnchorEl, setStatusAnchorEl] = (0,
|
|
3274
|
-
const [dialerAnchorEl, setDialerAnchorEl] = (0,
|
|
3275
|
-
const [ambulanceAnchorEl, setAmbulanceAnchorEl] = (0,
|
|
3276
|
-
const [moreOptionsAnchorEl, setMoreOptionsAnchorEl] = (0,
|
|
3277
|
-
const [showIframe, setShowIframe] = (0,
|
|
3278
|
-
const [openCallDisposition, setOpenCallDisposition] = (0,
|
|
3279
|
-
const [openProcessorDialog, setOpenProcessorDialog] = (0,
|
|
3280
|
-
const [openCallHistoryDialog, setOpenCallHistoryDialog] = (0,
|
|
3281
|
-
const [processList, setProcessList] = (0,
|
|
3282
|
-
const [breaksList, setBreaksList] = (0,
|
|
3283
|
-
const [phoneNumber, setPhoneNumber] = (0,
|
|
3284
|
-
const [callDuration, setCallDuration] = (0,
|
|
3285
|
-
const [callWrapuptime, setCallWrapuptime] = (0,
|
|
3286
|
-
const [holdDuration, setHoldDuration] = (0,
|
|
3287
|
-
const [muteDuration, setMuteDuration] = (0,
|
|
4012
|
+
const [anchorEl, setAnchorEl] = (0, import_react12.useState)(null);
|
|
4013
|
+
const [statusAnchorEl, setStatusAnchorEl] = (0, import_react12.useState)(null);
|
|
4014
|
+
const [dialerAnchorEl, setDialerAnchorEl] = (0, import_react12.useState)(null);
|
|
4015
|
+
const [ambulanceAnchorEl, setAmbulanceAnchorEl] = (0, import_react12.useState)(null);
|
|
4016
|
+
const [moreOptionsAnchorEl, setMoreOptionsAnchorEl] = (0, import_react12.useState)(null);
|
|
4017
|
+
const [showIframe, setShowIframe] = (0, import_react12.useState)(true);
|
|
4018
|
+
const [openCallDisposition, setOpenCallDisposition] = (0, import_react12.useState)(false);
|
|
4019
|
+
const [openProcessorDialog, setOpenProcessorDialog] = (0, import_react12.useState)(false);
|
|
4020
|
+
const [openCallHistoryDialog, setOpenCallHistoryDialog] = (0, import_react12.useState)(false);
|
|
4021
|
+
const [processList, setProcessList] = (0, import_react12.useState)(null);
|
|
4022
|
+
const [breaksList, setBreaksList] = (0, import_react12.useState)(null);
|
|
4023
|
+
const [phoneNumber, setPhoneNumber] = (0, import_react12.useState)("");
|
|
4024
|
+
const [callDuration, setCallDuration] = (0, import_react12.useState)(0);
|
|
4025
|
+
const [callWrapuptime, setCallWrapuptime] = (0, import_react12.useState)(null);
|
|
4026
|
+
const [holdDuration, setHoldDuration] = (0, import_react12.useState)(0);
|
|
4027
|
+
const [muteDuration, setMuteDuration] = (0, import_react12.useState)(0);
|
|
3288
4028
|
const { position, isDragging, dragRef, handleMouseDown, handleTouchStart } = useDraggable(
|
|
3289
4029
|
state.controlPanelPosition,
|
|
3290
4030
|
(newPosition) => sdkStateManager.setControlPanelPosition(newPosition)
|
|
@@ -3299,7 +4039,7 @@ function CallControls({ onDataChange }) {
|
|
|
3299
4039
|
state.iframePosition,
|
|
3300
4040
|
(newPosition) => sdkStateManager.setIframePosition(newPosition)
|
|
3301
4041
|
);
|
|
3302
|
-
const [
|
|
4042
|
+
const [clickToCall2, { isLoading: clickToCallLoading }] = usePostRequest({
|
|
3303
4043
|
onSuccess: () => {
|
|
3304
4044
|
setPhoneNumber("");
|
|
3305
4045
|
setDialerAnchorEl(null);
|
|
@@ -3314,7 +4054,7 @@ function CallControls({ onDataChange }) {
|
|
|
3314
4054
|
});
|
|
3315
4055
|
const [updateAgentStatus, { isLoading }] = usePostRequest();
|
|
3316
4056
|
const [sendNotification] = usePostRequest();
|
|
3317
|
-
const [
|
|
4057
|
+
const [endCall2, { isLoading: endCallLoading }] = usePostRequest({
|
|
3318
4058
|
onSuccess: () => {
|
|
3319
4059
|
sdkStateManager.endCall();
|
|
3320
4060
|
setOpenCallDisposition(false);
|
|
@@ -3385,7 +4125,7 @@ function CallControls({ onDataChange }) {
|
|
|
3385
4125
|
phone_number: number,
|
|
3386
4126
|
userId: state.agentId
|
|
3387
4127
|
};
|
|
3388
|
-
|
|
4128
|
+
clickToCall2(END_POINT.CLICK_TO_CALL, payload);
|
|
3389
4129
|
}
|
|
3390
4130
|
};
|
|
3391
4131
|
const handleHoldToggle = () => {
|
|
@@ -3421,7 +4161,7 @@ function CallControls({ onDataChange }) {
|
|
|
3421
4161
|
endcall_type: "CLOSE"
|
|
3422
4162
|
};
|
|
3423
4163
|
setPhoneNumber("");
|
|
3424
|
-
|
|
4164
|
+
endCall2(END_POINT.END_CALL, payload, {
|
|
3425
4165
|
params: {
|
|
3426
4166
|
isBreak: (_q2 = data == null ? void 0 : data.selected_break) != null ? _q2 : false
|
|
3427
4167
|
}
|
|
@@ -3444,7 +4184,7 @@ function CallControls({ onDataChange }) {
|
|
|
3444
4184
|
}
|
|
3445
4185
|
});
|
|
3446
4186
|
};
|
|
3447
|
-
(0,
|
|
4187
|
+
(0, import_react12.useEffect)(() => {
|
|
3448
4188
|
const handleBeforeUnload = (e) => {
|
|
3449
4189
|
e.preventDefault();
|
|
3450
4190
|
};
|
|
@@ -3453,7 +4193,7 @@ function CallControls({ onDataChange }) {
|
|
|
3453
4193
|
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
3454
4194
|
};
|
|
3455
4195
|
}, []);
|
|
3456
|
-
(0,
|
|
4196
|
+
(0, import_react12.useEffect)(() => {
|
|
3457
4197
|
const mic = createMicController();
|
|
3458
4198
|
micRef.current = mic;
|
|
3459
4199
|
mic.start().catch((err) => {
|
|
@@ -3461,7 +4201,7 @@ function CallControls({ onDataChange }) {
|
|
|
3461
4201
|
});
|
|
3462
4202
|
const handleKeyDown = (event) => {
|
|
3463
4203
|
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
3464
|
-
const fullState = (0, import_vault5.
|
|
4204
|
+
const fullState = (0, import_vault5.getSession)(STORAGE_KEY);
|
|
3465
4205
|
const key = (_a3 = event.key) == null ? void 0 : _a3.toLowerCase();
|
|
3466
4206
|
if (!event.altKey || ((_b2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _b2.status) !== "ONCALL" /* ONCALL */) {
|
|
3467
4207
|
return;
|
|
@@ -3506,7 +4246,7 @@ function CallControls({ onDataChange }) {
|
|
|
3506
4246
|
window.removeEventListener("keydown", handleKeyDown);
|
|
3507
4247
|
};
|
|
3508
4248
|
}, []);
|
|
3509
|
-
(0,
|
|
4249
|
+
(0, import_react12.useEffect)(() => {
|
|
3510
4250
|
let interval;
|
|
3511
4251
|
let wrapUpinterval;
|
|
3512
4252
|
if (state.callData.status && state.callData.status === "ONCALL" /* ONCALL */) {
|
|
@@ -3541,7 +4281,7 @@ function CallControls({ onDataChange }) {
|
|
|
3541
4281
|
if (wrapUpinterval) clearInterval(wrapUpinterval);
|
|
3542
4282
|
};
|
|
3543
4283
|
}, [state.callData.status]);
|
|
3544
|
-
(0,
|
|
4284
|
+
(0, import_react12.useEffect)(() => {
|
|
3545
4285
|
var _a3, _b2, _c2;
|
|
3546
4286
|
let holdInterval;
|
|
3547
4287
|
const isOnCall = ((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */;
|
|
@@ -3563,7 +4303,7 @@ function CallControls({ onDataChange }) {
|
|
|
3563
4303
|
if (holdInterval) clearInterval(holdInterval);
|
|
3564
4304
|
};
|
|
3565
4305
|
}, [(_d = state.callData) == null ? void 0 : _d.hold, (_e = state.callData) == null ? void 0 : _e.status]);
|
|
3566
|
-
(0,
|
|
4306
|
+
(0, import_react12.useEffect)(() => {
|
|
3567
4307
|
var _a3, _b2, _c2, _d2;
|
|
3568
4308
|
let muteInterval;
|
|
3569
4309
|
const isOnCall = ((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */;
|
|
@@ -3586,7 +4326,7 @@ function CallControls({ onDataChange }) {
|
|
|
3586
4326
|
if (muteInterval) clearInterval(muteInterval);
|
|
3587
4327
|
};
|
|
3588
4328
|
}, [(_f = state.callData) == null ? void 0 : _f.mute, (_g = state.callData) == null ? void 0 : _g.status]);
|
|
3589
|
-
(0,
|
|
4329
|
+
(0, import_react12.useEffect)(() => {
|
|
3590
4330
|
createAudioElement().then((audio) => {
|
|
3591
4331
|
audioRef.current = audio;
|
|
3592
4332
|
}).catch((error) => {
|
|
@@ -3602,7 +4342,7 @@ function CallControls({ onDataChange }) {
|
|
|
3602
4342
|
cleanupAudioResources();
|
|
3603
4343
|
};
|
|
3604
4344
|
}, []);
|
|
3605
|
-
(0,
|
|
4345
|
+
(0, import_react12.useEffect)(() => {
|
|
3606
4346
|
if (onDataChange && state.callData) {
|
|
3607
4347
|
const { process_id, process_name, status, phone_number, agent_id, convox_id } = state.callData;
|
|
3608
4348
|
const callData = {
|
|
@@ -3616,12 +4356,16 @@ function CallControls({ onDataChange }) {
|
|
|
3616
4356
|
onDataChange(callData);
|
|
3617
4357
|
}
|
|
3618
4358
|
}, [state.callData, onDataChange]);
|
|
3619
|
-
(0,
|
|
4359
|
+
(0, import_react12.useEffect)(() => {
|
|
3620
4360
|
if (state.agentId) {
|
|
3621
4361
|
axios_default.get(END_POINT.BREAKS_LIST).then((res) => {
|
|
3622
|
-
var _a3, _b2, _c2;
|
|
4362
|
+
var _a3, _b2, _c2, _d2;
|
|
3623
4363
|
if (res && ((_a3 = res.data) == null ? void 0 : _a3.data) && ((_c2 = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.length)) {
|
|
3624
4364
|
setBreaksList(res.data.data);
|
|
4365
|
+
const liveStatus = (_d2 = sdkStateManager.getState().callData) == null ? void 0 : _d2.status;
|
|
4366
|
+
if (!liveStatus) {
|
|
4367
|
+
handleUpdateAgentStatus(res.data.data[0].type);
|
|
4368
|
+
}
|
|
3625
4369
|
}
|
|
3626
4370
|
}).catch((err) => {
|
|
3627
4371
|
showToast(err.response.data.message, "error");
|
|
@@ -3656,13 +4400,13 @@ function CallControls({ onDataChange }) {
|
|
|
3656
4400
|
}, 3e4);
|
|
3657
4401
|
};
|
|
3658
4402
|
webSocketRef.current.onmessage = (event) => {
|
|
3659
|
-
var _a4, _b3, _c2, _d2, _e2;
|
|
4403
|
+
var _a4, _b3, _c2, _d2, _e2, _f2;
|
|
3660
4404
|
try {
|
|
3661
4405
|
const data = JSON.parse(event.data);
|
|
3662
4406
|
if (data.type === "pong") {
|
|
3663
4407
|
return;
|
|
3664
4408
|
}
|
|
3665
|
-
const sdkState = (0, import_vault5.
|
|
4409
|
+
const sdkState = (0, import_vault5.getSession)(STORAGE_KEY);
|
|
3666
4410
|
const confrence = getCombineConfrenceData(sdkState, data);
|
|
3667
4411
|
const callData = {
|
|
3668
4412
|
agent_id: data == null ? void 0 : data.agent_id,
|
|
@@ -3680,9 +4424,15 @@ function CallControls({ onDataChange }) {
|
|
|
3680
4424
|
};
|
|
3681
4425
|
sdkStateManager.updateCallData(callData);
|
|
3682
4426
|
sdkStateManager.updateConferenceData([...confrence]);
|
|
4427
|
+
sdkStateManager.setConsultInfo((_a4 = data.consult_info) != null ? _a4 : null);
|
|
4428
|
+
if (data == null ? void 0 : data.call_consult_controls) {
|
|
4429
|
+
sdkStateManager.updateSDKConfigFromPermissions(data.call_consult_controls);
|
|
4430
|
+
} else {
|
|
4431
|
+
sdkStateManager.resetConsultControls();
|
|
4432
|
+
}
|
|
3683
4433
|
if (["RINGING" /* RINGING */, "DIALING" /* DIALING */].includes(data.status)) {
|
|
3684
4434
|
setShowIframe(true);
|
|
3685
|
-
setCallWrapuptime((
|
|
4435
|
+
setCallWrapuptime((_c2 = (_b3 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _b3.auto_wrapup_time) != null ? _c2 : null);
|
|
3686
4436
|
sdkStateManager.updateConferenceData([
|
|
3687
4437
|
{
|
|
3688
4438
|
line: 1,
|
|
@@ -3735,7 +4485,7 @@ function CallControls({ onDataChange }) {
|
|
|
3735
4485
|
isMergeCall: false
|
|
3736
4486
|
}
|
|
3737
4487
|
]);
|
|
3738
|
-
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current && ((
|
|
4488
|
+
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current && ((_d2 = state == null ? void 0 : state.sdkConfig) == null ? void 0 : _d2.enableRingtone)) {
|
|
3739
4489
|
audioRef.current.play().catch((error) => {
|
|
3740
4490
|
console.error("Failed to play ringtone:", error);
|
|
3741
4491
|
});
|
|
@@ -3759,8 +4509,8 @@ function CallControls({ onDataChange }) {
|
|
|
3759
4509
|
}
|
|
3760
4510
|
} else if (((data == null ? void 0 : data.mute) === 1 || (data == null ? void 0 : data.hold) === 1) && data.status === "ONCALL" /* ONCALL */) {
|
|
3761
4511
|
} else if (data.status === "BREAK" /* BREAK */) {
|
|
3762
|
-
const breakTime = (
|
|
3763
|
-
const eventTime = (
|
|
4512
|
+
const breakTime = (_e2 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _e2.break_time;
|
|
4513
|
+
const eventTime = (_f2 = data == null ? void 0 : data.event_time) != null ? _f2 : null;
|
|
3764
4514
|
if (eventTime !== lastEventTimeRef.current) {
|
|
3765
4515
|
hasFlashedRef.current = false;
|
|
3766
4516
|
lastEventTimeRef.current = eventTime;
|
|
@@ -3822,7 +4572,7 @@ function CallControls({ onDataChange }) {
|
|
|
3822
4572
|
}
|
|
3823
4573
|
}
|
|
3824
4574
|
};
|
|
3825
|
-
(0,
|
|
4575
|
+
(0, import_react12.useEffect)(() => {
|
|
3826
4576
|
if (state.agentId) {
|
|
3827
4577
|
connectWebSocket();
|
|
3828
4578
|
}
|
|
@@ -3864,24 +4614,25 @@ function CallControls({ onDataChange }) {
|
|
|
3864
4614
|
}
|
|
3865
4615
|
const isOnHold = ((_h = state.callData) == null ? void 0 : _h.hold) === 1 && ((_j = (_i = state.callData) == null ? void 0 : _i.status) == null ? void 0 : _j.toUpperCase()) === "ONCALL" /* ONCALL */;
|
|
3866
4616
|
const isMuted = ((_k = state.callData) == null ? void 0 : _k.mute) === 1 && ((_m = (_l = state.callData) == null ? void 0 : _l.status) == null ? void 0 : _m.toUpperCase()) === "ONCALL" /* ONCALL */;
|
|
4617
|
+
const isVertical = ((_n = state.sdkConfig) == null ? void 0 : _n.sdkPosition) === "vertical";
|
|
3867
4618
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
3868
4619
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Fade, { in: true, timeout: 300, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3869
4620
|
import_material4.Paper,
|
|
3870
4621
|
{
|
|
3871
|
-
ref: ((
|
|
3872
|
-
elevation: isDragging ? 4 : ((
|
|
4622
|
+
ref: ((_o = state.sdkConfig) == null ? void 0 : _o.isDraggable) ? dragRef : null,
|
|
4623
|
+
elevation: isDragging ? 4 : ((_p = state.sdkConfig) == null ? void 0 : _p.isDraggable) ? 1 : 0,
|
|
3873
4624
|
sx: {
|
|
3874
|
-
position: ((
|
|
3875
|
-
left: ((
|
|
3876
|
-
top: ((
|
|
4625
|
+
position: ((_q = state.sdkConfig) == null ? void 0 : _q.isDraggable) ? "fixed" : "relative",
|
|
4626
|
+
left: ((_r = state.sdkConfig) == null ? void 0 : _r.isDraggable) ? position.x : "auto",
|
|
4627
|
+
top: ((_s = state.sdkConfig) == null ? void 0 : _s.isDraggable) ? position.y : "auto",
|
|
3877
4628
|
display: "inline-block",
|
|
3878
|
-
width: "auto",
|
|
4629
|
+
width: isVertical ? "180px" : "auto",
|
|
3879
4630
|
flexShrink: 0,
|
|
3880
4631
|
whiteSpace: "nowrap",
|
|
3881
4632
|
p: 0.5,
|
|
3882
4633
|
borderRadius: 3,
|
|
3883
4634
|
bgcolor: "background.paper",
|
|
3884
|
-
zIndex: ((
|
|
4635
|
+
zIndex: ((_t = state.sdkConfig) == null ? void 0 : _t.isDraggable) ? Number.MAX_SAFE_INTEGER : 0,
|
|
3885
4636
|
transition: theme.transitions.create(["box-shadow", "transform"], {
|
|
3886
4637
|
duration: theme.transitions.duration.short
|
|
3887
4638
|
}),
|
|
@@ -3892,7 +4643,8 @@ function CallControls({ onDataChange }) {
|
|
|
3892
4643
|
{
|
|
3893
4644
|
sx: {
|
|
3894
4645
|
display: "flex",
|
|
3895
|
-
|
|
4646
|
+
flexDirection: isVertical ? "column" : "row",
|
|
4647
|
+
alignItems: isVertical ? "stretch" : "center"
|
|
3896
4648
|
},
|
|
3897
4649
|
children: [
|
|
3898
4650
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
@@ -3900,12 +4652,13 @@ function CallControls({ onDataChange }) {
|
|
|
3900
4652
|
{
|
|
3901
4653
|
sx: {
|
|
3902
4654
|
display: "flex",
|
|
3903
|
-
|
|
4655
|
+
flexDirection: isVertical ? "column" : "row",
|
|
4656
|
+
alignItems: isVertical ? "stretch" : "center",
|
|
3904
4657
|
gap: 1,
|
|
3905
|
-
margin: "0px 10px"
|
|
4658
|
+
margin: isVertical ? "10px 8px 4px 8px" : "0px 10px"
|
|
3906
4659
|
},
|
|
3907
4660
|
children: [
|
|
3908
|
-
((
|
|
4661
|
+
((_u = state.sdkConfig) == null ? void 0 : _u.isDraggable) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3909
4662
|
import_material4.IconButton,
|
|
3910
4663
|
{
|
|
3911
4664
|
component: "div",
|
|
@@ -3918,8 +4671,49 @@ function CallControls({ onDataChange }) {
|
|
|
3918
4671
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.DragIndicator, {})
|
|
3919
4672
|
}
|
|
3920
4673
|
),
|
|
3921
|
-
((
|
|
3922
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((
|
|
4674
|
+
((_v = state.sdkConfig) == null ? void 0 : _v.enableQueueName) && ((_w = state == null ? void 0 : state.callData) == null ? void 0 : _w.queue_name) && ((_x = state == null ? void 0 : state.callData) == null ? void 0 : _x.mode) !== "manual" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Chip, { label: (_y = state == null ? void 0 : state.callData) == null ? void 0 : _y.queue_name }),
|
|
4675
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_z = state.sdkConfig) == null ? void 0 : _z.disabledDialButton) ? "Outbound call feature is disabled" : "Dial", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { component: "span", sx: isVertical ? { display: "block" } : {}, children: isVertical ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4676
|
+
import_material4.Button,
|
|
4677
|
+
{
|
|
4678
|
+
variant: "outlined",
|
|
4679
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.WifiCalling3, {}),
|
|
4680
|
+
onClick: (e) => {
|
|
4681
|
+
var _a3, _b2, _c2;
|
|
4682
|
+
if (![
|
|
4683
|
+
"BREAK" /* BREAK */,
|
|
4684
|
+
"ONCALL" /* ONCALL */,
|
|
4685
|
+
"RINGING" /* RINGING */,
|
|
4686
|
+
"WRAPUP" /* WRAPUP */
|
|
4687
|
+
].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) && !((_c2 = state.sdkConfig) == null ? void 0 : _c2.disabledDialButton)) {
|
|
4688
|
+
handleOpenDialer(e);
|
|
4689
|
+
}
|
|
4690
|
+
},
|
|
4691
|
+
disabled: [
|
|
4692
|
+
"BREAK" /* BREAK */,
|
|
4693
|
+
"ONCALL" /* ONCALL */,
|
|
4694
|
+
"RINGING" /* RINGING */,
|
|
4695
|
+
"WRAPUP" /* WRAPUP */
|
|
4696
|
+
].includes((_A = state.callData.status) == null ? void 0 : _A.toUpperCase()) || ((_B = state.sdkConfig) == null ? void 0 : _B.disabledDialButton),
|
|
4697
|
+
sx: {
|
|
4698
|
+
justifyContent: "flex-start",
|
|
4699
|
+
width: "100%",
|
|
4700
|
+
px: 2,
|
|
4701
|
+
color: [
|
|
4702
|
+
"BREAK" /* BREAK */,
|
|
4703
|
+
"ONCALL" /* ONCALL */,
|
|
4704
|
+
"RINGING" /* RINGING */,
|
|
4705
|
+
"WRAPUP" /* WRAPUP */
|
|
4706
|
+
].includes((_C = state.callData.status) == null ? void 0 : _C.toUpperCase()) || ((_D = state.sdkConfig) == null ? void 0 : _D.disabledDialButton) ? "action.selected" : "success.main",
|
|
4707
|
+
borderColor: [
|
|
4708
|
+
"BREAK" /* BREAK */,
|
|
4709
|
+
"ONCALL" /* ONCALL */,
|
|
4710
|
+
"RINGING" /* RINGING */,
|
|
4711
|
+
"WRAPUP" /* WRAPUP */
|
|
4712
|
+
].includes((_E = state.callData.status) == null ? void 0 : _E.toUpperCase()) || ((_F = state.sdkConfig) == null ? void 0 : _F.disabledDialButton) ? "action.selected" : "success.main"
|
|
4713
|
+
},
|
|
4714
|
+
children: "Dial"
|
|
4715
|
+
}
|
|
4716
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3923
4717
|
import_material4.IconButton,
|
|
3924
4718
|
{
|
|
3925
4719
|
size: "small",
|
|
@@ -3939,7 +4733,7 @@ function CallControls({ onDataChange }) {
|
|
|
3939
4733
|
"ONCALL" /* ONCALL */,
|
|
3940
4734
|
"RINGING" /* RINGING */,
|
|
3941
4735
|
"WRAPUP" /* WRAPUP */
|
|
3942
|
-
].includes((
|
|
4736
|
+
].includes((_G = state.callData.status) == null ? void 0 : _G.toUpperCase()) || ((_H = state.sdkConfig) == null ? void 0 : _H.disabledDialButton),
|
|
3943
4737
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3944
4738
|
import_icons_material2.WifiCalling3,
|
|
3945
4739
|
{
|
|
@@ -3949,7 +4743,7 @@ function CallControls({ onDataChange }) {
|
|
|
3949
4743
|
"ONCALL" /* ONCALL */,
|
|
3950
4744
|
"RINGING" /* RINGING */,
|
|
3951
4745
|
"WRAPUP" /* WRAPUP */
|
|
3952
|
-
].includes((
|
|
4746
|
+
].includes((_I = state.callData.status) == null ? void 0 : _I.toUpperCase()) || ((_J = state.sdkConfig) == null ? void 0 : _J.disabledDialButton) ? "action.selected" : "success.main"
|
|
3953
4747
|
}
|
|
3954
4748
|
}
|
|
3955
4749
|
)
|
|
@@ -4068,7 +4862,7 @@ function CallControls({ onDataChange }) {
|
|
|
4068
4862
|
width: "60px",
|
|
4069
4863
|
textAlign: "center"
|
|
4070
4864
|
},
|
|
4071
|
-
children: (
|
|
4865
|
+
children: (_M = (_L = (_K = state.callData) == null ? void 0 : _K.status) == null ? void 0 : _L.toUpperCase()) != null ? _M : "N/A"
|
|
4072
4866
|
}
|
|
4073
4867
|
),
|
|
4074
4868
|
onClick: handleOpenAgentStatus,
|
|
@@ -4084,17 +4878,20 @@ function CallControls({ onDataChange }) {
|
|
|
4084
4878
|
{
|
|
4085
4879
|
sx: {
|
|
4086
4880
|
display: "flex",
|
|
4881
|
+
flexDirection: isVertical ? "column" : "row",
|
|
4087
4882
|
gap: 1,
|
|
4088
4883
|
justifyContent: "center",
|
|
4089
|
-
alignItems: "center"
|
|
4884
|
+
alignItems: isVertical ? "stretch" : "center",
|
|
4885
|
+
margin: isVertical ? "0px 8px 8px 8px" : "0px"
|
|
4090
4886
|
},
|
|
4091
4887
|
children: [
|
|
4092
4888
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Agent Ready", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4093
4889
|
import_material4.Button,
|
|
4094
4890
|
{
|
|
4095
4891
|
variant: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
|
|
4096
|
-
(
|
|
4892
|
+
(_O = (_N = state.callData) == null ? void 0 : _N.status) == null ? void 0 : _O.toUpperCase()
|
|
4097
4893
|
) ? "outlined" : "contained",
|
|
4894
|
+
startIcon: isVertical ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SupportAgent, {}) : void 0,
|
|
4098
4895
|
onClick: (e) => {
|
|
4099
4896
|
var _a3, _b2;
|
|
4100
4897
|
if (["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
|
|
@@ -4106,20 +4903,21 @@ function CallControls({ onDataChange }) {
|
|
|
4106
4903
|
},
|
|
4107
4904
|
classes: {
|
|
4108
4905
|
root: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
|
|
4109
|
-
(
|
|
4906
|
+
(_Q = (_P = state.callData) == null ? void 0 : _P.status) == null ? void 0 : _Q.toUpperCase()
|
|
4110
4907
|
) ? "outlined" : "enabled"
|
|
4111
4908
|
},
|
|
4112
|
-
sx: __spreadValues({}, ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
|
|
4113
|
-
(
|
|
4114
|
-
) ? outlined : enabled),
|
|
4909
|
+
sx: __spreadValues(__spreadValues({}, ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
|
|
4910
|
+
(_S = (_R = state.callData) == null ? void 0 : _R.status) == null ? void 0 : _S.toUpperCase()
|
|
4911
|
+
) ? outlined : enabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }),
|
|
4115
4912
|
disabled: agentReadyLoading,
|
|
4116
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SupportAgent, {})
|
|
4913
|
+
children: isVertical ? "Agent Ready" : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SupportAgent, {})
|
|
4117
4914
|
}
|
|
4118
4915
|
) }),
|
|
4119
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((
|
|
4916
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_T = state.sdkConfig) == null ? void 0 : _T.disableHoldButton) ? "Hold feature is disabled" : ((_U = state.callData) == null ? void 0 : _U.hold) === 1 ? "Resume" : "Hold", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { component: "span", sx: isVertical ? { display: "block" } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4120
4917
|
import_material4.Button,
|
|
4121
4918
|
{
|
|
4122
|
-
variant: ((
|
|
4919
|
+
variant: ((_V = state.callData) == null ? void 0 : _V.hold) === 1 && ((_X = (_W = state.callData) == null ? void 0 : _W.status) == null ? void 0 : _X.toUpperCase()) === "ONCALL" /* ONCALL */ ? "contained" : "outlined",
|
|
4920
|
+
startIcon: isVertical ? holdOrUnHoldLoading ? void 0 : ((_Y = state.callData) == null ? void 0 : _Y.hold) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Pause, {}) : void 0,
|
|
4123
4921
|
onClick: (e) => {
|
|
4124
4922
|
var _a3;
|
|
4125
4923
|
e.stopPropagation();
|
|
@@ -4127,21 +4925,22 @@ function CallControls({ onDataChange }) {
|
|
|
4127
4925
|
handleHoldToggle();
|
|
4128
4926
|
}
|
|
4129
4927
|
},
|
|
4130
|
-
sx: ((
|
|
4131
|
-
disabled: ((
|
|
4928
|
+
sx: ((_Z = state.callData) == null ? void 0 : _Z.hold) === 1 && ((_$ = (__ = state.callData) == null ? void 0 : __.status) == null ? void 0 : _$.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues(__spreadValues({}, enabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : ((_ba = (_aa = state.callData) == null ? void 0 : _aa.status) == null ? void 0 : _ba.toUpperCase()) === "ONCALL" /* ONCALL */ && !((_ca = state.sdkConfig) == null ? void 0 : _ca.disableHoldButton) ? __spreadValues(__spreadValues({}, outlined), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : __spreadValues(__spreadValues({}, disabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }),
|
|
4929
|
+
disabled: ((_ea = (_da = state.callData) == null ? void 0 : _da.status) == null ? void 0 : _ea.toUpperCase()) !== "ONCALL" /* ONCALL */ && ((_fa = state.callData) == null ? void 0 : _fa.hold) !== 1 || holdOrUnHoldLoading || ((_ga = state.sdkConfig) == null ? void 0 : _ga.disableHoldButton),
|
|
4132
4930
|
children: holdOrUnHoldLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4133
4931
|
import_material4.CircularProgress,
|
|
4134
4932
|
{
|
|
4135
4933
|
size: "20px",
|
|
4136
4934
|
sx: { color: theme.palette.primary.main }
|
|
4137
4935
|
}
|
|
4138
|
-
) : ((
|
|
4936
|
+
) : isVertical ? ((_ha = state.callData) == null ? void 0 : _ha.hold) === 1 ? "Resume" : "Hold" : ((_ia = state.callData) == null ? void 0 : _ia.hold) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Pause, {})
|
|
4139
4937
|
}
|
|
4140
4938
|
) }) }),
|
|
4141
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((
|
|
4939
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_ja = state.sdkConfig) == null ? void 0 : _ja.disableMuteButton) ? "Mute feature is disabled" : ((_ka = state.callData) == null ? void 0 : _ka.mute) === 1 ? "Unmute" : "Mute", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { component: "span", sx: isVertical ? { display: "block" } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4142
4940
|
import_material4.Button,
|
|
4143
4941
|
{
|
|
4144
|
-
variant: ((
|
|
4942
|
+
variant: ((_la = state.callData) == null ? void 0 : _la.mute) === 1 && ((_na = (_ma = state.callData) == null ? void 0 : _ma.status) == null ? void 0 : _na.toUpperCase()) === "ONCALL" /* ONCALL */ ? "contained" : "outlined",
|
|
4943
|
+
startIcon: isVertical ? muteOrUnMuteLoading ? void 0 : ((_oa = state.callData) == null ? void 0 : _oa.mute) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MicOff, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Mic, {}) : void 0,
|
|
4145
4944
|
onClick: (e) => {
|
|
4146
4945
|
var _a3;
|
|
4147
4946
|
e.stopPropagation();
|
|
@@ -4149,21 +4948,22 @@ function CallControls({ onDataChange }) {
|
|
|
4149
4948
|
handleMuteToggle();
|
|
4150
4949
|
}
|
|
4151
4950
|
},
|
|
4152
|
-
sx: ((
|
|
4153
|
-
disabled: ((
|
|
4951
|
+
sx: ((_pa = state.sdkConfig) == null ? void 0 : _pa.disableMuteButton) || ((_qa = state.callData) == null ? void 0 : _qa.hold) === 1 ? __spreadValues(__spreadValues({}, disabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : ((_ra = state.callData) == null ? void 0 : _ra.mute) === 1 && ((_ta = (_sa = state.callData) == null ? void 0 : _sa.status) == null ? void 0 : _ta.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues(__spreadValues({}, enabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : ((_va = (_ua = state.callData) == null ? void 0 : _ua.status) == null ? void 0 : _va.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues(__spreadValues({}, outlined), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : __spreadValues(__spreadValues({}, disabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }),
|
|
4952
|
+
disabled: ((_xa = (_wa = state.callData) == null ? void 0 : _wa.status) == null ? void 0 : _xa.toUpperCase()) !== "ONCALL" /* ONCALL */ && ((_ya = state.callData) == null ? void 0 : _ya.mute) !== 1 || muteOrUnMuteLoading || ((_za = state.callData) == null ? void 0 : _za.hold) === 1 || ((_Aa = state.sdkConfig) == null ? void 0 : _Aa.disableMuteButton),
|
|
4154
4953
|
children: muteOrUnMuteLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4155
4954
|
import_material4.CircularProgress,
|
|
4156
4955
|
{
|
|
4157
4956
|
size: "20px",
|
|
4158
4957
|
sx: { color: theme.palette.primary.main }
|
|
4159
4958
|
}
|
|
4160
|
-
) : ((
|
|
4959
|
+
) : isVertical ? ((_Ba = state.callData) == null ? void 0 : _Ba.mute) === 1 ? "Unmute" : "Mute" : ((_Ca = state.callData) == null ? void 0 : _Ca.mute) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MicOff, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Mic, {})
|
|
4161
4960
|
}
|
|
4162
4961
|
) }) }),
|
|
4163
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((
|
|
4962
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_Da = state.sdkConfig) == null ? void 0 : _Da.disableCallTransferButton) ? "Transfer Call feature is disabled" : "Transfer Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { component: "span", sx: isVertical ? { display: "block" } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4164
4963
|
import_material4.Button,
|
|
4165
4964
|
{
|
|
4166
4965
|
variant: state.openCallTransferDialog ? "contained" : "outlined",
|
|
4966
|
+
startIcon: isVertical ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.TransferWithinAStation, {}) : void 0,
|
|
4167
4967
|
onClick: (e) => {
|
|
4168
4968
|
var _a3, _b2, _c2;
|
|
4169
4969
|
if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */ && !((_c2 = state.sdkConfig) == null ? void 0 : _c2.disableCallTransferButton)) {
|
|
@@ -4171,15 +4971,16 @@ function CallControls({ onDataChange }) {
|
|
|
4171
4971
|
sdkStateManager.setOpenCallTransferDialog(true);
|
|
4172
4972
|
}
|
|
4173
4973
|
},
|
|
4174
|
-
sx: state.openCallTransferDialog ? __spreadValues({}, enabled) : ((
|
|
4175
|
-
disabled: ((
|
|
4176
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.TransferWithinAStation, {})
|
|
4974
|
+
sx: state.openCallTransferDialog ? __spreadValues(__spreadValues({}, enabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : ((_Fa = (_Ea = state.callData) == null ? void 0 : _Ea.status) == null ? void 0 : _Fa.toUpperCase()) === "ONCALL" /* ONCALL */ && !((_Ga = state.sdkConfig) == null ? void 0 : _Ga.disableCallTransferButton) ? __spreadValues(__spreadValues({}, outlined), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : __spreadValues(__spreadValues({}, disabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }),
|
|
4975
|
+
disabled: ((_Ia = (_Ha = state.callData) == null ? void 0 : _Ha.status) == null ? void 0 : _Ia.toUpperCase()) !== "ONCALL" /* ONCALL */ || ((_Ja = state.sdkConfig) == null ? void 0 : _Ja.disableCallTransferButton),
|
|
4976
|
+
children: isVertical ? "Transfer" : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.TransferWithinAStation, {})
|
|
4177
4977
|
}
|
|
4178
4978
|
) }) }),
|
|
4179
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((
|
|
4979
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_Ka = state.sdkConfig) == null ? void 0 : _Ka.disableConferenceButton) ? "Conference Call feature is disabled" : "Conference Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { component: "span", sx: isVertical ? { display: "block" } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4180
4980
|
import_material4.Button,
|
|
4181
4981
|
{
|
|
4182
4982
|
variant: state.openConferenceDialog ? "contained" : "outlined",
|
|
4983
|
+
startIcon: isVertical ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Group, {}) : void 0,
|
|
4183
4984
|
onClick: (e) => {
|
|
4184
4985
|
var _a3, _b2, _c2;
|
|
4185
4986
|
if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */ && !((_c2 = state.sdkConfig) == null ? void 0 : _c2.disableConferenceButton)) {
|
|
@@ -4187,15 +4988,16 @@ function CallControls({ onDataChange }) {
|
|
|
4187
4988
|
sdkStateManager.setOpenConferenceDialog(true);
|
|
4188
4989
|
}
|
|
4189
4990
|
},
|
|
4190
|
-
sx: state.openConferenceDialog ? __spreadValues({}, enabled) : ((
|
|
4191
|
-
disabled: ((
|
|
4192
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Group, {})
|
|
4991
|
+
sx: state.openConferenceDialog ? __spreadValues(__spreadValues({}, enabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : ((_Ma = (_La = state.callData) == null ? void 0 : _La.status) == null ? void 0 : _Ma.toUpperCase()) === "ONCALL" /* ONCALL */ && !((_Na = state.sdkConfig) == null ? void 0 : _Na.disableConferenceButton) ? __spreadValues(__spreadValues({}, outlined), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : __spreadValues(__spreadValues({}, disabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }),
|
|
4992
|
+
disabled: ((_Pa = (_Oa = state.callData) == null ? void 0 : _Oa.status) == null ? void 0 : _Pa.toUpperCase()) !== "ONCALL" /* ONCALL */ || ((_Qa = state.sdkConfig) == null ? void 0 : _Qa.disableConferenceButton),
|
|
4993
|
+
children: isVertical ? "Conference" : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Group, {})
|
|
4193
4994
|
}
|
|
4194
4995
|
) }) }),
|
|
4195
|
-
((
|
|
4996
|
+
((_Ra = state.sdkConfig) == null ? void 0 : _Ra.enableSmsServices) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Send SMS", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4196
4997
|
import_material4.Button,
|
|
4197
4998
|
{
|
|
4198
4999
|
variant: Boolean(ambulanceAnchorEl) ? "contained" : "outlined",
|
|
5000
|
+
startIcon: isVertical ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SmsSharp, {}) : void 0,
|
|
4199
5001
|
onClick: (e) => {
|
|
4200
5002
|
var _a3, _b2;
|
|
4201
5003
|
if (["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
|
|
@@ -4205,16 +5007,16 @@ function CallControls({ onDataChange }) {
|
|
|
4205
5007
|
handleOpenAbulanceServices(e);
|
|
4206
5008
|
}
|
|
4207
5009
|
},
|
|
4208
|
-
sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) : ["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
|
|
4209
|
-
(
|
|
4210
|
-
) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
5010
|
+
sx: Boolean(ambulanceAnchorEl) ? __spreadValues(__spreadValues({}, enabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : ["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
|
|
5011
|
+
(_Ta = (_Sa = state.callData) == null ? void 0 : _Sa.status) == null ? void 0 : _Ta.toUpperCase()
|
|
5012
|
+
) ? __spreadValues(__spreadValues({}, outlined), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : __spreadValues(__spreadValues({}, disabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }),
|
|
4211
5013
|
disabled: !["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
|
|
4212
|
-
(
|
|
5014
|
+
(_Va = (_Ua = state.callData) == null ? void 0 : _Ua.status) == null ? void 0 : _Va.toUpperCase()
|
|
4213
5015
|
),
|
|
4214
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SmsSharp, {})
|
|
5016
|
+
children: isVertical ? "Send SMS" : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SmsSharp, {})
|
|
4215
5017
|
}
|
|
4216
5018
|
) }),
|
|
4217
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((
|
|
5019
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_Wa = state.sdkConfig) == null ? void 0 : _Wa.disableEndCallButton) ? "End Call feature is disabled" : "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { component: "span", sx: isVertical ? { display: "block" } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4218
5020
|
import_material4.Button,
|
|
4219
5021
|
{
|
|
4220
5022
|
variant: [
|
|
@@ -4222,7 +5024,8 @@ function CallControls({ onDataChange }) {
|
|
|
4222
5024
|
"RINGING" /* RINGING */,
|
|
4223
5025
|
"DIALING" /* DIALING */,
|
|
4224
5026
|
"WRAPUP" /* WRAPUP */
|
|
4225
|
-
].includes((
|
|
5027
|
+
].includes((_Ya = (_Xa = state.callData) == null ? void 0 : _Xa.status) == null ? void 0 : _Ya.toUpperCase()) && !((_Za = state.sdkConfig) == null ? void 0 : _Za.disableEndCallButton) ? "contained" : "outlined",
|
|
5028
|
+
startIcon: isVertical && !endCallLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.CallEnd, {}) : void 0,
|
|
4226
5029
|
onClick: (e) => {
|
|
4227
5030
|
var _a3, _b2, _c2;
|
|
4228
5031
|
if ([
|
|
@@ -4240,7 +5043,7 @@ function CallControls({ onDataChange }) {
|
|
|
4240
5043
|
"RINGING" /* RINGING */,
|
|
4241
5044
|
"DIALING" /* DIALING */,
|
|
4242
5045
|
"WRAPUP" /* WRAPUP */
|
|
4243
|
-
].includes((
|
|
5046
|
+
].includes((_$a = (__a = state.callData) == null ? void 0 : __a.status) == null ? void 0 : _$a.toUpperCase()) && !((_ab = state.sdkConfig) == null ? void 0 : _ab.disableEndCallButton) ? __spreadValues(__spreadProps(__spreadValues({}, enabled), {
|
|
4244
5047
|
borderRight: "1px",
|
|
4245
5048
|
backgroundColor: "error.main",
|
|
4246
5049
|
minWidth: "60px !important",
|
|
@@ -4256,22 +5059,23 @@ function CallControls({ onDataChange }) {
|
|
|
4256
5059
|
bgcolor: "error.light",
|
|
4257
5060
|
boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
|
|
4258
5061
|
}
|
|
4259
|
-
}) : __spreadProps(__spreadValues({}, disabled), {
|
|
5062
|
+
}), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : __spreadValues(__spreadProps(__spreadValues({}, disabled), {
|
|
4260
5063
|
minWidth: "60px !important"
|
|
4261
|
-
}),
|
|
5064
|
+
}), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }),
|
|
4262
5065
|
disabled: ![
|
|
4263
5066
|
"ONCALL" /* ONCALL */,
|
|
4264
5067
|
"RINGING" /* RINGING */,
|
|
4265
5068
|
"DIALING" /* DIALING */,
|
|
4266
5069
|
"WRAPUP" /* WRAPUP */
|
|
4267
|
-
].includes((
|
|
4268
|
-
children: endCallLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.CircularProgress, { size: "20px", color: "error" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.CallEnd, {})
|
|
5070
|
+
].includes((_cb = (_bb = state.callData) == null ? void 0 : _bb.status) == null ? void 0 : _cb.toUpperCase()) || endCallLoading || ((_db = state.sdkConfig) == null ? void 0 : _db.disableEndCallButton),
|
|
5071
|
+
children: endCallLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.CircularProgress, { size: "20px", color: "error" }) : isVertical ? "End Call" : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.CallEnd, {})
|
|
4269
5072
|
}
|
|
4270
5073
|
) }) }),
|
|
4271
|
-
!((
|
|
5074
|
+
!((_eb = state.sdkConfig) == null ? void 0 : _eb.disabledMoreOptionsButton) && processList && (processList == null ? void 0 : processList.length) > 1 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Switch Process", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4272
5075
|
import_material4.Button,
|
|
4273
5076
|
{
|
|
4274
5077
|
variant: Boolean(moreOptionsAnchorEl) ? "contained" : "outlined",
|
|
5078
|
+
startIcon: isVertical ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MoreVert, {}) : void 0,
|
|
4275
5079
|
onClick: (e) => {
|
|
4276
5080
|
var _a3, _b2;
|
|
4277
5081
|
if (["BREAK" /* BREAK */, "IDLE" /* IDLE */].includes(
|
|
@@ -4281,11 +5085,11 @@ function CallControls({ onDataChange }) {
|
|
|
4281
5085
|
handleOpenMoreOptions(e);
|
|
4282
5086
|
}
|
|
4283
5087
|
},
|
|
4284
|
-
sx: Boolean(moreOptionsAnchorEl) ? __spreadValues({}, enabled) : __spreadValues({}, outlined),
|
|
5088
|
+
sx: Boolean(moreOptionsAnchorEl) ? __spreadValues(__spreadValues({}, enabled), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }) : __spreadValues(__spreadValues({}, outlined), isVertical && { justifyContent: "flex-start", width: "100%", px: 2 }),
|
|
4285
5089
|
disabled: !["BREAK" /* BREAK */, "IDLE" /* IDLE */].includes(
|
|
4286
|
-
(
|
|
5090
|
+
(_gb = (_fb = state.callData) == null ? void 0 : _fb.status) == null ? void 0 : _gb.toUpperCase()
|
|
4287
5091
|
),
|
|
4288
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MoreVert, {})
|
|
5092
|
+
children: isVertical ? "Switch Process" : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MoreVert, {})
|
|
4289
5093
|
}
|
|
4290
5094
|
) })
|
|
4291
5095
|
]
|
|
@@ -4316,7 +5120,7 @@ function CallControls({ onDataChange }) {
|
|
|
4316
5120
|
transition: theme.transitions.create(["box-shadow", "transform"], {
|
|
4317
5121
|
duration: theme.transitions.duration.short
|
|
4318
5122
|
}),
|
|
4319
|
-
visibility: showIframe && !((
|
|
5123
|
+
visibility: showIframe && !((_hb = state.sdkConfig) == null ? void 0 : _hb.disableSoftPhone) ? "visible" : "hidden",
|
|
4320
5124
|
userSelect: "none"
|
|
4321
5125
|
},
|
|
4322
5126
|
children: [
|
|
@@ -4351,7 +5155,7 @@ function CallControls({ onDataChange }) {
|
|
|
4351
5155
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4352
5156
|
"iframe",
|
|
4353
5157
|
{
|
|
4354
|
-
src: `${(
|
|
5158
|
+
src: `${(_ib = state.urlConfig) == null ? void 0 : _ib.iframeURL}/static/phone/index.html?user_id=${(_jb = state.urlConfig) == null ? void 0 : _jb.id}&api_url=${(_kb = state.urlConfig) == null ? void 0 : _kb.iframeAPIURL}&token=${(_lb = state.authorization) == null ? void 0 : _lb.accessToken}`,
|
|
4355
5159
|
height: 380,
|
|
4356
5160
|
width: 420,
|
|
4357
5161
|
allow: "camera; microphone; autoplay",
|
|
@@ -4665,18 +5469,14 @@ function CallControls({ onDataChange }) {
|
|
|
4665
5469
|
] });
|
|
4666
5470
|
}
|
|
4667
5471
|
|
|
4668
|
-
// call-control-sdk/lib/components/SDKProvider.tsx
|
|
4669
|
-
var import_react12 = require("react");
|
|
4670
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4671
|
-
var SDKProvider = (0, import_react12.memo)(({ children }) => {
|
|
4672
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ToastProvider, { children });
|
|
4673
|
-
});
|
|
4674
|
-
SDKProvider.displayName = "SDKProvider";
|
|
4675
|
-
|
|
4676
5472
|
// call-control-sdk/lib/components/callControlPanel.tsx
|
|
5473
|
+
init_SDKProvider();
|
|
5474
|
+
init_permissions();
|
|
4677
5475
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4678
|
-
var CallControlPanel = (0,
|
|
4679
|
-
|
|
5476
|
+
var CallControlPanel = (0, import_react14.memo)(({ onDataChange }) => {
|
|
5477
|
+
var _a2;
|
|
5478
|
+
const { sdk } = useSDKState();
|
|
5479
|
+
const handleDataChange = (0, import_react14.useCallback)(
|
|
4680
5480
|
(data) => {
|
|
4681
5481
|
try {
|
|
4682
5482
|
if (onDataChange && typeof onDataChange === "function") {
|
|
@@ -4688,10 +5488,355 @@ var CallControlPanel = (0, import_react13.memo)(({ onDataChange }) => {
|
|
|
4688
5488
|
},
|
|
4689
5489
|
[onDataChange]
|
|
4690
5490
|
);
|
|
5491
|
+
const sdkObject = sdk == null ? void 0 : sdk.calls;
|
|
5492
|
+
const hasDialerAccess = (sdkObject == null ? void 0 : sdkObject.enabled) && ((_a2 = sdkObject == null ? void 0 : sdkObject.items) == null ? void 0 : _a2.some(
|
|
5493
|
+
(item) => item.code === SDK_PERMISSIONS.CALL_OUTBOUND || item.code === SDK_PERMISSIONS.CALL_INBOUND
|
|
5494
|
+
));
|
|
5495
|
+
if (!hasDialerAccess) return null;
|
|
4691
5496
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SDKProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CallControls, { onDataChange: handleDataChange }) });
|
|
4692
5497
|
});
|
|
4693
5498
|
CallControlPanel.displayName = "CallControlPanel";
|
|
4694
5499
|
|
|
5500
|
+
// call-control-sdk/lib/pages/sdkPages.tsx
|
|
5501
|
+
var import_react18 = __toESM(require("react"));
|
|
5502
|
+
|
|
5503
|
+
// call-control-sdk/lib/hooks/useSDKPermissions.ts
|
|
5504
|
+
var import_react15 = require("react");
|
|
5505
|
+
init_sdk_state();
|
|
5506
|
+
function useSDKPermissions() {
|
|
5507
|
+
var _a2, _b;
|
|
5508
|
+
const [state, setState] = (0, import_react15.useState)(() => sdkStateManager.getState());
|
|
5509
|
+
(0, import_react15.useEffect)(() => {
|
|
5510
|
+
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
5511
|
+
setState(sdkStateManager.getState());
|
|
5512
|
+
});
|
|
5513
|
+
return unsubscribe;
|
|
5514
|
+
}, []);
|
|
5515
|
+
const hasPermission = (0, import_react15.useCallback)(
|
|
5516
|
+
(permission) => sdkStateManager.hasPermission(permission),
|
|
5517
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5518
|
+
[state.userPermissions]
|
|
5519
|
+
);
|
|
5520
|
+
const hasAnyPermission = (0, import_react15.useCallback)(
|
|
5521
|
+
(permissions) => sdkStateManager.hasAnyPermission(permissions),
|
|
5522
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5523
|
+
[state.userPermissions]
|
|
5524
|
+
);
|
|
5525
|
+
const hasAllPermissions = (0, import_react15.useCallback)(
|
|
5526
|
+
(permissions) => sdkStateManager.hasAllPermissions(permissions),
|
|
5527
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5528
|
+
[state.userPermissions]
|
|
5529
|
+
);
|
|
5530
|
+
const hasMenuFeature = (0, import_react15.useCallback)(
|
|
5531
|
+
(code) => sdkStateManager.hasMenuFeature(code),
|
|
5532
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5533
|
+
[state.menuEntitlements]
|
|
5534
|
+
);
|
|
5535
|
+
return {
|
|
5536
|
+
permissions: (_a2 = state.userPermissions) != null ? _a2 : [],
|
|
5537
|
+
menuEntitlements: (_b = state.menuEntitlements) != null ? _b : [],
|
|
5538
|
+
isLoaded: state.isPermissionsLoaded,
|
|
5539
|
+
hasPermission,
|
|
5540
|
+
hasAnyPermission,
|
|
5541
|
+
hasAllPermissions,
|
|
5542
|
+
hasMenuFeature
|
|
5543
|
+
};
|
|
5544
|
+
}
|
|
5545
|
+
|
|
5546
|
+
// call-control-sdk/lib/components/SDKAccessDenied.tsx
|
|
5547
|
+
var import_material5 = require("@mui/material");
|
|
5548
|
+
var import_LockOutlined = __toESM(require("@mui/icons-material/LockOutlined"));
|
|
5549
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5550
|
+
var SDKAccessDenied = ({
|
|
5551
|
+
message = "You don't have permission to view this page."
|
|
5552
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
5553
|
+
import_material5.Box,
|
|
5554
|
+
{
|
|
5555
|
+
display: "flex",
|
|
5556
|
+
flexDirection: "column",
|
|
5557
|
+
alignItems: "center",
|
|
5558
|
+
justifyContent: "center",
|
|
5559
|
+
minHeight: 300,
|
|
5560
|
+
gap: 2,
|
|
5561
|
+
p: 4,
|
|
5562
|
+
children: [
|
|
5563
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_LockOutlined.default, { sx: { fontSize: 56, color: "text.disabled" } }),
|
|
5564
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material5.Typography, { variant: "h6", fontWeight: 600, color: "text.secondary", children: "Access Denied" }),
|
|
5565
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material5.Typography, { variant: "body2", color: "text.disabled", textAlign: "center", children: message })
|
|
5566
|
+
]
|
|
5567
|
+
}
|
|
5568
|
+
);
|
|
5569
|
+
|
|
5570
|
+
// call-control-sdk/lib/components/SDKPermissionGuard.tsx
|
|
5571
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5572
|
+
var SDKPermissionGuard = ({
|
|
5573
|
+
children,
|
|
5574
|
+
permission,
|
|
5575
|
+
permissions,
|
|
5576
|
+
requireAll = false,
|
|
5577
|
+
menuFeature,
|
|
5578
|
+
requireAllMenus = false,
|
|
5579
|
+
fallback,
|
|
5580
|
+
showFallback = true,
|
|
5581
|
+
onDenied
|
|
5582
|
+
}) => {
|
|
5583
|
+
const { isLoaded, hasPermission, hasAnyPermission, hasAllPermissions, hasMenuFeature } = useSDKPermissions();
|
|
5584
|
+
if (!isLoaded) return null;
|
|
5585
|
+
const isAllowed = checkAccess({
|
|
5586
|
+
permission,
|
|
5587
|
+
permissions,
|
|
5588
|
+
requireAll,
|
|
5589
|
+
menuFeature,
|
|
5590
|
+
requireAllMenus,
|
|
5591
|
+
hasPermission,
|
|
5592
|
+
hasAnyPermission,
|
|
5593
|
+
hasAllPermissions,
|
|
5594
|
+
hasMenuFeature
|
|
5595
|
+
});
|
|
5596
|
+
if (!isAllowed) {
|
|
5597
|
+
onDenied == null ? void 0 : onDenied();
|
|
5598
|
+
if (fallback !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: fallback });
|
|
5599
|
+
if (showFallback) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SDKAccessDenied, {});
|
|
5600
|
+
return null;
|
|
5601
|
+
}
|
|
5602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children });
|
|
5603
|
+
};
|
|
5604
|
+
function checkAccess({
|
|
5605
|
+
permission,
|
|
5606
|
+
permissions,
|
|
5607
|
+
requireAll,
|
|
5608
|
+
menuFeature,
|
|
5609
|
+
requireAllMenus,
|
|
5610
|
+
hasPermission,
|
|
5611
|
+
hasAnyPermission,
|
|
5612
|
+
hasAllPermissions,
|
|
5613
|
+
hasMenuFeature
|
|
5614
|
+
}) {
|
|
5615
|
+
const menuCodes = menuFeature ? Array.isArray(menuFeature) ? menuFeature : [menuFeature] : [];
|
|
5616
|
+
const hasNoGuards = !permission && (!permissions || permissions.length === 0) && menuCodes.length === 0;
|
|
5617
|
+
if (hasNoGuards) return true;
|
|
5618
|
+
if (menuCodes.length > 0) {
|
|
5619
|
+
const menuGranted = requireAllMenus ? menuCodes.every((c) => hasMenuFeature(c)) : menuCodes.some((c) => hasMenuFeature(c));
|
|
5620
|
+
if (!menuGranted) return false;
|
|
5621
|
+
}
|
|
5622
|
+
if (permission && !hasPermission(permission)) return false;
|
|
5623
|
+
if (permissions && permissions.length > 0) {
|
|
5624
|
+
const granted = requireAll ? hasAllPermissions(permissions) : hasAnyPermission(permissions);
|
|
5625
|
+
if (!granted) return false;
|
|
5626
|
+
}
|
|
5627
|
+
return true;
|
|
5628
|
+
}
|
|
5629
|
+
|
|
5630
|
+
// call-control-sdk/lib/pages/sdkPages.tsx
|
|
5631
|
+
init_permissions();
|
|
5632
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5633
|
+
function withGuard(menuCodes, loader) {
|
|
5634
|
+
return import_react18.default.lazy(async () => {
|
|
5635
|
+
const mod = await loader();
|
|
5636
|
+
const Page = mod.default;
|
|
5637
|
+
const Guarded = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SDKPermissionGuard, { menuFeature: menuCodes, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Page, __spreadValues({}, props)) });
|
|
5638
|
+
return { default: Guarded };
|
|
5639
|
+
});
|
|
5640
|
+
}
|
|
5641
|
+
var SDKPages = {
|
|
5642
|
+
CallHistory: withGuard(SDK_MENU_CODES.CALL_HISTORY, () => Promise.resolve().then(() => (init_callHistory(), callHistory_exports)))
|
|
5643
|
+
};
|
|
5644
|
+
|
|
5645
|
+
// call-control-sdk/lib/hooks/useClickToConference.ts
|
|
5646
|
+
var import_react19 = require("react");
|
|
5647
|
+
init_endPoint();
|
|
5648
|
+
init_axios();
|
|
5649
|
+
init_sdk_state();
|
|
5650
|
+
var import_vault6 = require("@react-solutions/vault");
|
|
5651
|
+
init_storage();
|
|
5652
|
+
var useClickToConference = () => {
|
|
5653
|
+
const [loading, setLoading] = (0, import_react19.useState)(false);
|
|
5654
|
+
const [success, setSuccess] = (0, import_react19.useState)(false);
|
|
5655
|
+
const [isError, setIsError] = (0, import_react19.useState)(false);
|
|
5656
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
5657
|
+
const [data, setData] = (0, import_react19.useState)(null);
|
|
5658
|
+
const pendingLineRef = (0, import_react19.useRef)(null);
|
|
5659
|
+
const prevConferenceRef = (0, import_react19.useRef)([]);
|
|
5660
|
+
(0, import_react19.useEffect)(() => {
|
|
5661
|
+
if (pendingLineRef.current === null) return;
|
|
5662
|
+
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
5663
|
+
var _a2;
|
|
5664
|
+
const state = sdkStateManager.getState();
|
|
5665
|
+
const targetLine = pendingLineRef.current;
|
|
5666
|
+
if (targetLine === null) return;
|
|
5667
|
+
const line = (_a2 = state.conferenceLine) == null ? void 0 : _a2.find(
|
|
5668
|
+
(l) => l.line === targetLine
|
|
5669
|
+
);
|
|
5670
|
+
if (line && line.status !== "IDLE") {
|
|
5671
|
+
pendingLineRef.current = null;
|
|
5672
|
+
prevConferenceRef.current = [];
|
|
5673
|
+
sdkStateManager.setOpenConferenceDialog(true);
|
|
5674
|
+
}
|
|
5675
|
+
});
|
|
5676
|
+
return unsubscribe;
|
|
5677
|
+
}, [loading]);
|
|
5678
|
+
const handleStartConferenceCall = (0, import_react19.useCallback)(
|
|
5679
|
+
async (payload) => {
|
|
5680
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5681
|
+
const state = (0, import_vault6.getSession)(STORAGE_KEY);
|
|
5682
|
+
if (((_a2 = state == null ? void 0 : state.callData) == null ? void 0 : _a2.status) !== "ONCALL") {
|
|
5683
|
+
const msg = "Conference call requires an active call (ONCALL status)";
|
|
5684
|
+
setIsError(true);
|
|
5685
|
+
setError(new Error(msg));
|
|
5686
|
+
throw new Error(msg);
|
|
5687
|
+
}
|
|
5688
|
+
const availableLine = payload.lineNumber != null ? (_b = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _b.find(
|
|
5689
|
+
(l) => l.line === payload.lineNumber
|
|
5690
|
+
) : (_d = (_c = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _c.filter((l) => l.line !== 1)) == null ? void 0 : _d.find((l) => l.status === "IDLE" && !(l == null ? void 0 : l.isCallStart));
|
|
5691
|
+
if (!availableLine) {
|
|
5692
|
+
const msg = "No available conference line found";
|
|
5693
|
+
setIsError(true);
|
|
5694
|
+
setError(new Error(msg));
|
|
5695
|
+
throw new Error(msg);
|
|
5696
|
+
}
|
|
5697
|
+
const requestPayload = {
|
|
5698
|
+
action: "EXTERNAL_CONFERENCE",
|
|
5699
|
+
operation: `CALL${availableLine.line}`,
|
|
5700
|
+
target: payload.mobileNumber,
|
|
5701
|
+
line_number: Number(availableLine.line),
|
|
5702
|
+
userid: (_f = (_e = state.callData) == null ? void 0 : _e.agent_id) != null ? _f : -1,
|
|
5703
|
+
process: (_h = (_g = state.callData) == null ? void 0 : _g.process_name) != null ? _h : ""
|
|
5704
|
+
};
|
|
5705
|
+
setLoading(true);
|
|
5706
|
+
setIsError(false);
|
|
5707
|
+
setError(null);
|
|
5708
|
+
setSuccess(false);
|
|
5709
|
+
pendingLineRef.current = availableLine.line;
|
|
5710
|
+
return axios_default.post(END_POINT.CONFERENCE_CALL, requestPayload).then((res) => {
|
|
5711
|
+
setData(res == null ? void 0 : res.data);
|
|
5712
|
+
setSuccess(true);
|
|
5713
|
+
return res == null ? void 0 : res.data;
|
|
5714
|
+
}).catch((err) => {
|
|
5715
|
+
var _a3;
|
|
5716
|
+
pendingLineRef.current = null;
|
|
5717
|
+
setIsError(true);
|
|
5718
|
+
setError(err);
|
|
5719
|
+
return (_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.data;
|
|
5720
|
+
}).finally(() => {
|
|
5721
|
+
setLoading(false);
|
|
5722
|
+
});
|
|
5723
|
+
},
|
|
5724
|
+
[]
|
|
5725
|
+
);
|
|
5726
|
+
return {
|
|
5727
|
+
handleStartConferenceCall,
|
|
5728
|
+
isLoading: loading,
|
|
5729
|
+
isSuccess: success,
|
|
5730
|
+
isError,
|
|
5731
|
+
error,
|
|
5732
|
+
data
|
|
5733
|
+
};
|
|
5734
|
+
};
|
|
5735
|
+
|
|
5736
|
+
// call-control-sdk/index.ts
|
|
5737
|
+
init_sdk_state();
|
|
5738
|
+
|
|
5739
|
+
// call-control-sdk/lib/angular-services/index.ts
|
|
5740
|
+
var import_vault7 = require("@react-solutions/vault");
|
|
5741
|
+
init_axios();
|
|
5742
|
+
init_endPoint();
|
|
5743
|
+
init_sdk_state();
|
|
5744
|
+
init_storage();
|
|
5745
|
+
async function clickToCall(payload) {
|
|
5746
|
+
const state = (0, import_vault7.getSession)(STORAGE_KEY);
|
|
5747
|
+
const body = {
|
|
5748
|
+
action: "CALL",
|
|
5749
|
+
userId: state == null ? void 0 : state.agentId,
|
|
5750
|
+
phone_number: payload.mobileNumber
|
|
5751
|
+
};
|
|
5752
|
+
try {
|
|
5753
|
+
const res = await axios_default.post(END_POINT.CLICK_TO_CALL, body);
|
|
5754
|
+
sdkStateManager.resetConferenceLines();
|
|
5755
|
+
if (!(res == null ? void 0 : res.success)) {
|
|
5756
|
+
throw res;
|
|
5757
|
+
}
|
|
5758
|
+
return res.data;
|
|
5759
|
+
} catch (err) {
|
|
5760
|
+
throw err;
|
|
5761
|
+
}
|
|
5762
|
+
}
|
|
5763
|
+
async function clickToConference(payload) {
|
|
5764
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
5765
|
+
const state = (0, import_vault7.getSession)(STORAGE_KEY);
|
|
5766
|
+
const availableLine = payload.lineNumber != null ? (_a2 = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _a2.find((l) => l.line === payload.lineNumber) : (_c = (_b = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _b.filter((l) => l.line !== 1)) == null ? void 0 : _c.find((l) => l.status === "IDLE" && !(l == null ? void 0 : l.isCallStart));
|
|
5767
|
+
if (!availableLine) {
|
|
5768
|
+
throw new Error("No available conference line found");
|
|
5769
|
+
}
|
|
5770
|
+
const body = {
|
|
5771
|
+
action: "EXTERNAL_CONFERENCE",
|
|
5772
|
+
operation: `CALL${availableLine.line}`,
|
|
5773
|
+
target: payload.mobileNumber,
|
|
5774
|
+
line_number: Number(availableLine.line),
|
|
5775
|
+
userid: (_e = (_d = state.callData) == null ? void 0 : _d.agent_id) != null ? _e : -1,
|
|
5776
|
+
process: (_g = (_f = state.callData) == null ? void 0 : _f.process_name) != null ? _g : ""
|
|
5777
|
+
};
|
|
5778
|
+
try {
|
|
5779
|
+
const res = await axios_default.post(END_POINT.CONFERENCE_CALL, body);
|
|
5780
|
+
sdkStateManager.setOpenConferenceDialog(true);
|
|
5781
|
+
if (!(res == null ? void 0 : res.success)) {
|
|
5782
|
+
throw res;
|
|
5783
|
+
}
|
|
5784
|
+
return res.data;
|
|
5785
|
+
} catch (err) {
|
|
5786
|
+
throw new Error((_j = (_i = (_h = err == null ? void 0 : err.response) == null ? void 0 : _h.data) == null ? void 0 : _i.message) != null ? _j : "Conference call API failed");
|
|
5787
|
+
}
|
|
5788
|
+
}
|
|
5789
|
+
async function endCall(options = {}) {
|
|
5790
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
5791
|
+
const state = (0, import_vault7.getSession)(STORAGE_KEY);
|
|
5792
|
+
const body = {
|
|
5793
|
+
action: "ENDCALL",
|
|
5794
|
+
userId: state == null ? void 0 : state.agentId,
|
|
5795
|
+
processid: (_c = (_b = (_a2 = state == null ? void 0 : state.process) == null ? void 0 : _a2.process_id) == null ? void 0 : _b.toString()) != null ? _c : "",
|
|
5796
|
+
process_name: (_e = (_d = state == null ? void 0 : state.process) == null ? void 0 : _d.process_name) != null ? _e : "",
|
|
5797
|
+
callreferenceid: (_g = (_f = state == null ? void 0 : state.callData) == null ? void 0 : _f.convox_id) != null ? _g : "",
|
|
5798
|
+
mobile_number: (_i = (_h = state == null ? void 0 : state.callData) == null ? void 0 : _h.phone_number) != null ? _i : "",
|
|
5799
|
+
disposition: (_j = options.disposition) != null ? _j : "RES",
|
|
5800
|
+
set_followUp: (_k = options.followUp) != null ? _k : "N",
|
|
5801
|
+
callback_date: (_l = options.callbackDate) != null ? _l : "",
|
|
5802
|
+
callback_hrs: (_m = options.callbackHrs) != null ? _m : "",
|
|
5803
|
+
callback_mins: (_n = options.callbackMins) != null ? _n : "",
|
|
5804
|
+
endcall_type: "CLOSE",
|
|
5805
|
+
patient_enquiry: (_o = options.patientLog) != null ? _o : null
|
|
5806
|
+
};
|
|
5807
|
+
const res = await axios_default.post(END_POINT.END_CALL, body, {
|
|
5808
|
+
params: { isBreak: (_p = options.isBreak) != null ? _p : false }
|
|
5809
|
+
});
|
|
5810
|
+
sdkStateManager.resetConferenceLines();
|
|
5811
|
+
sdkStateManager.endCall();
|
|
5812
|
+
return res.data;
|
|
5813
|
+
}
|
|
5814
|
+
async function logout() {
|
|
5815
|
+
var _a2, _b;
|
|
5816
|
+
let logoutError;
|
|
5817
|
+
try {
|
|
5818
|
+
await axios_default.post(END_POINT.AUTH_LOGOUT);
|
|
5819
|
+
} catch (err) {
|
|
5820
|
+
logoutError = new Error(((_b = (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.message) || "Logout failed. Please try again.");
|
|
5821
|
+
} finally {
|
|
5822
|
+
sdkStateManager.clearStorageAndReset();
|
|
5823
|
+
(0, import_vault7.removeSession)(STORAGE_KEY);
|
|
5824
|
+
}
|
|
5825
|
+
if (logoutError) throw logoutError;
|
|
5826
|
+
}
|
|
5827
|
+
async function startMonitoring(payload) {
|
|
5828
|
+
const res = await axios_default.post(END_POINT.SUPERVISOR_CALL_LISTEN, payload);
|
|
5829
|
+
return res.data;
|
|
5830
|
+
}
|
|
5831
|
+
async function stopMonitoring(payload) {
|
|
5832
|
+
const res = await axios_default.post(END_POINT.SUPERVISOR_CALL_LEAVE, payload);
|
|
5833
|
+
return res.data;
|
|
5834
|
+
}
|
|
5835
|
+
async function changeMonitorMode(payload) {
|
|
5836
|
+
const res = await axios_default.post(END_POINT.SUPERVISOR_CALL_CHANGE_MODE, payload);
|
|
5837
|
+
return res.data;
|
|
5838
|
+
}
|
|
5839
|
+
|
|
4695
5840
|
// call-control-sdk/index.ts
|
|
4696
5841
|
async function initSDK({
|
|
4697
5842
|
apiKey,
|
|
@@ -4731,7 +5876,8 @@ async function initSDK({
|
|
|
4731
5876
|
accessToken: initResult.accessToken,
|
|
4732
5877
|
expiration: initResult.expiration,
|
|
4733
5878
|
ticketId: initResult.ticketId,
|
|
4734
|
-
callControls: callcontrolConfig
|
|
5879
|
+
callControls: callcontrolConfig,
|
|
5880
|
+
userInfo: initResult.userInfo
|
|
4735
5881
|
};
|
|
4736
5882
|
console.info("SDK initialized successfully");
|
|
4737
5883
|
sdkStateManager.initialize(
|
|
@@ -4759,15 +5905,31 @@ function isSDKInitialized() {
|
|
|
4759
5905
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4760
5906
|
0 && (module.exports = {
|
|
4761
5907
|
CallControlPanel,
|
|
5908
|
+
SDKAccessDenied,
|
|
5909
|
+
SDKPages,
|
|
5910
|
+
SDKPermissionGuard,
|
|
5911
|
+
SDK_MENU_CODES,
|
|
4762
5912
|
SDK_PERMISSIONS,
|
|
5913
|
+
SDK_WILDCARD,
|
|
5914
|
+
changeMonitorMode,
|
|
5915
|
+
clickToCall,
|
|
5916
|
+
clickToConference,
|
|
5917
|
+
endCall,
|
|
4763
5918
|
getSDKVersion,
|
|
4764
5919
|
initSDK,
|
|
4765
5920
|
isSDKInitialized,
|
|
5921
|
+
logout,
|
|
5922
|
+
sdkStateManager,
|
|
5923
|
+
startMonitoring,
|
|
5924
|
+
stopMonitoring,
|
|
5925
|
+
useCallMonitoring,
|
|
4766
5926
|
useClickToCall,
|
|
5927
|
+
useClickToConference,
|
|
4767
5928
|
useEndCall,
|
|
4768
5929
|
useGetAuthorizationToken,
|
|
4769
5930
|
useGetCallerData,
|
|
4770
5931
|
useLogout,
|
|
5932
|
+
useSDKPermissions,
|
|
4771
5933
|
useSDKState
|
|
4772
5934
|
});
|
|
4773
5935
|
//# sourceMappingURL=index.js.map
|