Hooks
This section provides an overview of the hooks available in theembed-react/src/hooks directory. These hooks are
useful
useEmbeddedProjectQuery
Fetches project details and connection templates for a given project ID.
Parameters
projectId(string): The ID of the project to fetch.
Returns
isLoading (boolean): Indicates if the data is still loading.error (ApiError | undefined): Error object if the request fails.project (Project | undefined): The fetched project details.connectionTemplates (ConnectionTemplate[]): List of connection templates for the project.
Example
useDisconnectActivation
Handles the disconnection of an integration.
Returns
onDisconnectIntegration ((integrationId: string) => Promise<void>): Function to disconnect an integration by its ID.
Example
usePageSelectedState
Manages the state of the selected page in the integration UI.
Returns
state ({ projectId: string; method: string } | null): The current selected state.onOpenChange ((open: boolean) => void): Function to toggle the open state.onConnectClick ((projectId: string) => void): Function to handle the connect button click.onManageClick ((projectId: string) => void): Function to handle the manage button click.
Example
useEmbeddedIntegrationPageQuery
Fetches a list of projects and handles integration page data.
Parameters
params({ deployed?: boolean }): Optional parameters to filter projects. If true, then only deployed projects are fetched. Returns all projects if not specified or false.
Returns
isLoading (boolean): Indicates if the data is still loading.error (ApiError | undefined): Error object if the request fails.projects (UserProjectSummary[]): List of user project summaries. This includes the project along with anisActivatedbooelean indicating if the user is activated on the project.refresh (() => void): Function to refresh the data.