@adatechnology/notification-contracts 0.4.0 → 0.5.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
@@ -1901,4 +1901,56 @@ declare function renderStandardEmail(params: {
1901
1901
  readonly template: StandardEmailTemplate;
1902
1902
  }): RenderedStandardEmail;
1903
1903
 
1904
- export { type BroadcastPushBody, type BroadcastPushFilter, type BroadcastPushFilterBody, type BroadcastPushParams, type BroadcastPushResult, type CachePort, 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 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, extractTemplatePlaceholders, findUnsafeEmailHtml, htmlToPlainText, interpolateEmailHtml, interpolateTemplate, listNotificationsQuerySchema, preferenceEntrySchema, pushNotificationPayloadSchema, registerDeviceSchema, registerPushSubscriptionSchema, renderEmailLogoHtml, renderEmailMarksHtml, renderStandardEmail, renderTemplate, sendNotificationSchema, sendPushDirectSchema, sendPushDirectTargetSchema, updateCategoryPoliciesSchema, updatePreferencesSchema, upsertTemplateSchema, webPushKeysSchema, webPushSubscriptionSchema };
1904
+ /**
1905
+ * Copyright (c) 2026 Ada Technology. MIT License.
1906
+ */
1907
+ type NotificationCalendarEvent = {
1908
+ readonly title: string;
1909
+ readonly description?: string;
1910
+ readonly startsAt: string | Date;
1911
+ readonly endsAt?: string | Date;
1912
+ readonly location?: string;
1913
+ readonly url?: string;
1914
+ };
1915
+ /**
1916
+ * Gera URL para adicionar evento no Google Calendar via web.
1917
+ */
1918
+ declare function generateGoogleCalendarUrl(event: NotificationCalendarEvent): string;
1919
+ /**
1920
+ * Gera URL para adicionar evento no Outlook Web / Live.
1921
+ */
1922
+ declare function generateOutlookCalendarUrl(event: NotificationCalendarEvent): string;
1923
+ /**
1924
+ * Gera URL para adicionar evento no Microsoft 365 / Office 365 corporativo.
1925
+ */
1926
+ declare function generateOffice365CalendarUrl(event: NotificationCalendarEvent): string;
1927
+ /**
1928
+ * Gera URL para adicionar evento no Yahoo Calendar.
1929
+ */
1930
+ declare function generateYahooCalendarUrl(event: NotificationCalendarEvent): string;
1931
+ /**
1932
+ * Gera Data URI com o conteúdo iCalendar (.ics).
1933
+ * Permite abrir diretamente no Apple Calendar (iOS / macOS) ou disparar download no navegador.
1934
+ */
1935
+ declare function generateIcsDataUri(event: NotificationCalendarEvent, now?: Date): string;
1936
+ type CalendarLinks = {
1937
+ readonly google: string;
1938
+ readonly outlook: string;
1939
+ readonly office365: string;
1940
+ readonly yahoo: string;
1941
+ readonly icsDataUri: string;
1942
+ };
1943
+ /**
1944
+ * Retorna todos os links de calendário disponíveis para uma notificação/evento.
1945
+ */
1946
+ declare function generateCalendarLinks(event: NotificationCalendarEvent): CalendarLinks;
1947
+ /**
1948
+ * Gera conteúdo RFC 5545 iCalendar (.ics).
1949
+ */
1950
+ declare function generateIcsContent(event: NotificationCalendarEvent, now?: Date): string;
1951
+ /**
1952
+ * Extrai metadados de evento de calendário do payload de notificação, se presente.
1953
+ */
1954
+ declare function extractCalendarEvent(payload?: Readonly<Record<string, unknown>>): NotificationCalendarEvent | undefined;
1955
+
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 };
package/dist/index.d.ts CHANGED
@@ -1901,4 +1901,56 @@ declare function renderStandardEmail(params: {
1901
1901
  readonly template: StandardEmailTemplate;
1902
1902
  }): RenderedStandardEmail;
1903
1903
 
