ahs-cti 1.0.1-beta.46 → 1.0.1-beta.47
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.js +17 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36268,7 +36268,7 @@ var import_react6 = require("react");
|
|
|
36268
36268
|
init_sdk_state();
|
|
36269
36269
|
function deepEqual(a, b) {
|
|
36270
36270
|
if (a === b) return true;
|
|
36271
|
-
if (a
|
|
36271
|
+
if (a == null || b == null) return a === b;
|
|
36272
36272
|
if (typeof a !== "object" || typeof b !== "object") return false;
|
|
36273
36273
|
const keysA = Object.keys(a);
|
|
36274
36274
|
const keysB = Object.keys(b);
|
|
@@ -36279,15 +36279,19 @@ function deepEqual(a, b) {
|
|
|
36279
36279
|
}
|
|
36280
36280
|
var useGetSocketData = () => {
|
|
36281
36281
|
const getSnapshot = () => {
|
|
36282
|
+
var _a2;
|
|
36282
36283
|
const state = sdkStateManager.getState();
|
|
36283
|
-
return
|
|
36284
|
+
return {
|
|
36285
|
+
socket_info: state.callData.socket_info,
|
|
36286
|
+
call_sage: (_a2 = state.callData.call_sage) != null ? _a2 : null
|
|
36287
|
+
};
|
|
36284
36288
|
};
|
|
36285
36289
|
const [socketData, setSocketData] = (0, import_react6.useState)(getSnapshot);
|
|
36286
36290
|
const prevRef = (0, import_react6.useRef)(socketData);
|
|
36287
36291
|
(0, import_react6.useEffect)(() => {
|
|
36288
36292
|
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
36289
36293
|
const next = getSnapshot();
|
|
36290
|
-
if (!deepEqual(next.
|
|
36294
|
+
if (!deepEqual(next.call_sage, prevRef.current.call_sage)) {
|
|
36291
36295
|
prevRef.current = next;
|
|
36292
36296
|
setSocketData(next);
|
|
36293
36297
|
}
|
|
@@ -39143,7 +39147,7 @@ function CallControls({ onDataChange }) {
|
|
|
39143
39147
|
}, 3e4);
|
|
39144
39148
|
};
|
|
39145
39149
|
webSocketRef.current.onmessage = (event) => {
|
|
39146
|
-
var _a4, _b3, _c2, _d2, _e2, _f2, _g2;
|
|
39150
|
+
var _a4, _b3, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
39147
39151
|
try {
|
|
39148
39152
|
const data = JSON.parse(event.data);
|
|
39149
39153
|
if (data.type === "pong") {
|
|
@@ -39151,7 +39155,7 @@ function CallControls({ onDataChange }) {
|
|
|
39151
39155
|
}
|
|
39152
39156
|
const sdkState = (0, import_vault5.getSession)(STORAGE_KEY);
|
|
39153
39157
|
const confrence = getCombineConfrenceData(sdkState, data);
|
|
39154
|
-
const callData =
|
|
39158
|
+
const callData = __spreadProps(__spreadValues(__spreadValues({
|
|
39155
39159
|
socket_info: __spreadValues({}, data),
|
|
39156
39160
|
agent_id: data == null ? void 0 : data.agent_id,
|
|
39157
39161
|
status: data == null ? void 0 : data.status,
|
|
@@ -39166,10 +39170,12 @@ function CallControls({ onDataChange }) {
|
|
|
39166
39170
|
mode: data == null ? void 0 : data.mode,
|
|
39167
39171
|
queue_name: data == null ? void 0 : data.queue_name,
|
|
39168
39172
|
auto_wrapup_time: (_a4 = data == null ? void 0 : data.auto_wrapup_time) != null ? _a4 : null
|
|
39169
|
-
}, (data == null ? void 0 : data.call_details) !== void 0 && { call_details: data.call_details }), (data == null ? void 0 : data.break_details) !== void 0 && { break_details: data.break_details }),
|
|
39173
|
+
}, (data == null ? void 0 : data.call_details) !== void 0 && { call_details: data.call_details }), (data == null ? void 0 : data.break_details) !== void 0 && { break_details: data.break_details }), {
|
|
39174
|
+
call_sage: (_b3 = data == null ? void 0 : data.call_sage) != null ? _b3 : null
|
|
39175
|
+
});
|
|
39170
39176
|
sdkStateManager.updateCallData(callData);
|
|
39171
39177
|
sdkStateManager.updateConferenceData([...confrence]);
|
|
39172
|
-
sdkStateManager.setConsultInfo((
|
|
39178
|
+
sdkStateManager.setConsultInfo((_c2 = data.consult_info) != null ? _c2 : null);
|
|
39173
39179
|
const conferenceStatus = data == null ? void 0 : data.conferencestatus;
|
|
39174
39180
|
if (conferenceStatus) {
|
|
39175
39181
|
const hasAnsweredSecondaryLine = Object.keys(conferenceStatus).some((key) => {
|
|
@@ -39199,7 +39205,7 @@ function CallControls({ onDataChange }) {
|
|
|
39199
39205
|
}
|
|
39200
39206
|
if (["RINGING" /* RINGING */, "DIALING" /* DIALING */].includes(data.status)) {
|
|
39201
39207
|
setShowIframe(true);
|
|
39202
|
-
setCallWrapuptime((
|
|
39208
|
+
setCallWrapuptime((_e2 = (_d2 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _d2.auto_wrapup_time) != null ? _e2 : null);
|
|
39203
39209
|
sdkStateManager.updateConferenceData([
|
|
39204
39210
|
{
|
|
39205
39211
|
line: 1,
|
|
@@ -39252,7 +39258,7 @@ function CallControls({ onDataChange }) {
|
|
|
39252
39258
|
isMergeCall: false
|
|
39253
39259
|
}
|
|
39254
39260
|
]);
|
|
39255
|
-
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current && ((
|
|
39261
|
+
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current && ((_f2 = state == null ? void 0 : state.sdkConfig) == null ? void 0 : _f2.enableRingtone)) {
|
|
39256
39262
|
audioRef.current.play().catch((error) => {
|
|
39257
39263
|
console.error("Failed to play ringtone:", error);
|
|
39258
39264
|
});
|
|
@@ -39279,8 +39285,8 @@ function CallControls({ onDataChange }) {
|
|
|
39279
39285
|
}
|
|
39280
39286
|
} else if (((data == null ? void 0 : data.mute) === 1 || (data == null ? void 0 : data.hold) === 1) && data.status === "ONCALL" /* ONCALL */) {
|
|
39281
39287
|
} else if (data.status === "BREAK" /* BREAK */) {
|
|
39282
|
-
const breakTime = (
|
|
39283
|
-
const eventTime = (
|
|
39288
|
+
const breakTime = (_g2 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _g2.break_time;
|
|
39289
|
+
const eventTime = (_h2 = data == null ? void 0 : data.event_time) != null ? _h2 : null;
|
|
39284
39290
|
if (eventTime !== lastEventTimeRef.current) {
|
|
39285
39291
|
hasFlashedRef.current = false;
|
|
39286
39292
|
lastEventTimeRef.current = eventTime;
|