import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core'; /** * Provides a function for calling a specified RPC method. * * This function acts as a factory, returning a function that can be used to * call the given RPC method. It's designed for calling RPCs in response to * events or user interactions, such as clicking a button or submitting a form. * `useRpcCall` accepts the RPC method name and returns a callback function. * When invoked, this callback receives the RPC parameters, makes the request, * and returns a promise that resolves with the RPC's response. * * @template N The RPC Method Name. * @template P The RPC Method Parameters. * @template TResult The result type of the RPC method, excluding its`Response` object. * @template TakesParameters A boolean indicating whether the RPC method takes parameters. * It's `undefined` if the parameters extend `RpcContext`. * * @param method The name of the RPC method. * * @returns A function to call the specified RPC method. This returned function * will accept the RPC method parameters (if any) and return a Promise * that resolves with the result of the RPC call. * * @example * ```html * * * ``` */ export declare function useRpcCall, TResult extends Exclude>, Response>, TakesParameters = P extends RpcContext ? undefined : boolean>(method: N): TakesParameters extends undefined ? () => Promise : (params: P) => Promise;