@velaro/cli 1.4.120 → 1.4.121

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.
Files changed (65) hide show
  1. package/README.md +0 -19
  2. package/bin/velaro.js +21 -92
  3. package/lib/avatar-motion.test.js +1 -1
  4. package/lib/avatar-switch.test.js +1 -1
  5. package/lib/commands/agent.js +7 -58
  6. package/lib/commands/ai-config.js +8 -34
  7. package/lib/commands/index.js +18 -14
  8. package/lib/commands/kb.js +4 -94
  9. package/lib/commands/knowledge.js +2 -2
  10. package/lib/commands/ops-groups.js +0 -13
  11. package/lib/commands/safety.js +1 -1
  12. package/lib/commands/salesforce.js +1 -1
  13. package/lib/commands/sap.js +1 -1
  14. package/lib/commands/schedule-adherence.js +1 -1
  15. package/lib/commands/teams.js +1 -1
  16. package/lib/commands/woocommerce.js +1 -1
  17. package/lib/commands/workflow.js +4 -31
  18. package/lib/staff-optional.js +10 -0
  19. package/package.json +2 -2
  20. package/lib/cobrowse-settings.js +0 -90
  21. package/lib/cobrowse-settings.test.js +0 -45
  22. package/lib/commands/activity.js +0 -147
  23. package/lib/commands/acuity.js +0 -66
  24. package/lib/commands/ai-federation.js +0 -55
  25. package/lib/commands/ai-models.js +0 -203
  26. package/lib/commands/ai-spend.js +0 -71
  27. package/lib/commands/avatar.js +0 -253
  28. package/lib/commands/bigcommerce.js +0 -50
  29. package/lib/commands/calendly.js +0 -62
  30. package/lib/commands/cobrowse.js +0 -99
  31. package/lib/commands/coupon-grant.js +0 -192
  32. package/lib/commands/diag-groups.js +0 -108
  33. package/lib/commands/diagnostics.js +0 -298
  34. package/lib/commands/email-inbox.js +0 -110
  35. package/lib/commands/entitlement.js +0 -375
  36. package/lib/commands/image-analysis.js +0 -27
  37. package/lib/commands/logs-insights.js +0 -342
  38. package/lib/commands/logs.js +0 -1248
  39. package/lib/commands/migrate.js +0 -379
  40. package/lib/commands/migration-status.js +0 -66
  41. package/lib/commands/ops.js +0 -266
  42. package/lib/commands/parity-staff-tools.js +0 -205
  43. package/lib/commands/pricing.js +0 -132
  44. package/lib/commands/report-speed.js +0 -112
  45. package/lib/commands/scraper.js +0 -38
  46. package/lib/commands/site-provision.js +0 -68
  47. package/lib/commands/sitesync.js +0 -158
  48. package/lib/commands/skill-usage.js +0 -39
  49. package/lib/commands/staff.js +0 -31
  50. package/lib/commands/status-page.js +0 -95
  51. package/lib/commands/status-sla.js +0 -47
  52. package/lib/commands/subscription.js +0 -102
  53. package/lib/commands/support.js +0 -309
  54. package/lib/commands/tour-policy.js +0 -61
  55. package/lib/commands/triage.js +0 -66
  56. package/lib/entitlement-report-packages.test.js +0 -47
  57. package/lib/log-search.js +0 -252
  58. package/lib/log-search.test.js +0 -374
  59. package/lib/logs-insights.test.js +0 -146
  60. package/lib/messaging-routes.test.js +0 -37
  61. package/lib/report-speed.test.js +0 -26
  62. package/lib/siteUser.js +0 -35
  63. package/lib/siteUser.test.js +0 -45
  64. package/lib/skill-usage.test.js +0 -36
  65. package/lib/status-sla.test.js +0 -23
