Embedded analytics SDK API
    Preparing search index...

    Interface UseActionResult<TParameters, TKind>

    interface UseActionResult<
        TParameters extends Record<string, unknown> = Record<string, unknown>,
        TKind extends ActionKind | undefined = undefined,
    > {
        error: ActionExecuteError | null;
        execute: (
            parameters: TParameters,
        ) => Promise<ActionResultForKind<TKind> | null>;
        isExecuting: boolean;
        reset: () => void;
        result: ActionResultForKind<TKind> | null;
    }

    Type Parameters

    • TParameters extends Record<string, unknown> = Record<string, unknown>
    • TKind extends ActionKind | undefined = undefined
    Index

    Properties

    error: ActionExecuteError | null

    Last thrown error, normalized to the public ActionExecuteError shape, or null.

    execute: (parameters: TParameters) => Promise<ActionResultForKind<TKind> | null>

    Trigger the action with the given parameters. Returns the response body on success AND throws on failure — the same error is stored in error for render-time consumers. Resolves to the discriminated result shape (see ActionResultForKind<TKind>); when TKind is omitted it resolves to AnyActionResult, narrowable via "<key>" in r.

    Resolves to null (without making a request) when actionId is null or the SDK is not yet initialized — guard the host-side caller with if (!actionId) return; if these cases are reachable.

    isExecuting: boolean
    reset: () => void

    Clear result and error.

    result: ActionResultForKind<TKind> | null

    Last response, or null before first call and after reset().