const CHANNEL_REQUIRES_REAUTH_EVENT = "om:communication_channels:channel-requires-reauth";
const MESSAGE_RECEIVED_EVENT = "om:communication_channels:message-received";
const notificationHandlers = [
  {
    id: "communication_channels.channel-requires-reauth-toast",
    notificationType: "communication_channels.channel.requires_reauth",
    features: ["communication_channels.connect_user_channel"],
    priority: 110,
    handle(notification, context) {
      context.toast({
        title: notification.title,
        body: notification.body ?? void 0,
        severity: "warning",
        action: {
          label: context.t?.(
            "communication_channels.notifications.channel_requires_reauth.reconnect",
            "Reconnect"
          ) ?? "Reconnect",
          onClick: () => {
            const channelId = notification.sourceEntityId;
            const target = channelId ? `/backend/profile/communication-channels?reconnect=${encodeURIComponent(channelId)}` : "/backend/profile/communication-channels";
            context.navigate(target);
          }
        }
      });
      context.emitEvent(CHANNEL_REQUIRES_REAUTH_EVENT, {
        notificationId: notification.id,
        channelId: notification.sourceEntityId ?? null
      });
      context.refreshNotifications();
    }
  },
  {
    id: "communication_channels.message-received-event",
    notificationType: "communication_channels.message.received",
    features: ["communication_channels.view"],
    priority: 100,
    handle(notification, context) {
      context.emitEvent(MESSAGE_RECEIVED_EVENT, {
        notificationId: notification.id,
        messageId: notification.sourceEntityId ?? null
      });
    }
  }
];
var notifications_handlers_default = notificationHandlers;
export {
  CHANNEL_REQUIRES_REAUTH_EVENT,
  MESSAGE_RECEIVED_EVENT,
  notifications_handlers_default as default,
  notificationHandlers
};
//# sourceMappingURL=notifications.handlers.js.map
