export { type M as Middleware, type S as SendContext, type a as SendFunction, c as composeMiddleware } from "./packem_shared/types.d-CRs03TYV.js"; import { C as ChannelPayloadMap, a as NotificationMessage } from "./packem_shared/notification.d-D0ado_cy.js"; export { N as Notification, type b as NotificationProviders, type S as SendManyOptions, c as createNotification, s as send } from "./packem_shared/notification.d-D0ado_cy.js"; export { type P as Provider, type a as ProviderFactory, d as defineProvider } from "./packem_shared/provider.d-Dh32nRm9.js"; export type { d as BaseConfig, B as BaseNotificationPayload, C as ChannelType, b as ChatPayload, f as EmailAddressLike, E as EmailChannelPayload, g as FailureReceipt, F as FeatureFlags, I as InAppPayload, M as MaybePromise, N as NotificationEvent, e as NotificationEventType, h as NotificationPayload, a as NotificationResult, P as PushPayload, c as Receipt, i as RecipientResult, R as Result, S as SmsPayload, j as SuccessReceipt, W as WebhookPayload } from "./packem_shared/types.d-C7l7qdMG.js"; interface ErrorProperties { cause?: unknown; hint?: ErrorHint; location?: ErrorLocation; message?: string; name: string; stack?: string; title?: string; } interface ErrorLocation { column?: number; file?: string; line?: number; } /** * A message that explains to the user how they can fix the error. * @example * ```ts * const error = new VisulimaError({ * hint: "Try running `npm install` to install missing dependencies.", * location: { * file: "src/index.ts", * line: 1, * column: 1, * }, * message: "Cannot find module 'react'", * name: "ModuleNotFoundError", * }); * ``` * * For more complex hints, you can pass an array of strings or a single string in markdown format. */ type ErrorHint = string[] | string; declare class VisulimaError extends Error { loc: ErrorLocation | undefined; title: string | undefined; /** * A message that explains to the user how they can fix the error. */ hint: ErrorHint | undefined; type: string; constructor({ cause, hint, location, message, name, stack, title }: ErrorProperties); setLocation(location: ErrorLocation): void; setName(name: string): void; setMessage(message: string): void; setHint(hint: ErrorHint): void; } /** * Base error class for notification package operations. * @param component The component name where the error occurred. * @param message The error message describing what went wrong. * @param options Optional error options including cause, code, and hint. */ declare class NotificationError extends VisulimaError { readonly component: string; readonly code?: string; constructor(component: string, message: string, options?: { cause?: Error | unknown; code?: string; hint?: string | string[]; }); } /** * Error for missing required options. * @param component The component name where the error occurred. * @param name The name(s) of the missing required option(s). */ declare class RequiredOptionError extends NotificationError { constructor(component: string, name: string | string[]); } /** * Fluent builder for assembling a multi-channel {@link NotificationMessage}. * * Mirrors the ergonomics of `@visulima/email`'s `MailMessage`: chainable, per-channel * setters that accumulate a plain message object. It is a thin convenience over the * existing `NotificationMessage` shape and does not change the facade — `build()` * returns the exact object `Notification.send()` already accepts. * @example * ```ts * const message = createNotificationMessage() * .sms({ text: "your code is 123", to: "+15555550100" }) * .push({ body: "deploy finished", title: "CI", to: "device-token" }) * .idempotencyKey("deploy-42") * .build(); * * await createNotification({ sms, push }).send(message); * ``` */ declare class NotificationMessageBuilder { #private; /** * Sets the SMS payload for the message. * @param payload The SMS channel payload. * @returns This instance for method chaining. */ sms(payload: ChannelPayloadMap["sms"]): this; /** * Sets the push payload for the message. * @param payload The push channel payload. * @returns This instance for method chaining. */ push(payload: ChannelPayloadMap["push"]): this; /** * Sets the chat payload for the message. * @param payload The chat channel payload. * @returns This instance for method chaining. */ chat(payload: ChannelPayloadMap["chat"]): this; /** * Sets the in-app inbox payload for the message. * @param payload The in-app channel payload. * @returns This instance for method chaining. */ inApp(payload: ChannelPayloadMap["inapp"]): this; /** * Sets the outbound webhook payload for the message. * @param payload The webhook channel payload. * @returns This instance for method chaining. */ webhook(payload: ChannelPayloadMap["webhook"]): this; /** * Sets the email payload for the message. * @param payload The email channel payload. * @returns This instance for method chaining. */ email(payload: ChannelPayloadMap["email"]): this; /** * Sets metadata applied to every present channel payload at build time. * * Per-channel `metadata` already set on a payload takes precedence over these * builder-level values (the builder values are spread first). * @param metadata Arbitrary metadata to attach. * @returns This instance for method chaining. */ metadata(metadata: Record): this; /** * Sets an idempotency key applied to every present channel payload at build time. * * A per-channel `idempotencyKey` already set on a payload takes precedence. * @param key The idempotency key used to dedupe retried sends. * @returns This instance for method chaining. */ idempotencyKey(key: string): this; /** * Builds the plain {@link NotificationMessage}. * * Applies builder-level `metadata` / `idempotencyKey` to each present channel * payload without overriding values already set on the individual payloads. * @returns The assembled multi-channel message. */ build(): NotificationMessage; } /** * Creates a new {@link NotificationMessageBuilder}. * @returns A fresh fluent message builder. */ declare const createNotificationMessage: () => NotificationMessageBuilder; export { type ChannelPayloadMap, NotificationError, type NotificationMessage, NotificationMessageBuilder, RequiredOptionError, createNotificationMessage };