@velaro/cli 1.4.123 → 1.4.125
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/lib/commands/callpresence.js +29 -1
- package/package.json +1 -1
|
@@ -9,7 +9,8 @@ import { runCommand } from '../run.js';
|
|
|
9
9
|
|
|
10
10
|
const WHILE_ON_CALL = ['NoChats', 'TakeChats', 'FinishThenOffline'];
|
|
11
11
|
const AFTER_CALL = ['ReturnAutomatically', 'AskAgent', 'StayOffline'];
|
|
12
|
-
const CALLS_WHILE_BUSY = ['NoCallsWhileBusy', 'RingEvenWhenBusy'];
|
|
12
|
+
const CALLS_WHILE_BUSY = ['NoCallsWhileBusy', 'RingLeastBusyIfAllBusy', 'RingEvenWhenBusy'];
|
|
13
|
+
const APPLY_TO = ['inheritingGroups', 'allGroups', 'newGroupsOnly'];
|
|
13
14
|
const SCOPES = ['site', 'group', 'agent'];
|
|
14
15
|
|
|
15
16
|
const BOLD = '\x1b[1m';
|
|
@@ -52,10 +53,23 @@ async function setHandler(argv) {
|
|
|
52
53
|
callsWhileBusy: argv.callsWhileBusy ?? null,
|
|
53
54
|
};
|
|
54
55
|
if (scope === 'site' && argv.allowAgentOverrides !== undefined) body.allowAgentOverrides = argv.allowAgentOverrides;
|
|
56
|
+
if (scope === 'site' && argv.applyTo) body.applyTo = argv.applyTo;
|
|
55
57
|
const res = await messagingPut(`/CallPresencePolicy/${scope}/${id}`, body);
|
|
56
58
|
console.log(argv.json ? JSON.stringify(res, null, 2) : `Saved ${scope} ${id}.`);
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
async function groupsHandler(argv) {
|
|
62
|
+
const teamIds = String(argv.teams).split(',').map((x) => Number(x.trim())).filter((x) => Number.isInteger(x) && x > 0);
|
|
63
|
+
if (!teamIds.length) throw new Error('--teams must list team ids, for example 12,15');
|
|
64
|
+
const res = await messagingPut('/CallPresencePolicy/groups/bulk', {
|
|
65
|
+
teamIds,
|
|
66
|
+
whileOnCall: argv.whileOnCall ?? null,
|
|
67
|
+
afterCall: argv.afterCall ?? null,
|
|
68
|
+
callsWhileBusy: argv.callsWhileBusy ?? null,
|
|
69
|
+
});
|
|
70
|
+
console.log(argv.json ? JSON.stringify(res, null, 2) : `Set ${res.updated} routing group(s).`);
|
|
71
|
+
}
|
|
72
|
+
|
|
59
73
|
async function clearHandler(argv) {
|
|
60
74
|
const id = argv.scope === 'site' ? 0 : argv.id;
|
|
61
75
|
if (argv.scope !== 'site' && !id) throw new Error('--id is required for group and agent scope');
|
|
@@ -98,10 +112,23 @@ const setCommand = {
|
|
|
98
112
|
.option('after-call', { choices: AFTER_CALL, describe: 'After the call ends' })
|
|
99
113
|
.option('calls-while-busy', { choices: CALLS_WHILE_BUSY, describe: 'Calls for an agent busy on chats' })
|
|
100
114
|
.option('allow-agent-overrides', { type: 'boolean', describe: 'Site scope only: may agents set their own override' })
|
|
115
|
+
.option('apply-to', { choices: APPLY_TO, describe: 'Site scope only: how the change reaches existing groups (default inheritingGroups; allGroups clears group overrides; newGroupsOnly freezes every existing group as it is today)' })
|
|
101
116
|
.option('json', { type: 'boolean', describe: 'Raw JSON' }),
|
|
102
117
|
handler: runCommand(setHandler),
|
|
103
118
|
};
|
|
104
119
|
|
|
120
|
+
const groupsCommand = {
|
|
121
|
+
command: 'groups',
|
|
122
|
+
describe: 'Set the same policy on several routing groups at once',
|
|
123
|
+
builder: (y) => y
|
|
124
|
+
.option('teams', { type: 'string', demandOption: true, describe: 'Comma-separated team ids' })
|
|
125
|
+
.option('while-on-call', { choices: WHILE_ON_CALL })
|
|
126
|
+
.option('after-call', { choices: AFTER_CALL })
|
|
127
|
+
.option('calls-while-busy', { choices: CALLS_WHILE_BUSY })
|
|
128
|
+
.option('json', { type: 'boolean', describe: 'Raw JSON' }),
|
|
129
|
+
handler: runCommand(groupsHandler),
|
|
130
|
+
};
|
|
131
|
+
|
|
105
132
|
const clearCommand = {
|
|
106
133
|
command: 'clear',
|
|
107
134
|
describe: 'Remove the policy at one level so it inherits again',
|
|
@@ -134,6 +161,7 @@ export const callpresenceCommand = {
|
|
|
134
161
|
builder: (y) => y
|
|
135
162
|
.command(getCommand)
|
|
136
163
|
.command(setCommand)
|
|
164
|
+
.command(groupsCommand)
|
|
137
165
|
.command(clearCommand)
|
|
138
166
|
.command(effectiveCommand)
|
|
139
167
|
.command(statusCommand)
|
package/package.json
CHANGED