@webitel/api-services 26.8.33 → 26.8.35
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/package.json
CHANGED
|
@@ -3,18 +3,34 @@
|
|
|
3
3
|
* fixme: change on library
|
|
4
4
|
* https://webitel.atlassian.net/browse/WTEL-7842?focusedCommentId=702198
|
|
5
5
|
* */
|
|
6
|
-
const convertDuration = (duration: number) => {
|
|
7
|
-
if (!duration) return '00:00:00';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export interface ConvertDurationOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Keep the hours segment when the duration is under an hour.
|
|
10
|
+
*
|
|
11
|
+
* `true` (the default) preserves the long-standing `HH:MM:SS` output, which
|
|
12
|
+
* live timers rely on to stay a fixed width as they tick past an hour.
|
|
13
|
+
* `false` yields `MM:SS` below an hour and `HH:MM:SS` above it — for compact
|
|
14
|
+
* places where a leading `00:` is noise.
|
|
15
|
+
*/
|
|
16
|
+
alwaysShowHours?: boolean;
|
|
17
|
+
}
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
if (min.length === 1) min = `0${min}`;
|
|
15
|
-
if (sec.length === 1) sec = `0${sec}`;
|
|
19
|
+
const pad = (value: number) => `${value}`.padStart(2, '0');
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
const convertDuration = (
|
|
22
|
+
duration: number,
|
|
23
|
+
{ alwaysShowHours = true }: ConvertDurationOptions = {},
|
|
24
|
+
) => {
|
|
25
|
+
if (!duration) return alwaysShowHours ? '00:00:00' : '00:00';
|
|
26
|
+
|
|
27
|
+
const hours = Math.floor(duration / 3600);
|
|
28
|
+
const minutes = Math.floor((duration % 3600) / 60);
|
|
29
|
+
const seconds = Math.floor((duration % 3600) % 60);
|
|
30
|
+
|
|
31
|
+
const time = `${pad(minutes)}:${pad(seconds)}`;
|
|
32
|
+
|
|
33
|
+
return alwaysShowHours || hours > 0 ? `${pad(hours)}:${time}` : time;
|
|
18
34
|
};
|
|
19
35
|
|
|
20
36
|
export default convertDuration;
|
|
@@ -96,12 +96,14 @@ export const queueTypeRules: Record<number, QueueTypeRule> = {
|
|
|
96
96
|
'calendar',
|
|
97
97
|
'payload.resourceStrategy',
|
|
98
98
|
'payload.progressiveCount',
|
|
99
|
+
'payload.maxAgentLine',
|
|
99
100
|
],
|
|
100
101
|
minValue: {
|
|
101
102
|
'payload.originateTimeout': 0,
|
|
102
103
|
'payload.waitBetweenRetries': 0,
|
|
103
104
|
'payload.maxWaitTime': 0,
|
|
104
105
|
'payload.progressiveCount': 1,
|
|
106
|
+
'payload.maxAgentLine': 1,
|
|
105
107
|
},
|
|
106
108
|
},
|
|
107
109
|
[QueueType.CHAT_INBOUND_QUEUE]: {
|