@velaro/cli 1.4.120 → 1.4.122
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/README.md +0 -19
- package/bin/velaro.js +21 -92
- package/lib/avatar-motion.test.js +1 -1
- package/lib/avatar-switch.test.js +1 -1
- package/lib/commands/agent.js +7 -58
- package/lib/commands/ai-config.js +8 -34
- package/lib/commands/index.js +18 -14
- package/lib/commands/kb.js +4 -94
- package/lib/commands/knowledge.js +2 -2
- package/lib/commands/ops-groups.js +0 -13
- package/lib/commands/safety.js +1 -1
- package/lib/commands/salesforce.js +1 -1
- package/lib/commands/sap.js +1 -1
- package/lib/commands/schedule-adherence.js +1 -1
- package/lib/commands/signature.js +39 -3
- package/lib/commands/teams.js +1 -1
- package/lib/commands/woocommerce.js +1 -1
- package/lib/commands/workflow.js +4 -31
- package/lib/signature-policy.js +42 -0
- package/lib/signature-policy.test.js +28 -2
- package/lib/staff-optional.js +10 -0
- package/package.json +2 -2
- package/lib/cobrowse-settings.js +0 -90
- package/lib/cobrowse-settings.test.js +0 -45
- package/lib/commands/activity.js +0 -147
- package/lib/commands/acuity.js +0 -66
- package/lib/commands/ai-federation.js +0 -55
- package/lib/commands/ai-models.js +0 -203
- package/lib/commands/ai-spend.js +0 -71
- package/lib/commands/avatar.js +0 -253
- package/lib/commands/bigcommerce.js +0 -50
- package/lib/commands/calendly.js +0 -62
- package/lib/commands/cobrowse.js +0 -99
- package/lib/commands/coupon-grant.js +0 -192
- package/lib/commands/diag-groups.js +0 -108
- package/lib/commands/diagnostics.js +0 -298
- package/lib/commands/email-inbox.js +0 -110
- package/lib/commands/entitlement.js +0 -375
- package/lib/commands/image-analysis.js +0 -27
- package/lib/commands/logs-insights.js +0 -342
- package/lib/commands/logs.js +0 -1248
- package/lib/commands/migrate.js +0 -379
- package/lib/commands/migration-status.js +0 -66
- package/lib/commands/ops.js +0 -266
- package/lib/commands/parity-staff-tools.js +0 -205
- package/lib/commands/pricing.js +0 -132
- package/lib/commands/report-speed.js +0 -112
- package/lib/commands/scraper.js +0 -38
- package/lib/commands/site-provision.js +0 -68
- package/lib/commands/sitesync.js +0 -158
- package/lib/commands/skill-usage.js +0 -39
- package/lib/commands/staff.js +0 -31
- package/lib/commands/status-page.js +0 -95
- package/lib/commands/status-sla.js +0 -47
- package/lib/commands/subscription.js +0 -102
- package/lib/commands/support.js +0 -309
- package/lib/commands/tour-policy.js +0 -61
- package/lib/commands/triage.js +0 -66
- package/lib/entitlement-report-packages.test.js +0 -47
- package/lib/log-search.js +0 -252
- package/lib/log-search.test.js +0 -374
- package/lib/logs-insights.test.js +0 -146
- package/lib/messaging-routes.test.js +0 -37
- package/lib/report-speed.test.js +0 -26
- package/lib/siteUser.js +0 -35
- package/lib/siteUser.test.js +0 -45
- package/lib/skill-usage.test.js +0 -36
- package/lib/status-sla.test.js +0 -23
package/lib/commands/kb.js
CHANGED
|
@@ -4,20 +4,21 @@ import { get, post, del, messagingGet, messagingPost, messagingDel } from '../a
|
|
|
4
4
|
import { requireFeature } from '../subscription.js';
|
|
5
5
|
import { runCommand } from '../run.js';
|
|
6
6
|
import { articleCommand } from './article.js';
|
|
7
|
+
import { loadStaff } from '../staff-optional.js';
|
|
8
|
+
|
|
9
|
+
const staffKb = await loadStaff('commands/kb-staff.js');
|
|
7
10
|
|
|
8
11
|
export const kbCommand = {
|
|
9
12
|
command: 'kb <subcommand>',
|
|
10
13
|
describe: 'Manage knowledge base — articles, Q&A pairs, bot overrides, and custom content',
|
|
11
14
|
builder: (yargs) =>
|
|
12
|
-
yargs
|
|
15
|
+
(staffKb ? staffKb.addKbStaffCommands(yargs) : yargs)
|
|
13
16
|
.command(articleCommand)
|
|
14
17
|
.command(qnaCommand)
|
|
15
18
|
.command(overrideCommand)
|
|
16
19
|
.command(contentCommand)
|
|
17
|
-
.command(reindexCommand)
|
|
18
20
|
.command(settingsCommand)
|
|
19
21
|
.command(statusCommand)
|
|
20
|
-
.command(swapConnectionCommand)
|
|
21
22
|
.command(tenantCommand)
|
|
22
23
|
.demandCommand(1, 'Specify a subcommand: article, qna, override, content, reindex, settings, status, swap-connection, tenant'),
|
|
23
24
|
handler: () => {},
|
|
@@ -65,77 +66,6 @@ const tenantCommand = {
|
|
|
65
66
|
handler: () => {},
|
|
66
67
|
};
|
|
67
68
|
|
|
68
|
-
// ────────────────────────────────────────────────────────────────────────────
|
|
69
|
-
// Reindex — re-embed all KB articles with the current embedding model
|
|
70
|
-
// ────────────────────────────────────────────────────────────────────────────
|
|
71
|
-
|
|
72
|
-
const reindexCommand = {
|
|
73
|
-
command: 'reindex',
|
|
74
|
-
describe: 'Re-embed KB articles or scraper/ingestion content (use after embedding model upgrade)',
|
|
75
|
-
builder: (y) =>
|
|
76
|
-
y
|
|
77
|
-
.option('all', {
|
|
78
|
-
type: 'boolean',
|
|
79
|
-
describe: 'Reindex ALL sites (Velaro staff only)',
|
|
80
|
-
default: false,
|
|
81
|
-
})
|
|
82
|
-
.option('site', {
|
|
83
|
-
type: 'number',
|
|
84
|
-
describe: 'Reindex a specific site by ID (Velaro staff only)',
|
|
85
|
-
})
|
|
86
|
-
.option('ingestion', {
|
|
87
|
-
type: 'boolean',
|
|
88
|
-
describe: 'Reindex scraper/ingestion Azure Search indexers instead of KB articles',
|
|
89
|
-
default: false,
|
|
90
|
-
}),
|
|
91
|
-
handler: runCommand(async (argv) => {
|
|
92
|
-
if (argv.ingestion) {
|
|
93
|
-
if (argv.all) {
|
|
94
|
-
console.log('Starting bulk ingestion reindex for all sites — runs in background.');
|
|
95
|
-
console.log('Watch server logs ([ReindexAllIngestion]) for progress.\n');
|
|
96
|
-
const result = await post('/DatabaseTool/ReindexAllIngestionIndexes', {});
|
|
97
|
-
console.log(result.message ?? 'Queued.');
|
|
98
|
-
} else if (argv.site) {
|
|
99
|
-
console.log(`Reindexing scraper/ingestion index for site ${argv.site}…`);
|
|
100
|
-
const result = await post(`/DatabaseTool/ReindexIngestionIndex/${argv.site}`, {});
|
|
101
|
-
if (result.success) {
|
|
102
|
-
console.log(`✅ Triggered ${result.indexersRun} indexer(s) — re-processing in background.`);
|
|
103
|
-
} else {
|
|
104
|
-
console.error(`❌ Failed: ${result.message}`);
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
console.error('--ingestion requires --site <id> or --all (Velaro staff only)');
|
|
108
|
-
process.exit(1);
|
|
109
|
-
}
|
|
110
|
-
} else if (argv.all) {
|
|
111
|
-
console.log('Starting bulk KB reindex for all sites — this runs in the background.');
|
|
112
|
-
console.log('Watch server logs ([ReindexAllKb]) for progress.\n');
|
|
113
|
-
const result = await post('/DatabaseTool/ReindexAllKb', {});
|
|
114
|
-
console.log(result.message ?? 'Queued.');
|
|
115
|
-
} else if (argv.site) {
|
|
116
|
-
console.log(`Reindexing KB articles for site ${argv.site}…`);
|
|
117
|
-
const result = await messagingPost(`/Scraper/superadmin/kb/reindex/${argv.site}`, {});
|
|
118
|
-
if (result?.queued) {
|
|
119
|
-
console.log(`✅ Queued — full re-ingest running in background for site ${argv.site}.`);
|
|
120
|
-
} else {
|
|
121
|
-
console.error(`❌ Failed: ${result?.error ?? 'unknown error'}`);
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
console.log("Reindexing your site's KB articles\u2026");
|
|
125
|
-
// KBSearchIndexController is routed api/kb/search (the old /KBSearchIndex/reindex 404'd).
|
|
126
|
-
const result = await post('/api/kb/search/reindex', {});
|
|
127
|
-
if (result.success === false) {
|
|
128
|
-
console.error(`❌ Failed: ${result.message}`);
|
|
129
|
-
} else {
|
|
130
|
-
console.log(`✅ Done — ${result.articles ?? result.count ?? 'all'} articles reindexed.`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}),
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
// ────────────────────────────────────────────────────────────────────────────
|
|
137
|
-
// Status — which physical DB this environment's KB is actually connected to
|
|
138
|
-
// ────────────────────────────────────────────────────────────────────────────
|
|
139
69
|
|
|
140
70
|
const statusCommand = {
|
|
141
71
|
command: 'status',
|
|
@@ -146,26 +76,6 @@ const statusCommand = {
|
|
|
146
76
|
}),
|
|
147
77
|
};
|
|
148
78
|
|
|
149
|
-
const swapConnectionCommand = {
|
|
150
|
-
command: 'swap-connection',
|
|
151
|
-
describe: 'Toggle which physical database this environment\'s KB is connected to (primary vs. alternate, per KBConnectionHolder). Built 2026-08-18 after staging was found silently connected to PRODUCTION\'s KB database (KnowledgeBaseConnectionString, not _Staging) with no CLI/API way to check or fix it except a raw REST call.',
|
|
152
|
-
builder: (y) =>
|
|
153
|
-
y
|
|
154
|
-
.option('use-alternate', { type: 'boolean', demandOption: true, describe: 'true = use the alternate (KnowledgeBaseConnectionString_Staging) DB; false = use primary' })
|
|
155
|
-
.option('yes', { type: 'boolean', default: false, describe: 'Skip the confirmation prompt (for scripting)' }),
|
|
156
|
-
handler: runCommand(async (argv) => {
|
|
157
|
-
const before = await get('/api/kb/status');
|
|
158
|
-
console.log(`Currently connected to: ${before.server} / ${before.database} (alternate: ${before.isAlternate})`);
|
|
159
|
-
|
|
160
|
-
if (!argv.yes) {
|
|
161
|
-
console.log(`\nAbout to switch to ${argv['use-alternate'] ? 'ALTERNATE' : 'PRIMARY'}. Re-run with --yes to confirm.`);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const result = await post('/DatabaseTool/KBSwapConnection', { useAlternate: argv['use-alternate'] });
|
|
166
|
-
console.log(`✅ Switched. Now connected to: ${result.current.server} / ${result.current.database} (alternate: ${result.current.isAlternate})`);
|
|
167
|
-
}),
|
|
168
|
-
};
|
|
169
79
|
|
|
170
80
|
// ────────────────────────────────────────────────────────────────────────────
|
|
171
81
|
// Settings — branding, domain, layout, SEO/analytics
|
|
@@ -64,7 +64,7 @@ const clinicalGet = {
|
|
|
64
64
|
command: 'get',
|
|
65
65
|
describe: 'Show emergency/safety wording, supported languages and emergency-service mode',
|
|
66
66
|
builder: (y) => y
|
|
67
|
-
.option('site', { type: 'number', describe: 'Target site ID (
|
|
67
|
+
.option('site', { type: 'number', describe: 'Target site ID (restricted, enforced server-side; omit for your own site)' })
|
|
68
68
|
.option('json', { type: 'boolean', default: false }),
|
|
69
69
|
handler: runCommand(async (argv) => {
|
|
70
70
|
const state = await messagingGet(`${basePath(argv.site)}/state`);
|
|
@@ -79,7 +79,7 @@ const clinicalSet = {
|
|
|
79
79
|
command: 'set',
|
|
80
80
|
describe: 'Set emergency/safety wording. Entries replace the stored set: pass every override you want to keep (use get --json).',
|
|
81
81
|
builder: (y) => y
|
|
82
|
-
.option('site', { type: 'number', describe: 'Target site ID (
|
|
82
|
+
.option('site', { type: 'number', describe: 'Target site ID (restricted, enforced server-side)' })
|
|
83
83
|
.option('emergency', { type: 'array', string: true, describe: 'key=text, key is default|chat|voice|sms|whatsapp|email|<lang>|<lang>.<channel>; must contain {emergencyNumber}' })
|
|
84
84
|
.option('referral', { type: 'array', string: true, describe: 'key=text, same keys as --emergency' })
|
|
85
85
|
.option('emergency-number', { type: 'string', describe: 'Replaces {emergencyNumber}' })
|
|
@@ -104,19 +104,6 @@ export const conversionCommand = { command: 'conversion', ...group('Conversion g
|
|
|
104
104
|
async (a) => show(await get(`/Conversions/report?days=${a.days ?? 30}`))],
|
|
105
105
|
]) };
|
|
106
106
|
|
|
107
|
-
export const emailCommand = { command: 'email', ...group('Velaro staff: email delivery queue and stats', [
|
|
108
|
-
['queue-status', 'Email delivery queue status', (y) => y.option('site-id', { type: 'number' }),
|
|
109
|
-
async (a) => show(await messagingGet(`/SuperAdmin/email-delivery/status${qs({ siteId: a['site-id'] })}`))],
|
|
110
|
-
['delivery-stats', 'Email delivery stats', (y) => y.option('site-id', { type: 'number' }).option('days', { type: 'number' }).option('hours', { type: 'number' }),
|
|
111
|
-
async (a) => show(await messagingGet(`/SuperAdmin/email-delivery/stats${qs({ siteId: a['site-id'], days: a.days, hours: a.hours })}`))],
|
|
112
|
-
['queue-replay', 'Replay stuck emails (dry run unless --apply --yes)',
|
|
113
|
-
(y) => y.option('apply', { type: 'boolean', describe: 'Actually replay (default is a dry run)' }).option('yes', { type: 'boolean' }),
|
|
114
|
-
async (a) => {
|
|
115
|
-
if (a.apply) needYes(a, 'replay the email queue');
|
|
116
|
-
show(await messagingPost(`/SuperAdmin/email-delivery/replay?dryRun=${a.apply ? 'false' : 'true'}`));
|
|
117
|
-
}],
|
|
118
|
-
]) };
|
|
119
|
-
|
|
120
107
|
export const ivrCommand = { command: 'ivr', ...group('IVR voice configurations, phone lines and business hours', [
|
|
121
108
|
['list-voice-configs', 'List IVR voice configurations', null, async () => show(await get('/IVRVoiceConfigurations'))],
|
|
122
109
|
['get-voice-config <id>', 'Show one voice configuration', (y) => y.positional('id', { type: 'number' }),
|
package/lib/commands/safety.js
CHANGED
|
@@ -82,7 +82,7 @@ async function applyChange(a, enabled) {
|
|
|
82
82
|
return last;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
const siteOpt = { type: 'number', describe: '
|
|
85
|
+
const siteOpt = { type: 'number', describe: 'restricted, enforced server-side: target site ID (uses the staff route)' };
|
|
86
86
|
const controlOpt = { type: 'string', demandOption: true, describe: 'emergency_self_harm | abuse_ladder | threat_detection | input_jailbreak | output_filter' };
|
|
87
87
|
const audienceOpt = { type: 'string', choices: [...AUDIENCES, 'both'], default: 'both' };
|
|
88
88
|
const featureOpt = { type: 'string', describe: 'Per-feature/channel scope (chat, voice, sms, whatsapp, email). Omit for the whole account.' };
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* velaro salesforce diagnose --site-id <id> [--quick] Live read-only diagnostic: config, auth, per-capability probes
|
|
5
5
|
* velaro salesforce matrix --site-id <id> Capability matrix vs live probes (same data as diagnose)
|
|
6
6
|
*
|
|
7
|
-
* Calls messaging DiagController GET /diagnostics/test-salesforce?siteId=<id>&deep=<bool> (
|
|
7
|
+
* Calls messaging DiagController GET /diagnostics/test-salesforce?siteId=<id>&deep=<bool> (restricted, enforced server-side). Read-only:
|
|
8
8
|
* nothing is created or changed in Salesforce, and a write capability is never reported as verified.
|
|
9
9
|
*/
|
|
10
10
|
|
package/lib/commands/sap.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* velaro sap diagnose --site-id <id> [--quick] Live read-only diagnostic: config, auth, per-capability probes
|
|
5
5
|
* velaro sap matrix --site-id <id> Capability matrix vs live probes (same data as diagnose)
|
|
6
6
|
*
|
|
7
|
-
* Calls messaging DiagController GET /diagnostics/test-sap?siteId=<id>&deep=<bool> (
|
|
7
|
+
* Calls messaging DiagController GET /diagnostics/test-sap?siteId=<id>&deep=<bool> (restricted, enforced server-side). Read-only:
|
|
8
8
|
* nothing is created or changed in SAP, and a write capability is never reported as verified.
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ import { runCommand } from '../run.js';
|
|
|
4
4
|
// -- velaro schedule-adherence --------------------------------------------------
|
|
5
5
|
// Staff-only. siteId is an EXPLICIT argument (SupportTools-style), never derived from the caller.
|
|
6
6
|
// Backend: velaro-messaging GET /Reports/sites/{siteId}/schedule-adherence-diagnostics
|
|
7
|
-
// (
|
|
7
|
+
// (server-side staff gate; role=agent requires agentId, fails closed).
|
|
8
8
|
|
|
9
9
|
export const scheduleAdherenceCommand = {
|
|
10
10
|
command: 'schedule-adherence <siteId>',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { messagingGet, messagingPut } from '../api.js';
|
|
1
|
+
import { messagingGet, messagingPut, messagingPost } from '../api.js';
|
|
2
2
|
import { buildPolicyBody, findPolicy, describeMode, parseTeamId } from '../signature-policy.js';
|
|
3
3
|
|
|
4
4
|
// velaro signature policy get|set
|
|
@@ -19,6 +19,8 @@ function printRow(label, row) {
|
|
|
19
19
|
const dis = row.disclaimerEnabled === null || row.disclaimerEnabled === undefined ? 'follows company-wide (off if none set)' : row.disclaimerEnabled ? 'on' : 'off';
|
|
20
20
|
console.log(` disclaimer ${dis}`);
|
|
21
21
|
if (row.disclaimerText) console.log(` text ${row.disclaimerText}`);
|
|
22
|
+
console.log(` name line ${row.nameFormat ?? 'follows (none if nothing set)'}${row.nameSource ? `, ${row.nameSource}` : ''}${row.teamLabel ? `, team label "${row.teamLabel}"` : ''}`);
|
|
23
|
+
if (row.teamId === 0) console.log(` overrides team admins ${row.allowTeamOverrides === false ? 'blocked' : 'allowed'}, agents ${row.allowAgentOverrides === false ? 'blocked' : 'allowed'}`);
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const getCommand = {
|
|
@@ -47,7 +49,13 @@ const setCommand = {
|
|
|
47
49
|
.option('signature', { type: 'string', describe: 'Company signature HTML (empty string clears it)' })
|
|
48
50
|
.option('disclaimer', { type: 'boolean', describe: 'Turn the legal disclaimer on or off' })
|
|
49
51
|
.option('disclaimer-default', { type: 'boolean', describe: 'Clear the disclaimer on/off choice back to company-wide' })
|
|
50
|
-
.option('disclaimer-text', { type: 'string', describe: 'Legal disclaimer text (empty string clears it)' })
|
|
52
|
+
.option('disclaimer-text', { type: 'string', describe: 'Legal disclaimer text (empty string clears it)' })
|
|
53
|
+
.option('name-format', { type: 'string', describe: 'none | name | team | name-and-team | default' })
|
|
54
|
+
.option('name-source', { type: 'string', describe: 'real-name | display-name | default' })
|
|
55
|
+
.option('team-label', { type: 'string', describe: 'Team name shown by the team formats (empty string clears it)' })
|
|
56
|
+
.option('allow-team-overrides', { type: 'boolean', describe: 'Company-wide only: may team admins change group settings' })
|
|
57
|
+
.option('allow-agent-overrides', { type: 'boolean', describe: 'Company-wide only: may agents choose their own name line' })
|
|
58
|
+
.option('apply-to', { type: 'string', describe: 'Company-wide only: inheritingGroups | allGroups | newGroupsOnly' }),
|
|
51
59
|
handler: async (argv) => {
|
|
52
60
|
const teamId = parseTeamId(argv['team-id']);
|
|
53
61
|
const data = await messagingGet('/Signatures/policy');
|
|
@@ -58,16 +66,44 @@ const setCommand = {
|
|
|
58
66
|
corporateSignature: argv.signature,
|
|
59
67
|
disclaimerEnabled: argv['disclaimer-default'] ? null : argv.disclaimer,
|
|
60
68
|
disclaimerText: argv['disclaimer-text'],
|
|
69
|
+
nameFormat: argv['name-format'],
|
|
70
|
+
nameSource: argv['name-source'],
|
|
71
|
+
teamLabel: argv['team-label'],
|
|
72
|
+
allowTeamOverrides: argv['allow-team-overrides'],
|
|
73
|
+
allowAgentOverrides: argv['allow-agent-overrides'],
|
|
74
|
+
applyTo: argv['apply-to'],
|
|
61
75
|
});
|
|
62
76
|
await messagingPut('/Signatures/policy', body);
|
|
63
77
|
console.log(`${GRN}Signature policy updated.${RESET} Run \`velaro signature policy get\` to review.`);
|
|
64
78
|
},
|
|
65
79
|
};
|
|
66
80
|
|
|
81
|
+
const historyCommand = {
|
|
82
|
+
command: 'history',
|
|
83
|
+
describe: 'List saved versions of the policy (newest first)',
|
|
84
|
+
builder: (y) => y.option('team-id', { type: 'number', default: 0, describe: '0 = company-wide' }),
|
|
85
|
+
handler: async (argv) => {
|
|
86
|
+
const list = await messagingGet(`/Signatures/policy/history?teamId=${parseTeamId(argv['team-id'])}`);
|
|
87
|
+
for (const v of Array.isArray(list) ? list : []) {
|
|
88
|
+
console.log(`${v.id} ${v.changedAt} ${v.changedByName || 'unknown'} ${v.action}`);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const rollbackCommand = {
|
|
94
|
+
command: 'rollback <versionId>',
|
|
95
|
+
describe: 'Restore a saved version (saved as a new version)',
|
|
96
|
+
builder: (y) => y.positional('versionId', { type: 'number' }),
|
|
97
|
+
handler: async (argv) => {
|
|
98
|
+
await messagingPost(`/Signatures/policy/rollback/${Number(argv.versionId)}`, {});
|
|
99
|
+
console.log(`${GRN}Rolled back.${RESET} Run \`velaro signature policy get\` to review.`);
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
67
103
|
const policyCommand = {
|
|
68
104
|
command: 'policy <subcommand>',
|
|
69
105
|
describe: 'View and update the company email signature policy',
|
|
70
|
-
builder: (y) => y.command(getCommand).command(setCommand).demandCommand(1, 'Specify a subcommand: get | set'),
|
|
106
|
+
builder: (y) => y.command(getCommand).command(setCommand).command(historyCommand).command(rollbackCommand).demandCommand(1, 'Specify a subcommand: get | set | history | rollback'),
|
|
71
107
|
handler: () => {},
|
|
72
108
|
};
|
|
73
109
|
|
package/lib/commands/teams.js
CHANGED
|
@@ -103,7 +103,7 @@ export const teamsCommand = {
|
|
|
103
103
|
)
|
|
104
104
|
.command(
|
|
105
105
|
'send-direct <user> <title>',
|
|
106
|
-
'Send a 1:1 Teams message to any user in the tenant (UPN or Entra id).
|
|
106
|
+
'Send a 1:1 Teams message to any user in the tenant (UPN or Entra id). restricted, enforced server-side.',
|
|
107
107
|
(y) =>
|
|
108
108
|
y
|
|
109
109
|
.positional('user', { type: 'string', describe: 'alex@velaro.com or Entra object id' })
|
|
@@ -87,7 +87,7 @@ async function skillsHandler(argv) {
|
|
|
87
87
|
const wooSkills = skills.filter(s => s.category === 'WooCommerce');
|
|
88
88
|
if (wooSkills.length === 0) {
|
|
89
89
|
console.log(`\n${YLW}No WooCommerce skills available for this site.${RST}`);
|
|
90
|
-
console.log(`${DIM}Enable in
|
|
90
|
+
console.log(`${DIM}Enable in the site Subscription settings (staff) → Subscription: EnableWooCommerce (core/read), EnableWooCommerceWrite (write tier), EnableDestructiveAiSkills (cancel/refund/coupon).${RST}\n`);
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
console.log(`\n${BOLD}${wooSkills.length} WooCommerce AI skill(s)${RST}\n`);
|
package/lib/commands/workflow.js
CHANGED
|
@@ -3,12 +3,15 @@ import { getCredentials, messagingGet, messagingPost, messagingPut, messagingDel
|
|
|
3
3
|
import { requireFeature } from '../subscription.js';
|
|
4
4
|
import { runCommand } from '../run.js';
|
|
5
5
|
import { applyFollowUpOptions } from '../ai-followups.js';
|
|
6
|
+
import { loadStaff } from '../staff-optional.js';
|
|
7
|
+
|
|
8
|
+
const staffWorkflow = await loadStaff('commands/workflow-staff.js');
|
|
6
9
|
|
|
7
10
|
export const workflowCommand = {
|
|
8
11
|
command: 'workflow <subcommand>',
|
|
9
12
|
describe: 'Manage automation workflows',
|
|
10
13
|
builder: (yargs) =>
|
|
11
|
-
yargs
|
|
14
|
+
(staffWorkflow ? staffWorkflow.addWorkflowStaffCommands(yargs) : yargs)
|
|
12
15
|
.command(workflowListCommand)
|
|
13
16
|
.command(workflowGetCommand)
|
|
14
17
|
.command(workflowCreateCommand)
|
|
@@ -16,7 +19,6 @@ export const workflowCommand = {
|
|
|
16
19
|
.command(workflowDisableCommand)
|
|
17
20
|
.command(workflowRunCommand)
|
|
18
21
|
.command(workflowNodeOptionsCommand)
|
|
19
|
-
.command(workflowIntegrityScanCommand)
|
|
20
22
|
.command(workflowAiFollowupsCommand)
|
|
21
23
|
.command(workflowScheduleCommand)
|
|
22
24
|
.command(siteAiFollowupsCommand)
|
|
@@ -331,35 +333,6 @@ const siteAiFollowupsCommand = {
|
|
|
331
333
|
}),
|
|
332
334
|
};
|
|
333
335
|
|
|
334
|
-
// ── integrity-scan (Velaro staff only) ──────────────────────────────────────────
|
|
335
|
-
|
|
336
|
-
const workflowIntegrityScanCommand = {
|
|
337
|
-
command: 'integrity-scan <siteId>',
|
|
338
|
-
describe: 'Scan every workflow on a site for NodesBlob that fails to parse (Velaro staff only)',
|
|
339
|
-
builder: (y) => y.positional('siteId', { type: 'number', describe: 'Site ID to scan' }),
|
|
340
|
-
handler: runCommand(async (argv) => {
|
|
341
|
-
const creds = await getCredentials();
|
|
342
|
-
if (creds.siteId !== 1032) {
|
|
343
|
-
console.error('velaro workflow integrity-scan is only available to Velaro staff.');
|
|
344
|
-
process.exit(1);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
const results = await messagingGet(`/SuperAdmin/workflows/integrity-scan?siteId=${argv.siteId}`);
|
|
348
|
-
|
|
349
|
-
if (!results?.length) {
|
|
350
|
-
console.log(`\nSite ${argv.siteId}: no corrupted workflows found.\n`);
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
console.log(`\nSite ${argv.siteId}: ${results.length} corrupted workflow(s):\n`);
|
|
355
|
-
for (const r of results) {
|
|
356
|
-
console.log(` [${r.id}] ${r.name}`);
|
|
357
|
-
console.log(` Last modified: ${r.lastModified}`);
|
|
358
|
-
console.log(` Error: ${r.error}\n`);
|
|
359
|
-
}
|
|
360
|
-
}),
|
|
361
|
-
};
|
|
362
|
-
|
|
363
336
|
// ── schedule (workflow schedule priority; messaging owns /Workflows/schedule/*) ──────────────
|
|
364
337
|
// Mirrors the velaro MCP tools workflow_schedule_resolve / _timeline / _validate / _banner / _override_save / _override_list / _override_delete.
|
|
365
338
|
// An older messaging answers 404/501: print "not available" instead of failing.
|
package/lib/signature-policy.js
CHANGED
|
@@ -22,6 +22,28 @@ export function parseMode(value) {
|
|
|
22
22
|
return mode;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const NAME_SOURCES = ['real_name', 'display_name'];
|
|
26
|
+
const NAME_FORMATS = ['none', 'name', 'team', 'name_and_team'];
|
|
27
|
+
const APPLY_TO = ['inheritingGroups', 'allGroups', 'newGroupsOnly'];
|
|
28
|
+
|
|
29
|
+
// undefined = not supplied, null = inherit, else a validated API value. Accepts dashes ("display-name").
|
|
30
|
+
function parseEnum(value, allowed, label) {
|
|
31
|
+
if (value === undefined) return undefined;
|
|
32
|
+
if (value === null) return null;
|
|
33
|
+
const v = String(value).trim().toLowerCase().replace(/-/g, '_');
|
|
34
|
+
if (v === '' || v === 'default' || v === 'inherit') return null;
|
|
35
|
+
if (!allowed.includes(v)) throw new Error(`${label} must be one of ${allowed.join(', ')} or default`);
|
|
36
|
+
return v;
|
|
37
|
+
}
|
|
38
|
+
export const parseNameSource = (v) => parseEnum(v, NAME_SOURCES, 'nameSource');
|
|
39
|
+
export const parseNameFormat = (v) => parseEnum(v, NAME_FORMATS, 'nameFormat');
|
|
40
|
+
|
|
41
|
+
export function parseApplyTo(value) {
|
|
42
|
+
if (value === undefined || value === null || value === '') return undefined;
|
|
43
|
+
if (!APPLY_TO.includes(value)) throw new Error(`applyTo must be one of ${APPLY_TO.join(', ')}`);
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
|
|
25
47
|
export function parseTeamId(value) {
|
|
26
48
|
if (value === undefined || value === null || value === '') return 0;
|
|
27
49
|
const n = Number(value);
|
|
@@ -39,6 +61,12 @@ export function buildPolicyBody(current, opts = {}) {
|
|
|
39
61
|
corporateSignature: cur.corporateSignature || null,
|
|
40
62
|
disclaimerEnabled: cur.disclaimerEnabled ?? null,
|
|
41
63
|
disclaimerText: cur.disclaimerText || null,
|
|
64
|
+
// PUT replaces the whole row, so the flow-down fields must be carried or a mode change would wipe them.
|
|
65
|
+
nameSource: cur.nameSource ?? null,
|
|
66
|
+
nameFormat: cur.nameFormat ?? null,
|
|
67
|
+
teamLabel: cur.teamLabel || null,
|
|
68
|
+
allowTeamOverrides: cur.allowTeamOverrides ?? null,
|
|
69
|
+
allowAgentOverrides: cur.allowAgentOverrides ?? null,
|
|
42
70
|
};
|
|
43
71
|
const mode = parseMode(opts.mode);
|
|
44
72
|
if (mode !== undefined) body.mode = mode;
|
|
@@ -50,6 +78,20 @@ export function buildPolicyBody(current, opts = {}) {
|
|
|
50
78
|
body.disclaimerEnabled = opts.disclaimerEnabled;
|
|
51
79
|
}
|
|
52
80
|
if (opts.disclaimerText !== undefined) body.disclaimerText = opts.disclaimerText || null;
|
|
81
|
+
const nameSource = parseNameSource(opts.nameSource);
|
|
82
|
+
if (nameSource !== undefined) body.nameSource = nameSource;
|
|
83
|
+
const nameFormat = parseNameFormat(opts.nameFormat);
|
|
84
|
+
if (nameFormat !== undefined) body.nameFormat = nameFormat;
|
|
85
|
+
if (opts.teamLabel !== undefined) body.teamLabel = opts.teamLabel || null;
|
|
86
|
+
for (const k of ['allowTeamOverrides', 'allowAgentOverrides']) {
|
|
87
|
+
if (opts[k] !== undefined) {
|
|
88
|
+
if (opts[k] !== null && typeof opts[k] !== 'boolean') throw new Error(`${k} must be true, false or null`);
|
|
89
|
+
body[k] = opts[k];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const applyTo = parseApplyTo(opts.applyTo);
|
|
93
|
+
if (applyTo !== undefined) body.applyTo = applyTo;
|
|
94
|
+
if (body.teamLabel && body.teamLabel.length > 100) throw new Error('teamLabel is limited to 100 characters');
|
|
53
95
|
if (body.corporateSignature && body.corporateSignature.length > 4000) throw new Error('corporateSignature is limited to 4000 characters');
|
|
54
96
|
if (body.disclaimerText && body.disclaimerText.length > 2000) throw new Error('disclaimerText is limited to 2000 characters');
|
|
55
97
|
return body;
|
|
@@ -21,12 +21,12 @@ test('parseTeamId defaults to company-wide and rejects junk', () => {
|
|
|
21
21
|
test('buildPolicyBody keeps current values for fields that are not passed', () => {
|
|
22
22
|
const cur = { teamId: 0, mode: 'company_default', corporateSignature: '<b>Acme</b>', disclaimerEnabled: true, disclaimerText: 'Confidential' };
|
|
23
23
|
const body = buildPolicyBody(cur, { mode: 'locked' });
|
|
24
|
-
assert.deepEqual(body, { teamId: 0, mode: 'admin_locked', corporateSignature: '<b>Acme</b>', disclaimerEnabled: true, disclaimerText: 'Confidential' });
|
|
24
|
+
assert.deepEqual(body, { teamId: 0, mode: 'admin_locked', corporateSignature: '<b>Acme</b>', disclaimerEnabled: true, disclaimerText: 'Confidential', nameSource: null, nameFormat: null, teamLabel: null, allowTeamOverrides: null, allowAgentOverrides: null });
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
test('buildPolicyBody with no existing row starts from all-null (follow company-wide)', () => {
|
|
28
28
|
const body = buildPolicyBody(undefined, { teamId: 5, disclaimerEnabled: true });
|
|
29
|
-
assert.deepEqual(body, { teamId: 5, mode: null, corporateSignature: null, disclaimerEnabled: true, disclaimerText: null });
|
|
29
|
+
assert.deepEqual(body, { teamId: 5, mode: null, corporateSignature: null, disclaimerEnabled: true, disclaimerText: null, nameSource: null, nameFormat: null, teamLabel: null, allowTeamOverrides: null, allowAgentOverrides: null });
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
test('null clears a field and over-long text is rejected before sending', () => {
|
|
@@ -46,3 +46,29 @@ test('findPolicy picks the row for a team and describeMode is readable', () => {
|
|
|
46
46
|
assert.match(describeMode('admin_locked'), /locked/);
|
|
47
47
|
assert.match(describeMode(null), /follows/);
|
|
48
48
|
});
|
|
49
|
+
|
|
50
|
+
test('a mode change keeps the name line, team label and override switches (PUT replaces the row)', () => {
|
|
51
|
+
const cur = { teamId: 0, mode: 'company_default', nameSource: 'display_name', nameFormat: 'name_and_team', teamLabel: 'Customer Support', allowTeamOverrides: false, allowAgentOverrides: true };
|
|
52
|
+
const body = buildPolicyBody(cur, { mode: 'locked' });
|
|
53
|
+
assert.equal(body.mode, 'admin_locked');
|
|
54
|
+
assert.equal(body.nameSource, 'display_name');
|
|
55
|
+
assert.equal(body.nameFormat, 'name_and_team');
|
|
56
|
+
assert.equal(body.teamLabel, 'Customer Support');
|
|
57
|
+
assert.equal(body.allowTeamOverrides, false);
|
|
58
|
+
assert.equal(body.allowAgentOverrides, true);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('name line options validate, accept dashes and clear with default', () => {
|
|
62
|
+
const body = buildPolicyBody(undefined, { nameFormat: 'name-and-team', nameSource: 'display-name', teamLabel: 'Support', allowAgentOverrides: false, applyTo: 'allGroups' });
|
|
63
|
+
assert.equal(body.nameFormat, 'name_and_team');
|
|
64
|
+
assert.equal(body.nameSource, 'display_name');
|
|
65
|
+
assert.equal(body.teamLabel, 'Support');
|
|
66
|
+
assert.equal(body.allowAgentOverrides, false);
|
|
67
|
+
assert.equal(body.applyTo, 'allGroups');
|
|
68
|
+
assert.equal(buildPolicyBody({ nameFormat: 'team' }, { nameFormat: 'default' }).nameFormat, null);
|
|
69
|
+
assert.throws(() => buildPolicyBody(undefined, { nameFormat: 'loud' }), /nameFormat must be one of/);
|
|
70
|
+
assert.throws(() => buildPolicyBody(undefined, { nameSource: 'nick' }), /nameSource must be one of/);
|
|
71
|
+
assert.throws(() => buildPolicyBody(undefined, { applyTo: 'some' }), /applyTo/);
|
|
72
|
+
assert.throws(() => buildPolicyBody(undefined, { allowTeamOverrides: 'no' }), /true, false or null/);
|
|
73
|
+
assert.throws(() => buildPolicyBody(undefined, { teamLabel: 'x'.repeat(101) }), /100/);
|
|
74
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Staff-only subcommands live in cli/staff (NOT published in the public npm package). A customer command that has a
|
|
2
|
+
// staff-only subcommand loads it through this helper and gets null when the staff folder is absent.
|
|
3
|
+
export async function loadStaff(rel) {
|
|
4
|
+
try {
|
|
5
|
+
return await import(new URL(`../staff/${rel}`, import.meta.url).href);
|
|
6
|
+
} catch (e) {
|
|
7
|
+
if (e?.code === 'ERR_MODULE_NOT_FOUND' && /[\\/]staff[\\/]/.test(String(e.message))) return null;
|
|
8
|
+
throw e;
|
|
9
|
+
}
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velaro/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.122",
|
|
4
4
|
"description": "Velaro Workspace v20 — command-line interface for managing bots, knowledge base ingestion, MCP API keys, search indexes, and ops health.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"postinstall": "node scripts/postinstall.js",
|
|
11
|
-
"test": "node --test lib/*.test.js"
|
|
11
|
+
"test": "node --test lib/*.test.js staff/tests/*.test.js"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
14
14
|
"node": ">=18.0.0"
|
package/lib/cobrowse-settings.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// Pure helpers for `velaro cobrowse ...` (kept free of I/O so they are unit-testable).
|
|
2
|
-
//
|
|
3
|
-
// The platform API (messaging: GET/PUT superadmin/sites/{siteId}/cobrowse...) has REPLACE semantics: every setting
|
|
4
|
-
// that is not sent goes back to the platform default. For a CLI that is a footgun, so `set` first reads the current
|
|
5
|
-
// raw settings and only overwrites what the operator named on the command line.
|
|
6
|
-
|
|
7
|
-
export const TRI_FIELDS = [
|
|
8
|
-
['cues', 'cuesEnabled'],
|
|
9
|
-
['formFill', 'formFillEnabled'],
|
|
10
|
-
['strictMask', 'strictMaskMode'],
|
|
11
|
-
['disableMobile', 'disableOnMobile'],
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
/** "on" / "off" / "default" (also true/false) -> true / false / null. Throws on anything else. */
|
|
15
|
-
export function parseTri(value, flag) {
|
|
16
|
-
if (value === undefined) return undefined;
|
|
17
|
-
const v = String(value).trim().toLowerCase();
|
|
18
|
-
if (['on', 'true', 'yes', '1'].includes(v)) return true;
|
|
19
|
-
if (['off', 'false', 'no', '0'].includes(v)) return false;
|
|
20
|
-
if (['default', 'inherit', 'null', ''].includes(v)) return null;
|
|
21
|
-
throw new Error(`--${flag} must be on, off or default (got "${value}")`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function parseIntOrDefault(value, flag) {
|
|
25
|
-
if (value === undefined) return undefined;
|
|
26
|
-
const v = String(value).trim().toLowerCase();
|
|
27
|
-
if (v === 'default' || v === '') return null;
|
|
28
|
-
const n = Number(v);
|
|
29
|
-
if (!Number.isInteger(n)) throw new Error(`--${flag} must be a whole number of minutes or "default" (got "${value}")`);
|
|
30
|
-
return n;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function parseTextOrDefault(value) {
|
|
34
|
-
if (value === undefined) return undefined;
|
|
35
|
-
return String(value).trim().toLowerCase() === 'default' ? null : String(value);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Merge operator flags over the site's current raw settings. Returns the full request body to PUT.
|
|
40
|
-
* Protected pages: "default" -> platform list, "none" -> no protected pages, otherwise a newline/comma list.
|
|
41
|
-
*/
|
|
42
|
-
export function buildCobrowseUpdate(current, args) {
|
|
43
|
-
const body = { ...(current ?? {}) };
|
|
44
|
-
delete body.updatedAt;
|
|
45
|
-
|
|
46
|
-
for (const [flag, field] of TRI_FIELDS) {
|
|
47
|
-
const v = parseTri(args[flag], flag);
|
|
48
|
-
if (v !== undefined) body[field] = v;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (args.protectedPages !== undefined) {
|
|
52
|
-
const raw = String(args.protectedPages).trim();
|
|
53
|
-
const lower = raw.toLowerCase();
|
|
54
|
-
body.blockedUrlPatterns = lower === 'default' ? null : lower === 'none' ? '' : raw.split(/[\n,]/).map(s => s.trim()).filter(Boolean).join('\n');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const max = parseIntOrDefault(args.maxMinutes, 'max-minutes');
|
|
58
|
-
if (max !== undefined) body.maxSessionMinutes = max;
|
|
59
|
-
const idle = parseIntOrDefault(args.idleMinutes, 'idle-minutes');
|
|
60
|
-
if (idle !== undefined) body.idleStopMinutes = idle;
|
|
61
|
-
|
|
62
|
-
const title = parseTextOrDefault(args.consentTitle);
|
|
63
|
-
if (title !== undefined) body.consentTitle = title;
|
|
64
|
-
const message = parseTextOrDefault(args.consentMessage);
|
|
65
|
-
if (message !== undefined) body.consentMessage = message;
|
|
66
|
-
const allow = parseTextOrDefault(args.consentAllow);
|
|
67
|
-
if (allow !== undefined) body.consentAllowLabel = allow;
|
|
68
|
-
|
|
69
|
-
const teams = parseTextOrDefault(args.teams);
|
|
70
|
-
if (teams !== undefined) body.allowedTeamIds = teams === 'none' ? null : teams;
|
|
71
|
-
const roles = parseTextOrDefault(args.roles);
|
|
72
|
-
if (roles !== undefined) body.allowedRoles = roles === 'none' ? null : roles;
|
|
73
|
-
|
|
74
|
-
return body;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function describeEffective(e) {
|
|
78
|
-
if (!e) return [];
|
|
79
|
-
return [
|
|
80
|
-
['Agent cues', e.cuesEnabled ? 'on' : 'off'],
|
|
81
|
-
['Guided form fill', e.formFillEnabled ? 'on' : 'off'],
|
|
82
|
-
['Strict mask mode', e.strictMask ? 'on' : 'off'],
|
|
83
|
-
['Off on mobile', e.disableOnMobile ? 'yes' : 'no'],
|
|
84
|
-
['Protected pages', (e.blockedUrlPatterns ?? []).length ? e.blockedUrlPatterns.join(' ') : 'none'],
|
|
85
|
-
['Max session / idle stop', `${e.maxSessionMinutes} min / ${e.idleStopMinutes} min`],
|
|
86
|
-
['Who can start', (e.allowedTeamIds ?? []).length || (e.allowedRoles ?? []).length
|
|
87
|
-
? `teams [${(e.allowedTeamIds ?? []).join(', ')}] roles [${(e.allowedRoles ?? []).join(', ')}]`
|
|
88
|
-
: 'everyone with a seat'],
|
|
89
|
-
];
|
|
90
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { buildCobrowseUpdate, parseTri, describeEffective } from './cobrowse-settings.js';
|
|
4
|
-
|
|
5
|
-
test('parseTri maps on/off/default and rejects anything else', () => {
|
|
6
|
-
assert.equal(parseTri('on', 'cues'), true);
|
|
7
|
-
assert.equal(parseTri('OFF', 'cues'), false);
|
|
8
|
-
assert.equal(parseTri('default', 'cues'), null);
|
|
9
|
-
assert.equal(parseTri(undefined, 'cues'), undefined);
|
|
10
|
-
assert.throws(() => parseTri('maybe', 'cues'), /--cues must be on, off or default/);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('set only changes the flags named; everything else is preserved (the API itself replaces)', () => {
|
|
14
|
-
const current = { cuesEnabled: true, strictMaskMode: true, maxSessionMinutes: 30, blockedUrlPatterns: '/a\n/b', updatedAt: '2026-10-15T00:00:00Z' };
|
|
15
|
-
const body = buildCobrowseUpdate(current, { formFill: 'on', maxMinutes: '60' });
|
|
16
|
-
assert.deepEqual(body, { cuesEnabled: true, strictMaskMode: true, maxSessionMinutes: 60, blockedUrlPatterns: '/a\n/b', formFillEnabled: true });
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test('default clears a setting back to the platform default', () => {
|
|
20
|
-
const body = buildCobrowseUpdate({ cuesEnabled: false, maxSessionMinutes: 30 }, { cues: 'default', maxMinutes: 'default' });
|
|
21
|
-
assert.equal(body.cuesEnabled, null);
|
|
22
|
-
assert.equal(body.maxSessionMinutes, null);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test('protected pages: default / none / explicit list', () => {
|
|
26
|
-
assert.equal(buildCobrowseUpdate({}, { protectedPages: 'default' }).blockedUrlPatterns, null);
|
|
27
|
-
assert.equal(buildCobrowseUpdate({}, { protectedPages: 'none' }).blockedUrlPatterns, '');
|
|
28
|
-
assert.equal(buildCobrowseUpdate({}, { protectedPages: '/checkout, /portal/pay ' }).blockedUrlPatterns, '/checkout\n/portal/pay');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test('teams and roles accept "none"', () => {
|
|
32
|
-
const body = buildCobrowseUpdate({ allowedTeamIds: '1,2', allowedRoles: 'Manager' }, { teams: 'none', roles: 'Agent' });
|
|
33
|
-
assert.equal(body.allowedTeamIds, null);
|
|
34
|
-
assert.equal(body.allowedRoles, 'Agent');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('non-integer minutes are rejected before anything is sent', () => {
|
|
38
|
-
assert.throws(() => buildCobrowseUpdate({}, { maxMinutes: 'soon' }), /whole number/);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('describeEffective renders a readable summary', () => {
|
|
42
|
-
const rows = describeEffective({ cuesEnabled: true, formFillEnabled: false, strictMask: false, disableOnMobile: false, blockedUrlPatterns: ['/checkout'], maxSessionMinutes: 120, idleStopMinutes: 15, allowedTeamIds: [], allowedRoles: [] });
|
|
43
|
-
assert.ok(rows.some(([k, v]) => k === 'Protected pages' && v === '/checkout'));
|
|
44
|
-
assert.ok(rows.some(([k, v]) => k === 'Who can start' && v === 'everyone with a seat'));
|
|
45
|
-
});
|