import { InlineFlow } from '@getuserfeedback/protocol/internal/inline-flow'; export { InlineFlow } from '@getuserfeedback/protocol/internal/inline-flow'; import { AppEventJsonValue, ListInstanceFeedbackMineRequest, ListInstanceFeedbackMineResponse, CaptureInstanceFeedbackRequest, CaptureInstanceFeedbackResponse } from '@getuserfeedback/protocol'; import { TrackOptions, OpenRequestedDetail, ClientOptions, ResponseMetadataInput, FlowRenderState, WidgetLayoutTransitionPolicy, ContainerPolicy, ConfigureOptions, IdentifyOptions } from '@getuserfeedback/protocol/host'; type EventProperties = Record; type EventOptions = TrackOptions; type OpenRequestedPayload = OpenRequestedDetail; type OpenRequestedSource = OpenRequestedPayload["source"]; type OpenRequestedEvent$1 = { /** * Origin of this open request. * - `"command"`: requested by an explicit open command, e.g. when you call `client.flow(flowId).open()`. * - `"targeting"`: requested by targeting plan evaluation. */ readonly source: OpenRequestedSource; /** Flow identifier that is about to be opened. */ readonly flowId: string; readonly defaultPrevented: boolean; preventDefault: () => void; }; /** Feedback captured as an evaluation of the current app or a specific target. */ type FeedbackInput = CaptureInstanceFeedbackRequest; /** Receipt returned after feedback has been accepted. */ type SubmitFeedbackResult = CaptureInstanceFeedbackResponse; /** Selectors used to read the current authenticated user's feedback. */ type FetchFeedbackInput = ListInstanceFeedbackMineRequest; /** Feedback matching each requested selector, in selector order. */ type FetchFeedbackResult = ListInstanceFeedbackMineResponse; /** Operations for submitting and reading feedback through the current SDK client. */ type FeedbackOperations = { /** * Read feedback matching each selector for the JWT-authenticated user. * Requires `auth.jwt` configuration; `identify()` alone does not authorize readback. */ fetch: (input: FetchFeedbackInput) => Promise; submit: (input: FeedbackInput) => Promise; }; /** One endpoint in a directed relationship observation. */ type GraphRelationshipRef = { collection: string; id: string; }; /** A directed relationship observation recorded through the analytics pipeline. */ type GraphRelationship = { from: GraphRelationshipRef; to: GraphRelationshipRef; }; /** Operations for recording relationship observations as product events. */ type GraphOperations = { connect: (relationship: GraphRelationship) => Promise; disconnect: (relationship: GraphRelationship) => Promise; }; /** Durable state of a flow run (open/loading + dimensions when known). */ interface FlowState extends FlowRenderState { /** * @deprecated Stop reading this field. SDK state snapshots and subscriptions * never populate it, and there is no replacement SDK state field. */ transitionPolicy?: WidgetLayoutTransitionPolicy; } /** Callback invoked when flow state changes. */ type FlowStateCallback = (state: FlowState) => void; type IdentifyTraits = Record; type OpenRequestedEvent = OpenRequestedEvent$1; type OpenRequestedCallback = (event: OpenRequestedEvent) => void; /** Options for opening a flow run. */ type OpenFlowOptions = { /** Host container used for this open request. Omit to use default floating mounting; pass null to wait for a custom container. */ container?: HTMLElement | null; /** * Optional response metadata to preserve with the eventual submission. * These tags are attached when the flow is opened and do not affect prerendering. */ metadata?: ResponseMetadataInput; /** * When `true`, the flow view does not show a close button. * Useful for mobile or embedded contexts where the host handles dismissal (e.g. via a drawer or back gesture). */ hideCloseButton?: boolean; }; /** Options for prerendering a flow run. */ type PrerenderFlowOptions = { /** * When `true`, the prerendered view does not show a close button. */ hideCloseButton?: boolean; }; /** Options for subscribing to flow state updates. */ type SubscribeFlowStateOptions = { /** Emit the current snapshot immediately. Default `true`. */ emitInitial?: boolean; /** Auto-unsubscribe when the signal is aborted. */ signal?: AbortSignal; }; /** Instance for a specific flow: open, prefetch, prerender, close, and subscribe to flow state. */ type FlowRun = { /** The flow/survey ID this instance refers to. */ flowId: string; /** Open the flow (show the survey). */ open: (options?: OpenFlowOptions) => Promise; /** Prefetch the flow so it opens faster when you call `open()`. */ prefetch: () => Promise; /** Prerender the flow into a container (e.g. for a custom dialog). */ prerender: (options?: PrerenderFlowOptions) => Promise; /** Attach or detach this flow to a specific host container. */ setContainer: (element: HTMLElement | null) => void; /** Close this flow. */ close: () => Promise; /** Return the latest known flow state snapshot. */ getFlowState: () => FlowState; /** Subscribe to open/loading/dimensions; returns an unsubscribe function. */ subscribeFlowState: (callback: FlowStateCallback, options?: SubscribeFlowStateOptions) => () => void; }; /** * getuserfeedback client for loading the widget, opening flows, configuring * consent/auth, identifying users, and tracking events. * * @see https://getuserfeedback.com/docs/reference/javascript-sdk-reference */ type Client = { /** Load the widget script. Call when you created the client with `disableAutoLoad: true`. */ load: () => void; /** Set how this instance should choose default containers for flows. */ setDefaultContainerPolicy: (policy: ContainerPolicy) => void; /** Return the latest known instance-level flow state snapshot. */ getFlowState: () => FlowState; /** Subscribe to instance-level flow state updates (eg targeting-triggered opens). */ subscribeFlowState: (callback: FlowStateCallback, options?: SubscribeFlowStateOptions) => () => void; /** Return a flow instance; call .open(), .prefetch(), .prerender(), .close() on it. */ flow: (flowId: string) => FlowRun; /** Close all open flows. */ close: () => Promise; /** Close all open flows, clear JWT authentication, and reset user identity. */ reset: () => Promise; /** * Update color scheme, consent, or auth. Pass a fresh JWT here after login * and whenever your auth provider refreshes the session token. Await the * returned promise or handle its rejection when applying runtime updates. * * When using `disableAutoLoad`, call `load()` first. Calls made before `load()` * resolve without applying the update. Provide the initial color scheme, * default consent, and capabilities to `createClient()`; configure auth after * `load()`. * * @see https://getuserfeedback.com/docs/security-and-privacy/jwt-auth */ configure: (updates: ConfigureOptions) => Promise; /** * Associate the current user with a user ID, traits, and optional external IDs. * * Use `options.externalIds` for Segment-compatible identifiers from another * system. Without a user ID, pass options as `client.identify(traits, options)`, * or use `client.identify(traits, undefined, options)` when your call site needs * the explicit three-argument form. Do not put Segment-shaped `externalIds` in * traits. Some invalid arguments throw synchronously; other validation or * command-processing failures reject the returned promise. * * @see https://getuserfeedback.com/docs/guides/identity-resolution */ identify: { (userId: string, traits?: IdentifyTraits, options?: IdentifyOptions): Promise; (traits: IdentifyTraits, placeholder: undefined, options?: IdentifyOptions): Promise; (traits: IdentifyTraits, options?: IdentifyOptions): Promise; }; /** * Track a product event from the browser. * * Use `options.externalIds` when the event carries a Segment-compatible * identifier from another system. Do not put Segment-shaped `externalIds` in * properties. Some invalid arguments throw synchronously; other validation or * command-processing failures reject the returned promise. * * @see https://getuserfeedback.com/docs/reference/events */ track: (eventName: string, properties?: EventProperties, options?: EventOptions) => Promise; /** * Record the current browser page or a named page location. Some invalid * arguments throw synchronously; other validation or command-processing * failures reject the returned promise. */ page: (name?: string, properties?: EventProperties, options?: EventOptions) => Promise; /** Record directed relationship observations through the analytics pipeline. */ graph: GraphOperations; /** Submit feedback or read the authenticated user's matching feedback. */ feedback: FeedbackOperations; /** Subscribe to explicit SDK and client-side targeting open requests, or suppress them — for example if you know the user should not be interrupted. * For example, when the user is filling out a form, or is in the middle of a multi-step flow. * Prevention applies only to that presentation attempt; it does not create a * public retry schedule. * * @example — suppress open flow requests if the user is busy * ```ts * client.onOpenRequested((event) => { * if (userIsBusy()) { * event.preventDefault(); * } * }); * ``` */ onOpenRequested: (callback: OpenRequestedCallback) => () => void; }; /** Private runtime inputs for the deployment-owned bundled-docs client. */ type BundledDocsClientOptions = { loaderUrl: string; coreUrl: string; colorScheme?: ClientOptions["colorScheme"]; disableAutoLoad?: boolean; }; /** * Build options that the public React provider can pass through to the SDK root * without exposing local registration in the public options type. * Pass the returned object intact; cloning or serializing it deliberately fails * closed instead of falling back to persisted registration. * See docs/specs/2026-08-02-flow-interaction-model.md. */ declare const createBundledDocsClientOptions: (options: BundledDocsClientOptions) => ClientOptions; /** Internal supplied-flow run using the normal Flow lifecycle. */ type InlineFlowRun = Omit & { open: (options?: Omit) => Promise; }; /** First-party supplied-flow entrypoint; intentionally absent from the public SDK root. */ declare const createInlineFlow: (client: Client, flow: InlineFlow) => InlineFlowRun; export { createBundledDocsClientOptions, createInlineFlow }; export type { BundledDocsClientOptions, InlineFlowRun };