@adatechnology/notification-contracts 0.5.0 → 0.7.0
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.cjs +99 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -1
- package/dist/index.d.ts +89 -1
- package/dist/index.js +93 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -276,6 +276,13 @@ type SendEmailParams = {
|
|
|
276
276
|
readonly attachments?: readonly EmailAttachment[];
|
|
277
277
|
/** Correlaciona o recibo assíncrono (bounce/complaint) com a `delivery` que o originou. */
|
|
278
278
|
readonly idempotencyKey?: string;
|
|
279
|
+
/**
|
|
280
|
+
* Etiquetas de rastreio do provedor (Resend `tags`; SMTP: cabeçalho `X-Tag-<nome>`). Valores livres: o driver troca o
|
|
281
|
+
* que o provedor não aceita por `_`. O módulo preenche `template`; o host pode somar `env` e o que mais precisar.
|
|
282
|
+
*/
|
|
283
|
+
readonly tags?: Readonly<Record<string, string>>;
|
|
284
|
+
/** Cabeçalhos extras da mensagem (ex.: `X-Environment`). Provedor sem suporte a cabeçalho ignora. */
|
|
285
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
279
286
|
};
|
|
280
287
|
type SendWhatsAppTemplateParams = {
|
|
281
288
|
readonly templateName: string;
|
|
@@ -1723,6 +1730,8 @@ type TemplateVariableDefinition = {
|
|
|
1723
1730
|
readonly required: boolean;
|
|
1724
1731
|
/** Chave de i18n do rótulo na tela. Ausente, a tela mostra o próprio `name`. */
|
|
1725
1732
|
readonly labelKey?: string;
|
|
1733
|
+
/** Texto livre para quem edita o modelo ("nome do cliente"). Ausente, a tela mostra só o `name`. */
|
|
1734
|
+
readonly description?: string;
|
|
1726
1735
|
};
|
|
1727
1736
|
/** `templateKey` → variáveis que o produto promete enviar no payload daquela notificação. */
|
|
1728
1737
|
type TemplateVariableCatalog = Readonly<Record<string, readonly TemplateVariableDefinition[]>>;
|
|
@@ -1758,6 +1767,58 @@ declare function diffTemplateVariables(params: DiffTemplateVariablesParams): Tem
|
|
|
1758
1767
|
*/
|
|
1759
1768
|
declare function buildPreviewPayload(variables: readonly TemplateVariableDefinition[] | undefined): Readonly<Record<string, string>>;
|
|
1760
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1772
|
+
*
|
|
1773
|
+
* A definição de um template: o que o host declara no boot para que o painel saiba rotular,
|
|
1774
|
+
* explicar, validar e restaurar o texto. O conteúdo editável vive no banco (versionado); a definição
|
|
1775
|
+
* é código do host e nunca é gravada — por isso evoluir rótulo, descrição ou variáveis não exige
|
|
1776
|
+
* migration.
|
|
1777
|
+
*
|
|
1778
|
+
* Mora no contracts porque a tela lista as definições e o módulo as valida com a MESMA regra.
|
|
1779
|
+
*/
|
|
1780
|
+
|
|
1781
|
+
type TemplateDefinitionIdentity = {
|
|
1782
|
+
readonly key: string;
|
|
1783
|
+
readonly channel: NotificationChannel;
|
|
1784
|
+
readonly locale: string;
|
|
1785
|
+
};
|
|
1786
|
+
type TemplateDefinition = TemplateDefinitionIdentity & {
|
|
1787
|
+
/** Nome legível mostrado na lista do painel. */
|
|
1788
|
+
readonly label: string;
|
|
1789
|
+
readonly description?: string;
|
|
1790
|
+
/** Variáveis que o payload promete, com descrição e exemplo. Alimenta validação e preview. */
|
|
1791
|
+
readonly variables: readonly TemplateVariableDefinition[];
|
|
1792
|
+
/** Texto padrão: gravado como v1 por `ensure` e reaplicado por "restaurar padrão". */
|
|
1793
|
+
readonly body: string;
|
|
1794
|
+
readonly subject?: string;
|
|
1795
|
+
readonly whatsappTemplateName?: string;
|
|
1796
|
+
};
|
|
1797
|
+
/** Uma linha do painel: a definição do host + o estado gravado. Contrato de `GET /notification-template-definitions`. */
|
|
1798
|
+
type TemplateEditorItem = {
|
|
1799
|
+
readonly key: string;
|
|
1800
|
+
readonly channel: NotificationChannel;
|
|
1801
|
+
readonly locale: string;
|
|
1802
|
+
readonly label: string;
|
|
1803
|
+
readonly description?: string;
|
|
1804
|
+
readonly variables: readonly TemplateVariableDefinition[];
|
|
1805
|
+
readonly defaultBody: string;
|
|
1806
|
+
readonly defaultSubject?: string;
|
|
1807
|
+
/** A versão ativa mais alta; ausente se nunca foi gravada ou foi desativada. */
|
|
1808
|
+
readonly current?: NotificationTemplate;
|
|
1809
|
+
/** `true` quando o texto ativo difere do padrão — é o que habilita "restaurar padrão". */
|
|
1810
|
+
readonly isCustomized: boolean;
|
|
1811
|
+
};
|
|
1812
|
+
declare class InvalidTemplateDefinitionError extends Error {
|
|
1813
|
+
readonly definitionKey: string;
|
|
1814
|
+
constructor(definitionKey: string, reason: string);
|
|
1815
|
+
}
|
|
1816
|
+
/** Catálogo por `key`. Locales diferentes da mesma chave compartilham as variáveis da primeira. */
|
|
1817
|
+
declare function buildTemplateVariableCatalog(definitions: readonly TemplateDefinition[]): TemplateVariableCatalog;
|
|
1818
|
+
declare function findTemplateDefinition(definitions: readonly TemplateDefinition[], identity: TemplateDefinitionIdentity): TemplateDefinition | undefined;
|
|
1819
|
+
/** Falha no boot, não no primeiro "restaurar": um padrão que o próprio `upsert` recusaria é bug do host. */
|
|
1820
|
+
declare function assertTemplateDefinitions(definitions: readonly TemplateDefinition[]): void;
|
|
1821
|
+
|
|
1761
1822
|
/**
|
|
1762
1823
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1763
1824
|
*
|
|
@@ -1828,6 +1889,33 @@ declare function renderEmailMarksHtml(params: {
|
|
|
1828
1889
|
readonly text?: string | undefined;
|
|
1829
1890
|
}): string;
|
|
1830
1891
|
|
|
1892
|
+
/**
|
|
1893
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1894
|
+
*
|
|
1895
|
+
* Marca de ambiente de e-mail: fora de produção a mensagem sai com o assunto prefixado, uma faixa no topo do corpo HTML
|
|
1896
|
+
* e a primeira linha do texto avisando que é teste. Pura e idempotente (reenvio nunca duplica a marca); o host chama a
|
|
1897
|
+
* MESMA função no envio e na prévia, para a prévia ser exatamente o que sai. Tabela e estilo inline: é HTML de e-mail.
|
|
1898
|
+
*/
|
|
1899
|
+
type EmailEnvironmentMark = {
|
|
1900
|
+
/** Prefixo do assunto, com o espaço final (`"[Teste] "`). */
|
|
1901
|
+
readonly subjectPrefix: string;
|
|
1902
|
+
/** Texto da faixa e da primeira linha do texto simples. */
|
|
1903
|
+
readonly bannerText: string;
|
|
1904
|
+
/** Fundo da faixa; padrão âmbar claro. */
|
|
1905
|
+
readonly bannerBackground?: string;
|
|
1906
|
+
/** Cor do texto da faixa; padrão âmbar escuro. */
|
|
1907
|
+
readonly bannerColor?: string;
|
|
1908
|
+
/** Borda inferior da faixa; padrão âmbar. */
|
|
1909
|
+
readonly bannerBorder?: string;
|
|
1910
|
+
};
|
|
1911
|
+
type MarkableEmail = {
|
|
1912
|
+
readonly subject: string;
|
|
1913
|
+
readonly html: string;
|
|
1914
|
+
readonly text: string;
|
|
1915
|
+
};
|
|
1916
|
+
declare function buildEnvironmentBannerHtml(mark: EmailEnvironmentMark): string;
|
|
1917
|
+
declare function markEmailForEnvironment<TEmail extends MarkableEmail>(message: TEmail, mark: EmailEnvironmentMark): TEmail;
|
|
1918
|
+
|
|
1831
1919
|
/**
|
|
1832
1920
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1833
1921
|
*
|
|
@@ -1953,4 +2041,4 @@ declare function generateIcsContent(event: NotificationCalendarEvent, now?: Date
|
|
|
1953
2041
|
*/
|
|
1954
2042
|
declare function extractCalendarEvent(payload?: Readonly<Record<string, unknown>>): NotificationCalendarEvent | undefined;
|
|
1955
2043
|
|
|
1956
|
-
export { type BroadcastPushBody, type BroadcastPushFilter, type BroadcastPushFilterBody, type BroadcastPushParams, type BroadcastPushResult, type CachePort, type CalendarLinks, type ChannelDrivers, ChannelNotConfiguredError, type ClockPort, type CompanyId, ConfigMissingError, DELIVERY_STATUS, DEVICE_PLATFORM, type DeliveryAttemptResult, type DeliveryBouncedEvent, type DeliveryFailedEvent, type DeliveryReceipt, type DeliverySentEvent, type DeliveryStatus, type DeliverySummary, type DeliveryWebhookBody, type DeviceInvalidatedEvent, DeviceNotFoundError, type DevicePlatform, type DeviceRegisteredEvent, type DeviceRegistration, type DiffTemplateVariablesParams, DuplicateWebhookDeliveryError, EMAIL_ATTACHMENT_MAX_BYTES, EMAIL_ATTACHMENT_MAX_COUNT, EMAIL_DRIVER, type EmailAttachment, type EmailDriver, type EmailDriverPort, type EmailLogo, INTRUSIVE_CHANNELS, type InterpolateEmailHtmlParams, InvalidVapidKeysError, InvalidWebhookSignatureError, type ListNotificationsParams, type ListNotificationsQuery, type ListNotificationsResult, type LogMeta, type LoggerPort, type MetricsPort, NOTIFICATION_CATEGORY_HINT, NOTIFICATION_CHANNEL, NOTIFICATION_ERROR_CODES, NOTIFICATION_EVENT, NOTIFICATION_STATUS, type NotificationCalendarEvent, type NotificationCategoryPolicy, type NotificationChannel, type NotificationCreatedEvent, type NotificationDispatchedEvent, NotificationError, type NotificationEvent, type NotificationHooks, type NotificationId, type NotificationJob, NotificationNotFoundError, type NotificationPreference, type NotificationReadEvent, type NotificationStatus, type NotificationSummary, type NotificationTemplate, PREVIEW_VIEWPORT, PREVIEW_VIEWPORT_BY_CHANNEL, PUSH_DRIVER, type PreferencesUpdatedEvent, type PreviewViewport, type PreviewViewportSpec, type PushDriver, type PushDriverPort, type PushNotificationPayload, type PushNotificationPayloadBody, type PushServiceContainerConfig, type PushServicePort, type PushSubscriptionRecord, type QueuePort, type RealtimeEvent, type RealtimeNotifierPort, type RealtimeSubscription, type RecipientResolverPort, RecipientUnresolvedError, type RegisterDeviceBody, type RegisterPushSubscriptionBody, type RegisterPushSubscriptionParams, type RenderTemplateParams, type RenderedStandardEmail, type RenderedTemplate, type RenderedTemplatePreview, type ResolvedRecipient, STANDARD_EMAIL_BUILTIN_TEMPLATE, STANDARD_EMAIL_CHANNEL, STANDARD_EMAIL_HTML_MAX_BYTES, STANDARD_EMAIL_LOCALE, STANDARD_EMAIL_REQUIRED_VARIABLES, STANDARD_EMAIL_SYSTEM_HTML_VARIABLES, STANDARD_EMAIL_TEMPLATE_KEY, STANDARD_EMAIL_THEME, STANDARD_EMAIL_VARIABLES, SUPPRESSION_REASON, type SendEmailParams, type SendNotificationBody, type SendNotificationParams, type SendNotificationResult, type SendPushDirectBody, type SendPushDirectParams, type SendPushDirectResult, type SendPushDirectTarget, type SendPushDirectTargetBody, type SendPushParams, type SendSmsParams, type SendWhatsAppParams, type SendWhatsAppTemplateParams, type SmsDriverPort, type StandardEmailAssessment, type StandardEmailInput, type StandardEmailSystemHtmlVariable, type StandardEmailTemplate, SubscriptionNotFoundError, SuppressedTargetError, type SuppressionReason, TEMPLATE_CONSTRAINTS_BY_CHANNEL, TEMPLATE_VARIABLE_KIND, type TemplateConstraintCheck, type TemplateConstraintField, type TemplateConstraintLimits, TemplateIdNotFoundError, TemplateNotFoundError, type TemplateRendererPort, type TemplateVariableCatalog, type TemplateVariableDefinition, type TemplateVariableDiff, type TemplateVariableKind, ThrottledError, UnknownTemplateVariablesError, type UnsafeEmailHtmlRule, type UpdateCategoryPoliciesBody, type UpdatePreferencesBody, type UpsertTemplateBody, type UserId, type VapidKeys, WebPushEncryptionError, type WebPushKeys, type WebPushKeysBody, type WebPushSubscription, type WebPushSubscriptionBody, type WhatsAppDriverPort, type WhatsAppSendingChannel, assessStandardEmailTemplate, broadcastPushFilterSchema, broadcastPushSchema, buildInitials, buildPreviewPayload, categoryPolicyEntrySchema, checkEmailAttachment, createWhatsAppDriverFromChannel, deliveryWebhookSchema, deriveTitleFromBody, diffTemplateVariables, escapeEmailHtml, escapeTemplateHtml, extractCalendarEvent, extractTemplatePlaceholders, findUnsafeEmailHtml, generateCalendarLinks, generateGoogleCalendarUrl, generateIcsContent, generateIcsDataUri, generateOffice365CalendarUrl, generateOutlookCalendarUrl, generateYahooCalendarUrl, htmlToPlainText, interpolateEmailHtml, interpolateTemplate, listNotificationsQuerySchema, preferenceEntrySchema, pushNotificationPayloadSchema, registerDeviceSchema, registerPushSubscriptionSchema, renderEmailLogoHtml, renderEmailMarksHtml, renderStandardEmail, renderTemplate, sendNotificationSchema, sendPushDirectSchema, sendPushDirectTargetSchema, updateCategoryPoliciesSchema, updatePreferencesSchema, upsertTemplateSchema, webPushKeysSchema, webPushSubscriptionSchema };
|
|
2044
|
+
export { type BroadcastPushBody, type BroadcastPushFilter, type BroadcastPushFilterBody, type BroadcastPushParams, type BroadcastPushResult, type CachePort, type CalendarLinks, type ChannelDrivers, ChannelNotConfiguredError, type ClockPort, type CompanyId, ConfigMissingError, DELIVERY_STATUS, DEVICE_PLATFORM, type DeliveryAttemptResult, type DeliveryBouncedEvent, type DeliveryFailedEvent, type DeliveryReceipt, type DeliverySentEvent, type DeliveryStatus, type DeliverySummary, type DeliveryWebhookBody, type DeviceInvalidatedEvent, DeviceNotFoundError, type DevicePlatform, type DeviceRegisteredEvent, type DeviceRegistration, type DiffTemplateVariablesParams, DuplicateWebhookDeliveryError, EMAIL_ATTACHMENT_MAX_BYTES, EMAIL_ATTACHMENT_MAX_COUNT, EMAIL_DRIVER, type EmailAttachment, type EmailDriver, type EmailDriverPort, type EmailEnvironmentMark, type EmailLogo, INTRUSIVE_CHANNELS, type InterpolateEmailHtmlParams, InvalidTemplateDefinitionError, InvalidVapidKeysError, InvalidWebhookSignatureError, type ListNotificationsParams, type ListNotificationsQuery, type ListNotificationsResult, type LogMeta, type LoggerPort, type MarkableEmail, type MetricsPort, NOTIFICATION_CATEGORY_HINT, NOTIFICATION_CHANNEL, NOTIFICATION_ERROR_CODES, NOTIFICATION_EVENT, NOTIFICATION_STATUS, type NotificationCalendarEvent, type NotificationCategoryPolicy, type NotificationChannel, type NotificationCreatedEvent, type NotificationDispatchedEvent, NotificationError, type NotificationEvent, type NotificationHooks, type NotificationId, type NotificationJob, NotificationNotFoundError, type NotificationPreference, type NotificationReadEvent, type NotificationStatus, type NotificationSummary, type NotificationTemplate, PREVIEW_VIEWPORT, PREVIEW_VIEWPORT_BY_CHANNEL, PUSH_DRIVER, type PreferencesUpdatedEvent, type PreviewViewport, type PreviewViewportSpec, type PushDriver, type PushDriverPort, type PushNotificationPayload, type PushNotificationPayloadBody, type PushServiceContainerConfig, type PushServicePort, type PushSubscriptionRecord, type QueuePort, type RealtimeEvent, type RealtimeNotifierPort, type RealtimeSubscription, type RecipientResolverPort, RecipientUnresolvedError, type RegisterDeviceBody, type RegisterPushSubscriptionBody, type RegisterPushSubscriptionParams, type RenderTemplateParams, type RenderedStandardEmail, type RenderedTemplate, type RenderedTemplatePreview, type ResolvedRecipient, STANDARD_EMAIL_BUILTIN_TEMPLATE, STANDARD_EMAIL_CHANNEL, STANDARD_EMAIL_HTML_MAX_BYTES, STANDARD_EMAIL_LOCALE, STANDARD_EMAIL_REQUIRED_VARIABLES, STANDARD_EMAIL_SYSTEM_HTML_VARIABLES, STANDARD_EMAIL_TEMPLATE_KEY, STANDARD_EMAIL_THEME, STANDARD_EMAIL_VARIABLES, SUPPRESSION_REASON, type SendEmailParams, type SendNotificationBody, type SendNotificationParams, type SendNotificationResult, type SendPushDirectBody, type SendPushDirectParams, type SendPushDirectResult, type SendPushDirectTarget, type SendPushDirectTargetBody, type SendPushParams, type SendSmsParams, type SendWhatsAppParams, type SendWhatsAppTemplateParams, type SmsDriverPort, type StandardEmailAssessment, type StandardEmailInput, type StandardEmailSystemHtmlVariable, type StandardEmailTemplate, SubscriptionNotFoundError, SuppressedTargetError, type SuppressionReason, TEMPLATE_CONSTRAINTS_BY_CHANNEL, TEMPLATE_VARIABLE_KIND, type TemplateConstraintCheck, type TemplateConstraintField, type TemplateConstraintLimits, type TemplateDefinition, type TemplateDefinitionIdentity, type TemplateEditorItem, TemplateIdNotFoundError, TemplateNotFoundError, type TemplateRendererPort, type TemplateVariableCatalog, type TemplateVariableDefinition, type TemplateVariableDiff, type TemplateVariableKind, ThrottledError, UnknownTemplateVariablesError, type UnsafeEmailHtmlRule, type UpdateCategoryPoliciesBody, type UpdatePreferencesBody, type UpsertTemplateBody, type UserId, type VapidKeys, WebPushEncryptionError, type WebPushKeys, type WebPushKeysBody, type WebPushSubscription, type WebPushSubscriptionBody, type WhatsAppDriverPort, type WhatsAppSendingChannel, assertTemplateDefinitions, assessStandardEmailTemplate, broadcastPushFilterSchema, broadcastPushSchema, buildEnvironmentBannerHtml, buildInitials, buildPreviewPayload, buildTemplateVariableCatalog, categoryPolicyEntrySchema, checkEmailAttachment, createWhatsAppDriverFromChannel, deliveryWebhookSchema, deriveTitleFromBody, diffTemplateVariables, escapeEmailHtml, escapeTemplateHtml, extractCalendarEvent, extractTemplatePlaceholders, findTemplateDefinition, findUnsafeEmailHtml, generateCalendarLinks, generateGoogleCalendarUrl, generateIcsContent, generateIcsDataUri, generateOffice365CalendarUrl, generateOutlookCalendarUrl, generateYahooCalendarUrl, htmlToPlainText, interpolateEmailHtml, interpolateTemplate, listNotificationsQuerySchema, markEmailForEnvironment, preferenceEntrySchema, pushNotificationPayloadSchema, registerDeviceSchema, registerPushSubscriptionSchema, renderEmailLogoHtml, renderEmailMarksHtml, renderStandardEmail, renderTemplate, sendNotificationSchema, sendPushDirectSchema, sendPushDirectTargetSchema, updateCategoryPoliciesSchema, updatePreferencesSchema, upsertTemplateSchema, webPushKeysSchema, webPushSubscriptionSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -276,6 +276,13 @@ type SendEmailParams = {
|
|
|
276
276
|
readonly attachments?: readonly EmailAttachment[];
|
|
277
277
|
/** Correlaciona o recibo assíncrono (bounce/complaint) com a `delivery` que o originou. */
|
|
278
278
|
readonly idempotencyKey?: string;
|
|
279
|
+
/**
|
|
280
|
+
* Etiquetas de rastreio do provedor (Resend `tags`; SMTP: cabeçalho `X-Tag-<nome>`). Valores livres: o driver troca o
|
|
281
|
+
* que o provedor não aceita por `_`. O módulo preenche `template`; o host pode somar `env` e o que mais precisar.
|
|
282
|
+
*/
|
|
283
|
+
readonly tags?: Readonly<Record<string, string>>;
|
|
284
|
+
/** Cabeçalhos extras da mensagem (ex.: `X-Environment`). Provedor sem suporte a cabeçalho ignora. */
|
|
285
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
279
286
|
};
|
|
280
287
|
type SendWhatsAppTemplateParams = {
|
|
281
288
|
readonly templateName: string;
|
|
@@ -1723,6 +1730,8 @@ type TemplateVariableDefinition = {
|
|
|
1723
1730
|
readonly required: boolean;
|
|
1724
1731
|
/** Chave de i18n do rótulo na tela. Ausente, a tela mostra o próprio `name`. */
|
|
1725
1732
|
readonly labelKey?: string;
|
|
1733
|
+
/** Texto livre para quem edita o modelo ("nome do cliente"). Ausente, a tela mostra só o `name`. */
|
|
1734
|
+
readonly description?: string;
|
|
1726
1735
|
};
|
|
1727
1736
|
/** `templateKey` → variáveis que o produto promete enviar no payload daquela notificação. */
|
|
1728
1737
|
type TemplateVariableCatalog = Readonly<Record<string, readonly TemplateVariableDefinition[]>>;
|
|
@@ -1758,6 +1767,58 @@ declare function diffTemplateVariables(params: DiffTemplateVariablesParams): Tem
|
|
|
1758
1767
|
*/
|
|
1759
1768
|
declare function buildPreviewPayload(variables: readonly TemplateVariableDefinition[] | undefined): Readonly<Record<string, string>>;
|
|
1760
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1772
|
+
*
|
|
1773
|
+
* A definição de um template: o que o host declara no boot para que o painel saiba rotular,
|
|
1774
|
+
* explicar, validar e restaurar o texto. O conteúdo editável vive no banco (versionado); a definição
|
|
1775
|
+
* é código do host e nunca é gravada — por isso evoluir rótulo, descrição ou variáveis não exige
|
|
1776
|
+
* migration.
|
|
1777
|
+
*
|
|
1778
|
+
* Mora no contracts porque a tela lista as definições e o módulo as valida com a MESMA regra.
|
|
1779
|
+
*/
|
|
1780
|
+
|
|
1781
|
+
type TemplateDefinitionIdentity = {
|
|
1782
|
+
readonly key: string;
|
|
1783
|
+
readonly channel: NotificationChannel;
|
|
1784
|
+
readonly locale: string;
|
|
1785
|
+
};
|
|
1786
|
+
type TemplateDefinition = TemplateDefinitionIdentity & {
|
|
1787
|
+
/** Nome legível mostrado na lista do painel. */
|
|
1788
|
+
readonly label: string;
|
|
1789
|
+
readonly description?: string;
|
|
1790
|
+
/** Variáveis que o payload promete, com descrição e exemplo. Alimenta validação e preview. */
|
|
1791
|
+
readonly variables: readonly TemplateVariableDefinition[];
|
|
1792
|
+
/** Texto padrão: gravado como v1 por `ensure` e reaplicado por "restaurar padrão". */
|
|
1793
|
+
readonly body: string;
|
|
1794
|
+
readonly subject?: string;
|
|
1795
|
+
readonly whatsappTemplateName?: string;
|
|
1796
|
+
};
|
|
1797
|
+
/** Uma linha do painel: a definição do host + o estado gravado. Contrato de `GET /notification-template-definitions`. */
|
|
1798
|
+
type TemplateEditorItem = {
|
|
1799
|
+
readonly key: string;
|
|
1800
|
+
readonly channel: NotificationChannel;
|
|
1801
|
+
readonly locale: string;
|
|
1802
|
+
readonly label: string;
|
|
1803
|
+
readonly description?: string;
|
|
1804
|
+
readonly variables: readonly TemplateVariableDefinition[];
|
|
1805
|
+
readonly defaultBody: string;
|
|
1806
|
+
readonly defaultSubject?: string;
|
|
1807
|
+
/** A versão ativa mais alta; ausente se nunca foi gravada ou foi desativada. */
|
|
1808
|
+
readonly current?: NotificationTemplate;
|
|
1809
|
+
/** `true` quando o texto ativo difere do padrão — é o que habilita "restaurar padrão". */
|
|
1810
|
+
readonly isCustomized: boolean;
|
|
1811
|
+
};
|
|
1812
|
+
declare class InvalidTemplateDefinitionError extends Error {
|
|
1813
|
+
readonly definitionKey: string;
|
|
1814
|
+
constructor(definitionKey: string, reason: string);
|
|
1815
|
+
}
|
|
1816
|
+
/** Catálogo por `key`. Locales diferentes da mesma chave compartilham as variáveis da primeira. */
|
|
1817
|
+
declare function buildTemplateVariableCatalog(definitions: readonly TemplateDefinition[]): TemplateVariableCatalog;
|
|
1818
|
+
declare function findTemplateDefinition(definitions: readonly TemplateDefinition[], identity: TemplateDefinitionIdentity): TemplateDefinition | undefined;
|
|
1819
|
+
/** Falha no boot, não no primeiro "restaurar": um padrão que o próprio `upsert` recusaria é bug do host. */
|
|
1820
|
+
declare function assertTemplateDefinitions(definitions: readonly TemplateDefinition[]): void;
|
|
1821
|
+
|
|
1761
1822
|
/**
|
|
1762
1823
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1763
1824
|
*
|
|
@@ -1828,6 +1889,33 @@ declare function renderEmailMarksHtml(params: {
|
|
|
1828
1889
|
readonly text?: string | undefined;
|
|
1829
1890
|
}): string;
|
|
1830
1891
|
|
|
1892
|
+
/**
|
|
1893
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1894
|
+
*
|
|
1895
|
+
* Marca de ambiente de e-mail: fora de produção a mensagem sai com o assunto prefixado, uma faixa no topo do corpo HTML
|
|
1896
|
+
* e a primeira linha do texto avisando que é teste. Pura e idempotente (reenvio nunca duplica a marca); o host chama a
|
|
1897
|
+
* MESMA função no envio e na prévia, para a prévia ser exatamente o que sai. Tabela e estilo inline: é HTML de e-mail.
|
|
1898
|
+
*/
|
|
1899
|
+
type EmailEnvironmentMark = {
|
|
1900
|
+
/** Prefixo do assunto, com o espaço final (`"[Teste] "`). */
|
|
1901
|
+
readonly subjectPrefix: string;
|
|
1902
|
+
/** Texto da faixa e da primeira linha do texto simples. */
|
|
1903
|
+
readonly bannerText: string;
|
|
1904
|
+
/** Fundo da faixa; padrão âmbar claro. */
|
|
1905
|
+
readonly bannerBackground?: string;
|
|
1906
|
+
/** Cor do texto da faixa; padrão âmbar escuro. */
|
|
1907
|
+
readonly bannerColor?: string;
|
|
1908
|
+
/** Borda inferior da faixa; padrão âmbar. */
|
|
1909
|
+
readonly bannerBorder?: string;
|
|
1910
|
+
};
|
|
1911
|
+
type MarkableEmail = {
|
|
1912
|
+
readonly subject: string;
|
|
1913
|
+
readonly html: string;
|
|
1914
|
+
readonly text: string;
|
|
1915
|
+
};
|
|
1916
|
+
declare function buildEnvironmentBannerHtml(mark: EmailEnvironmentMark): string;
|
|
1917
|
+
declare function markEmailForEnvironment<TEmail extends MarkableEmail>(message: TEmail, mark: EmailEnvironmentMark): TEmail;
|
|
1918
|
+
|
|
1831
1919
|
/**
|
|
1832
1920
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1833
1921
|
*
|
|
@@ -1953,4 +2041,4 @@ declare function generateIcsContent(event: NotificationCalendarEvent, now?: Date
|
|
|
1953
2041
|
*/
|
|
1954
2042
|
declare function extractCalendarEvent(payload?: Readonly<Record<string, unknown>>): NotificationCalendarEvent | undefined;
|
|
1955
2043
|
|
|
1956
|
-
export { type BroadcastPushBody, type BroadcastPushFilter, type BroadcastPushFilterBody, type BroadcastPushParams, type BroadcastPushResult, type CachePort, type CalendarLinks, type ChannelDrivers, ChannelNotConfiguredError, type ClockPort, type CompanyId, ConfigMissingError, DELIVERY_STATUS, DEVICE_PLATFORM, type DeliveryAttemptResult, type DeliveryBouncedEvent, type DeliveryFailedEvent, type DeliveryReceipt, type DeliverySentEvent, type DeliveryStatus, type DeliverySummary, type DeliveryWebhookBody, type DeviceInvalidatedEvent, DeviceNotFoundError, type DevicePlatform, type DeviceRegisteredEvent, type DeviceRegistration, type DiffTemplateVariablesParams, DuplicateWebhookDeliveryError, EMAIL_ATTACHMENT_MAX_BYTES, EMAIL_ATTACHMENT_MAX_COUNT, EMAIL_DRIVER, type EmailAttachment, type EmailDriver, type EmailDriverPort, type EmailLogo, INTRUSIVE_CHANNELS, type InterpolateEmailHtmlParams, InvalidVapidKeysError, InvalidWebhookSignatureError, type ListNotificationsParams, type ListNotificationsQuery, type ListNotificationsResult, type LogMeta, type LoggerPort, type MetricsPort, NOTIFICATION_CATEGORY_HINT, NOTIFICATION_CHANNEL, NOTIFICATION_ERROR_CODES, NOTIFICATION_EVENT, NOTIFICATION_STATUS, type NotificationCalendarEvent, type NotificationCategoryPolicy, type NotificationChannel, type NotificationCreatedEvent, type NotificationDispatchedEvent, NotificationError, type NotificationEvent, type NotificationHooks, type NotificationId, type NotificationJob, NotificationNotFoundError, type NotificationPreference, type NotificationReadEvent, type NotificationStatus, type NotificationSummary, type NotificationTemplate, PREVIEW_VIEWPORT, PREVIEW_VIEWPORT_BY_CHANNEL, PUSH_DRIVER, type PreferencesUpdatedEvent, type PreviewViewport, type PreviewViewportSpec, type PushDriver, type PushDriverPort, type PushNotificationPayload, type PushNotificationPayloadBody, type PushServiceContainerConfig, type PushServicePort, type PushSubscriptionRecord, type QueuePort, type RealtimeEvent, type RealtimeNotifierPort, type RealtimeSubscription, type RecipientResolverPort, RecipientUnresolvedError, type RegisterDeviceBody, type RegisterPushSubscriptionBody, type RegisterPushSubscriptionParams, type RenderTemplateParams, type RenderedStandardEmail, type RenderedTemplate, type RenderedTemplatePreview, type ResolvedRecipient, STANDARD_EMAIL_BUILTIN_TEMPLATE, STANDARD_EMAIL_CHANNEL, STANDARD_EMAIL_HTML_MAX_BYTES, STANDARD_EMAIL_LOCALE, STANDARD_EMAIL_REQUIRED_VARIABLES, STANDARD_EMAIL_SYSTEM_HTML_VARIABLES, STANDARD_EMAIL_TEMPLATE_KEY, STANDARD_EMAIL_THEME, STANDARD_EMAIL_VARIABLES, SUPPRESSION_REASON, type SendEmailParams, type SendNotificationBody, type SendNotificationParams, type SendNotificationResult, type SendPushDirectBody, type SendPushDirectParams, type SendPushDirectResult, type SendPushDirectTarget, type SendPushDirectTargetBody, type SendPushParams, type SendSmsParams, type SendWhatsAppParams, type SendWhatsAppTemplateParams, type SmsDriverPort, type StandardEmailAssessment, type StandardEmailInput, type StandardEmailSystemHtmlVariable, type StandardEmailTemplate, SubscriptionNotFoundError, SuppressedTargetError, type SuppressionReason, TEMPLATE_CONSTRAINTS_BY_CHANNEL, TEMPLATE_VARIABLE_KIND, type TemplateConstraintCheck, type TemplateConstraintField, type TemplateConstraintLimits, TemplateIdNotFoundError, TemplateNotFoundError, type TemplateRendererPort, type TemplateVariableCatalog, type TemplateVariableDefinition, type TemplateVariableDiff, type TemplateVariableKind, ThrottledError, UnknownTemplateVariablesError, type UnsafeEmailHtmlRule, type UpdateCategoryPoliciesBody, type UpdatePreferencesBody, type UpsertTemplateBody, type UserId, type VapidKeys, WebPushEncryptionError, type WebPushKeys, type WebPushKeysBody, type WebPushSubscription, type WebPushSubscriptionBody, type WhatsAppDriverPort, type WhatsAppSendingChannel, assessStandardEmailTemplate, broadcastPushFilterSchema, broadcastPushSchema, buildInitials, buildPreviewPayload, categoryPolicyEntrySchema, checkEmailAttachment, createWhatsAppDriverFromChannel, deliveryWebhookSchema, deriveTitleFromBody, diffTemplateVariables, escapeEmailHtml, escapeTemplateHtml, extractCalendarEvent, extractTemplatePlaceholders, findUnsafeEmailHtml, generateCalendarLinks, generateGoogleCalendarUrl, generateIcsContent, generateIcsDataUri, generateOffice365CalendarUrl, generateOutlookCalendarUrl, generateYahooCalendarUrl, htmlToPlainText, interpolateEmailHtml, interpolateTemplate, listNotificationsQuerySchema, preferenceEntrySchema, pushNotificationPayloadSchema, registerDeviceSchema, registerPushSubscriptionSchema, renderEmailLogoHtml, renderEmailMarksHtml, renderStandardEmail, renderTemplate, sendNotificationSchema, sendPushDirectSchema, sendPushDirectTargetSchema, updateCategoryPoliciesSchema, updatePreferencesSchema, upsertTemplateSchema, webPushKeysSchema, webPushSubscriptionSchema };
|
|
2044
|
+
export { type BroadcastPushBody, type BroadcastPushFilter, type BroadcastPushFilterBody, type BroadcastPushParams, type BroadcastPushResult, type CachePort, type CalendarLinks, type ChannelDrivers, ChannelNotConfiguredError, type ClockPort, type CompanyId, ConfigMissingError, DELIVERY_STATUS, DEVICE_PLATFORM, type DeliveryAttemptResult, type DeliveryBouncedEvent, type DeliveryFailedEvent, type DeliveryReceipt, type DeliverySentEvent, type DeliveryStatus, type DeliverySummary, type DeliveryWebhookBody, type DeviceInvalidatedEvent, DeviceNotFoundError, type DevicePlatform, type DeviceRegisteredEvent, type DeviceRegistration, type DiffTemplateVariablesParams, DuplicateWebhookDeliveryError, EMAIL_ATTACHMENT_MAX_BYTES, EMAIL_ATTACHMENT_MAX_COUNT, EMAIL_DRIVER, type EmailAttachment, type EmailDriver, type EmailDriverPort, type EmailEnvironmentMark, type EmailLogo, INTRUSIVE_CHANNELS, type InterpolateEmailHtmlParams, InvalidTemplateDefinitionError, InvalidVapidKeysError, InvalidWebhookSignatureError, type ListNotificationsParams, type ListNotificationsQuery, type ListNotificationsResult, type LogMeta, type LoggerPort, type MarkableEmail, type MetricsPort, NOTIFICATION_CATEGORY_HINT, NOTIFICATION_CHANNEL, NOTIFICATION_ERROR_CODES, NOTIFICATION_EVENT, NOTIFICATION_STATUS, type NotificationCalendarEvent, type NotificationCategoryPolicy, type NotificationChannel, type NotificationCreatedEvent, type NotificationDispatchedEvent, NotificationError, type NotificationEvent, type NotificationHooks, type NotificationId, type NotificationJob, NotificationNotFoundError, type NotificationPreference, type NotificationReadEvent, type NotificationStatus, type NotificationSummary, type NotificationTemplate, PREVIEW_VIEWPORT, PREVIEW_VIEWPORT_BY_CHANNEL, PUSH_DRIVER, type PreferencesUpdatedEvent, type PreviewViewport, type PreviewViewportSpec, type PushDriver, type PushDriverPort, type PushNotificationPayload, type PushNotificationPayloadBody, type PushServiceContainerConfig, type PushServicePort, type PushSubscriptionRecord, type QueuePort, type RealtimeEvent, type RealtimeNotifierPort, type RealtimeSubscription, type RecipientResolverPort, RecipientUnresolvedError, type RegisterDeviceBody, type RegisterPushSubscriptionBody, type RegisterPushSubscriptionParams, type RenderTemplateParams, type RenderedStandardEmail, type RenderedTemplate, type RenderedTemplatePreview, type ResolvedRecipient, STANDARD_EMAIL_BUILTIN_TEMPLATE, STANDARD_EMAIL_CHANNEL, STANDARD_EMAIL_HTML_MAX_BYTES, STANDARD_EMAIL_LOCALE, STANDARD_EMAIL_REQUIRED_VARIABLES, STANDARD_EMAIL_SYSTEM_HTML_VARIABLES, STANDARD_EMAIL_TEMPLATE_KEY, STANDARD_EMAIL_THEME, STANDARD_EMAIL_VARIABLES, SUPPRESSION_REASON, type SendEmailParams, type SendNotificationBody, type SendNotificationParams, type SendNotificationResult, type SendPushDirectBody, type SendPushDirectParams, type SendPushDirectResult, type SendPushDirectTarget, type SendPushDirectTargetBody, type SendPushParams, type SendSmsParams, type SendWhatsAppParams, type SendWhatsAppTemplateParams, type SmsDriverPort, type StandardEmailAssessment, type StandardEmailInput, type StandardEmailSystemHtmlVariable, type StandardEmailTemplate, SubscriptionNotFoundError, SuppressedTargetError, type SuppressionReason, TEMPLATE_CONSTRAINTS_BY_CHANNEL, TEMPLATE_VARIABLE_KIND, type TemplateConstraintCheck, type TemplateConstraintField, type TemplateConstraintLimits, type TemplateDefinition, type TemplateDefinitionIdentity, type TemplateEditorItem, TemplateIdNotFoundError, TemplateNotFoundError, type TemplateRendererPort, type TemplateVariableCatalog, type TemplateVariableDefinition, type TemplateVariableDiff, type TemplateVariableKind, ThrottledError, UnknownTemplateVariablesError, type UnsafeEmailHtmlRule, type UpdateCategoryPoliciesBody, type UpdatePreferencesBody, type UpsertTemplateBody, type UserId, type VapidKeys, WebPushEncryptionError, type WebPushKeys, type WebPushKeysBody, type WebPushSubscription, type WebPushSubscriptionBody, type WhatsAppDriverPort, type WhatsAppSendingChannel, assertTemplateDefinitions, assessStandardEmailTemplate, broadcastPushFilterSchema, broadcastPushSchema, buildEnvironmentBannerHtml, buildInitials, buildPreviewPayload, buildTemplateVariableCatalog, categoryPolicyEntrySchema, checkEmailAttachment, createWhatsAppDriverFromChannel, deliveryWebhookSchema, deriveTitleFromBody, diffTemplateVariables, escapeEmailHtml, escapeTemplateHtml, extractCalendarEvent, extractTemplatePlaceholders, findTemplateDefinition, findUnsafeEmailHtml, generateCalendarLinks, generateGoogleCalendarUrl, generateIcsContent, generateIcsDataUri, generateOffice365CalendarUrl, generateOutlookCalendarUrl, generateYahooCalendarUrl, htmlToPlainText, interpolateEmailHtml, interpolateTemplate, listNotificationsQuerySchema, markEmailForEnvironment, preferenceEntrySchema, pushNotificationPayloadSchema, registerDeviceSchema, registerPushSubscriptionSchema, renderEmailLogoHtml, renderEmailMarksHtml, renderStandardEmail, renderTemplate, sendNotificationSchema, sendPushDirectSchema, sendPushDirectTargetSchema, updateCategoryPoliciesSchema, updatePreferencesSchema, upsertTemplateSchema, webPushKeysSchema, webPushSubscriptionSchema };
|
package/dist/index.js
CHANGED
|
@@ -708,6 +708,53 @@ function buildPreviewPayload(variables) {
|
|
|
708
708
|
}
|
|
709
709
|
__name(buildPreviewPayload, "buildPreviewPayload");
|
|
710
710
|
|
|
711
|
+
// src/templateDefinition.ts
|
|
712
|
+
var InvalidTemplateDefinitionError = class extends Error {
|
|
713
|
+
static {
|
|
714
|
+
__name(this, "InvalidTemplateDefinitionError");
|
|
715
|
+
}
|
|
716
|
+
definitionKey;
|
|
717
|
+
constructor(definitionKey, reason) {
|
|
718
|
+
super(`Defini\xE7\xE3o de template inv\xE1lida (${definitionKey}): ${reason}`), this.definitionKey = definitionKey;
|
|
719
|
+
this.name = "InvalidTemplateDefinitionError";
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
function buildTemplateVariableCatalog(definitions) {
|
|
723
|
+
const catalog = {};
|
|
724
|
+
for (const definition of definitions) {
|
|
725
|
+
catalog[definition.key] ??= definition.variables;
|
|
726
|
+
}
|
|
727
|
+
return catalog;
|
|
728
|
+
}
|
|
729
|
+
__name(buildTemplateVariableCatalog, "buildTemplateVariableCatalog");
|
|
730
|
+
function findTemplateDefinition(definitions, identity) {
|
|
731
|
+
return definitions.find((definition) => definition.key === identity.key && definition.channel === identity.channel && definition.locale === identity.locale);
|
|
732
|
+
}
|
|
733
|
+
__name(findTemplateDefinition, "findTemplateDefinition");
|
|
734
|
+
function assertTemplateDefinitions(definitions) {
|
|
735
|
+
const seen = /* @__PURE__ */ new Set();
|
|
736
|
+
for (const definition of definitions) {
|
|
737
|
+
const identity = `${definition.key}|${definition.channel}|${definition.locale}`;
|
|
738
|
+
if (seen.has(identity)) throw new InvalidTemplateDefinitionError(definition.key, "identidade duplicada");
|
|
739
|
+
seen.add(identity);
|
|
740
|
+
if (definition.label.trim() === "") throw new InvalidTemplateDefinitionError(definition.key, "label vazio");
|
|
741
|
+
if (definition.body.trim() === "") throw new InvalidTemplateDefinitionError(definition.key, "body vazio");
|
|
742
|
+
const names = definition.variables.map((variable) => variable.name);
|
|
743
|
+
if (new Set(names).size !== names.length) {
|
|
744
|
+
throw new InvalidTemplateDefinitionError(definition.key, "vari\xE1vel declarada duas vezes");
|
|
745
|
+
}
|
|
746
|
+
const { unknown } = diffTemplateVariables({
|
|
747
|
+
body: definition.body,
|
|
748
|
+
subject: definition.subject,
|
|
749
|
+
variables: definition.variables
|
|
750
|
+
});
|
|
751
|
+
if (unknown.length > 0) {
|
|
752
|
+
throw new InvalidTemplateDefinitionError(definition.key, `o texto padr\xE3o usa vari\xE1veis n\xE3o declaradas: ${unknown.join(", ")}`);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
__name(assertTemplateDefinitions, "assertTemplateDefinitions");
|
|
757
|
+
|
|
711
758
|
// src/emailHtml.ts
|
|
712
759
|
var STANDARD_EMAIL_THEME = {
|
|
713
760
|
colors: {
|
|
@@ -857,12 +904,48 @@ function renderEmailMarksHtml(params) {
|
|
|
857
904
|
}
|
|
858
905
|
__name(renderEmailMarksHtml, "renderEmailMarksHtml");
|
|
859
906
|
|
|
907
|
+
// src/emailEnvironmentMark.ts
|
|
908
|
+
var BANNER_ATTRIBUTE = "data-environment-banner";
|
|
909
|
+
var BODY_OPEN_PATTERN = /<body\b[^>]*>/i;
|
|
910
|
+
var DEFAULT_BACKGROUND = "#fff1c2";
|
|
911
|
+
var DEFAULT_COLOR = "#5c3d00";
|
|
912
|
+
var DEFAULT_BORDER = "#e6c866";
|
|
913
|
+
var FONT2 = "Arial,Helvetica,sans-serif";
|
|
914
|
+
function buildEnvironmentBannerHtml(mark) {
|
|
915
|
+
const background = mark.bannerBackground ?? DEFAULT_BACKGROUND;
|
|
916
|
+
const color = mark.bannerColor ?? DEFAULT_COLOR;
|
|
917
|
+
const border = mark.bannerBorder ?? DEFAULT_BORDER;
|
|
918
|
+
return `<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" ${BANNER_ATTRIBUTE}="true"><tr><td align="center" style="padding:8px 12px;background:${background};color:${color};border-bottom:1px solid ${border};font-family:${FONT2};font-size:13px;line-height:18px;font-weight:bold;text-align:center;">${escapeEmailHtml(mark.bannerText)}</td></tr></table>`;
|
|
919
|
+
}
|
|
920
|
+
__name(buildEnvironmentBannerHtml, "buildEnvironmentBannerHtml");
|
|
921
|
+
function markHtml(html, mark) {
|
|
922
|
+
if (html.includes(BANNER_ATTRIBUTE)) return html;
|
|
923
|
+
const banner = buildEnvironmentBannerHtml(mark);
|
|
924
|
+
const bodyOpen = BODY_OPEN_PATTERN.exec(html);
|
|
925
|
+
if (!bodyOpen) return banner + html;
|
|
926
|
+
const insertAt = bodyOpen.index + bodyOpen[0].length;
|
|
927
|
+
return html.slice(0, insertAt) + banner + html.slice(insertAt);
|
|
928
|
+
}
|
|
929
|
+
__name(markHtml, "markHtml");
|
|
930
|
+
function markEmailForEnvironment(message, mark) {
|
|
931
|
+
const bannerLine = `[${mark.bannerText}]`;
|
|
932
|
+
return {
|
|
933
|
+
...message,
|
|
934
|
+
subject: message.subject.startsWith(mark.subjectPrefix) ? message.subject : mark.subjectPrefix + message.subject,
|
|
935
|
+
html: markHtml(message.html, mark),
|
|
936
|
+
text: message.text.startsWith(bannerLine) ? message.text : `${bannerLine}
|
|
937
|
+
|
|
938
|
+
${message.text}`
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
__name(markEmailForEnvironment, "markEmailForEnvironment");
|
|
942
|
+
|
|
860
943
|
// src/templates/standardEmailTemplate.generated.ts
|
|
861
944
|
var STANDARD_EMAIL_PT_BR_HTML = '<table role="presentation" width="620" cellpadding="0" cellspacing="0" border="0" style="width:620px;max-width:620px;margin:0 auto;background:#ffffff;font-family:Arial,Helvetica,sans-serif;color:#1d2b33">\n <tr>\n <td style="background:#10222c;padding:18px 24px">\n <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">\n <tr>\n <td width="56" valign="middle" style="width:56px">{{logoEmpresa}}</td>\n <td valign="middle" style="padding-left:12px;font-size:17px;font-weight:bold;color:#ffffff">{{nomeEmpresa}}</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style="padding:22px 24px 6px;font-size:14px;line-height:1.55;color:#1d2b33">{{corpoMensagem}}</td>\n </tr>\n <tr>\n <td style="padding:0 24px 12px">{{listaAnexos}}</td>\n </tr>\n <tr>\n <td style="padding:0 24px 16px">{{faixaResposta}}</td>\n </tr>\n <tr>\n <td style="padding:16px 24px;border-top:1px solid #d9ded8">\n <table role="presentation" cellpadding="0" cellspacing="0" border="0">\n <tr>\n <td width="40" height="40" align="center" valign="middle" style="width:40px;height:40px;background:#10222c;color:#ffffff;font-size:14px;font-weight:bold">{{iniciaisAssinante}}</td>\n <td valign="middle" style="padding-left:12px;font-size:13px;line-height:1.4">\n <div style="font-weight:bold;color:#10222c">{{nomeAssinante}}</div>\n <div style="color:#5a6b74">{{cargoAssinante}}</div>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td align="center" style="background:#f0f2ee;padding:14px 24px;font-size:11px;line-height:1.5;color:#5a6b74">\n <div>{{rodapePlataforma}}</div>\n <div style="padding-top:8px">{{marcasRodape}}</div>\n </td>\n </tr>\n</table>\n';
|
|
862
945
|
|
|
863
946
|
// src/standardEmail.ts
|
|
864
947
|
var { copper: copper2, ink, mist, rule, slate: slate2 } = STANDARD_EMAIL_THEME.colors;
|
|
865
|
-
var
|
|
948
|
+
var FONT3 = STANDARD_EMAIL_THEME.font;
|
|
866
949
|
var STANDARD_EMAIL_TEMPLATE_KEY = "notification.standard-email";
|
|
867
950
|
var STANDARD_EMAIL_CHANNEL = "email";
|
|
868
951
|
var STANDARD_EMAIL_LOCALE = "pt-BR";
|
|
@@ -958,13 +1041,13 @@ function buildMessageBody(bodyText) {
|
|
|
958
1041
|
__name(buildMessageBody, "buildMessageBody");
|
|
959
1042
|
function buildAttachmentList(attachments) {
|
|
960
1043
|
if (attachments.length === 0) return "";
|
|
961
|
-
const rows = attachments.map((attachment) => `<tr><td style="padding:4px 0;border-bottom:1px solid ${rule};font:13px ${
|
|
962
|
-
return `<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding:0 0 4px;font:700 11px ${
|
|
1044
|
+
const rows = attachments.map((attachment) => `<tr><td style="padding:4px 0;border-bottom:1px solid ${rule};font:13px ${FONT3};color:${ink}">${escapeEmailHtml(attachment.name)}</td></tr>`).join("");
|
|
1045
|
+
return `<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding:0 0 4px;font:700 11px ${FONT3};text-transform:uppercase;color:${slate2}">Anexos</td></tr>${rows}</table>`;
|
|
963
1046
|
}
|
|
964
1047
|
__name(buildAttachmentList, "buildAttachmentList");
|
|
965
1048
|
function buildReplyStrip(replyHint) {
|
|
966
1049
|
if (replyHint === void 0 || replyHint.trim() === "") return "";
|
|
967
|
-
return `<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding:10px 14px;background:${mist};border-left:3px solid ${copper2};font-family:${
|
|
1050
|
+
return `<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding:10px 14px;background:${mist};border-left:3px solid ${copper2};font-family:${FONT3};font-size:12px;color:${ink}">${escapeEmailHtml(replyHint)}</td></tr></table>`;
|
|
968
1051
|
}
|
|
969
1052
|
__name(buildReplyStrip, "buildReplyStrip");
|
|
970
1053
|
function renderStandardEmail(params) {
|
|
@@ -1170,6 +1253,7 @@ export {
|
|
|
1170
1253
|
EMAIL_ATTACHMENT_MAX_COUNT,
|
|
1171
1254
|
EMAIL_DRIVER,
|
|
1172
1255
|
INTRUSIVE_CHANNELS,
|
|
1256
|
+
InvalidTemplateDefinitionError,
|
|
1173
1257
|
InvalidVapidKeysError,
|
|
1174
1258
|
InvalidWebhookSignatureError,
|
|
1175
1259
|
NOTIFICATION_CATEGORY_HINT,
|
|
@@ -1202,11 +1286,14 @@ export {
|
|
|
1202
1286
|
ThrottledError,
|
|
1203
1287
|
UnknownTemplateVariablesError,
|
|
1204
1288
|
WebPushEncryptionError,
|
|
1289
|
+
assertTemplateDefinitions,
|
|
1205
1290
|
assessStandardEmailTemplate,
|
|
1206
1291
|
broadcastPushFilterSchema,
|
|
1207
1292
|
broadcastPushSchema,
|
|
1293
|
+
buildEnvironmentBannerHtml,
|
|
1208
1294
|
buildInitials,
|
|
1209
1295
|
buildPreviewPayload,
|
|
1296
|
+
buildTemplateVariableCatalog,
|
|
1210
1297
|
categoryPolicyEntrySchema,
|
|
1211
1298
|
checkEmailAttachment,
|
|
1212
1299
|
createWhatsAppDriverFromChannel,
|
|
@@ -1217,6 +1304,7 @@ export {
|
|
|
1217
1304
|
escapeTemplateHtml,
|
|
1218
1305
|
extractCalendarEvent,
|
|
1219
1306
|
extractTemplatePlaceholders,
|
|
1307
|
+
findTemplateDefinition,
|
|
1220
1308
|
findUnsafeEmailHtml,
|
|
1221
1309
|
generateCalendarLinks,
|
|
1222
1310
|
generateGoogleCalendarUrl,
|
|
@@ -1229,6 +1317,7 @@ export {
|
|
|
1229
1317
|
interpolateEmailHtml,
|
|
1230
1318
|
interpolateTemplate,
|
|
1231
1319
|
listNotificationsQuerySchema,
|
|
1320
|
+
markEmailForEnvironment,
|
|
1232
1321
|
preferenceEntrySchema,
|
|
1233
1322
|
pushNotificationPayloadSchema,
|
|
1234
1323
|
registerDeviceSchema,
|