import 'rollup-plugin-inject-process-env'; import { Cta } from "@xapp/stentor-chat-widget"; import { ChatDetail } from "../store/ChatAction"; /** * Carries "this visitor just clicked a link in the chat" across a same-tab navigation. * * Persisted widget state already survives the page load, but it cannot tell a chat link * click from a visitor coming back to the site later. The param can; it is read on arrival * and stripped from the address bar so it is never bookmarked or shared. */ export declare const CHAT_CONTINUE_PARAM = "xa_chat"; export declare const CONTINUE_CTA_MESSAGE = "Continue your conversation"; /** * Marks a link the widget is about to follow in this tab. Only same-origin links: widget * state lives in this origin's localStorage, so the widget on any other origin - a * subdomain included - has no conversation to continue. */ export declare function withChatContinueParam(url: string, currentOrigin: string): string; /** * True when this page was reached through a chat link. Pure, so it is safe inside a * render-time initializer that React may call twice (StrictMode); strip the param * separately with `stripChatContinueParam`, from an effect. */ export declare function hasChatContinueParam(win?: Window): boolean; /** * Removes the param from the address bar with replaceState, keeping the rest of the URL * and any SPA history state. A no-op when it is absent, so repeating it is harmless. */ export declare function stripChatContinueParam(win?: Window): void; /** * A conversation worth continuing: any message on screen. Join notices do not count - the * MCP connection posts one before the greeting, so a brand-new session has one too. */ export declare function hasConversation(chats: ChatDetail[] | undefined): boolean; /** * True once the visitor has said something themselves. * * Stricter than `hasConversation`, which counts the greeting the assistant posts before anyone * has engaged. Visitor messages carry a `visitor:` nick, the same marker MessageList uses to * decide which side of the thread a message belongs on. */ export declare function hasVisitorMessage(chats: ChatDetail[] | undefined): boolean; /** * The CTA to show, given whether there is a conversation to go back to. * * With one, the first-visit copy ("Need Help? Click Here") becomes a prompt to continue, * keeping the tenant's timing and styling. A tenant with no CTA gets none on an ordinary * page load; right after a chat link it does, immediately - on mobile that prompt is the * only sign the conversation is still there, because the panel stays closed over the page * they asked for. */ export declare function resolveCta(cta: Cta | undefined, options: { hasConversation: boolean; arrivedViaChatLink: boolean; }): Cta | undefined;