@sendinel/mcp-server 1.0.12 → 1.0.13
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
type ProjectDbClient = {
|
|
2
2
|
from: (table: string) => any;
|
|
3
3
|
};
|
|
4
|
-
export declare function renderTemplateString(input: string, vars?: Record<string, string>): string;
|
|
5
4
|
export declare function resolveSurveyShortLink(sb: ProjectDbClient, projectId: string, surveyId: string): Promise<string | null>;
|
|
6
5
|
export {};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export function renderTemplateString(input, vars = {}) {
|
|
2
|
-
return String(input ?? '').replace(/\{\{(\w+)\}\}/g, (_, key) => vars[key] ?? `{{${key}}}`);
|
|
3
|
-
}
|
|
4
1
|
function appBaseUrl() {
|
|
5
2
|
return (process.env.NEXT_PUBLIC_APP_URL ?? process.env.SENDINEL_APP_URL ?? process.env.APP_URL ?? 'https://sendinel.ai').replace(/\/$/, '');
|
|
6
3
|
}
|
package/build/tools/campaigns.js
CHANGED
|
@@ -10,7 +10,7 @@ import { assertChannelCanExecute, currentChannelContext, requestApproval, checkA
|
|
|
10
10
|
import { getAnthropicModelId } from '../anthropic-model.js';
|
|
11
11
|
import { getScheduleWindowBounds, groupScheduleByCampaign, parseFutureDate } from '../lib/schedule.js';
|
|
12
12
|
import { sendEmailForSite } from '../lib/email-provider.js';
|
|
13
|
-
import {
|
|
13
|
+
import { resolveSurveyShortLink } from '../lib/survey-link-resolver.js';
|
|
14
14
|
import { logAudit } from '../audit.js';
|
|
15
15
|
import { recordBrandAssetUsage } from '../lib/brand-asset-usage.js';
|
|
16
16
|
import { BLOCK_GENERATION_SCHEMA, blocksToHtml, blocksToText, normalizeComposerBlocks } from '../lib/composer-blocks.js';
|
|
@@ -472,11 +472,11 @@ export function registerCampaignTools(server) {
|
|
|
472
472
|
return j({ error: 'Survey has no short link yet', code: 'SURVEY_LINK_NOT_READY' });
|
|
473
473
|
renderVars.survey_link = surveyLink;
|
|
474
474
|
}
|
|
475
|
-
const renderedSubject = survey_id ?
|
|
475
|
+
const renderedSubject = survey_id ? renderTemplateVars(subject, renderVars) : subject;
|
|
476
476
|
const normalizedBlocks = blocks ? normalizeComposerBlocks(blocks) : undefined;
|
|
477
477
|
const htmlFromBlocks = normalizedBlocks?.length ? blocksToHtml(normalizedBlocks) : undefined;
|
|
478
|
-
const renderedHtml = body_html !== undefined && survey_id ?
|
|
479
|
-
const renderedText = body_text !== undefined && survey_id ?
|
|
478
|
+
const renderedHtml = body_html !== undefined && survey_id ? renderTemplateVars(body_html, renderVars) : body_html ?? htmlFromBlocks;
|
|
479
|
+
const renderedText = body_text !== undefined && survey_id ? renderTemplateVars(body_text, renderVars) : body_text;
|
|
480
480
|
const { data, error } = await db()
|
|
481
481
|
.from('campaign_steps')
|
|
482
482
|
.insert({ campaign_id, step_order, subject: renderedSubject, body_html: renderedHtml, body_text: renderedText ?? (normalizedBlocks?.length ? blocksToText(normalizedBlocks) : undefined), blocks: normalizedBlocks ?? null, delay_days, delay_hours, variant_label: variant_label ?? 'A' })
|
|
@@ -2251,9 +2251,9 @@ Return ONLY valid JSON with this exact shape:
|
|
|
2251
2251
|
...(normalizedBlocks !== undefined ? { blocks: normalizedBlocks.length ? normalizedBlocks : null } : {}),
|
|
2252
2252
|
...(normalizedBlocks?.length && stepUpdates.body_html === undefined ? { body_html: blocksToHtml(normalizedBlocks) } : {}),
|
|
2253
2253
|
...(normalizedBlocks?.length && stepUpdates.body_text === undefined ? { body_text: blocksToText(normalizedBlocks) } : {}),
|
|
2254
|
-
...(survey_id && stepUpdates.subject !== undefined ? { subject:
|
|
2255
|
-
...(survey_id && stepUpdates.body_html !== undefined ? { body_html:
|
|
2256
|
-
...(survey_id && stepUpdates.body_text !== undefined ? { body_text:
|
|
2254
|
+
...(survey_id && stepUpdates.subject !== undefined ? { subject: renderTemplateVars(stepUpdates.subject, renderVars) } : {}),
|
|
2255
|
+
...(survey_id && stepUpdates.body_html !== undefined ? { body_html: renderTemplateVars(stepUpdates.body_html, renderVars) } : {}),
|
|
2256
|
+
...(survey_id && stepUpdates.body_text !== undefined ? { body_text: renderTemplateVars(stepUpdates.body_text, renderVars) } : {}),
|
|
2257
2257
|
};
|
|
2258
2258
|
const { data, error } = await db()
|
|
2259
2259
|
.from('campaign_steps')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendinel/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "AI-controlled email operations control plane for campaigns, contacts, segments, analytics, and multi-provider sending via MCP.",
|
|
5
5
|
"mcpName": "ai.sendinel/mcp-server",
|
|
6
6
|
"type": "module",
|