@odla-ai/crm 0.10.0 → 0.10.1

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/dist/index.d.cts CHANGED
@@ -1141,7 +1141,7 @@ interface SendEmailOpts {
1141
1141
  baseUrl: string;
1142
1142
  /** Route mount point for the unsubscribe link. Default "/api/crm". */
1143
1143
  basePath?: string;
1144
- /** Admin test-send: bypasses the enabled flag — NEVER the consent gate. */
1144
+ /** Admin test-send: permits an explicitly disabled template, but never bypasses copy validation or consent. */
1145
1145
  force?: boolean;
1146
1146
  }
1147
1147
  /** What happened to the send — delivered, gated, logged, or failed. */
@@ -1153,7 +1153,8 @@ interface SendEmailResult {
1153
1153
  }
1154
1154
  /**
1155
1155
  * Render and send one templated email to a record's contact channel, with
1156
- * consent gating, dedupe, dev redirection, and an unconditional audit row.
1156
+ * copy validation, explicit enablement, consent gating, dedupe, dev redirection,
1157
+ * and audit rows for transport attempts. Incomplete or internal copy never reaches transport.
1157
1158
  * Marketing-class sends get `{{unsubscribeUrl}}` plus RFC 8058 one-click
1158
1159
  * headers automatically.
1159
1160
  */
@@ -1565,4 +1566,28 @@ declare const crmIntegration: CrmIntegrationDescriptor;
1565
1566
  */
1566
1567
  declare function createCrmIntegration(crm: Crm, options?: CrmIntegrationOptions): CrmIntegrationDescriptor;
1567
1568
 
