ahs-cti 1.0.0-beta.41 → 1.0.0-beta.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +54 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1654,11 +1654,9 @@ var useClickToCall = () => {
|
|
|
1654
1654
|
// call-control-sdk/lib/hooks/useGetCallerData.ts
|
|
1655
1655
|
var import_react5 = require("react");
|
|
1656
1656
|
init_sdk_state();
|
|
1657
|
-
var
|
|
1658
|
-
|
|
1659
|
-
const
|
|
1660
|
-
const { process_id, process_name, status, phone_number, agent_id, call_id, call_details } = state.callData;
|
|
1661
|
-
return {
|
|
1657
|
+
var useGetCallerData = () => {
|
|
1658
|
+
const { process_id, process_name, status, phone_number, agent_id, call_id, call_details, auto_wrapup_time } = sdkStateManager.getState().callData;
|
|
1659
|
+
const initialCallData = {
|
|
1662
1660
|
phone_number,
|
|
1663
1661
|
status,
|
|
1664
1662
|
callReferenceId: call_id,
|
|
@@ -1666,14 +1664,23 @@ var buildCallData = () => {
|
|
|
1666
1664
|
process_id,
|
|
1667
1665
|
process_name,
|
|
1668
1666
|
call_details,
|
|
1669
|
-
auto_wrapup_time
|
|
1667
|
+
auto_wrapup_time
|
|
1670
1668
|
};
|
|
1671
|
-
|
|
1672
|
-
var useGetCallerData = () => {
|
|
1673
|
-
const [callData, setCallData] = (0, import_react5.useState)(buildCallData);
|
|
1669
|
+
const [callData, setCallData] = (0, import_react5.useState)(initialCallData);
|
|
1674
1670
|
(0, import_react5.useEffect)(() => {
|
|
1675
1671
|
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
1676
|
-
|
|
1672
|
+
const { process_id: process_id2, process_name: process_name2, status: status2, phone_number: phone_number2, agent_id: agent_id2, call_id: call_id2, call_details: call_details2, auto_wrapup_time: auto_wrapup_time2 } = sdkStateManager.getState().callData;
|
|
1673
|
+
const currentCallData = {
|
|
1674
|
+
phone_number: phone_number2,
|
|
1675
|
+
status: status2,
|
|
1676
|
+
callReferenceId: call_id2,
|
|
1677
|
+
agent_id: agent_id2,
|
|
1678
|
+
process_id: process_id2,
|
|
1679
|
+
process_name: process_name2,
|
|
1680
|
+
call_details: call_details2,
|
|
1681
|
+
auto_wrapup_time: auto_wrapup_time2
|
|
1682
|
+
};
|
|
1683
|
+
setCallData(currentCallData);
|
|
1677
1684
|
});
|
|
1678
1685
|
return unsubscribe;
|
|
1679
1686
|
}, []);
|
|
@@ -2694,39 +2701,39 @@ function CallTransferDialog({ open }) {
|
|
|
2694
2701
|
sdkStateManager.setOpenCallTransferDialog(false);
|
|
2695
2702
|
};
|
|
2696
2703
|
const handleTransferCall = (data, type, mode = "DEFAULT") => {
|
|
2697
|
-
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
|
|
2704
|
+
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;
|
|
2698
2705
|
if (type === "PROCESS") {
|
|
2699
2706
|
const payload = {
|
|
2700
2707
|
mobile_number: (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.phone_number) != null ? _b2 : "",
|
|
2701
|
-
userid:
|
|
2708
|
+
userid: state.agentId,
|
|
2702
2709
|
type: "PROCESS",
|
|
2703
|
-
transfer_to: (
|
|
2704
|
-
callreferenceid: (
|
|
2705
|
-
processid: String((
|
|
2706
|
-
process_name: (
|
|
2710
|
+
transfer_to: (_c2 = data == null ? void 0 : data.process_name) != null ? _c2 : "",
|
|
2711
|
+
callreferenceid: (_e2 = (_d2 = state.callData) == null ? void 0 : _d2.call_id) != null ? _e2 : "",
|
|
2712
|
+
processid: String((_g2 = (_f2 = state.callData) == null ? void 0 : _f2.process_id) != null ? _g2 : ""),
|
|
2713
|
+
process_name: (_i2 = (_h2 = state.callData) == null ? void 0 : _h2.process_name) != null ? _i2 : ""
|
|
2707
2714
|
};
|
|
2708
2715
|
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
2709
2716
|
} else if (type === "QUEUE") {
|
|
2710
2717
|
const payload = {
|
|
2711
|
-
mobile_number: (
|
|
2712
|
-
userid:
|
|
2718
|
+
mobile_number: (_k2 = (_j2 = state.callData) == null ? void 0 : _j2.phone_number) != null ? _k2 : "",
|
|
2719
|
+
userid: state.agentId,
|
|
2713
2720
|
type: "QUEUE",
|
|
2714
|
-
transfer_to: (
|
|
2715
|
-
callreferenceid: (
|
|
2716
|
-
processid: String((
|
|
2717
|
-
process_name: (
|
|
2721
|
+
transfer_to: (_l2 = data == null ? void 0 : data.queue_name) != null ? _l2 : "",
|
|
2722
|
+
callreferenceid: (_n2 = (_m2 = state.callData) == null ? void 0 : _m2.call_id) != null ? _n2 : "",
|
|
2723
|
+
processid: String((_p2 = (_o2 = state.callData) == null ? void 0 : _o2.process_id) != null ? _p2 : ""),
|
|
2724
|
+
process_name: (_r2 = (_q2 = state.callData) == null ? void 0 : _q2.process_name) != null ? _r2 : ""
|
|
2718
2725
|
};
|
|
2719
2726
|
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
2720
2727
|
} else if (type === "AGENT") {
|
|
2721
2728
|
const payload = {
|
|
2722
|
-
mobile_number: (
|
|
2723
|
-
userid:
|
|
2729
|
+
mobile_number: (_t2 = (_s2 = state.callData) == null ? void 0 : _s2.phone_number) != null ? _t2 : "",
|
|
2730
|
+
userid: state.agentId,
|
|
2724
2731
|
type: "AGENT",
|
|
2725
2732
|
transfer_type: mode === "CONSULT" ? "ATTENDED" : "BLIND",
|
|
2726
|
-
transfer_to: (
|
|
2727
|
-
callreferenceid: (
|
|
2728
|
-
processid: String((
|
|
2729
|
-
process_name: (
|
|
2733
|
+
transfer_to: (_v2 = (_u2 = data == null ? void 0 : data.user_id) == null ? void 0 : _u2.toString()) != null ? _v2 : "",
|
|
2734
|
+
callreferenceid: (_x2 = (_w2 = state.callData) == null ? void 0 : _w2.call_id) != null ? _x2 : "",
|
|
2735
|
+
processid: String((_z = (_y2 = state.callData) == null ? void 0 : _y2.process_id) != null ? _z : ""),
|
|
2736
|
+
process_name: (_B = (_A = state.callData) == null ? void 0 : _A.process_name) != null ? _B : ""
|
|
2730
2737
|
};
|
|
2731
2738
|
if (mode === "CONSULT") {
|
|
2732
2739
|
initiateConsultCall(END_POINT.TRANSFER_CALL, payload);
|
|
@@ -2738,9 +2745,9 @@ function CallTransferDialog({ open }) {
|
|
|
2738
2745
|
// action: mode === "CONSULT" ? "ATTENDED" : "BLIND_TRANSFER",
|
|
2739
2746
|
transfer_type: mode === "CONSULT" ? "ATTENDED" : "BLIND",
|
|
2740
2747
|
type: "OTHER",
|
|
2741
|
-
transfer_to: (
|
|
2742
|
-
userid:
|
|
2743
|
-
callreferenceid: (
|
|
2748
|
+
transfer_to: (_C = data == null ? void 0 : data.mobile_number) != null ? _C : "",
|
|
2749
|
+
userid: state.agentId,
|
|
2750
|
+
callreferenceid: (_E = (_D = state.callData) == null ? void 0 : _D.call_id) != null ? _E : ""
|
|
2744
2751
|
// blind_transfer_no: data?.mobile_number ?? "",
|
|
2745
2752
|
};
|
|
2746
2753
|
if (mode === "CONSULT") {
|
|
@@ -4477,9 +4484,8 @@ function CallControls({ onDataChange }) {
|
|
|
4477
4484
|
};
|
|
4478
4485
|
}, []);
|
|
4479
4486
|
(0, import_react12.useEffect)(() => {
|
|
4480
|
-
var _a3;
|
|
4481
4487
|
if (onDataChange && state.callData) {
|
|
4482
|
-
const { process_id, process_name, status, phone_number, agent_id, call_id, call_details } = state.callData;
|
|
4488
|
+
const { process_id, process_name, status, phone_number, agent_id, call_id, call_details, auto_wrapup_time } = state.callData;
|
|
4483
4489
|
const callData = {
|
|
4484
4490
|
phone_number,
|
|
4485
4491
|
status,
|
|
@@ -4488,7 +4494,7 @@ function CallControls({ onDataChange }) {
|
|
|
4488
4494
|
process_id,
|
|
4489
4495
|
process_name,
|
|
4490
4496
|
call_details,
|
|
4491
|
-
auto_wrapup_time
|
|
4497
|
+
auto_wrapup_time
|
|
4492
4498
|
};
|
|
4493
4499
|
onDataChange(callData);
|
|
4494
4500
|
}
|
|
@@ -4537,7 +4543,7 @@ function CallControls({ onDataChange }) {
|
|
|
4537
4543
|
}, 3e4);
|
|
4538
4544
|
};
|
|
4539
4545
|
webSocketRef.current.onmessage = (event) => {
|
|
4540
|
-
var _a4, _b3, _c2, _d2, _e2, _f2;
|
|
4546
|
+
var _a4, _b3, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
4541
4547
|
try {
|
|
4542
4548
|
const data = JSON.parse(event.data);
|
|
4543
4549
|
if (data.type === "pong") {
|
|
@@ -4557,11 +4563,12 @@ function CallControls({ onDataChange }) {
|
|
|
4557
4563
|
hold: data == null ? void 0 : data.hold,
|
|
4558
4564
|
mute: data == null ? void 0 : data.mute,
|
|
4559
4565
|
mode: data == null ? void 0 : data.mode,
|
|
4560
|
-
queue_name: data == null ? void 0 : data.queue_name
|
|
4566
|
+
queue_name: data == null ? void 0 : data.queue_name,
|
|
4567
|
+
auto_wrapup_time: (_a4 = data == null ? void 0 : data.auto_wrapup_time) != null ? _a4 : null
|
|
4561
4568
|
}, (data == null ? void 0 : data.call_details) !== void 0 && { call_details: data.call_details });
|
|
4562
4569
|
sdkStateManager.updateCallData(callData);
|
|
4563
4570
|
sdkStateManager.updateConferenceData([...confrence]);
|
|
4564
|
-
sdkStateManager.setConsultInfo((
|
|
4571
|
+
sdkStateManager.setConsultInfo((_b3 = data.consult_info) != null ? _b3 : null);
|
|
4565
4572
|
const conferenceStatus = data == null ? void 0 : data.conferencestatus;
|
|
4566
4573
|
if (conferenceStatus) {
|
|
4567
4574
|
const hasAnsweredSecondaryLine = Object.keys(conferenceStatus).some((key) => {
|
|
@@ -4591,7 +4598,7 @@ function CallControls({ onDataChange }) {
|
|
|
4591
4598
|
}
|
|
4592
4599
|
if (["RINGING" /* RINGING */, "DIALING" /* DIALING */].includes(data.status)) {
|
|
4593
4600
|
setShowIframe(true);
|
|
4594
|
-
setCallWrapuptime((
|
|
4601
|
+
setCallWrapuptime((_e2 = (_d2 = data == null ? void 0 : data.auto_wrapup_time) != null ? _d2 : (_c2 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _c2.auto_wrapup_time) != null ? _e2 : null);
|
|
4595
4602
|
sdkStateManager.updateConferenceData([
|
|
4596
4603
|
{
|
|
4597
4604
|
line: 1,
|
|
@@ -4644,7 +4651,7 @@ function CallControls({ onDataChange }) {
|
|
|
4644
4651
|
isMergeCall: false
|
|
4645
4652
|
}
|
|
4646
4653
|
]);
|
|
4647
|
-
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current && ((
|
|
4654
|
+
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current && ((_f2 = state == null ? void 0 : state.sdkConfig) == null ? void 0 : _f2.enableRingtone)) {
|
|
4648
4655
|
audioRef.current.play().catch((error) => {
|
|
4649
4656
|
console.error("Failed to play ringtone:", error);
|
|
4650
4657
|
});
|
|
@@ -4668,8 +4675,8 @@ function CallControls({ onDataChange }) {
|
|
|
4668
4675
|
}
|
|
4669
4676
|
} else if (((data == null ? void 0 : data.mute) === 1 || (data == null ? void 0 : data.hold) === 1) && data.status === "ONCALL" /* ONCALL */) {
|
|
4670
4677
|
} else if (data.status === "BREAK" /* BREAK */) {
|
|
4671
|
-
const breakTime = (
|
|
4672
|
-
const eventTime = (
|
|
4678
|
+
const breakTime = (_g2 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _g2.break_time;
|
|
4679
|
+
const eventTime = (_h2 = data == null ? void 0 : data.event_time) != null ? _h2 : null;
|
|
4673
4680
|
if (eventTime !== lastEventTimeRef.current) {
|
|
4674
4681
|
hasFlashedRef.current = false;
|
|
4675
4682
|
lastEventTimeRef.current = eventTime;
|
|
@@ -5831,7 +5838,7 @@ var useClickToConference = () => {
|
|
|
5831
5838
|
}, [loading]);
|
|
5832
5839
|
const handleStartConferenceCall = (0, import_react19.useCallback)(
|
|
5833
5840
|
async (payload) => {
|
|
5834
|
-
var _a2, _b, _c, _d, _e, _f
|
|
5841
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
5835
5842
|
const state = (0, import_vault6.getSession)(STORAGE_KEY);
|
|
5836
5843
|
if (((_a2 = state == null ? void 0 : state.callData) == null ? void 0 : _a2.status) !== "ONCALL") {
|
|
5837
5844
|
const msg = "Conference call requires an active call (ONCALL status)";
|
|
@@ -5853,8 +5860,8 @@ var useClickToConference = () => {
|
|
|
5853
5860
|
operation: `CALL${availableLine.line}`,
|
|
5854
5861
|
target: payload.mobileNumber,
|
|
5855
5862
|
line_number: Number(availableLine.line),
|
|
5856
|
-
userid:
|
|
5857
|
-
process: (
|
|
5863
|
+
userid: state.agentId,
|
|
5864
|
+
process: (_f = (_e = state.callData) == null ? void 0 : _e.process_name) != null ? _f : ""
|
|
5858
5865
|
};
|
|
5859
5866
|
setLoading(true);
|
|
5860
5867
|
setIsError(false);
|
|
@@ -5922,7 +5929,7 @@ function clickToCall(payload) {
|
|
|
5922
5929
|
});
|
|
5923
5930
|
}
|
|
5924
5931
|
function clickToConference(payload) {
|
|
5925
|
-
var _a2, _b, _c, _d, _e
|
|
5932
|
+
var _a2, _b, _c, _d, _e;
|
|
5926
5933
|
const state = sdkStateManager.getState();
|
|
5927
5934
|
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));
|
|
5928
5935
|
if (!availableLine) {
|
|
@@ -5933,8 +5940,8 @@ function clickToConference(payload) {
|
|
|
5933
5940
|
operation: `CALL${availableLine.line}`,
|
|
5934
5941
|
target: payload.mobileNumber,
|
|
5935
5942
|
line_number: Number(availableLine.line),
|
|
5936
|
-
userid:
|
|
5937
|
-
process: (
|
|
5943
|
+
userid: state.agentId,
|
|
5944
|
+
process: (_e = (_d = state.callData) == null ? void 0 : _d.process_name) != null ? _e : ""
|
|
5938
5945
|
};
|
|
5939
5946
|
return axios_default.post(END_POINT.CONFERENCE_CALL, body).then((res) => {
|
|
5940
5947
|
try {
|