@velaro/cli 1.4.178 → 1.4.180

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/bin/velaro.js CHANGED
@@ -101,6 +101,7 @@ import { statusNotifyCommand } from '../lib/commands/status-notify.js';
101
101
  import { callbackCommand } from '../lib/commands/callback.js';
102
102
  import { cobrowseCommand } from '../lib/commands/cobrowse.js';
103
103
  import { callpresenceCommand } from '../lib/commands/callpresence.js';
104
+ import { signupFormCommand } from '../lib/commands/signup-form.js';
104
105
  import { authorityCommand } from '../lib/commands/authority.js';
105
106
  import { caseCommand } from '../lib/commands/case.js';
106
107
  import { dealCommand } from '../lib/commands/deal.js';
@@ -132,6 +133,7 @@ import { crmViewCommand, crmBulkCommand, crmWebformCommand } from '../lib/comman
132
133
  import { featureDiscoveryGroup } from '../lib/commands/feature-discovery.js';
133
134
  import { billingInsightsGroup } from '../lib/commands/billing-insights.js';
134
135
  import { supportTicketsCommand } from '../lib/commands/support-tickets.js';
136
+ import { aiAckGroup } from '../lib/commands/ai-ack.js';
135
137
  import { afterHoursSupportCommand } from '../lib/commands/after-hours-support.js';
136
138
  import { startUpdateCheck } from '../lib/update-check.js';
137
139
  import { printBanner, printBannerIfFirstRun } from '../lib/banner.js';
@@ -262,6 +264,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
262
264
  // The staff build already registers a cobrowse group that includes seats/seat set; only the public build adds this one.
263
265
  .command(registerStaffCommands ? { command: 'cobrowse-seats-in-staff-group', describe: false, builder: (y) => y, handler: () => {} } : cobrowseCommand)
264
266
  .command(callpresenceCommand)
267
+ .command(signupFormCommand)
265
268
  .command(authorityCommand)
266
269
  .command(caseCommand)
267
270
  .command(dealCommand)
@@ -283,6 +286,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
283
286
  .command(featureDiscoveryGroup)
284
287
  .command(billingInsightsGroup)
285
288
  .command(supportTicketsCommand)
289
+ .command(aiAckGroup)
286
290
  .command(afterHoursSupportCommand)
287
291
  .command(usageCommand)
288
292
  .command(campaignsCommand)
