@velaro/cli 1.4.170 → 1.4.171

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.
@@ -9,7 +9,7 @@
9
9
  * (velaro-messaging). Site is resolved server-side from the auth context — never caller-supplied.
10
10
  */
11
11
 
12
- import { messagingGet, messagingPost, messagingDel } from '../api.js';
12
+ import { messagingGet, messagingPost, messagingPut, messagingDel } from '../api.js';
13
13
 
14
14
  const GRN = '\x1b[32m';
15
15
  const DIM = '\x1b[2m';
@@ -130,6 +130,46 @@ async function embedStatusHandler() {
130
130
  else console.log(` ${DIM}Key created, never used: no NetSuite page has polled with it yet${RST}\n`);
131
131
  }
132
132
 
133
+ /** Flat row list from GET api/v1/CallPopSettings ({ data: rows[] } or a bare array). */
134
+ function popRowsOf(raw) {
135
+ const body = raw?.data ?? raw;
136
+ return Array.isArray(body) ? body : [...(body?.global ? [body.global] : []), ...(body?.overrides ?? [])];
137
+ }
138
+
139
+ /** PUT replaces the whole row, so every existing field goes back; only showOnEveryPage changes. */
140
+ export function buildEveryPageBody(existing, value) {
141
+ const r = existing ?? {};
142
+ return {
143
+ popMode: r.popMode ?? null,
144
+ popOnInbound: r.popOnInbound ?? null,
145
+ popOnOutbound: r.popOnOutbound ?? null,
146
+ autoOpenRecord: r.autoOpenRecord ?? null,
147
+ unknownCallerInbox: r.unknownCallerInbox ?? null,
148
+ promptNotesAfterCall: r.promptNotesAfterCall ?? null,
149
+ displayFieldsCsv: r.displayFieldsCsv || null,
150
+ callLogAssociationsCsv: r.callLogAssociationsCsv || null,
151
+ showOnEveryPage: value,
152
+ };
153
+ }
154
+
155
+ async function screenPopEveryPageHandler(argv) {
156
+ const action = String(argv.state).toLowerCase();
157
+ if (!['on', 'off', 'status'].includes(action)) throw new Error('Use on, off or status.');
158
+ const row = popRowsOf(await messagingGet('/api/v1/CallPopSettings')).find(x => x.integrationSlug === 'netsuite') ?? null;
159
+ const current = row?.showOnEveryPage ?? null;
160
+ if (action === 'status') {
161
+ console.log(`
162
+ Screen pop on every NetSuite page: ${current === null ? 'not set (inherits the default)' : current ? 'on' : 'off'}
163
+ `);
164
+ return;
165
+ }
166
+ const value = action === 'on';
167
+ await messagingPut('/api/v1/CallPopSettings/netsuite', buildEveryPageBody(row, value));
168
+ console.log(`
169
+ ${GRN}Saved${RST}: screen pop on every NetSuite page is now ${value ? 'on' : 'off'} (was ${current === null ? 'not set' : current ? 'on' : 'off'}). Needs SuiteApp 1.2.0 or later.
170
+ `);
171
+ }
172
+
133
173
  export const netsuiteCommand = {
134
174
  command: 'netsuite <subcommand>',
135
175
  describe: 'NetSuite integration setup (click-to-dial / CTI)',
@@ -192,6 +232,11 @@ export const netsuiteCommand = {
192
232
  .strict(),
193
233
  handler: () => {},
194
234
  })
235
+ .command({
236
+ command: 'screen-pop-every-page <state>',
237
+ describe: 'Show the screen pop on every NetSuite page (on | off | status); needs SuiteApp 1.2.0 or later',
238
+ handler: screenPopEveryPageHandler,
239
+ })
195
240
  .command({
196
241
  command: 'm2m <action>',
197
242
  describe: 'NetSuite machine-to-machine (OAuth 2.0 Client Credentials) setup',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/cli",
3
- "version": "1.4.170",
3
+ "version": "1.4.171",
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": {