1568
- export { ACTIVITY_KINDS, type ActivityKind, type AttrType, type BillingEvent, type BillingProvider, CONFIG_KEY, CONSENT_STATES, CRM_DISCUSSION_REFERENCE_KINDS, CRM_NS, CRM_RULES, CRM_SCHEMA, CRM_SLOTS, type CompiledList, type ConfigPatch, type ConsentEvent, type ConsentOutcome, type ConsentState, type Crm, type CrmActivity, type CrmActor, type CrmAggregateResult, type CrmAggregateSpec, type CrmAttrs, CrmClient, type CrmClientOptions, type CrmConfig, type CrmConfigRow, type CrmContactChannel, type CrmDb, type CrmDeps, type CrmDiscussionReference, type CrmDiscussionReferenceActor, type CrmDiscussionReferenceKind, type CrmDiscussionReferenceTarget, type CrmEmailLogRow, type CrmEmailSender, type CrmEntityRef, CrmInputError, type CrmIntegrationDescriptor, type CrmIntegrationOptions, type CrmIntegrationProbe, type CrmIntegrationSeed, type CrmLink, type CrmListParams, type CrmLookup, CrmNotFoundError, type CrmOp, type CrmQuery, type CrmRecord, type CrmRecordDelivery, type CrmRecordOrigin, type CrmResult, type CrmRouteOpts, type CrmRow, type CrmRule, type CrmRules, type CrmScalar, type CrmSlot, type CrmSort, type CrmTag, type CrmTransactGuard, type CrmView, DEFAULT_LIMIT, EMAIL_STATUSES, type EmailStatus, type FieldCondition, type FieldConditions, type FieldDef, type FieldFilter, type FieldState, type FieldType, MAX_LIMIT, type PipelineDef, type PreparedWrite, RANK_EPSILON, RANK_STEP, type RelationDef, SORTABLE_COLUMNS, type SendEmailOpts, type SendEmailResult, type SerializedAttr, type SerializedEntity, type SerializedLink, type SerializedLinkEnd, type SerializedSchema, type StageDef, type StoredTemplate, type SubscriptionSnapshot, TASK_STATUSES, type TaskStatus, type TemplateSpec, type TypeDef, type TypeFacets, type TypeSummary, type ViewFilters, type ViewSpec, addActivity, addLink, addTag, applyConsent, applyConsentEvent, assertFieldCondition, canEmail, canTransition, channelKey, compileList, composeCrmConfigs, createCrmIntegration, createCrmRoutes, createRecord, crmDiscussionReferenceHref, crmDiscussionReferenceId, crmIntegration, crmRules, defaultTemplates, defineCrm, deleteView, emailChannelOps, evaluateFieldCondition, foldEmailStatus, formatCrmDiscussionReference, getConfig, getRecord, getRecordByOrigin, getRecordOrigin, initialStage, linkIdentity, lintTemplate, listActivities, listChannels, listEmailLog, listLinks, listRecordDeliveries, listRecordOrigins, listRecords, listTags, listTasks, listViews, mustGetRecord, needsRebalance, normalizeTag, parseCrmDiscussionReference, prepare, rankBetween, rebalancePlan, rebalanceRanks, recordCanEmail, recordDeliveryAttempt, recordDeliveryKey, recordOriginKey, removeLink, removeTag, renderTemplate, resolveDeps, resolveFieldState, resolveFieldStates, resolveSortColumn, rowToRecord, saveConfig, saveView, searchTextFor, sendTemplatedEmail, setArchived, setRank, setStage, stageIndexOf, templateVars, typeSummary, updateRecord, updateTask, updateView, upsertRecordOrigin };
1569
+ /** One actionable problem with email copy or the data needed to render it. */
1570
+ interface EmailCopyIssue {
1571
+ code: string;
1572
+ message: string;
1573
+ variable?: string;
1574
+ }
1575
+ /** A display name suitable for membership mail, never a missing name or a provider identifier. */
1576
+ declare function isEmailTierName(value: unknown, id?: string): value is string;
1577
+ /** Variables and concrete data to check. Omit values when auditing saved copy before an event occurs. */
1578
+ interface EmailCopyValidation {
1579
+ allowedVariables?: readonly string[];
1580
+ optionalVariables?: readonly string[];
1581
+ requiredVariables?: readonly string[];
1582
+ values?: Record<string, string>;
1583
+ tierId?: string;
1584
+ }
1585
+ /** Validate saved copy and, when supplied, its actual event data. Does not render, store, or send mail.
1586
+ * Unknown tokens, missing required values, explicit internal draft notes and invalid tier names fail closed.
1587
+ * Optional values must be named by the event contract; arbitrary unknown placeholders never become blanks. */
1588
+ declare function validateEmailCopy(copy: {
1589
+ subject?: unknown;
1590
+ text?: unknown;
1591
+ }, options?: EmailCopyValidation): EmailCopyIssue[];
1592
+
1593
+ export { ACTIVITY_KINDS, type ActivityKind, type AttrType, type BillingEvent, type BillingProvider, CONFIG_KEY, CONSENT_STATES, CRM_DISCUSSION_REFERENCE_KINDS, CRM_NS, CRM_RULES, CRM_SCHEMA, CRM_SLOTS, type CompiledList, type ConfigPatch, type ConsentEvent, type ConsentOutcome, type ConsentState, type Crm, type CrmActivity, type CrmActor, type CrmAggregateResult, type CrmAggregateSpec, type CrmAttrs, CrmClient, type CrmClientOptions, type CrmConfig, type CrmConfigRow, type CrmContactChannel, type CrmDb, type CrmDeps, type CrmDiscussionReference, type CrmDiscussionReferenceActor, type CrmDiscussionReferenceKind, type CrmDiscussionReferenceTarget, type CrmEmailLogRow, type CrmEmailSender, type CrmEntityRef, CrmInputError, type CrmIntegrationDescriptor, type CrmIntegrationOptions, type CrmIntegrationProbe, type CrmIntegrationSeed, type CrmLink, type CrmListParams, type CrmLookup, CrmNotFoundError, type CrmOp, type CrmQuery, type CrmRecord, type CrmRecordDelivery, type CrmRecordOrigin, type CrmResult, type CrmRouteOpts, type CrmRow, type CrmRule, type CrmRules, type CrmScalar, type CrmSlot, type CrmSort, type CrmTag, type CrmTransactGuard, type CrmView, DEFAULT_LIMIT, EMAIL_STATUSES, type EmailCopyIssue, type EmailCopyValidation, type EmailStatus, type FieldCondition, type FieldConditions, type FieldDef, type FieldFilter, type FieldState, type FieldType, MAX_LIMIT, type PipelineDef, type PreparedWrite, RANK_EPSILON, RANK_STEP, type RelationDef, SORTABLE_COLUMNS, type SendEmailOpts, type SendEmailResult, type SerializedAttr, type SerializedEntity, type SerializedLink, type SerializedLinkEnd, type SerializedSchema, type StageDef, type StoredTemplate, type SubscriptionSnapshot, TASK_STATUSES, type TaskStatus, type TemplateSpec, type TypeDef, type TypeFacets, type TypeSummary, type ViewFilters, type ViewSpec, addActivity, addLink, addTag, applyConsent, applyConsentEvent, assertFieldCondition, canEmail, canTransition, channelKey, compileList, composeCrmConfigs, createCrmIntegration, createCrmRoutes, createRecord, crmDiscussionReferenceHref, crmDiscussionReferenceId, crmIntegration, crmRules, defaultTemplates, defineCrm, deleteView, emailChannelOps, evaluateFieldCondition, foldEmailStatus, formatCrmDiscussionReference, getConfig, getRecord, getRecordByOrigin, getRecordOrigin, initialStage, isEmailTierName, linkIdentity, lintTemplate, listActivities, listChannels, listEmailLog, listLinks, listRecordDeliveries, listRecordOrigins, listRecords, listTags, listTasks, listViews, mustGetRecord, needsRebalance, normalizeTag, parseCrmDiscussionReference, prepare, rankBetween, rebalancePlan, rebalanceRanks, recordCanEmail, recordDeliveryAttempt, recordDeliveryKey, recordOriginKey, removeLink, removeTag, renderTemplate, resolveDeps, resolveFieldState, resolveFieldStates, resolveSortColumn, rowToRecord, saveConfig, saveView, searchTextFor, sendTemplatedEmail, setArchived, setRank, setStage, stageIndexOf, templateVars, typeSummary, updateRecord, updateTask, updateView, upsertRecordOrigin, validateEmailCopy };
package/dist/index.d.ts CHANGED
@@ -1141,7 +1141,7 @@ interface SendEmailOpts {
1141
1141
  baseUrl: string;
1142
1142
  /** Route mount point for the unsubscribe link. Default "/api/crm". */
1143
1143
  basePath?: string;
1144
- /** Admin test-send: bypasses the enabled flag — NEVER the consent gate. */
1144
+ /** Admin test-send: permits an explicitly disabled template, but never bypasses copy validation or consent. */
1145
1145
  force?: boolean;
1146
1146
  }
