@velaro/mcp-server 2.0.117 → 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.
- package/chat-window-style.js +26 -0
- package/package.json +1 -1
- package/server.js +41 -1
package/chat-window-style.js
CHANGED
|
@@ -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.
|
|
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
|
|
|
@@ -2268,6 +2268,16 @@ For multiSelect dynamic options: the variable named in dynamicOptionsVariable mu
|
|
|
2268
2268
|
description: 'Mark one safety event as reviewed. Wraps POST SafetyEvents/{id}/acknowledge.',
|
|
2269
2269
|
inputSchema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'] },
|
|
2270
2270
|
},
|
|
2271
|
+
{
|
|
2272
|
+
name: 'safety_event_source',
|
|
2273
|
+
description: 'Where a safety event came from: component, visitor, IP, browser, exact text, blocked or let through, repeat count. Administrators and managers only; the site comes from your login. Wraps GET SafetyEvents/{id}/detail.',
|
|
2274
|
+
inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Event id' } }, required: ['id'] },
|
|
2275
|
+
},
|
|
2276
|
+
{
|
|
2277
|
+
name: 'safety_event_block',
|
|
2278
|
+
description: 'Block the IP or the visitor behind a safety event. Writes an audit row (who, when). Administrators and managers only. Wraps POST SafetyEvents/{id}/block-ip and block-visitor.',
|
|
2279
|
+
inputSchema: { type: 'object', properties: { id: { type: 'string' }, target: { type: 'string', enum: ['ip', 'visitor'] } }, required: ['id', 'target'] },
|
|
2280
|
+
},
|
|
2271
2281
|
{
|
|
2272
2282
|
name: 'safety_settings_get',
|
|
2273
2283
|
description: 'Get the safety alert settings: enabled, emailRecipients, smsRecipients, immediateTypes, digest (off|daily|weekly), threshold {count, windowMinutes}. Wraps GET SafetyEvents/settings.',
|
|
@@ -2981,6 +2991,18 @@ For multiSelect dynamic options: the variable named in dynamicOptionsVariable mu
|
|
|
2981
2991
|
required: ['id', 'multiTabMode'],
|
|
2982
2992
|
},
|
|
2983
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
|
+
},
|
|
2984
3006
|
// ── Visitor Monitor (session-scoped: SiteId comes from the caller's JWT, never an arg) ──
|
|
2985
3007
|
{
|
|
2986
3008
|
name: 'visitor_monitor_active',
|
|
@@ -7270,6 +7292,10 @@ reply: ${r?.reply}`;
|
|
|
7270
7292
|
return JSON.stringify(await messagingGet(`/SafetyEvents/summary?days=${Number(args.days) || 7}`), null, 2);
|
|
7271
7293
|
case 'safety_event_ack':
|
|
7272
7294
|
return JSON.stringify(await messagingPost(`/SafetyEvents/${encodeURIComponent(args.id)}/acknowledge`), null, 2);
|
|
7295
|
+
case 'safety_event_source':
|
|
7296
|
+
return JSON.stringify(await messagingGet('/SafetyEvents/' + encodeURIComponent(args.id) + '/detail'), null, 2);
|
|
7297
|
+
case 'safety_event_block':
|
|
7298
|
+
return JSON.stringify(await messagingPost('/SafetyEvents/' + encodeURIComponent(args.id) + (args.target === 'visitor' ? '/block-visitor' : '/block-ip')), null, 2);
|
|
7273
7299
|
case 'safety_settings_get':
|
|
7274
7300
|
return JSON.stringify(await messagingGet('/SafetyEvents/settings'), null, 2);
|
|
7275
7301
|
case 'safety_settings_set': {
|
|
@@ -8239,6 +8265,20 @@ reply: ${r?.reply}`;
|
|
|
8239
8265
|
return JSON.stringify({ id: updated.id, multiTabMode: updated.styleConfig?.multiTabMode ?? null }, null, 2);
|
|
8240
8266
|
}
|
|
8241
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
|
+
|
|
8242
8282
|
case 'widget_container_get': {
|
|
8243
8283
|
const c = await api('GET', `/PageWidgetContainers/${args.id}`);
|
|
8244
8284
|
return JSON.stringify(c, null, 2);
|