triggerQuotaNotification (notifications/triggers.ts)

intelligo · packages/core/src/notifications/triggers.ts · typescript · Apache-2.0
payments

Triggers in-app and email notifications for quota, trial, payment failures, and team joins.

// Source: https://github.com/intelligo-dev/intelligo | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Each trigger creates an in-app notification (awaited) and sends an email
 * (fire-and-forget, errors logged). Deduplication is the caller's job.
 */

import { createNotification } from "./index";
import {
  sendQuotaWarningEmail,
  sendTrialWarningEmail,
  sendPaymentFailedEmail,
} from "../email/senders";
import { formatMoney, type Money } from "../money";
import { runInBackground } from "../request-context";

/** The locale the framework's own notification and email copy is written in. */
const COPY_LOCALE = "en";

/**
 * The plan allowance is money, not tokens: `used` an

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key