1147
1147
  /** What happened to the send — delivered, gated, logged, or failed. */
@@ -1153,7 +1153,8 @@ interface SendEmailResult {
1153
1153
  }
1154
1154
  /**
1155
1155
  * Render and send one templated email to a record's contact channel, with
1156
- * consent gating, dedupe, dev redirection, and an unconditional audit row.
1156
+ * copy validation, explicit enablement, consent gating, dedupe, dev redirection,
1157
+ * and audit rows for transport attempts. Incomplete or internal copy never reaches transport.
1157
1158
  * Marketing-class sends get `{{unsubscribeUrl}}` plus RFC 8058 one-click
1158
1159
  * headers automatically.
1159
1160
  */
@@ -1565,4 +1566,28 @@ declare const crmIntegration: CrmIntegrationDescriptor;
1565
1566
  */
1566
1567
  declare function createCrmIntegration(crm: Crm, options?: CrmIntegrationOptions): CrmIntegrationDescriptor;
1567
1568
 
1568
- export { ACTIVITY_KINDS, type ActivityKind, type AttrType, type BillingEvent, type BillingProvider, CONFIG_KEY, CONSENT_STATES, CRM_DISCUSSION_REFERENCE_KINDS, CRM_NS, CRM_RULES, CRM_SCHEMA, CRM_SLOTS, type CompiledList, type ConfigPatch, type ConsentEvent, type ConsentOutcome, type ConsentState, type Crm, type CrmActivity, type CrmActor, type CrmAggregateResult, type CrmAggregateSpec, type CrmAttrs, CrmClient, type CrmClientOptions, type CrmConfig, type CrmConfigRow, type CrmContactChannel, type CrmDb, type CrmDeps, type CrmDiscussionReference, type CrmDiscussionReferenceActor, type CrmDiscussionReferenceKind, type CrmDiscussionReferenceTarget, type CrmEmailLogRow, type CrmEmailSender, type CrmEntityRef, CrmInputError, type CrmIntegrationDescriptor, type CrmIntegrationOptions, type CrmIntegrationProbe, type CrmIntegrationSeed, type CrmLink, type CrmListParams, type CrmLookup, CrmNotFoundError, type CrmOp, type CrmQuery, type CrmRecord, type CrmRecordDelivery, type CrmRecordOrigin, type CrmResult, type CrmRouteOpts, type CrmRow, type CrmRule, type CrmRules, type CrmScalar, type CrmSlot, type CrmSort, type CrmTag, type CrmTransactGuard, type CrmView, DEFAULT_LIMIT, EMAIL_STATUSES, type EmailStatus, type FieldCondition, type FieldConditions, type FieldDef, type FieldFilter, type FieldState, type FieldType, MAX_LIMIT, type PipelineDef, type PreparedWrite, RANK_EPSILON, RANK_STEP, type RelationDef, SORTABLE_COLUMNS, type SendEmailOpts, type SendEmailResult, type SerializedAttr, type SerializedEntity, type SerializedLink, type SerializedLinkEnd, type SerializedSchema, type StageDef, type StoredTemplate, type SubscriptionSnapshot, TASK_STATUSES, type TaskStatus, type TemplateSpec, type TypeDef, type TypeFacets, type TypeSummary, type ViewFilters, type ViewSpec, addActivity, addLink, addTag, applyConsent, applyConsentEvent, assertFieldCondition, canEmail, canTransition, channelKey, compileList, composeCrmConfigs, createCrmIntegration, createCrmRoutes, createRecord, crmDiscussionReferenceHref, crmDiscussionReferenceId, crmIntegration, crmRules, defaultTemplates, defineCrm, deleteView, emailChannelOps, evaluateFieldCondition, foldEmailStatus, formatCrmDiscussionReference, getConfig, getRecord, getRecordByOrigin, getRecordOrigin, initialStage, linkIdentity, lintTemplate, listActivities, listChannels, listEmailLog, listLinks, listRecordDeliveries, listRecordOrigins, listRecords, listTags, listTasks, listViews, mustGetRecord, needsRebalance, normalizeTag, parseCrmDiscussionReference, prepare, rankBetween, rebalancePlan, rebalanceRanks, recordCanEmail, recordDeliveryAttempt, recordDeliveryKey, recordOriginKey, removeLink, removeTag, renderTemplate, resolveDeps, resolveFieldState, resolveFieldStates, resolveSortColumn, rowToRecord, saveConfig, saveView, searchTextFor, sendTemplatedEmail, setArchived, setRank, setStage, stageIndexOf, templateVars, typeSummary, updateRecord, updateTask, updateView, upsertRecordOrigin };
1569
+ /** One actionable problem with email copy or the data needed to render it. */
1570
+ interface EmailCopyIssue {
1571
+ code: string;
1572
+ message: string;
1573
+ variable?: string;
1574
+ }
1575
+ /** A display name suitable for membership mail, never a missing name or a provider identifier. */
1576
+ declare function isEmailTierName(value: unknown, id?: string): value is string;
1577
+ /** Variables and concrete data to check. Omit values when auditing saved copy before an event occurs. */
1578
+ interface EmailCopyValidation {
1579
+ allowedVariables?: readonly string[];
1580
+ optionalVariables?: readonly string[];
1581
+ requiredVariables?: readonly string[];
1582
+ values?: Record<string, string>;
1583
+ tierId?: string;
1584
+ }
1585
+ /** Validate saved copy and, when supplied, its actual event data. Does not render, store, or send mail.
1586
+ * Unknown tokens, missing required values, explicit internal draft notes and invalid tier names fail closed.
1587
+ * Optional values must be named by the event contract; arbitrary unknown placeholders never become blanks. */
1588
+ declare function validateEmailCopy(copy: {
1589
+ subject?: unknown;
1590
+ text?: unknown;
1591
+ }, options?: EmailCopyValidation): EmailCopyIssue[];
1592
+
1593
+ export { ACTIVITY_KINDS, type ActivityKind, type AttrType, type BillingEvent, type BillingProvider, CONFIG_KEY, CONSENT_STATES, CRM_DISCUSSION_REFERENCE_KINDS, CRM_NS, CRM_RULES, CRM_SCHEMA, CRM_SLOTS, type CompiledList, type ConfigPatch, type ConsentEvent, type ConsentOutcome, type ConsentState, type Crm, type CrmActivity, type CrmActor, type CrmAggregateResult, type CrmAggregateSpec, type CrmAttrs, CrmClient, type CrmClientOptions, type CrmConfig, type CrmConfigRow, type CrmContactChannel, type CrmDb, type CrmDeps, type CrmDiscussionReference, type CrmDiscussionReferenceActor, type CrmDiscussionReferenceKind, type CrmDiscussionReferenceTarget, type CrmEmailLogRow, type CrmEmailSender, type CrmEntityRef, CrmInputError, type CrmIntegrationDescriptor, type CrmIntegrationOptions, type CrmIntegrationProbe, type CrmIntegrationSeed, type CrmLink, type CrmListParams, type CrmLookup, CrmNotFoundError, type CrmOp, type CrmQuery, type CrmRecord, type CrmRecordDelivery, type CrmRecordOrigin, type CrmResult, type CrmRouteOpts, type CrmRow, type CrmRule, type CrmRules, type CrmScalar, type CrmSlot, type CrmSort, type CrmTag, type CrmTransactGuard, type CrmView, DEFAULT_LIMIT, EMAIL_STATUSES, type EmailCopyIssue, type EmailCopyValidation, type EmailStatus, type FieldCondition, type FieldConditions, type FieldDef, type FieldFilter, type FieldState, type FieldType, MAX_LIMIT, type PipelineDef, type PreparedWrite, RANK_EPSILON, RANK_STEP, type RelationDef, SORTABLE_COLUMNS, type SendEmailOpts, type SendEmailResult, type SerializedAttr, type SerializedEntity, type SerializedLink, type SerializedLinkEnd, type SerializedSchema, type StageDef, type StoredTemplate, type SubscriptionSnapshot, TASK_STATUSES, type TaskStatus, type TemplateSpec, type TypeDef, type TypeFacets, type TypeSummary, type ViewFilters, type ViewSpec, addActivity, addLink, addTag, applyConsent, applyConsentEvent, assertFieldCondition, canEmail, canTransition, channelKey, compileList, composeCrmConfigs, createCrmIntegration, createCrmRoutes, createRecord, crmDiscussionReferenceHref, crmDiscussionReferenceId, crmIntegration, crmRules, defaultTemplates, defineCrm, deleteView, emailChannelOps, evaluateFieldCondition, foldEmailStatus, formatCrmDiscussionReference, getConfig, getRecord, getRecordByOrigin, getRecordOrigin, initialStage, isEmailTierName, linkIdentity, lintTemplate, listActivities, listChannels, listEmailLog, listLinks, listRecordDeliveries, listRecordOrigins, listRecords, listTags, listTasks, listViews, mustGetRecord, needsRebalance, normalizeTag, parseCrmDiscussionReference, prepare, rankBetween, rebalancePlan, rebalanceRanks, recordCanEmail, recordDeliveryAttempt, recordDeliveryKey, recordOriginKey, removeLink, removeTag, renderTemplate, resolveDeps, resolveFieldState, resolveFieldStates, resolveSortColumn, rowToRecord, saveConfig, saveView, searchTextFor, sendTemplatedEmail, setArchived, setRank, setStage, stageIndexOf, templateVars, typeSummary, updateRecord, updateTask, updateView, upsertRecordOrigin, validateEmailCopy };
package/dist/index.js CHANGED
@@ -1661,6 +1661,43 @@ async function saveConfig(deps, patch, opts = {}) {
1661
1661
  return { config: merged, duplicate };
1662
1662
  }
