ahs-cti 1.0.0-beta.42 → 1.0.0-beta.45
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 -6
- package/dist/index.d.ts +1 -6
- package/dist/index.js +58 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -70,10 +70,9 @@ type CallData$1 = {
|
|
|
70
70
|
call_id?: string;
|
|
71
71
|
process_id?: string;
|
|
72
72
|
process_name?: string;
|
|
73
|
-
/** Auto wrapup time in seconds, sourced from backend call controls config */
|
|
74
|
-
auto_wrapup_time?: number;
|
|
75
73
|
mute?: number;
|
|
76
74
|
hold?: number;
|
|
75
|
+
auto_wrapup_time?: number | null;
|
|
77
76
|
};
|
|
78
77
|
|
|
79
78
|
type ConferenceLineTypes = {
|
|
@@ -113,8 +112,6 @@ type SDKState$1 = {
|
|
|
113
112
|
userPermissions: string[] | null;
|
|
114
113
|
menuEntitlements: Array<{ code: string; name: string; enabled: boolean }> | null;
|
|
115
114
|
consultInfo: any | null;
|
|
116
|
-
/** Raw callControls from the backend init response, before merging with permissions or consumer config */
|
|
117
|
-
backendCallControls: any | null;
|
|
118
115
|
};
|
|
119
116
|
|
|
120
117
|
/**
|
|
@@ -625,8 +622,6 @@ interface CallData {
|
|
|
625
622
|
phone_number?: string;
|
|
626
623
|
process_id?: string;
|
|
627
624
|
process_name?: string;
|
|
628
|
-
/** Auto wrapup time in seconds, sourced from backend call controls config */
|
|
629
|
-
auto_wrapup_time?: number;
|
|
630
625
|
}
|
|
631
626
|
|
|
632
627
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -70,10 +70,9 @@ type CallData$1 = {
|
|
|
70
70
|
call_id?: string;
|
|
71
71
|
process_id?: string;
|
|
72
72
|
process_name?: string;
|
|
73
|
-
/** Auto wrapup time in seconds, sourced from backend call controls config */
|
|
74
|
-
auto_wrapup_time?: number;
|
|
75
73
|
mute?: number;
|
|
76
74
|
hold?: number;
|
|
75
|
+
auto_wrapup_time?: number | null;
|
|
77
76
|
};
|
|
78
77
|
|
|
79
78
|
type ConferenceLineTypes = {
|
|
@@ -113,8 +112,6 @@ type SDKState$1 = {
|
|
|
113
112
|
userPermissions: string[] | null;
|
|
114
113
|
menuEntitlements: Array<{ code: string; name: string; enabled: boolean }> | null;
|
|
115
114
|
consultInfo: any | null;
|
|
116
|
-
/** Raw callControls from the backend init response, before merging with permissions or consumer config */
|
|
117
|
-
backendCallControls: any | null;
|
|
118
115
|
};
|
|
119
116
|
|
|
120
117
|
/**
|
|
@@ -625,8 +622,6 @@ interface CallData {
|
|
|
625
622
|
phone_number?: string;
|
|
626
623
|
process_id?: string;
|
|
627
624
|
process_name?: string;
|
|
628
|
-
/** Auto wrapup time in seconds, sourced from backend call controls config */
|
|
629
|
-
auto_wrapup_time?: number;
|
|
630
625
|
}
|
|
631
626
|
|
|
632
627
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1654,11 +1654,11 @@ 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
|
-
var _a2;
|
|
1659
|
-
const
|
|
1660
|
-
const { process_id, process_name, status, phone_number, agent_id, call_id, call_details } =
|
|
1661
|
-
|
|
1657
|
+
var useGetCallerData = () => {
|
|
1658
|
+
var _a2, _b;
|
|
1659
|
+
const sdkState = sdkStateManager.getState();
|
|
1660
|
+
const { process_id, process_name, status, phone_number, agent_id, call_id, call_details } = sdkState.callData;
|
|
1661
|
+
const initialCallData = {
|
|
1662
1662
|
phone_number,
|
|
1663
1663
|
status,
|
|
1664
1664
|
callReferenceId: call_id,
|
|
@@ -1666,14 +1666,25 @@ var buildCallData = () => {
|
|
|
1666
1666
|
process_id,
|
|
1667
1667
|
process_name,
|
|
1668
1668
|
call_details,
|
|
1669
|
-
auto_wrapup_time: (_a2 =
|
|
1669
|
+
auto_wrapup_time: (_b = (_a2 = sdkState.backendCallControls) == null ? void 0 : _a2.auto_wrapup_time) != null ? _b : null
|
|
1670
1670
|
};
|
|
1671
|
-
|
|
1672
|
-
var useGetCallerData = () => {
|
|
1673
|
-
const [callData, setCallData] = (0, import_react5.useState)(buildCallData);
|
|
1671
|
+
const [callData, setCallData] = (0, import_react5.useState)(initialCallData);
|
|
1674
1672
|
(0, import_react5.useEffect)(() => {
|
|
1675
1673
|
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
1676
|
-
|
|
1674
|
+
var _a3, _b2;
|
|
1675
|
+
const state = sdkStateManager.getState();
|
|
1676
|
+
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 } = state.callData;
|
|
1677
|
+
const currentCallData = {
|
|
1678
|
+
phone_number: phone_number2,
|
|
1679
|
+
status: status2,
|
|
1680
|
+
callReferenceId: call_id2,
|
|
1681
|
+
agent_id: agent_id2,
|
|
1682
|
+
process_id: process_id2,
|
|
1683
|
+
process_name: process_name2,
|
|
1684
|
+
call_details: call_details2,
|
|
1685
|
+
auto_wrapup_time: (_b2 = auto_wrapup_time != null ? auto_wrapup_time : (_a3 = state.backendCallControls) == null ? void 0 : _a3.auto_wrapup_time) != null ? _b2 : null
|
|
1686
|
+
};
|
|
1687
|
+
setCallData(currentCallData);
|
|
1677
1688
|
});
|
|
1678
1689
|
return unsubscribe;
|
|
1679
1690
|
}, []);
|
|
@@ -2694,39 +2705,39 @@ function CallTransferDialog({ open }) {
|
|
|
2694
2705
|
sdkStateManager.setOpenCallTransferDialog(false);
|
|
2695
2706
|
};
|
|
2696
2707
|
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
|
|
2708
|
+
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
2709
|
if (type === "PROCESS") {
|
|
2699
2710
|
const payload = {
|
|
2700
2711
|
mobile_number: (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.phone_number) != null ? _b2 : "",
|
|
2701
|
-
userid:
|
|
2712
|
+
userid: state.agentId,
|
|
2702
2713
|
type: "PROCESS",
|
|
2703
|
-
transfer_to: (
|
|
2704
|
-
callreferenceid: (
|
|
2705
|
-
processid: String((
|
|
2706
|
-
process_name: (
|
|
2714
|
+
transfer_to: (_c2 = data == null ? void 0 : data.process_name) != null ? _c2 : "",
|
|
2715
|
+
callreferenceid: (_e2 = (_d2 = state.callData) == null ? void 0 : _d2.call_id) != null ? _e2 : "",
|
|
2716
|
+
processid: String((_g2 = (_f2 = state.callData) == null ? void 0 : _f2.process_id) != null ? _g2 : ""),
|
|
2717
|
+
process_name: (_i2 = (_h2 = state.callData) == null ? void 0 : _h2.process_name) != null ? _i2 : ""
|
|
2707
2718
|
};
|
|
2708
2719
|
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
2709
2720
|
} else if (type === "QUEUE") {
|
|
2710
2721
|
const payload = {
|
|
2711
|
-
mobile_number: (
|
|
2712
|
-
userid:
|
|
2722
|
+
mobile_number: (_k2 = (_j2 = state.callData) == null ? void 0 : _j2.phone_number) != null ? _k2 : "",
|
|
2723
|
+
userid: state.agentId,
|
|
2713
2724
|
type: "QUEUE",
|
|
2714
|
-
transfer_to: (
|
|
2715
|
-
callreferenceid: (
|
|
2716
|
-
processid: String((
|
|
2717
|
-
process_name: (
|
|
2725
|
+
transfer_to: (_l2 = data == null ? void 0 : data.queue_name) != null ? _l2 : "",
|
|
2726
|
+
callreferenceid: (_n2 = (_m2 = state.callData) == null ? void 0 : _m2.call_id) != null ? _n2 : "",
|
|
2727
|
+
processid: String((_p2 = (_o2 = state.callData) == null ? void 0 : _o2.process_id) != null ? _p2 : ""),
|
|
2728
|
+
process_name: (_r2 = (_q2 = state.callData) == null ? void 0 : _q2.process_name) != null ? _r2 : ""
|
|
2718
2729
|
};
|
|
2719
2730
|
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
2720
2731
|
} else if (type === "AGENT") {
|
|
2721
2732
|
const payload = {
|
|
2722
|
-
mobile_number: (
|
|
2723
|
-
userid:
|
|
2733
|
+
mobile_number: (_t2 = (_s2 = state.callData) == null ? void 0 : _s2.phone_number) != null ? _t2 : "",
|
|
2734
|
+
userid: state.agentId,
|
|
2724
2735
|
type: "AGENT",
|
|
2725
2736
|
transfer_type: mode === "CONSULT" ? "ATTENDED" : "BLIND",
|
|
2726
|
-
transfer_to: (
|
|
2727
|
-
callreferenceid: (
|
|
2728
|
-
processid: String((
|
|
2729
|
-
process_name: (
|
|
2737
|
+
transfer_to: (_v2 = (_u2 = data == null ? void 0 : data.user_id) == null ? void 0 : _u2.toString()) != null ? _v2 : "",
|
|
2738
|
+
callreferenceid: (_x2 = (_w2 = state.callData) == null ? void 0 : _w2.call_id) != null ? _x2 : "",
|
|
2739
|
+
processid: String((_z = (_y2 = state.callData) == null ? void 0 : _y2.process_id) != null ? _z : ""),
|
|
2740
|
+
process_name: (_B = (_A = state.callData) == null ? void 0 : _A.process_name) != null ? _B : ""
|
|
2730
2741
|
};
|
|
2731
2742
|
if (mode === "CONSULT") {
|
|
2732
2743
|
initiateConsultCall(END_POINT.TRANSFER_CALL, payload);
|
|
@@ -2738,9 +2749,9 @@ function CallTransferDialog({ open }) {
|
|
|
2738
2749
|
// action: mode === "CONSULT" ? "ATTENDED" : "BLIND_TRANSFER",
|
|
2739
2750
|
transfer_type: mode === "CONSULT" ? "ATTENDED" : "BLIND",
|
|
2740
2751
|
type: "OTHER",
|
|
2741
|
-
transfer_to: (
|
|
2742
|
-
userid:
|
|
2743
|
-
callreferenceid: (
|
|
2752
|
+
transfer_to: (_C = data == null ? void 0 : data.mobile_number) != null ? _C : "",
|
|
2753
|
+
userid: state.agentId,
|
|
2754
|
+
callreferenceid: (_E = (_D = state.callData) == null ? void 0 : _D.call_id) != null ? _E : ""
|
|
2744
2755
|
// blind_transfer_no: data?.mobile_number ?? "",
|
|
2745
2756
|
};
|
|
2746
2757
|
if (mode === "CONSULT") {
|
|
@@ -4477,7 +4488,7 @@ function CallControls({ onDataChange }) {
|
|
|
4477
4488
|
};
|
|
4478
4489
|
}, []);
|
|
4479
4490
|
(0, import_react12.useEffect)(() => {
|
|
4480
|
-
var _a3;
|
|
4491
|
+
var _a3, _b2;
|
|
4481
4492
|
if (onDataChange && state.callData) {
|
|
4482
4493
|
const { process_id, process_name, status, phone_number, agent_id, call_id, call_details } = state.callData;
|
|
4483
4494
|
const callData = {
|
|
@@ -4488,7 +4499,7 @@ function CallControls({ onDataChange }) {
|
|
|
4488
4499
|
process_id,
|
|
4489
4500
|
process_name,
|
|
4490
4501
|
call_details,
|
|
4491
|
-
auto_wrapup_time: (_a3 = state.backendCallControls) == null ? void 0 : _a3.auto_wrapup_time
|
|
4502
|
+
auto_wrapup_time: (_b2 = (_a3 = state.backendCallControls) == null ? void 0 : _a3.auto_wrapup_time) != null ? _b2 : null
|
|
4492
4503
|
};
|
|
4493
4504
|
onDataChange(callData);
|
|
4494
4505
|
}
|
|
@@ -4537,7 +4548,7 @@ function CallControls({ onDataChange }) {
|
|
|
4537
4548
|
}, 3e4);
|
|
4538
4549
|
};
|
|
4539
4550
|
webSocketRef.current.onmessage = (event) => {
|
|
4540
|
-
var _a4, _b3, _c2, _d2, _e2, _f2;
|
|
4551
|
+
var _a4, _b3, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
4541
4552
|
try {
|
|
4542
4553
|
const data = JSON.parse(event.data);
|
|
4543
4554
|
if (data.type === "pong") {
|
|
@@ -4557,11 +4568,12 @@ function CallControls({ onDataChange }) {
|
|
|
4557
4568
|
hold: data == null ? void 0 : data.hold,
|
|
4558
4569
|
mute: data == null ? void 0 : data.mute,
|
|
4559
4570
|
mode: data == null ? void 0 : data.mode,
|
|
4560
|
-
queue_name: data == null ? void 0 : data.queue_name
|
|
4571
|
+
queue_name: data == null ? void 0 : data.queue_name,
|
|
4572
|
+
auto_wrapup_time: (_a4 = data == null ? void 0 : data.auto_wrapup_time) != null ? _a4 : null
|
|
4561
4573
|
}, (data == null ? void 0 : data.call_details) !== void 0 && { call_details: data.call_details });
|
|
4562
4574
|
sdkStateManager.updateCallData(callData);
|
|
4563
4575
|
sdkStateManager.updateConferenceData([...confrence]);
|
|
4564
|
-
sdkStateManager.setConsultInfo((
|
|
4576
|
+
sdkStateManager.setConsultInfo((_b3 = data.consult_info) != null ? _b3 : null);
|
|
4565
4577
|
const conferenceStatus = data == null ? void 0 : data.conferencestatus;
|
|
4566
4578
|
if (conferenceStatus) {
|
|
4567
4579
|
const hasAnsweredSecondaryLine = Object.keys(conferenceStatus).some((key) => {
|
|
@@ -4591,7 +4603,7 @@ function CallControls({ onDataChange }) {
|
|
|
4591
4603
|
}
|
|
4592
4604
|
if (["RINGING" /* RINGING */, "DIALING" /* DIALING */].includes(data.status)) {
|
|
4593
4605
|
setShowIframe(true);
|
|
4594
|
-
setCallWrapuptime((
|
|
4606
|
+
setCallWrapuptime((_e2 = (_d2 = data == null ? void 0 : data.auto_wrapup_time) != null ? _d2 : (_c2 = sdkState == null ? void 0 : sdkState.backendCallControls) == null ? void 0 : _c2.auto_wrapup_time) != null ? _e2 : null);
|
|
4595
4607
|
sdkStateManager.updateConferenceData([
|
|
4596
4608
|
{
|
|
4597
4609
|
line: 1,
|
|
@@ -4644,7 +4656,7 @@ function CallControls({ onDataChange }) {
|
|
|
4644
4656
|
isMergeCall: false
|
|
4645
4657
|
}
|
|
4646
4658
|
]);
|
|
4647
|
-
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current && ((
|
|
4659
|
+
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current && ((_f2 = state == null ? void 0 : state.sdkConfig) == null ? void 0 : _f2.enableRingtone)) {
|
|
4648
4660
|
audioRef.current.play().catch((error) => {
|
|
4649
4661
|
console.error("Failed to play ringtone:", error);
|
|
4650
4662
|
});
|
|
@@ -4668,8 +4680,8 @@ function CallControls({ onDataChange }) {
|
|
|
4668
4680
|
}
|
|
4669
4681
|
} else if (((data == null ? void 0 : data.mute) === 1 || (data == null ? void 0 : data.hold) === 1) && data.status === "ONCALL" /* ONCALL */) {
|
|
4670
4682
|
} else if (data.status === "BREAK" /* BREAK */) {
|
|
4671
|
-
const breakTime = (
|
|
4672
|
-
const eventTime = (
|
|
4683
|
+
const breakTime = (_g2 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _g2.break_time;
|
|
4684
|
+
const eventTime = (_h2 = data == null ? void 0 : data.event_time) != null ? _h2 : null;
|
|
4673
4685
|
if (eventTime !== lastEventTimeRef.current) {
|
|
4674
4686
|
hasFlashedRef.current = false;
|
|
4675
4687
|
lastEventTimeRef.current = eventTime;
|
|
@@ -5831,7 +5843,7 @@ var useClickToConference = () => {
|
|
|
5831
5843
|
}, [loading]);
|
|
5832
5844
|
const handleStartConferenceCall = (0, import_react19.useCallback)(
|
|
5833
5845
|
async (payload) => {
|
|
5834
|
-
var _a2, _b, _c, _d, _e, _f
|
|
5846
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
5835
5847
|
const state = (0, import_vault6.getSession)(STORAGE_KEY);
|
|
5836
5848
|
if (((_a2 = state == null ? void 0 : state.callData) == null ? void 0 : _a2.status) !== "ONCALL") {
|
|
5837
5849
|
const msg = "Conference call requires an active call (ONCALL status)";
|
|
@@ -5853,8 +5865,8 @@ var useClickToConference = () => {
|
|
|
5853
5865
|
operation: `CALL${availableLine.line}`,
|
|
5854
5866
|
target: payload.mobileNumber,
|
|
5855
5867
|
line_number: Number(availableLine.line),
|
|
5856
|
-
userid:
|
|
5857
|
-
process: (
|
|
5868
|
+
userid: state.agentId,
|
|
5869
|
+
process: (_f = (_e = state.callData) == null ? void 0 : _e.process_name) != null ? _f : ""
|
|
5858
5870
|
};
|
|
5859
5871
|
setLoading(true);
|
|
5860
5872
|
setIsError(false);
|
|
@@ -5922,7 +5934,7 @@ function clickToCall(payload) {
|
|
|
5922
5934
|
});
|
|
5923
5935
|
}
|
|
5924
5936
|
function clickToConference(payload) {
|
|
5925
|
-
var _a2, _b, _c, _d, _e
|
|
5937
|
+
var _a2, _b, _c, _d, _e;
|
|
5926
5938
|
const state = sdkStateManager.getState();
|
|
5927
5939
|
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
5940
|
if (!availableLine) {
|
|
@@ -5933,8 +5945,8 @@ function clickToConference(payload) {
|
|
|
5933
5945
|
operation: `CALL${availableLine.line}`,
|
|
5934
5946
|
target: payload.mobileNumber,
|
|
5935
5947
|
line_number: Number(availableLine.line),
|
|
5936
|
-
userid:
|
|
5937
|
-
process: (
|
|
5948
|
+
userid: state.agentId,
|
|
5949
|
+
process: (_e = (_d = state.callData) == null ? void 0 : _d.process_name) != null ? _e : ""
|
|
5938
5950
|
};
|
|
5939
5951
|
return axios_default.post(END_POINT.CONFERENCE_CALL, body).then((res) => {
|
|
5940
5952
|
try {
|