@adatechnology/notification-contracts 0.6.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.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;
@@ -1882,6 +1889,33 @@ declare function renderEmailMarksHtml(params: {
1882
1889
  readonly text?: string | undefined;
1883
1890
  }): string;
1884
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
+
1885
1919
  /**
1886
1920
  * Copyright (c) 2026 Ada Technology. MIT License.
1887
1921
  *
@@ -2007,4 +2041,4 @@ declare function generateIcsContent(event: NotificationCalendarEvent, now?: Date
2007
2041
  */
2008
2042
  declare function extractCalendarEvent(payload?: Readonly<Record<string, unknown>>): NotificationCalendarEvent | undefined;
2009
2043
 
2010
- 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, InvalidTemplateDefinitionError, 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, 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, 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, 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;
@@ -1882,6 +1889,33 @@ declare function renderEmailMarksHtml(params: {
1882
1889
  readonly text?: string | undefined;
1883
1890
  }): string;
1884
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
+
1885
1919
  /**
1886
1920
  * Copyright (c) 2026 Ada Technology. MIT License.
1887
1921
  *
@@ -2007,4 +2041,4 @@ declare function generateIcsContent(event: NotificationCalendarEvent, now?: Date
2007
2041
  */
2008
2042
  declare function extractCalendarEvent(payload?: Readonly<Record<string, unknown>>): NotificationCalendarEvent | undefined;
2009
2043
 
2010
- 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, InvalidTemplateDefinitionError, 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, 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, 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, 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
@@ -904,12 +904,48 @@ function renderEmailMarksHtml(params) {
904
904
  }
905
905
  __name(renderEmailMarksHtml, "renderEmailMarksHtml");
906
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
+
907
943
  // src/templates/standardEmailTemplate.generated.ts
908
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';
909
945
 
910
946
  // src/standardEmail.ts
911
947
  var { copper: copper2, ink, mist, rule, slate: slate2 } = STANDARD_EMAIL_THEME.colors;
912
- var FONT2 = STANDARD_EMAIL_THEME.font;
948
+ var FONT3 = STANDARD_EMAIL_THEME.font;
913
949
  var STANDARD_EMAIL_TEMPLATE_KEY = "notification.standard-email";
914
950
  var STANDARD_EMAIL_CHANNEL = "email";
915
951
  var STANDARD_EMAIL_LOCALE = "pt-BR";
@@ -1005,13 +1041,13 @@ function buildMessageBody(bodyText) {
1005
1041
  __name(buildMessageBody, "buildMessageBody");
1006
1042
  function buildAttachmentList(attachments) {
1007
1043
  if (attachments.length === 0) return "";
1008
- const rows = attachments.map((attachment) => `<tr><td style="padding:4px 0;border-bottom:1px solid ${rule};font:13px ${FONT2};color:${ink}">${escapeEmailHtml(attachment.name)}</td></tr>`).join("");
1009
- return `<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding:0 0 4px;font:700 11px ${FONT2};text-transform:uppercase;color:${slate2}">Anexos</td></tr>${rows}</table>`;
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>`;
1010
1046
  }
1011
1047
  __name(buildAttachmentList, "buildAttachmentList");
1012
1048
  function buildReplyStrip(replyHint) {
1013
1049
  if (replyHint === void 0 || replyHint.trim() === "") return "";
1014
- 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:${FONT2};font-size:12px;color:${ink}">${escapeEmailHtml(replyHint)}</td></tr></table>`;
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>`;
1015
1051
  }
1016
1052
  __name(buildReplyStrip, "buildReplyStrip");
1017
1053
  function renderStandardEmail(params) {
@@ -1254,6 +1290,7 @@ export {
1254
1290
  assessStandardEmailTemplate,
1255
1291
  broadcastPushFilterSchema,
1256
1292
  broadcastPushSchema,
1293
+ buildEnvironmentBannerHtml,
1257
1294
  buildInitials,
1258
1295
  buildPreviewPayload,
1259
1296
  buildTemplateVariableCatalog,
@@ -1280,6 +1317,7 @@ export {
1280
1317
  interpolateEmailHtml,
1281
1318
  interpolateTemplate,
1282
1319
  listNotificationsQuerySchema,
1320
+ markEmailForEnvironment,
1283
1321
  preferenceEntrySchema,
1284
1322
  pushNotificationPayloadSchema,
1285
1323
  registerDeviceSchema,