1663
1663
 
1664
+ // src/email-validation.ts
1665
+ function isEmailTierName(value, id) {
1666
+ return typeof value === "string" && !!value.trim() && value.trim() !== id && !/^(?:unknown|undefined|null|n\/a|(?:sku|price|tier|prod)_[\w-]+|[0-9a-f]{8}-[0-9a-f-]{27,})$/i.test(value.trim()) && !/[{}\r\n]/.test(value);
1667
+ }
1668
+ function validateEmailCopy(copy, options = {}) {
1669
+ const issues = [];
1670
+ const subject = typeof copy.subject === "string" ? copy.subject : "";
1671
+ const text = typeof copy.text === "string" ? copy.text : "";
1672
+ if (!subject.trim()) issues.push({ code: "subject-missing", message: "Add an email subject." });
1673
+ if (!text.trim()) issues.push({ code: "body-missing", message: "Add an email body." });
1674
+ if (/[\r\n]/.test(subject) || subject.length > 200) issues.push({ code: "subject-invalid", message: "Use a single-line subject of at most 200 characters." });
1675
+ if (text.length > 1e4) issues.push({ code: "body-invalid", message: "Keep the email body within 10,000 characters." });
1676
+ const combined = `${subject}
1677
+ ${text}`;
1678
+ if (/^\s*(?:\(\s*unused\s*:|Unused\.\s*Switched off\b|(?:TODO|TBD|PLACEHOLDER)\s*:|DRAFT\s*[-:]|\[\s*(?:draft|placeholder)\s*\]|do not (?:send|use) this (?:email|template))/im.test(combined)) {
1679
+ issues.push({ code: "internal-copy", message: "Replace internal draft or retirement notes with recipient-facing copy." });
1680
+ }
1681
+ const tokens = [...new Set([...combined.matchAll(/\{\{(\w+)\}\}/g)].map((match) => match[1]))];
1682
+ if (/[{}]/.test(combined.replace(/\{\{\w+\}\}/g, ""))) issues.push({ code: "placeholder-invalid", message: "Fix malformed placeholders; use {{variableName}}." });
1683
+ for (const variable of tokens) {
1684
+ if (options.allowedVariables && !options.allowedVariables.includes(variable)) issues.push({ code: "variable-unknown", variable, message: `This event does not supply {{${variable}}}.` });
1685
+ }
1686
+ if (options.values) {
1687
+ for (const variable of /* @__PURE__ */ new Set([...tokens, ...options.requiredVariables ?? []])) {
1688
+ const value = options.values[variable];
1689
+ if (typeof value !== "string" || !value.trim() && !options.optionalVariables?.includes(variable)) {
1690
+ issues.push({ code: "value-missing", variable, message: `Missing event value: ${variable}.` });
1691
+ } else if ((variable === "tierName" || variable === "tier") && !isEmailTierName(value, options.tierId)) {
1692
+ issues.push({ code: "tier-name-invalid", variable, message: "Resolve the membership tier's display name before sending." });
1693
+ } else if (/\{\{|\}\}/.test(value)) {
1694
+ issues.push({ code: "value-invalid", variable, message: `Unresolved placeholder in ${variable}.` });
1695
+ }
1696
+ }
1697
+ }
1698
+ return issues;
1699
+ }
1700
+
1664
1701
  // src/email.ts
1665
1702
  async function sendTemplatedEmail(deps, opts) {
1666
1703
  const { crm, db, now, newId } = resolveDeps(deps);
@@ -1669,7 +1706,8 @@ async function sendTemplatedEmail(deps, opts) {
1669
1706
  const config = await getConfig(deps);
1670
1707
  const stored = config?.emailTemplates[opts.templateId] ?? null;
1671
1708
  if (!stored || !stored.subject && !stored.text) return { sent: false, reason: "no_template_copy" };
1672
- if (!stored.enabled && !opts.force) return { sent: false, reason: "disabled" };
1709
+ if (typeof stored.enabled !== "boolean") return { sent: false, reason: "template-invalid" };
1710
+ if (stored.enabled !== true && !opts.force) return { sent: false, reason: "disabled" };
1673
1711
  const record = await mustGetRecord(deps, opts.recordId);
1674
1712
  const channels = await listChannels(deps, record.id);
1675
1713
  const channel = opts.channelId ? channels.find((c) => c.id === opts.channelId) : channels.find((c) => c.kind === "email" && c.isPrimary);
@@ -1688,8 +1726,10 @@ async function sendTemplatedEmail(deps, opts) {
1688
1726
  headers["List-Unsubscribe"] = `<${unsubscribeUrl}>`;
1689
1727
  headers["List-Unsubscribe-Post"] = "List-Unsubscribe=One-Click";
1690
1728
  }
1729
+ if (validateEmailCopy(stored, { allowedVariables: spec.vars, values: vars }).length) return { sent: false, reason: "template-invalid" };
1691
1730
  let subject = renderTemplate(stored.subject, vars);
1692
1731
  const text = renderTemplate(stored.text, vars);
1732
+ if (validateEmailCopy({ subject, text }, { allowedVariables: [] }).length) return { sent: false, reason: "template-invalid" };
1693
1733
  let to = channel.value;
1694
1734
  let redirected = false;
1695
1735
  let logOnly = !deps.sender;
@@ -2747,6 +2787,7 @@ export {
2747
2787
  getRecordByOrigin,
2748
2788
  getRecordOrigin,
2749
2789
  initialStage,
2790
+ isEmailTierName,
2750
2791
  linkIdentity,
2751
2792
  lintTemplate,
2752
2793
  listActivities,
@@ -2792,6 +2833,7 @@ export {
2792
2833
  updateRecord,
2793
2834
  updateTask,
2794
2835
  updateView,
2795
- upsertRecordOrigin
2836
+ upsertRecordOrigin,
2837
+ validateEmailCopy
2796
2838
  };
2797
2839
  //# sourceMappingURL=index.js.map