@@ -0,0 +1,37 @@
1
+ // velaro ai-ack: the AI Features Acknowledgment (read-only).
2
+ // Site scoping is server-side: calls never pass a siteId. Acceptance is done by an administrator in the app.
3
+ import { request } from '../api.js';
4
+
5
+ async function status() {
6
+ const r = await request('GET', 'FeatureAcknowledgments/status?key=AiFeatures');
7
+ console.log(`\nAI Features Acknowledgment, version ${r.textVersion}`);
8
+ if (r.accepted && r.acceptedRecord) {
9
+ const a = r.acceptedRecord;
10
+ console.log(` Accepted by ${a.signerName}, ${a.signerTitle} (${a.signerEmail}) on ${a.acceptedAt}`);
11
+ } else {
12
+ console.log(' Not accepted yet. An administrator accepts it in the app the first time they turn on an AI feature.');
13
+ if (r.acceptedEarlierVersion) console.log(' An earlier version was accepted; the current version needs a new acceptance.');
14
+ }
15
+ console.log(` Full text: ${r.fullTextUrl}\n`);
16
+ }
17
+
18
+ async function list() {
19
+ const rows = await request('GET', 'FeatureAcknowledgments');
20
+ if (!Array.isArray(rows) || rows.length === 0) {
21
+ console.log('No acknowledgments accepted yet.');
22
+ return;
23
+ }
24
+ for (const a of rows) {
25
+ console.log(` v${a.textVersion} ${a.acceptedAt} ${a.signerName}, ${a.signerTitle} <${a.signerEmail}> (${a.signerRole}) trigger: ${a.triggerFeature ?? '-'}`);
26
+ }
27
+ }
28
+
29
+ export function aiAckCommand(yargs) {
30
+ return yargs
31
+ .command('status', 'Show whether the current AI Features Acknowledgment has been accepted', () => {}, () => status())
32
+ .command('list', 'List every acknowledgment this site accepted', () => {}, () => list())
33
+ .demandCommand(1, 'Specify a subcommand: status | list');
34
+ }
35
+
36
+ // Registered group object (the CLI/MCP parity validator reads `command:` from a named const).
37
+ export const aiAckGroup = { command: 'ai-ack', desc: 'AI Features Acknowledgment status and history (read-only)', builder: aiAckCommand, handler: () => {} };
@@ -0,0 +1,110 @@
1
+ import { messagingGet, messagingPost } from '../api.js';
2
+ import { runCommand } from '../run.js';
3
+ import { readFileSync } from 'node:fs';
4
+
5
+ // -- velaro signup-form ----------------------------------------------------------------------------------------------
6
+ // Signup forms, popups and slide-ins are the LIST-GROWTH LAYER of a survey (Survey.GrowthConfigJson), not a separate
7
+ // form system: fields, validation, consent wording, versions and submissions are the survey's. This group reads and
8
+ // writes only that layer, plus its stats and signups. Backend: velaro-messaging SurveysController (Surveys/...).
9
+ // The site always comes from the credential. Needs the Email Growth package (the server answers 403 naming it).
10
+
11
+ const BOLD = '\x1b[1m';
12
+ const DIM = '\x1b[2m';
13
+ const RST = '\x1b[0m';
14
+
15
+ const parseConfig = (s) => { try { return JSON.parse(s); } catch { throw new Error('growth config is not valid JSON'); } };
16
+
17
+ async function findSurvey(id) {
18
+ const all = (await messagingGet('/Surveys/list')) ?? [];
19
+ const s = all.find((x) => x.id === Number(id));
20
+ if (!s) throw new Error(`Survey ${id} not found`);
21
+ return s;
22
+ }
23
+
24
+ const isGrowth = (s) => { if (!s.growthConfigJson) return false; try { return !!JSON.parse(s.growthConfigJson).enabled; } catch { return false; } };
25
+
26
+ async function listHandler(argv) {
27
+ const all = ((await messagingGet('/Surveys/list')) ?? []).filter(isGrowth);
28
+ if (argv.json) { console.log(JSON.stringify(all.map((s) => ({ id: s.id, name: s.name, publicSlug: s.publicSlug, growth: JSON.parse(s.growthConfigJson) })), null, 2)); return; }
29
+ if (!all.length) { console.log('\n No signup forms yet. Turn on "List growth" on a survey (velaro signup-form set).\n'); return; }
30
+ console.log(`\n${BOLD}Signup forms${RST}`);
31
+ for (const s of all) {
32
+ const g = JSON.parse(s.growthConfigJson);
33
+ console.log(` #${s.id} ${s.name} ${DIM}${g.display?.type ?? 'popup'} / ${g.display?.trigger ?? 'timed'} list ${g.list?.listId ?? '-'} slug ${s.publicSlug ?? '(no shareable link yet)'}${RST}`);
34
+ }
35
+ console.log('');
36
+ }
37
+
38
+ async function getHandler(argv) {
39
+ const s = await findSurvey(argv.id);
40
+ const out = { id: s.id, name: s.name, publicSlug: s.publicSlug, allowStandaloneAccess: s.allowStandaloneAccess, consentEnabled: s.consentEnabled, growth: s.growthConfigJson ? JSON.parse(s.growthConfigJson) : null };
41
+ console.log(JSON.stringify(out, null, 2));
42
+ }
43
+
44
+ async function setHandler(argv) {
45
+ const s = await findSurvey(argv.id);
46
+ let cfg = s.growthConfigJson ? JSON.parse(s.growthConfigJson) : { enabled: false };
47
+ if (argv.file) cfg = parseConfig(readFileSync(argv.file, 'utf8'));
48
+ if (argv.config) cfg = parseConfig(argv.config);
49
+ if (argv.enable !== undefined) cfg.enabled = argv.enable;
50
+ const body = { ...s, growthConfigJson: JSON.stringify(cfg) };
51
+ const saved = await messagingPost('/Surveys', body);
52
+ if (cfg.enabled && !saved.allowStandaloneAccess) await messagingPost(`/Surveys/${saved.id}/standalone-link`);
53
+ console.log(argv.json ? JSON.stringify(saved, null, 2) : `Saved signup form settings on survey ${saved.id}.`);
54
+ }
55
+
56
+ async function statsHandler(argv) {
57
+ const r = await messagingGet(`/Surveys/${argv.id}/growth/stats?days=${argv.days}`);
58
+ if (argv.json) { console.log(JSON.stringify(r, null, 2)); return; }
59
+ console.log(`\n${BOLD}Form ${argv.id}, last ${argv.days} days${RST}`);
60
+ console.log(` Views ${r.views} Dismissals ${r.dismissals} Signups ${r.submissions} Conversion ${r.conversionRate}%`);
61
+ console.log(` Subscribed ${r.subscribed} Awaiting confirmation ${r.pendingConfirmation} Confirmed ${r.confirmed} Suppressed ${r.suppressed}\n`);
62
+ }
63
+
64
+ async function submissionsHandler(argv) {
65
+ const q = `page=${argv.page}&pageSize=${argv.pageSize}${argv.status ? `&status=${encodeURIComponent(argv.status)}` : ''}`;
66
+ const r = await messagingGet(`/Surveys/${argv.id}/growth/submissions?${q}`);
67
+ if (argv.json) { console.log(JSON.stringify(r, null, 2)); return; }
68
+ console.log(`\n${BOLD}Signups for form ${argv.id}${RST} ${DIM}(${r.total} total, page ${r.page})${RST}`);
69
+ for (const i of r.items) console.log(` ${i.submittedAt} ${i.contactEmail ?? '-'} ${i.optInStatus} consent record #${i.consentRecordId ?? '-'}`);
70
+ console.log('');
71
+ }
72
+
73
+ async function snippetHandler(argv) {
74
+ const s = await findSurvey(argv.id);
75
+ if (!s.publicSlug || !s.allowStandaloneAccess) throw new Error('Enable the shareable link first (velaro signup-form set <id> --enable).');
76
+ const host = argv.host || 'https://messaging.velaro.com';
77
+ const embedded = s.growthConfigJson && JSON.parse(s.growthConfigJson).display?.type === 'embedded';
78
+ console.log(`<script async src="${host}/messenger/forms.js" data-form="${s.publicSlug}"></script>`);
79
+ if (embedded) console.log(`<div data-velaro-form="${s.publicSlug}"></div>`);
80
+ }
81
+
82
+ export const signupFormCommand = {
83
+ command: 'signup-form <subcommand>',
84
+ describe: 'Signup forms and popups: the list-growth layer of a survey (display rules, list, double opt-in, stats, signups)',
85
+ builder: (y) => y
86
+ .command({ command: 'list', describe: 'List the surveys that have the list-growth layer on', builder: (a) => a.option('json', { type: 'boolean' }), handler: runCommand(listHandler) })
87
+ .command({ command: 'get <id>', describe: 'Show one form (survey id) and its growth settings', builder: (a) => a.positional('id', { type: 'number' }), handler: runCommand(getHandler) })
88
+ .command({
89
+ command: 'set <id>',
90
+ describe: 'Change the list-growth settings of a survey (read-modify-write; the survey itself is untouched)',
91
+ builder: (a) => a.positional('id', { type: 'number' })
92
+ .option('file', { type: 'string', describe: 'JSON file with the growth settings' })
93
+ .option('config', { type: 'string', describe: 'Growth settings as a JSON string' })
94
+ .option('enable', { type: 'boolean', describe: 'Switch the layer on or off' })
95
+ .option('json', { type: 'boolean' }),
96
+ handler: runCommand(setHandler),
97
+ })
98
+ .command({ command: 'stats <id>', describe: 'Views, dismissals, signups and conversion', builder: (a) => a.positional('id', { type: 'number' }).option('days', { type: 'number', default: 30 }).option('json', { type: 'boolean' }), handler: runCommand(statsHandler) })
99
+ .command({
100
+ command: 'submissions <id>',
101
+ describe: 'Signups with opt-in status and consent record id (paginated)',
102
+ builder: (a) => a.positional('id', { type: 'number' }).option('page', { type: 'number', default: 1 }).option('page-size', { type: 'number', default: 25, alias: 'pageSize' })
103
+ .option('status', { type: 'string', describe: 'subscribed | pending_confirmation | confirmed | suppressed | list_sync_failed' }).option('json', { type: 'boolean' }),
104
+ handler: runCommand(submissionsHandler),
105
+ })
106
+ .command({ command: 'snippet <id>', describe: 'Print the one-line install snippet', builder: (a) => a.positional('id', { type: 'number' }).option('host', { type: 'string' }), handler: runCommand(snippetHandler) })
107
+ .demandCommand(1, 'Specify a signup-form subcommand.')
108
+ .strict(),
109
+ handler: () => {},
110
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/cli",
3
- "version": "1.4.178",
3
+ "version": "1.4.180",
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": {