@webex/cc-user-state 1.28.0-ccwidgets.4 → 1.28.0-ccwidgets.5
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/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/helper.js +19 -2
- package/dist/helper.js.map +1 -1
- package/dist/types/constants.d.ts +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,mBAAmB,CAAC"}
|
package/dist/helper.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useUserState = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
// TODO: Export & Import this AGENT_STATE_CHANGE constant from SDK
|
|
6
|
+
const constants_1 = require("./constants");
|
|
5
7
|
const useUserState = ({ idleCodes, agentId, cc }) => {
|
|
6
8
|
const [isSettingAgentStatus, setIsSettingAgentStatus] = (0, react_1.useState)(false);
|
|
7
9
|
const [errorMessage, setErrorMessage] = (0, react_1.useState)('');
|
|
@@ -10,11 +12,26 @@ const useUserState = ({ idleCodes, agentId, cc }) => {
|
|
|
10
12
|
(0, react_1.useEffect)(() => {
|
|
11
13
|
// Reset the timer whenever the component mounts or the state changes
|
|
12
14
|
setElapsedTime(0);
|
|
13
|
-
|
|
15
|
+
let timer = setInterval(() => {
|
|
14
16
|
setElapsedTime(prevTime => prevTime + 1);
|
|
15
17
|
}, 1000);
|
|
18
|
+
const handleStateChange = (data) => {
|
|
19
|
+
var _a;
|
|
20
|
+
if (data && typeof data === 'object' && data.type === 'AgentStateChangeSuccess') {
|
|
21
|
+
const DEFAULT_CODE = '0'; // Default code when no aux code is present
|
|
22
|
+
setCurrentState({
|
|
23
|
+
id: ((_a = data.auxCodeId) === null || _a === void 0 ? void 0 : _a.trim()) !== '' ? data.auxCodeId : DEFAULT_CODE
|
|
24
|
+
});
|
|
25
|
+
setElapsedTime(0);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
cc.on(constants_1.AGENT_STATE_CHANGE, handleStateChange);
|
|
16
29
|
// Cleanup the timer on component unmount
|
|
17
|
-
return () =>
|
|
30
|
+
return () => {
|
|
31
|
+
clearInterval(timer);
|
|
32
|
+
timer = null;
|
|
33
|
+
cc.off(constants_1.AGENT_STATE_CHANGE, handleStateChange);
|
|
34
|
+
};
|
|
18
35
|
}, []);
|
|
19
36
|
const setAgentStatus = (selectedCode) => {
|
|
20
37
|
const { auxCodeId, state } = {
|
package/dist/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":";;;AAAA,iCAA0C;
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":";;;AAAA,iCAA0C;AAC1C,kEAAkE;AAClE,2CAA+C;AAExC,MAAM,YAAY,GAAG,CAAC,EAAC,SAAS,EAAE,OAAO,EAAE,EAAE,EAAC,EAAE,EAAE;IAEvD,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACxE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAErD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAErD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,qEAAqE;QACrE,cAAc,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,KAAK,GAAG,WAAW,CAAC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CAAC,MAAM,CAAC;QACjE,EAAE,CAAC,aAAa,CAAC,EAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACzG,eAAe,CAAC,EAAE,CAAC,CAAC;YACpB,cAAc,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACf,eAAe,CAAC,QAAQ,CAAC,CAAC;YAC1B,eAAe,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACd,uBAAuB,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,SAAS;QACT,cAAc;QACd,oBAAoB;QACpB,YAAY;QACZ,WAAW;QACX,YAAY;QACZ,eAAe;KAChB,CAAA;AACH,CAAC,CAAC;AArEW,QAAA,YAAY,gBAqEvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AGENT_STATE_CHANGE = "agent:stateChange";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/cc-user-state",
|
|
3
3
|
"description": "Webex Contact Center Widgets: User State",
|
|
4
|
-
"version": "1.28.0-ccwidgets.
|
|
4
|
+
"version": "1.28.0-ccwidgets.5",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test:unit": "jest"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@webex/cc-store": "1.28.0-ccwidgets.
|
|
20
|
+
"@webex/cc-store": "1.28.0-ccwidgets.5",
|
|
21
21
|
"mobx-react": "9.1.1",
|
|
22
22
|
"react": "18.3.1",
|
|
23
23
|
"react-dom": "18.3.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
],
|
|
52
52
|
"verbose": true
|
|
53
53
|
},
|
|
54
|
-
"stableVersion": "1.28.0-ccwidgets.
|
|
54
|
+
"stableVersion": "1.28.0-ccwidgets.4"
|
|
55
55
|
}
|