@velaro/mcp-server 2.0.118 → 2.0.119

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.
@@ -25,3 +25,29 @@ export function buildMultiTabUpdateFields(current, mode) {
25
25
  languageConfig: JSON.stringify(current.languageConfig ?? {}),
26
26
  };
27
27
  }
28
+
29
+ // Per-chat-window "visitors can email themselves a transcript" (MessengerStyleConfig.EnableEmailTranscriptButton).
30
+ // Global default is ON; an absent key (null) follows it. A transcript requested while a chat is still open is
31
+ // emailed in full once when the chat ends.
32
+ /** Returns true | false | null (follow the global default, on). Throws on anything else. */
33
+ export function normalizeEmailTranscript(raw) {
34
+ if (raw === null || raw === undefined) return null;
35
+ if (typeof raw === 'boolean') return raw;
36
+ const v = String(raw).trim().toLowerCase();
37
+ if (['default', 'follow-default', 'null', ''].includes(v)) return null;
38
+ if (['on', 'true', 'yes', '1'].includes(v)) return true;
39
+ if (['off', 'false', 'no', '0'].includes(v)) return false;
40
+ throw new Error('enableEmailTranscriptButton must be on, off or default (follows the global default, on).');
41
+ }
42
+
43
+ /** Fields of the update form for a chat window with only enableEmailTranscriptButton changed. */
44
+ export function buildEmailTranscriptUpdateFields(current, value) {
45
+ if (!current || typeof current !== 'object') throw new Error('chat window not found');
46
+ const styleConfig = { ...(current.styleConfig ?? {}) };
47
+ if (value === null) delete styleConfig.enableEmailTranscriptButton; else styleConfig.enableEmailTranscriptButton = value;
48
+ return {
49
+ name: current.name ?? '',
50
+ styleConfig: JSON.stringify(styleConfig),
51
+ languageConfig: JSON.stringify(current.languageConfig ?? {}),
52
+ };
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/mcp-server",
3
- "version": "2.0.118",
3
+ "version": "2.0.119",
4
4
  "description": "Velaro MCP server — connect Claude and other AI agents directly to your Velaro account: KB, workflows, bots, conversations, contacts, routing, and more.",
5
5
  "type": "module",
6
6
  "bin": {
package/server.js CHANGED
@@ -54,7 +54,7 @@ import { withAnnotations } from './tool-annotations.js';
54
54
  import { loadParity, runParity } from './parity/loader.js';
55
55
  import { parseToolsets, filterTools, toolsetBlockedMessage } from './toolsets.js';
56
56
  import { resolveMessagingApi } from './messaging-base.js';
57
- import { normalizeMultiTabMode, buildMultiTabUpdateFields } from './chat-window-style.js';
57
+ import { normalizeMultiTabMode, buildMultiTabUpdateFields, normalizeEmailTranscript, buildEmailTranscriptUpdateFields } from './chat-window-style.js';
58
58
  import { buildResolvePath, buildTimelinePath, buildOverrideBody, buildValidateBody, buildBannerPath, buildOverrideListPath, tolerant, VALIDATE_PATH, OVERRIDE_PATH } from './workflow-schedule.js';
59
59
  import { applyEmailSubmissionsTo } from './survey-email.js';
60
60
 
@@ -2991,6 +2991,18 @@ For multiSelect dynamic options: the variable named in dynamicOptionsVariable mu
2991
2991
  required: ['id', 'multiTabMode'],
2992
2992
  },
2993
2993
  },
2994
+ {
2995
+ name: 'chat_window_set_email_transcript',
2996
+ description: 'Turn the visitor "email me this transcript" option on or off for a chat window, or "default" to follow the global default (on). If a visitor asks for a transcript while the chat is still open, the full transcript is emailed once when the chat ends. Reads the window first and saves it with only this field changed.',
2997
+ inputSchema: {
2998
+ type: 'object',
2999
+ properties: {
3000
+ id: { type: 'number', description: 'Chat window ID (see chat_window_list)' },
3001
+ value: { type: 'string', enum: ['on', 'off', 'default'], description: '"default" clears the override (global default is on)' },
3002
+ },
3003
+ required: ['id', 'value'],
3004
+ },
3005
+ },
2994
3006
  // ── Visitor Monitor (session-scoped: SiteId comes from the caller's JWT, never an arg) ──
2995
3007
  {
2996
3008
  name: 'visitor_monitor_active',
@@ -8253,6 +8265,20 @@ reply: ${r?.reply}`;
8253
8265
  return JSON.stringify({ id: updated.id, multiTabMode: updated.styleConfig?.multiTabMode ?? null }, null, 2);
8254
8266
  }
8255
8267
 
8268
+ case 'chat_window_set_email_transcript': {
8269
+ if (!args.id) throw new Error('id is required');
8270
+ const value = normalizeEmailTranscript(args.value);
8271
+ const current = await messagingGet(`/ChatWindow/get/${args.id}`);
8272
+ const form = new FormData();
8273
+ for (const [k, v] of Object.entries(buildEmailTranscriptUpdateFields(current, value))) form.append(k, v);
8274
+ const res = await fetch(`${MESSAGING_API}/ChatWindow/Update/${args.id}`, {
8275
+ method: 'POST', headers: { Authorization: authHeader() }, body: form, signal: AbortSignal.timeout(30000),
8276
+ });
8277
+ if (!res.ok) throw new Error(`/ChatWindow/Update/${args.id} -> ${res.status}: ${(await res.text().catch(() => '')).slice(0, 300)}`);
8278
+ const updated = await res.json();
8279
+ return JSON.stringify({ id: updated.id, enableEmailTranscriptButton: updated.styleConfig?.enableEmailTranscriptButton ?? null }, null, 2);
8280
+ }
8281
+
8256
8282
  case 'widget_container_get': {
8257
8283
  const c = await api('GET', `/PageWidgetContainers/${args.id}`);
8258
8284
  return JSON.stringify(c, null, 2);