Skip to main content
Glama
surveys.d.ts4.87 kB
import { PostHog } from '../posthog-core'; import { Survey, SurveyRenderReason } from '../posthog-surveys-types'; export declare function getNextSurveyStep(survey: Survey, currentQuestionIndex: number, response: string | string[] | number | null): any; export declare class SurveyManager { private posthog; private surveyInFocus; private surveyTimeouts; constructor(posthog: PostHog); private canShowNextEventBasedSurvey; private clearSurveyTimeout; private handlePopoverSurvey; private handleWidget; private handleWidgetSelector; /** * Sorts surveys by their appearance delay in ascending order. If a survey does not have an appearance delay, * it is considered to have a delay of 0. * @param surveys * @returns The surveys sorted by their appearance delay */ private sortSurveysByAppearanceDelay; /** * Checks the feature flags associated with this Survey to see if the survey can be rendered. * @param survey * @param instance */ canRenderSurvey: (survey: Survey) => SurveyRenderReason; renderSurvey: (survey: Survey, selector: Element) => void; callSurveysAndEvaluateDisplayLogic: (forceReload?: boolean) => void; private addSurveyToFocus; private removeSurveyFromFocus; getTestAPI(): { addSurveyToFocus: (id: string) => void; removeSurveyFromFocus: (id: string) => void; surveyInFocus: string | null; surveyTimeouts: Map<string, NodeJS.Timeout>; canShowNextEventBasedSurvey: () => boolean; handleWidget: (survey: Survey) => void; handlePopoverSurvey: (survey: Survey) => void; handleWidgetSelector: (survey: Survey) => void; sortSurveysByAppearanceDelay: (surveys: Survey[]) => Survey[]; }; } export declare const renderSurveysPreview: ({ survey, parentElement, previewPageIndex, forceDisableHtml, onPreviewSubmit, posthog, }: { survey: Survey; parentElement: HTMLElement; previewPageIndex: number; forceDisableHtml?: boolean; onPreviewSubmit?: (res: string | string[] | number | null) => void; posthog?: PostHog; }) => void; export declare const renderFeedbackWidgetPreview: ({ survey, root, forceDisableHtml, posthog, }: { survey: Survey; root: HTMLElement; forceDisableHtml?: boolean; posthog?: PostHog; }) => void; export declare function generateSurveys(posthog: PostHog): SurveyManager | undefined; type UseHideSurveyOnURLChangeProps = { survey: Pick<Survey, 'id' | 'conditions'>; removeSurveyFromFocus: (id: string) => void; setSurveyVisible: (visible: boolean) => void; isPreviewMode?: boolean; }; /** * This hook handles URL-based survey visibility after the initial mount. * The initial URL check is handled by the `getActiveMatchingSurveys` method in the `PostHogSurveys` class, * which ensures the URL matches before displaying a survey for the first time. * That is the method that is called every second to see if there's a matching survey. * * This separation of concerns means: * 1. Initial URL matching is done by `getActiveMatchingSurveys` before displaying the survey * 2. Subsequent URL changes are handled here to hide the survey as the user navigates */ export declare function useHideSurveyOnURLChange({ survey, removeSurveyFromFocus, setSurveyVisible, isPreviewMode, }: UseHideSurveyOnURLChangeProps): void; export declare function usePopupVisibility(survey: Survey, posthog: PostHog | undefined, millisecondDelay: number, isPreviewMode: boolean, removeSurveyFromFocus: (id: string) => void): { isPopupVisible: boolean; isSurveySent: boolean; setIsPopupVisible: import("preact/hooks").StateUpdater<boolean>; }; interface SurveyPopupProps { survey: Survey; forceDisableHtml?: boolean; posthog?: PostHog; style?: React.CSSProperties; previewPageIndex?: number | undefined; removeSurveyFromFocus: (id: string) => void; isPopup?: boolean; onPreviewSubmit?: (res: string | string[] | number | null) => void; onPopupSurveyDismissed?: () => void; onPopupSurveySent?: () => void; } export declare function SurveyPopup({ survey, forceDisableHtml, posthog, style, previewPageIndex, removeSurveyFromFocus, isPopup, onPreviewSubmit, onPopupSurveyDismissed, onPopupSurveySent, }: SurveyPopupProps): JSX.Element | null; export declare function Questions({ survey, forceDisableHtml, posthog, styleOverrides, }: { survey: Survey; forceDisableHtml: boolean; posthog?: PostHog; styleOverrides?: React.CSSProperties; }): JSX.Element; export declare function FeedbackWidget({ survey, forceDisableHtml, posthog, readOnly, removeSurveyFromFocus, }: { survey: Survey; forceDisableHtml?: boolean; posthog?: PostHog; readOnly?: boolean; removeSurveyFromFocus: (id: string) => void; }): JSX.Element | null; export {};

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sadiuysal/mem0-mcp-server-ts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server