import { type AdapterPostableMessage, type CardElement } from "chat"; import type { RelayCarouselPart, RelayOutgoingPart, RelayRichCardPart } from "./types.js"; /** * Allocate a Relay Attachment and put the bytes behind it, returning the ID a * media part references. `RelayClient.uploadAttachment` satisfies this. */ export type RelayMediaUploader = (upload: { body: Uint8Array; contentType: string; filename: string; height?: number; width?: number; }) => Promise<{ attachment_id: string; }>; export declare const RELAY_MAX_TEXT_PART_LENGTH = 65536; export declare const RELAY_MAX_MESSAGE_PARTS = 100; export declare const RELAY_MAX_ATTACHMENT_BYTES = 104857600; /** * Relay accepts any syntactically valid media type for an Attachment and * stores the original bytes unchanged, so this adapter validates the shape of * a declared content type instead of matching it against a list. Only * pictures and group icons must be images, and those are set through * `@relaymessenger/sdk`, never here. */ export declare const RELAY_MAX_CONTENT_TYPE_LENGTH = 255; export declare const RELAY_FALLBACK_CONTENT_TYPE = "application/octet-stream"; export declare function contentTypeFor(filename: string, declared?: string): string; /** Relay's card limits (Relay-Server `rich-cards.ts`, `@relaymessenger/sdk` RICH_CARD_*). */ export declare const RELAY_CARD_TITLE_MAX_LENGTH = 200; export declare const RELAY_CARD_DESCRIPTION_MAX_LENGTH = 2000; export declare const RELAY_CARD_MAX_SUGGESTIONS = 4; export declare const RELAY_SUGGESTION_LABEL_MAX_LENGTH = 25; export declare const RELAY_SUGGESTION_ID_MAX_LENGTH = 256; export declare const RELAY_CAROUSEL_MIN_CARDS = 2; export declare const RELAY_CAROUSEL_MAX_CARDS = 10; /** * The reply id a Chat SDK Button travels as, in the codec the official * WhatsApp and Telegram adapters use (`chat:` + `{"a": id, "v": value}`), so * a tap comes back as the Button's `actionId` and `value` and reaches * `chat.onAction`, as https://chat-sdk.dev/docs/actions documents. */ export declare const RELAY_ACTION_ID_PREFIX = "chat:"; export declare function encodeRelayActionId(actionId: string, value?: string): string; /** * The Button behind a reply id, or undefined for an id this adapter did not * encode: a native Relay card's reply, which stays an ordinary message. */ export declare function decodeRelayActionId(id: string): { actionId: string; value?: string; } | undefined; /** * The Relay `rich_card` part for a Chat SDK Card, or undefined when the card * holds something a Relay card cannot draw; such a card is sent as text. */ export declare function toRelayRichCard(card: CardElement): RelayRichCardPart | undefined; /** * A Relay `carousel` part from 2 to 10 Chat SDK Cards, swiped sideways. * Throws when a card cannot be a Relay card or two buttons share an id, since * a carousel has no text form to fall back to. Send it with * `adapter.postMessageParts(threadId, [part])`. */ export declare function toRelayCarousel(cards: readonly CardElement[], options?: { cardWidth?: RelayCarouselPart["card_width"]; }): RelayCarouselPart; export declare function postableText(message: AdapterPostableMessage): string; export declare function hasPostableContent(message: AdapterPostableMessage): boolean; /** The server's limit for a link part's URL. */ export declare const RELAY_MAX_LINK_LENGTH = 2048; /** * The URL a message carries when its whole text is one absolute HTTP or HTTPS * URL, the way the Relay app itself turns such a draft into a `link` part so * the reader sees a card; otherwise undefined, and the words go as text. */ export declare function standaloneLinkText(value: string): string | undefined; export declare function textParts(value: string): RelayOutgoingPart[]; /** * Turn a Chat SDK postable message into Relay message parts, allocating and * uploading any local bytes it carries. * * Uploads run before the send, so the send body names attachment IDs that * already exist. Inside an inbound webhook turn the send is keyed on the * event ID: a redelivery re-uploads, producing new attachment IDs and so a * different body under the same Idempotency-Key, which Relay refuses with * HTTP 409 rather than posting the message twice. A loud refusal on * redelivery is the safe end of that trade; a silent duplicate is not. */ export declare function buildRelayParts(message: AdapterPostableMessage, upload: RelayMediaUploader): Promise; //# sourceMappingURL=content.d.ts.map