1904
- export { type BroadcastPushBody, type BroadcastPushFilter, type BroadcastPushFilterBody, type BroadcastPushParams, type BroadcastPushResult, type CachePort, 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 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, extractTemplatePlaceholders, findUnsafeEmailHtml, htmlToPlainText, interpolateEmailHtml, interpolateTemplate, listNotificationsQuerySchema, preferenceEntrySchema, pushNotificationPayloadSchema, registerDeviceSchema, registerPushSubscriptionSchema, renderEmailLogoHtml, renderEmailMarksHtml, renderStandardEmail, renderTemplate, sendNotificationSchema, sendPushDirectSchema, sendPushDirectTargetSchema, updateCategoryPoliciesSchema, updatePreferencesSchema, upsertTemplateSchema, webPushKeysSchema, webPushSubscriptionSchema };
1904
+ /**
1905
+ * Copyright (c) 2026 Ada Technology. MIT License.
1906
+ */
1907
+ type NotificationCalendarEvent = {
1908
+ readonly title: string;
1909
+ readonly description?: string;
1910
+ readonly startsAt: string | Date;
1911
+ readonly endsAt?: string | Date;
1912
+ readonly location?: string;
1913
+ readonly url?: string;
1914
+ };
1915
+ /**
1916
+ * Gera URL para adicionar evento no Google Calendar via web.
1917
+ */
1918
+ declare function generateGoogleCalendarUrl(event: NotificationCalendarEvent): string;
1919
+ /**
1920
+ * Gera URL para adicionar evento no Outlook Web / Live.
1921
+ */
1922
+ declare function generateOutlookCalendarUrl(event: NotificationCalendarEvent): string;
1923
+ /**
1924
+ * Gera URL para adicionar evento no Microsoft 365 / Office 365 corporativo.
1925
+ */
1926
+ declare function generateOffice365CalendarUrl(event: NotificationCalendarEvent): string;
1927
+ /**
1928
+ * Gera URL para adicionar evento no Yahoo Calendar.
1929
+ */
1930
+ declare function generateYahooCalendarUrl(event: NotificationCalendarEvent): string;
1931
+ /**
1932
+ * Gera Data URI com o conteúdo iCalendar (.ics).
1933
+ * Permite abrir diretamente no Apple Calendar (iOS / macOS) ou disparar download no navegador.
1934
+ */
1935
+ declare function generateIcsDataUri(event: NotificationCalendarEvent, now?: Date): string;
1936
+ type CalendarLinks = {
1937
+ readonly google: string;
1938
+ readonly outlook: string;
1939
+ readonly office365: string;
1940
+ readonly yahoo: string;
1941
+ readonly icsDataUri: string;
1942
+ };
1943
+ /**
1944
+ * Retorna todos os links de calendário disponíveis para uma notificação/evento.
1945
+ */
1946
+ declare function generateCalendarLinks(event: NotificationCalendarEvent): CalendarLinks;
1947
+ /**
1948
+ * Gera conteúdo RFC 5545 iCalendar (.ics).
1949
+ */
1950
+ declare function generateIcsContent(event: NotificationCalendarEvent, now?: Date): string;
1951
+ /**
1952
+ * Extrai metadados de evento de calendário do payload de notificação, se presente.
1953
+ */
1954
+ declare function extractCalendarEvent(payload?: Readonly<Record<string, unknown>>): NotificationCalendarEvent | undefined;
1955
+
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 };
package/dist/index.js CHANGED
@@ -1009,6 +1009,156 @@ function renderStandardEmail(params) {
1009
1009
  };
1010
1010
  }
1011
1011
  __name(renderStandardEmail, "renderStandardEmail");