@@ -1,253 +0,0 @@
1
- import { request, messagingGet, messagingPut, messagingDel } from '../api.js';
2
- import { overrideBody, scopePath } from '../avatar-override.js';
3
- import { applyMotionArgs } from '../avatar-motion.js';
4
- import { SWITCH_VALUES, workflowSwitchBody, bulkSwitchBody } from '../avatar-switch.js';
5
- import { runCommand } from '../run.js';
6
-
7
- // ── velaro avatar ─────────────────────────────────────────────────────────────
8
- // Superadmin commands to inspect/configure the AI Video Avatar (Simli/D-ID/HeyGen)
9
- // for any customer site. Requires a Velaro admin JWT (site 1032).
10
- //
11
- // The customer-facing endpoints (GET/POST velaro-messaging /avatar/config) are
12
- // JWT-scoped to the caller's own site only — these hit velaro-admin's own
13
- // Avatar/superadmin/* endpoints instead, which can target any siteId.
14
-
15
- export const avatarCommand = {
16
- command: 'avatar <subcommand>',
17
- describe: 'Manage the AI Video Avatar for any site (Velaro admin only)',
18
- builder: yargs => yargs
19
- .command({
20
- command: 'get',
21
- describe: 'Show AI Video Avatar config for a site',
22
- builder: y => y.option('site', { type: 'number', demandOption: true, describe: 'Site ID' }),
23
- handler: runCommand(async argv => {
24
- const data = await request('GET', `/Avatar/superadmin/status?siteId=${argv.site}`);
25
- if (!data.configured) {
26
- console.log(`\nSite ${argv.site}: AI Video Avatar NOT configured (no saved config).\n`);
27
- return;
28
- }
29
- console.log(`\nSite ${argv.site}: AI Video Avatar ${data.enabled ? 'ENABLED ✓' : 'configured but DISABLED'}`);
30
- console.log(` Provider: ${data.providerSlug}`);
31
- console.log(` Avatar ID: ${data.avatarId || '(provider default)'}`);
32
- console.log(` Face/provider: ${data.avatarIdByProvider && Object.keys(data.avatarIdByProvider).length ? JSON.stringify(data.avatarIdByProvider) : '(none saved)'} (read-only)`);
33
- console.log(` Voice ID: ${data.voiceId || '(site default)'}`);
34
- console.log(` Keep on agent join: ${data.enabledOnAgentTransfer ? 'yes' : 'no'}`);
35
- console.log(` Enabled: ${data.enabled ? 'yes' : 'no'}`);
36
- console.log(` "Call me": ${data.showCallMeOption ? 'yes' : 'no'}`);
37
- console.log(` Callback window: ${data.callbackConfirmWindowMinutes} min`);
38
- console.log(` Show transcript: ${data.showTranscript ? 'yes' : 'no'}`);
39
- console.log(` Display name: ${data.displayName || '(AI)'}`);
40
- console.log(` Badge shown: ${data.showBadge ? 'yes' : 'no'}`);
41
- console.log(` Size: ${data.sizePx}px`);
42
- console.log(` Body motion: ${data.motionLevel || '(default: natural)'} @ ${data.motionIntensityPercent ?? 100}%`);
43
- console.log(` Max minutes/mo: ${data.maxAvatarMinutesPerMonth ?? '(plan default)'}`);
44
- console.log(` Max TTS chars/mo: ${data.maxAvatarTtsChars ?? '(plan default)'}`);
45
- try {
46
- const ent = await request('GET', `/Entitlements/${argv.site}`);
47
- console.log(` HeyGen entitled: ${ent?.features?.EnableAvatarHeyGen ? 'yes' : 'no'}\n`);
48
- } catch (e) { console.log(` HeyGen entitled: unknown (${e.message})\n`); }
49
- }),
50
- })
51
- .command({
52
- command: 'heygen',
53
- describe: 'Grant or revoke the HeyGen provider entitlement (EnableAvatarHeyGen) for a site',
54
- builder: y => y
55
- .option('site', { type: 'number', demandOption: true, describe: 'Site ID' })
56
- .option('enabled', { type: 'boolean', demandOption: true, describe: 'true = grant, false = revoke' }),
57
- handler: runCommand(async argv => {
58
- await request('POST', `/Entitlements/${argv.site}/override`, { featureKey: 'EnableAvatarHeyGen', value: argv.enabled, reason: 'velaro avatar heygen' });
59
- const ent = await request('GET', `/Entitlements/${argv.site}`);
60
- console.log(`\n✓ Site ${argv.site}: EnableAvatarHeyGen=${ent?.features?.EnableAvatarHeyGen ? 'true' : 'false'}\n`);
61
- }),
62
- })
63
- .command({
64
- command: 'session-readiness',
65
- describe: 'Staff diagnostic: why an avatar session will or will not start for a site (plan, config, key, billing, concurrency). Read-only, no provider call.',
66
- builder: y => y.option('site', { type: 'number', demandOption: true, describe: 'Site ID' }),
67
- handler: runCommand(async argv => {
68
- const data = await messagingGet(`/avatar/diagnostics/session-readiness?siteId=${argv.site}`);
69
- console.log(JSON.stringify(data, null, 2));
70
- }),
71
- })
72
- .command({
73
- command: 'enable',
74
- describe: 'Turn on (or update) the AI Video Avatar for a site',
75
- builder: y => y
76
- .option('site', { type: 'number', demandOption: true, describe: 'Site ID' })
77
- .option('provider', { type: 'string', describe: 'Avatar provider slug (velaro, simli, d-id, heygen). Default on first setup: velaro (Velaro Avatar). Omit on a re-run to leave the existing provider untouched.' })
78
- .option('bot', { type: 'string', describe: 'Reserved for a future per-bot override (not yet implemented on this endpoint)' })
79
- .option('avatar-id',{ type: 'string', describe: 'Provider-specific avatar/face ID. Omit for provider default.' })
80
- .option('voice', { type: 'string', describe: 'ElevenLabs voice ID override' })
81
- .option('keep-on-agent-join', { type: 'boolean', describe: 'Keep the avatar running after a human agent joins. Omit on a re-run to leave it untouched.' })
82
- .option('show-transcript', { type: 'boolean', describe: 'Show an on-screen avatar transcript (default off). Omit on a re-run to leave it untouched.' })
83
- .option('call-me', { type: 'boolean', describe: 'Show the "Call me instead" option. Omit on a re-run to leave it untouched.' })
84
- .option('display-name', { type: 'string', describe: 'Visitor-facing avatar name on the badge (e.g. Moshky). Empty string resets to "AI".' })
85
- .option('show-badge', { type: 'boolean', describe: 'Show the name badge over the avatar video.' })
86
- .option('size', { type: 'number', describe: 'Avatar panel max width in px (160-640). Default 360.' })
87
- .option('motion-level', { type: 'string', describe: 'Body motion: off | subtle | natural | expressive. Empty string resets to the default (natural).' })
88
- .option('motion-intensity', { type: 'number', describe: 'Body motion strength percent (25-150). Default 100.' }),
89
- handler: runCommand(async argv => {
90
- if (argv.bot) {
91
- console.log(`\nNote: --bot is not yet supported by this endpoint — this sets the SITE-level avatar config only. Use the admin UI's per-bot override toggle for bot-specific control.\n`);
92
- }
93
- // Partial update: only send fields the caller actually passed, so re-running `enable`
94
- // to change one field (e.g. just --voice) never silently resets provider/call-me back
95
- // to a hardcoded default on an existing config.
96
- const body = { enabled: true };
97
- body.providerSlug = argv.provider ?? 'velaro';
98
- if (argv['avatar-id'] !== undefined) body.avatarId = argv['avatar-id'];
99
- if (argv.voice !== undefined) body.voiceId = argv.voice;
100
- if (argv['keep-on-agent-join'] !== undefined) body.enabledOnAgentTransfer = argv['keep-on-agent-join'];
101
- if (argv['call-me'] !== undefined) body.showCallMeOption = argv['call-me'];
102
- if (argv['show-transcript'] !== undefined) body.showTranscript = argv['show-transcript'];
103
- if (argv['display-name'] !== undefined) body.displayName = argv['display-name'];
104
- if (argv['show-badge'] !== undefined) body.showBadge = argv['show-badge'];
105
- if (argv.size !== undefined) body.sizePx = argv.size;
106
- applyMotionArgs(body, argv);
107
- const data = await request('POST', `/Avatar/superadmin/config?siteId=${argv.site}`, body);
108
- if (!data.success) throw new Error(data.error || 'Configure failed');
109
- console.log(`\n✓ AI Video Avatar enabled for site ${argv.site}`);
110
- console.log(` Provider: ${data.providerSlug}`);
111
- console.log(` Avatar ID: ${data.avatarId || '(provider default)'}\n`);
112
- }),
113
- })
114
- .command({
115
- command: 'disable',
116
- describe: 'Turn off the AI Video Avatar for a site (keeps the saved config)',
117
- builder: y => y.option('site', { type: 'number', demandOption: true, describe: 'Site ID' }),
118
- handler: runCommand(async argv => {
119
- const data = await request('POST', `/Avatar/superadmin/config?siteId=${argv.site}`, { enabled: false });
120
- if (!data.success) throw new Error(data.error || 'Update failed');
121
- console.log(`\n✓ AI Video Avatar disabled for site ${argv.site}\n`);
122
- }),
123
- })
124
- .command({
125
- command: 'set',
126
- describe: "Set a site's monthly avatar caps (finite only, audited)",
127
- builder: y => y
128
- .option('site', { type: 'number', demandOption: true, describe: 'Site ID' })
129
- .option('max-minutes', { type: 'number', describe: 'Monthly avatar video minutes cap (whole number 1-100000)' })
130
- .option('max-tts-chars', { type: 'number', describe: 'Monthly avatar TTS character cap (whole number 1-100000000)' })
131
- .option('voice-stability', { type: 'number', describe: 'ElevenLabs stability 0-1 (lower = livelier, default 0.35)' })
132
- .option('voice-similarity', { type: 'number', describe: 'ElevenLabs similarity boost 0-1 (default 0.8)' })
133
- .option('voice-style', { type: 'number', describe: 'ElevenLabs style 0-1 (higher = more animated, default 0.45)' })
134
- .option('voice-speed', { type: 'number', describe: 'ElevenLabs speed 0.7-1.2 (default 1.05)' })
135
- .option('background-mode', { type: 'string', describe: 'Backdrop frame: none | color | gradient | image' })
136
- .option('background-value', { type: 'string', describe: 'color #1e293b | gradient "#1e293b,#7c3aed" | https image URL' })
137
- .option('regular-chat', { type: 'boolean', describe: 'Allow the avatar in the regular chat on pages matching --url-rules' })
138
- .option('zoom', { type: 'number', describe: 'Camera closeness: zoom 100-250 percent (160 = head and shoulders)' })
139
- .option('focal-x', { type: 'number', describe: 'Framing focal X 0-100 (default 50)' })
140
- .option('focal-y', { type: 'number', describe: 'Framing focal Y 0-100 (default 35)' })
141
- .option('shape', { type: 'string', describe: 'rounded | circle | square' })
142
- .option('corner-radius', { type: 'number', describe: 'Corner radius 0-48 px (rounded shape)' })
143
- .option('mirror', { type: 'boolean', describe: 'Mirror the video horizontally' })
144
- .option('speaking-ring', { type: 'boolean', describe: 'Ring around the avatar while active' })
145
- .option('muted', { type: 'boolean', describe: 'Start muted' })
146
- .option('volume', { type: 'number', describe: 'Volume 0-100' })
147
- .option('align', { type: 'string', describe: 'left | center | right' })
148
- .option('greeting', { type: 'string', describe: 'Line spoken at session start (empty clears)' })
149
- .option('voice-map', { type: 'string', describe: 'JSON map of language code to ElevenLabs voice id, e.g. {"es":"id"} (empty clears)' })
150
- .option('url-rules', { type: 'string', describe: 'Pages for regular-chat avatar, separated by \\n or commas: plain = URL contains, re:<regex>. Empty string clears.' })
151
- .option('motion-level', { type: 'string', describe: 'Body motion: off | subtle | natural | expressive. Empty string resets to the default.' })
152
- .option('motion-intensity', { type: 'number', describe: 'Body motion strength percent (25-150).' }),
153
- handler: runCommand(async argv => {
154
- const body = {};
155
- applyMotionArgs(body, argv);
156
- for (const [opt, key] of [['voice-stability', 'voiceStability'], ['voice-similarity', 'voiceSimilarity'], ['voice-style', 'voiceStyle'], ['voice-speed', 'voiceSpeed'], ['background-mode', 'backgroundMode'], ['background-value', 'backgroundValue'], ['regular-chat', 'regularChatEnabled'], ['zoom', 'zoomPercent'], ['focal-x', 'focalX'], ['focal-y', 'focalY'], ['shape', 'shape'], ['corner-radius', 'cornerRadiusPx'], ['mirror', 'mirror'], ['speaking-ring', 'speakingRing'], ['muted', 'mutedByDefault'], ['volume', 'volume'], ['align', 'align'], ['greeting', 'greetingLine'], ['voice-map', 'voiceIdByLanguage']]) {
157
- if (argv[opt] !== undefined) body[key] = argv[opt];
158
- }
159
- if (argv['url-rules'] !== undefined) body.regularChatUrlRules = String(argv['url-rules']).replace(/\\n|,/g, '\n');
160
- for (const [opt, key, max] of [['max-minutes', 'maxAvatarMinutesPerMonth', 100000], ['max-tts-chars', 'maxAvatarTtsChars', 100000000]]) {
161
- if (argv[opt] === undefined) continue;
162
- if (!Number.isInteger(argv[opt]) || argv[opt] < 1 || argv[opt] > max) throw new Error(`--${opt} must be a whole number between 1 and ${max} (never unlimited)`);
163
- body[key] = argv[opt];
164
- }
165
- if (!Object.keys(body).length) throw new Error('Provide at least one setting (--max-minutes, --voice-style, --background-mode, --regular-chat, --motion-level, ...)');
166
- const data = await request('POST', `/Avatar/superadmin/config?siteId=${argv.site}`, body);
167
- if (!data.success) throw new Error(data.error || 'Set avatar caps failed');
168
- console.log(`
169
- ✓ Avatar settings updated for site ${argv.site}`);
170
- console.log(` Body motion: ${data.motionLevel || '(default: natural)'} @ ${data.motionIntensityPercent ?? 100}%`);
171
- console.log(` Max minutes/mo: ${data.maxAvatarMinutesPerMonth}`);
172
- console.log(` Max TTS chars/mo: ${data.maxAvatarTtsChars}\n`);
173
- }),
174
- })
175
- .command({
176
- command: 'override',
177
- describe: 'Set the person / personality / voice / name / backdrop for ONE group or workflow of YOUR site (perWorkflow ?? perGroup ?? perSite)',
178
- builder: y => y
179
- .option('group', { type: 'number', describe: 'Group (team) id' })
180
- .option('workflow', { type: 'number', describe: 'Workflow id (wins over its group)' })
181
- .option('avatar', { type: 'string', describe: 'Library avatar slug (see the avatar library), e.g. priya. Empty string clears.' })
182
- .option('personality', { type: 'string', describe: 'Personality preset slug. Empty string clears.' })
183
- .option('voice', { type: 'string', describe: 'ElevenLabs voice id. Empty string clears.' })
184
- .option('display-name', { type: 'string', describe: 'Visitor-facing avatar name. Empty string clears.' })
185
- .option('backdrop', { type: 'string', choices: ['none', 'color', 'gradient', 'image', ''], describe: 'Backdrop type. none = explicitly no backdrop; empty string = inherit.' })
186
- .option('backdrop-value', { type: 'string', describe: 'Hex color, "#a,#b" gradient, or https image URL' })
187
- .option('provider', { type: 'string', describe: 'Provider slug (a library avatar implies velaro)' })
188
- .option('motion-level', { type: 'string', describe: 'Body motion: off | subtle | natural | expressive. Empty string clears back to inherit.' })
189
- .option('replace', { type: 'boolean', describe: 'Replace the whole override instead of changing only the flags passed' }),
190
- handler: runCommand(async argv => {
191
- const base = scopePath(argv);
192
- const data = await messagingPut(`${base}/override`, overrideBody(argv));
193
- if (!data?.success) throw new Error(data?.error || 'Override failed');
194
- const eff = await messagingGet(`${base}/effective`);
195
- console.log(`
196
- ✓ Override saved. Effective now: motion=${eff.motionLevel ?? '(default)'} avatar=${eff.avatarId ?? '(default)'} backdrop=${eff.backgroundMode}${eff.backgroundValue ? ' ' + eff.backgroundValue : ''} name=${eff.displayName ?? '(AI)'} layer=${eff.layer}
197
- `);
198
- }),
199
- })
200
- .command({
201
- command: 'effective',
202
- describe: 'Show what a group or workflow of your site gets (override fields layered over the site default)',
203
- builder: y => y
204
- .option('group', { type: 'number', describe: 'Group (team) id' })
205
- .option('workflow', { type: 'number', describe: 'Workflow id' }),
206
- handler: runCommand(async argv => {
207
- const eff = await messagingGet(`${scopePath(argv)}/effective`);
208
- console.log(JSON.stringify(eff, null, 2));
209
- }),
210
- })
211
- .command({
212
- command: 'reset',
213
- describe: 'Remove a group or workflow override (back to the next layer / site default)',
214
- builder: y => y
215
- .option('group', { type: 'number', describe: 'Group (team) id' })
216
- .option('workflow', { type: 'number', describe: 'Workflow id' }),
217
- handler: runCommand(async argv => {
218
- const data = await messagingDel(`${scopePath(argv)}/override`);
219
- console.log(`
220
- ✓ Reset (${data?.removed ?? 0} override removed)
221
- `);
222
- }),
223
- })
224
- .command({
225
- command: 'workflow-switch <workflowId> <value>',
226
- describe: 'Switch the avatar on, off, or back to the site rules (rules) for ONE workflow of your site',
227
- builder: y => y
228
- .positional('workflowId', { type: 'number', describe: 'Workflow id' })
229
- .positional('value', { type: 'string', choices: SWITCH_VALUES, describe: 'on | off | rules (rules = the site rules decide)' }),
230
- handler: runCommand(async argv => {
231
- const id = Number(argv.workflowId);
232
- if (!Number.isInteger(id) || id <= 0) throw new Error('The workflow id must be a positive whole number');
233
- const data = await messagingPut(`/avatar/workflows/${id}/enabled`, workflowSwitchBody(argv.value));
234
- if (!data?.success) throw new Error(data?.error || 'Switch failed');
235
- console.log(`\n✓ Workflow ${id} avatar switch: ${data.mode} (${data.changed ? 'changed' : 'already set'})\n`);
236
- }),
237
- })
238
- .command({
239
- command: 'bulk-switch',
240
- describe: 'Set the avatar switch for many workflows and/or teams of your site in one call (max 500)',
241
- builder: y => y
242
- .option('ids', { type: 'string', describe: 'Comma-separated workflow ids, e.g. 12,13,14' })
243
- .option('groups', { type: 'string', describe: 'Comma-separated team (group) ids' })
244
- .option('value', { type: 'string', choices: SWITCH_VALUES, demandOption: true, describe: 'on | off | rules' }),
245
- handler: runCommand(async argv => {
246
- const body = bulkSwitchBody({ ids: argv.ids, groups: argv.groups, value: argv.value });
247
- const data = await messagingPut('/avatar/overrides/enabled', body);
248
- if (!data?.success) throw new Error(data?.error || 'Bulk switch failed');
249
- console.log(`\n✓ Bulk avatar switch ${data.mode}: ${data.changed} of ${data.requested} rows changed\n`);
250
- }),
251
- })
252
- .demandCommand(1, 'Specify a subcommand: get | enable | disable | set | override | effective | reset | workflow-switch | bulk-switch'),
253
- };
@@ -1,50 +0,0 @@
1
- /**
2
- * velaro bigcommerce — BigCommerce store management
3
- *
4
- * velaro bigcommerce refund-check <siteId> <orderId> Check whether an order is refundable
5
- */
6
-
7
- import { messagingGet } from '../api.js';
8
-
9
- const GRN = '\x1b[32m';
10
- const RED = '\x1b[31m';
11
- const DIM = '\x1b[2m';
12
- const BOLD = '\x1b[1m';
13
- const RST = '\x1b[0m';
14
-
15
- // ── refund-check ──────────────────────────────────────────────────────────────
16
-
17
- async function refundCheckHandler(argv) {
18
- try {
19
- const data = await messagingGet(`/SupportTools/sites/${argv.siteId}/bigcommerce/refund-check/${argv.orderId}`);
20
-
21
- if (data.refundable) {
22
- const method = data.methods?.[0];
23
- console.log(`\n${GRN}${BOLD}REFUNDABLE${RST} via ${BOLD}${method?.providerId ?? 'unknown'}${RST} (offline: ${method?.offline ? 'true' : 'false'})\n`);
24
- } else {
25
- console.log(`\n${RED}${BOLD}NOT REFUNDABLE${RST} — ${data.message ?? data.error ?? 'unknown reason'}.`);
26
- console.log(`${DIM}Recreate this order using an offline/manual payment method or the BigCommerce Test Payment Gateway (Settings > Payments), then re-check.${RST}\n`);
27
- }
28
- } catch (e) {
29
- console.error(`\n${RED}✗ Refund check failed: ${e.message}${RST}\n`);
30
- process.exitCode = 1;
31
- }
32
- }
33
-
34
- // ── command export ────────────────────────────────────────────────────────────
35
-
36
- export const bigcommerceCommand = {
37
- command: 'bigcommerce <subcommand>',
38
- describe: 'BigCommerce store management',
39
- builder: y => y
40
- .command({
41
- command: 'refund-check <siteId> <orderId>',
42
- describe: 'Check whether a BigCommerce order currently has a refundable payment record',
43
- builder: yy => yy
44
- .positional('siteId', { describe: 'Site ID', type: 'number' })
45
- .positional('orderId', { describe: 'BigCommerce order ID', type: 'number' }),
46
- handler: refundCheckHandler,
47
- })
48
- .demandCommand(1, 'Specify a subcommand. Run "velaro bigcommerce --help" for options.'),
49
- handler: () => {},
50
- };
@@ -1,62 +0,0 @@
1
- import { request } from '../api.js';
2
- import { runCommand } from '../run.js';
3
-
4
- // ── velaro calendly ───────────────────────────────────────────────────────────
5
- // Superadmin commands to configure Calendly for any customer site.
6
- // Requires a Velaro admin JWT (site 1032).
7
-
8
- export const calendlyCommand = {
9
- command: 'calendly <subcommand>',
10
- describe: 'Manage Calendly integration for any site (Velaro admin only)',
11
- builder: yargs => yargs
12
- .command({
13
- command: 'status',
14
- describe: 'Show Calendly config for a site',
15
- builder: y => y.option('site', { type: 'number', demandOption: true, describe: 'Site ID' }),
16
- handler: runCommand(async argv => {
17
- const data = await request('GET', `/Calendly/superadmin/status?siteId=${argv.site}`);
18
- if (!data.configured) {
19
- console.log(`\nSite ${argv.site}: Calendly NOT configured.\n`);
20
- return;
21
- }
22
- console.log(`\nSite ${argv.site}: Calendly configured ✓`);
23
- console.log(` Account: ${data.userName}`);
24
- console.log(` Default type: ${data.defaultEventTypeName || '(none)'}`);
25
- console.log(` Single-use: ${data.useSingleUseLinks ? 'yes' : 'no'}\n`);
26
- }),
27
- })
28
- .command({
29
- command: 'configure',
30
- describe: 'Set up or update Calendly for a site',
31
- builder: y => y
32
- .option('site', { type: 'number', demandOption: true, describe: 'Site ID' })
33
- .option('token', { type: 'string', demandOption: true, describe: 'Calendly Personal Access Token' })
34
- .option('event-uri', { type: 'string', demandOption: false, describe: 'Default event type URI' })
35
- .option('event-name', { type: 'string', demandOption: false, describe: 'Default event type display name' })
36
- .option('label', { type: 'string', demandOption: false, describe: 'Display label (e.g. "Acme Demo Booking")' })
37
- .option('single-use', { type: 'boolean', default: true, describe: 'Use single-use scheduling links' }),
38
- handler: runCommand(async argv => {
39
- const data = await request('POST', `/Calendly/superadmin/config?siteId=${argv.site}`, {
40
- accessToken: argv.token,
41
- displayName: argv.label || '',
42
- defaultEventTypeUri: argv['event-uri'] || '',
43
- defaultEventTypeName: argv['event-name'] || '',
44
- useSingleUseLinks: argv['single-use'],
45
- });
46
- if (!data.success) throw new Error(data.error || 'Configure failed');
47
- console.log(`\n✓ Calendly configured for site ${argv.site}`);
48
- console.log(` Account: ${data.userName}`);
49
- console.log(` Org: ${data.organizationUri}\n`);
50
- }),
51
- })
52
- .command({
53
- command: 'disconnect',
54
- describe: 'Remove Calendly config from a site',
55
- builder: y => y.option('site', { type: 'number', demandOption: true, describe: 'Site ID' }),
56
- handler: runCommand(async argv => {
57
- await request('DELETE', `/Calendly/superadmin/config?siteId=${argv.site}`);
58
- console.log(`\n✓ Calendly disconnected from site ${argv.site}\n`);
59
- }),
60
- })
61
- .demandCommand(1, 'Specify a subcommand: status | configure | disconnect'),
62
- };
@@ -1,99 +0,0 @@
1
- import { messagingGet, messagingPut } from '../api.js';
2
- import { buildCobrowseUpdate, describeEffective } from '../cobrowse-settings.js';
3
-
4
- // velaro cobrowse show|set|reset|sessions <siteId>
5
- //
6
- // Staff view and control of a site's Co-Browse configuration (what the plan entitles it to, what the site switched
7
- // on, the effective values after platform defaults and hard caps, and recent session metadata). Goes through the
8
- // messaging SuperAdmin endpoints, which share ONE validated service with the customer admin UI and the MCP tools,
9
- // so the CLI cannot store anything the UI cannot, and every change lands in the site's Activity Log.
10
-
11
- const RESET = '\x1b[0m';
12
- const BOLD = '\x1b[1m';
13
- const DIM = '\x1b[2m';
14
- const GRN = '\x1b[32m';
15
- const RED = '\x1b[31m';
16
-
17
- function fmtDate(iso) {
18
- if (!iso) return '-';
19
- return new Date(iso).toLocaleString('en-US', { timeZone: 'America/Los_Angeles', dateStyle: 'short', timeStyle: 'short' });
20
- }
21
-
22
- const siteArg = (y) => y.positional('siteId', { type: 'number', describe: 'Site id' });
23
-
24
- function printSite(data) {
25
- const ent = data.entitlements ?? {};
26
- const chip = (on) => (on ? `${GRN}yes${RESET}` : `${RED}no${RESET}`);
27
- console.log(`\n${BOLD}Co-Browse - site ${data.siteId}${RESET}`);
28
- console.log(` Entitled: Co-Browse ${chip(ent.coBrowse)} Plus cues ${chip(ent.cues)} Plus form fill ${chip(ent.formFill)} Plus redaction ${chip(ent.enhancedPiiRedaction)}`);
29
- console.log(`\n${BOLD}Effective settings${RESET} ${DIM}(null in the raw settings = platform default)${RESET}`);
30
- for (const [k, v] of describeEffective(data.effective)) console.log(` ${k.padEnd(26)} ${v}`);
31
- }
32
-
33
- const showCommand = {
34
- command: 'show <siteId>',
35
- describe: 'Show entitlement, settings and recent sessions for a site',
36
- builder: siteArg,
37
- handler: async (argv) => {
38
- const data = await messagingGet(`/superadmin/sites/${argv.siteId}/cobrowse`);
39
- if (argv.json) return console.log(JSON.stringify(data, null, 2));
40
- printSite(data);
41
- console.log(`\n${BOLD}Recent sessions${RESET} ${DIM}(metadata only, Pacific time)${RESET}`);
42
- const rows = data.recentSessions ?? [];
43
- if (rows.length === 0) console.log(' none');
44
- for (const s of rows) {
45
- console.log(` ${fmtDate(s.startedAt).padEnd(18)} conv #${String(s.conversationId).padEnd(8)} agent ${String(s.initiatedByUserId ?? '-').padEnd(7)} ${String(s.durationSeconds ?? '-').padStart(5)}s ${s.outcome ?? '-'}${s.endReason ? ` (${s.endReason})` : ''}`);
46
- }
47
- },
48
- };
49
-
50
- const setCommand = {
51
- command: 'set <siteId>',
52
- describe: 'Change Co-Browse settings for a site (only the flags you pass change)',
53
- builder: (y) => siteArg(y)
54
- .option('cues', { type: 'string', describe: 'Agent pointer/highlight/annotation (Plus): on | off | default' })
55
- .option('form-fill', { type: 'string', describe: 'Guided form fill (Plus): on | off | default', alias: 'formFill' })
56
- .option('strict-mask', { type: 'string', describe: 'Strict mask mode: on | off | default', alias: 'strictMask' })
57
- .option('disable-mobile', { type: 'string', describe: 'Turn off on mobile: on | off | default', alias: 'disableMobile' })
58
- .option('protected-pages', { type: 'string', describe: 'URL patterns (newline/comma separated), "default" or "none"', alias: 'protectedPages' })
59
- .option('max-minutes', { type: 'string', describe: 'Max session minutes (5-240) or default', alias: 'maxMinutes' })
60
- .option('idle-minutes', { type: 'string', describe: 'Idle auto-stop minutes (2-60) or default', alias: 'idleMinutes' })
61
- .option('consent-title', { type: 'string', alias: 'consentTitle' })
62
- .option('consent-message', { type: 'string', alias: 'consentMessage' })
63
- .option('consent-allow', { type: 'string', alias: 'consentAllow' })
64
- .option('teams', { type: 'string', describe: 'Comma separated team ids allowed to start, or "none"' })
65
- .option('roles', { type: 'string', describe: 'Comma separated roles allowed to start (Administrator, Manager, Agent), or "none"' }),
66
- handler: async (argv) => {
67
- const current = await messagingGet(`/superadmin/sites/${argv.siteId}/cobrowse`);
68
- const body = buildCobrowseUpdate(current.settings, argv);
69
- const saved = await messagingPut(`/superadmin/sites/${argv.siteId}/cobrowse-settings`, body);
70
- if (argv.json) return console.log(JSON.stringify(saved, null, 2));
71
- console.log(`${GRN}Saved.${RESET} Effective settings now:`);
72
- for (const [k, v] of describeEffective(saved.effective)) console.log(` ${k.padEnd(26)} ${v}`);
73
- },
74
- };
75
-
76
- const resetCommand = {
77
- command: 'reset <siteId>',
78
- describe: 'Reset every Co-Browse setting for a site to the platform defaults',
79
- builder: siteArg,
80
- handler: async (argv) => {
81
- const saved = await messagingPut(`/superadmin/sites/${argv.siteId}/cobrowse-settings`, {});
82
- if (argv.json) return console.log(JSON.stringify(saved, null, 2));
83
- console.log(`${GRN}Reset to platform defaults.${RESET}`);
84
- for (const [k, v] of describeEffective(saved.effective)) console.log(` ${k.padEnd(26)} ${v}`);
85
- },
86
- };
87
-
88
- export const cobrowseCommand = {
89
- command: 'cobrowse <subcommand>',
90
- describe: 'View and control a site\'s Co-Browse settings and session history',
91
- builder: (y) => y
92
- .option('json', { type: 'boolean', describe: 'Print raw JSON' })
93
- .command(showCommand)
94
- .command(setCommand)
95
- .command(resetCommand)
96
- .demandCommand(1, 'Specify a subcommand: show, set, reset')
97
- .strict(),
98
- handler: () => {},
99
- };