import { TelegramSubscriberLinkOptions, TelegramSubscriberLinkStatus } from '@novu/js'; type UseTelegramSubscriberLinkProps = TelegramSubscriberLinkOptions; type UseTelegramSubscriberLinkResult = { /** Current deep-link URL (`t.me/?start=`), or `null` before the first issue. */ deepLinkUrl: string | null; /** Telegram bot username (no `@`), or `null` before the first issue. */ botUsername: string | null; /** Lifecycle status: `loading` while resolving initial state, `pending` while waiting for Start, `connected` once linked, `expired` briefly before auto-reissue. */ status: TelegramSubscriberLinkStatus; /** Last error, if any. */ error: Error | null; /** Re-issue a fresh deep link and restart polling. */ refresh: () => Promise; }; /** * React hook wrapping {@link TelegramSubscriberLink} from `@novu/js`. * * Issues a Telegram subscriber-link deep link, polls for connection, and * re-issues automatically on code expiry. Returns reactive state that * updates as the lifecycle progresses. * * **Important:** The underlying API endpoint requires `INTEGRATION_WRITE` permission. * Either pass `secretKey` for direct server-side usage, or provide a custom * `fetchFn` / `apiUrl` that routes through your backend proxy. * * @example * ```tsx * import { useTelegramSubscriberLink } from '@novu/react'; * * function TelegramConnect() { * const { deepLinkUrl, botUsername, status, refresh } = useTelegramSubscriberLink({ * apiUrl: '/api/novu-proxy', * integrationIdentifier: '', * subscriberId: 'user-42', * }); * * if (status === 'connected') return

Connected!

; * * return ( *
* {deepLinkUrl && Open @{botUsername} in Telegram} * *
* ); * } * ``` */ declare function useTelegramSubscriberLink(props: UseTelegramSubscriberLinkProps): UseTelegramSubscriberLinkResult; export { useTelegramSubscriberLink }; export type { UseTelegramSubscriberLinkProps, UseTelegramSubscriberLinkResult };