1012
+
1013
+ // src/calendarEvent.ts
1014
+ function toIsoDate(value) {
1015
+ return value instanceof Date ? value : new Date(value);
1016
+ }
1017
+ __name(toIsoDate, "toIsoDate");
1018
+ function formatUtcCompact(date) {
1019
+ return date.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "");
1020
+ }
1021
+ __name(formatUtcCompact, "formatUtcCompact");
1022
+ function escapeIcsText(text) {
1023
+ return text.replace(/\\/g, "\\\\").replace(/;/g, "\\;").replace(/,/g, "\\,").replace(/\r\n/g, "\\n").replace(/\n/g, "\\n");
1024
+ }
1025
+ __name(escapeIcsText, "escapeIcsText");
1026
+ function generateGoogleCalendarUrl(event) {
1027
+ const start = toIsoDate(event.startsAt);
1028
+ const end = event.endsAt ? toIsoDate(event.endsAt) : new Date(start.getTime() + 60 * 60 * 1e3);
1029
+ const params = new URLSearchParams({
1030
+ action: "TEMPLATE",
1031
+ text: event.title,
1032
+ dates: `${formatUtcCompact(start)}/${formatUtcCompact(end)}`
1033
+ });
1034
+ if (event.description) params.set("details", event.description);
1035
+ if (event.location) params.set("location", event.location);
1036
+ return `https://calendar.google.com/calendar/render?${params.toString()}`;
1037
+ }
1038
+ __name(generateGoogleCalendarUrl, "generateGoogleCalendarUrl");
1039
+ function generateOutlookCalendarUrl(event) {
1040
+ const start = toIsoDate(event.startsAt);
1041
+ const end = event.endsAt ? toIsoDate(event.endsAt) : new Date(start.getTime() + 60 * 60 * 1e3);
1042
+ const params = new URLSearchParams({
1043
+ path: "/calendar/action/compose",
1044
+ rru: "addevent",
1045
+ subject: event.title,
1046
+ startdt: start.toISOString(),
1047
+ enddt: end.toISOString()
1048
+ });
1049
+ if (event.description) params.set("body", event.description);
1050
+ if (event.location) params.set("location", event.location);
1051
+ return `https://outlook.live.com/calendar/0/deeplink/compose?${params.toString()}`;
1052
+ }
1053
+ __name(generateOutlookCalendarUrl, "generateOutlookCalendarUrl");
1054
+ function generateOffice365CalendarUrl(event) {
1055
+ const start = toIsoDate(event.startsAt);
1056
+ const end = event.endsAt ? toIsoDate(event.endsAt) : new Date(start.getTime() + 60 * 60 * 1e3);
1057
+ const params = new URLSearchParams({
1058
+ path: "/calendar/action/compose",
1059
+ rru: "addevent",
1060
+ subject: event.title,
1061
+ startdt: start.toISOString(),
1062
+ enddt: end.toISOString()
1063
+ });
1064
+ if (event.description) params.set("body", event.description);
1065
+ if (event.location) params.set("location", event.location);
1066
+ return `https://outlook.office.com/calendar/0/deeplink/compose?${params.toString()}`;
1067
+ }
1068
+ __name(generateOffice365CalendarUrl, "generateOffice365CalendarUrl");
1069
+ function generateYahooCalendarUrl(event) {
1070
+ const start = toIsoDate(event.startsAt);
1071
+ const end = event.endsAt ? toIsoDate(event.endsAt) : new Date(start.getTime() + 60 * 60 * 1e3);
1072
+ const durationMs = Math.max(0, end.getTime() - start.getTime());
1073
+ const durationHours = Math.floor(durationMs / (60 * 60 * 1e3));
1074
+ const durationMinutes = Math.floor(durationMs % (60 * 60 * 1e3) / (60 * 1e3));
1075
+ const durStr = `${String(durationHours).padStart(2, "0")}${String(durationMinutes).padStart(2, "0")}`;
1076
+ const params = new URLSearchParams({
1077
+ v: "60",
1078
+ view: "d",
1079
+ type: "20",
1080
+ title: event.title,
1081
+ st: formatUtcCompact(start),
1082
+ dur: durStr
1083
+ });
1084
+ if (event.description) params.set("desc", event.description);
1085
+ if (event.location) params.set("in_loc", event.location);
1086
+ return `https://calendar.yahoo.com/?${params.toString()}`;
1087
+ }
1088
+ __name(generateYahooCalendarUrl, "generateYahooCalendarUrl");
1089
+ function generateIcsDataUri(event, now = /* @__PURE__ */ new Date()) {
1090
+ const ics = generateIcsContent(event, now);
1091
+ return `data:text/calendar;charset=utf-8,${encodeURIComponent(ics)}`;
1092
+ }
1093
+ __name(generateIcsDataUri, "generateIcsDataUri");
1094
+ function generateCalendarLinks(event) {
1095
+ return {
1096
+ google: generateGoogleCalendarUrl(event),
1097
+ outlook: generateOutlookCalendarUrl(event),
1098
+ office365: generateOffice365CalendarUrl(event),
1099
+ yahoo: generateYahooCalendarUrl(event),
1100
+ icsDataUri: generateIcsDataUri(event)
1101
+ };
1102
+ }
1103
+ __name(generateCalendarLinks, "generateCalendarLinks");
1104
+ function generateIcsContent(event, now = /* @__PURE__ */ new Date()) {
1105
+ const start = toIsoDate(event.startsAt);
1106
+ const end = event.endsAt ? toIsoDate(event.endsAt) : new Date(start.getTime() + 60 * 60 * 1e3);
1107
+ const uid = `${now.getTime()}-${Math.random().toString(36).substring(2, 9)}@adatechnology.com.br`;
1108
+ const lines = [
1109
+ "BEGIN:VCALENDAR",
1110
+ "VERSION:2.0",
1111
+ "PRODID:-//Ada Technology//Notification Calendar//PT",
1112
+ "CALSCALE:GREGORIAN",
1113
+ "METHOD:PUBLISH",
1114
+ "BEGIN:VEVENT",
1115
+ `UID:${uid}`,
1116
+ `DTSTAMP:${formatUtcCompact(now)}`,
1117
+ `DTSTART:${formatUtcCompact(start)}`,
1118
+ `DTEND:${formatUtcCompact(end)}`,
1119
+ `SUMMARY:${escapeIcsText(event.title)}`
1120
+ ];
1121
+ if (event.description) {
1122
+ lines.push(`DESCRIPTION:${escapeIcsText(event.description)}`);
1123
+ }
1124
+ if (event.location) {
1125
+ lines.push(`LOCATION:${escapeIcsText(event.location)}`);
1126
+ }
1127
+ if (event.url) {
1128
+ lines.push(`URL:${event.url}`);
1129
+ }
1130
+ lines.push("END:VEVENT", "END:VCALENDAR");
1131
+ return lines.join("\r\n");
1132
+ }
1133
+ __name(generateIcsContent, "generateIcsContent");
1134
+ function extractCalendarEvent(payload) {
1135
+ if (!payload || typeof payload !== "object") return void 0;
1136
+ const raw = payload.calendarEvent && typeof payload.calendarEvent === "object" ? payload.calendarEvent : payload;
1137
+ const title = typeof raw.calendarTitle === "string" ? raw.calendarTitle : typeof raw.title === "string" ? raw.title : void 0;
1138
+ const startsAt = typeof raw.calendarStartsAt === "string" ? raw.calendarStartsAt : raw.startsAt instanceof Date || typeof raw.startsAt === "string" ? raw.startsAt : typeof raw.activityDate === "string" ? typeof raw.activityTime === "string" ? `${raw.activityDate}T${raw.activityTime}:00` : `${raw.activityDate}T09:00:00` : void 0;
1139
+ if (!title || !startsAt) return void 0;
1140
+ const description = typeof raw.calendarDescription === "string" ? raw.calendarDescription : typeof raw.description === "string" ? raw.description : void 0;
1141
+ const endsAt = typeof raw.calendarEndsAt === "string" ? raw.calendarEndsAt : raw.endsAt instanceof Date || typeof raw.endsAt === "string" ? raw.endsAt : void 0;
1142
+ const location = typeof raw.location === "string" ? raw.location : void 0;
1143
+ const url = typeof raw.url === "string" ? raw.url : void 0;
1144
+ return {
1145
+ title,
1146
+ startsAt,
1147
+ ...description ? {
1148
+ description
1149
+ } : {},
1150
+ ...endsAt ? {
1151
+ endsAt
1152
+ } : {},
1153
+ ...location ? {
1154
+ location
1155
+ } : {},
1156
+ ...url ? {
1157
+ url
1158
+ } : {}
1159
+ };
1160
+ }
1161
+ __name(extractCalendarEvent, "extractCalendarEvent");
1012
1162
  export {
1013
1163
  ChannelNotConfiguredError,
1014
1164
  ConfigMissingError,
@@ -1065,8 +1215,16 @@ export {
1065
1215
  diffTemplateVariables,
1066
1216
  escapeEmailHtml,
1067
1217
  escapeTemplateHtml,
1218
+ extractCalendarEvent,
1068
1219
  extractTemplatePlaceholders,
1069
1220
  findUnsafeEmailHtml,
1221
+ generateCalendarLinks,
1222
+ generateGoogleCalendarUrl,
1223
+ generateIcsContent,
1224
+ generateIcsDataUri,
1225
+ generateOffice365CalendarUrl,
1226
+ generateOutlookCalendarUrl,
1227
+ generateYahooCalendarUrl,
1070
1228
  htmlToPlainText,
1071
1229
  interpolateEmailHtml,
1072
1230
  interpolateTemplate,