
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
@bluecopa/react
Advanced tools
A React library providing opinionated custom hooks for TanStack React Query integration with Bluecopa core API. This package enables efficient data fetching, caching, and synchronization with the Bluecopa platform while maintaining type safety and developer experience.
useUser(options?)useDataset(datasetId, options?)useDatasetSample(datasetId, options?)useMetric(metricId, options?)useInputTable(inputTableId, options?)useRows(tableId, options?)useGetFileUrlByFileId(fileId, options?)useGetFileByFolderIdAndName(folderId, name, options?)useGetPublishedWorkbookById(workbookId, options?)useGetTableById(tableId, options?)useGetWorkbooksByType(workbookType, options?)useGetWorkflowInstanceStatusById(instanceId, options?)useGetWorksheets(options?)useGetWorksheetsByType(worksheetType, options?)useRunDefinition(definitionId, options?)useRunPublishedDefinition(publishedDefinitionId, options?)useRunSampleDefinition(sampleDefinitionId, options?)useTriggerHttpWorkflow(workflowId, payload, options?)useTriggerWorkflow(workflowId, options?)useWorkbook(workbookId, options?)useWorkflow(workflowId, options?)useWorksheet(worksheetId, options?)useWorksheet.npm install @bluecopa/react
# or with pnpm
pnpm add @bluecopa/react
This package requires the following in your application:
npm install react@^18.0.0 react-dom@^18.0.0
Wrap your application with the React Query provider:
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 60 * 1000, // 1 minute
refetchOnWindowFocus: false,
},
},
});
function App() {
return (
<QueryClientProvider client={queryClient}>
<YourApp />
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
);
}
For projects using the Bluecopa React boilerplate, use the pre-configured QueryProvider component that handles API configuration automatically:
// src/providers/query-provider.tsx
import { ReactQueryDevtools, reactQuery, copaSetConfig } from "@bluecopa/react";
import { useEffect, useState } from "react";
const { QueryClient, QueryClientProvider } = reactQuery;
export default function QueryProvider({
children,
}: {
children: React.ReactNode;
}) {
const [queryClient] = useState(
() =>
new QueryClient({
defaultOptions: {
queries: {
staleTime: 60 * 1000, // 1 minute
refetchOnWindowFocus: false,
},
},
}),
);
useEffect(() => {
let copaUser: any = {};
try {
const copaToken = import.meta.env.VITE_BLUECOPA_API_TOKEN
? atob(import.meta.env.VITE_BLUECOPA_API_TOKEN)
: "{}";
copaUser = JSON.parse(copaToken);
} catch (error) {
console.warn("Failed to parse VITE_BLUECOPA_API_TOKEN:", error);
}
copaSetConfig({
apiBaseUrl:
import.meta.env.VITE_BLUECOPA_API_URL ||
"https://develop.bluecopa.com/api/v1",
workspaceId: import.meta.env.VITE_BLUECOPA_WORKSPACE_ID || "",
accessToken: copaUser?.accessToken || "",
});
}, []);
return (
<QueryClientProvider client={queryClient}>
{children}
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
);
}
Required Environment Variables:
| Variable | Description | Example |
|---|---|---|
VITE_BLUECOPA_API_URL | Base URL for Bluecopa API | https://develop.bluecopa.com |
VITE_BLUECOPA_WORKSPACE_ID | Your workspace identifier | my-workspace-123 |
VITE_BLUECOPA_API_TOKEN | Base64-encoded JSON string containing accessToken | eyJhY2Nlc3NUb2tlbiI6IjEyMzQ1In0= |
Example .env file:
VITE_BLUECOPA_API_URL=https://develop.bluecopa.com
VITE_BLUECOPA_WORKSPACE_ID=your-workspace-id
VITE_BLUECOPA_API_TOKEN=base64-encoded-json-here
Then wrap your application with this provider:
import QueryProvider from "./providers/query-provider";
function App() {
return (
<QueryProvider>
<YourApp />
</QueryProvider>
);
}
This setup automatically configures the API client with your environment-specific settings and applies optimal caching defaults.
useUser - Fetch authenticated userimport { useUser } from "@bluecopa/react";
function UserProfile() {
const { data, isLoading, error } = useUser({
staleTime: 5 * 60 * 1000, // 5 minutes
retry: 2,
});
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return <div>Welcome, {data?.name}!</div>;
}
useDataset - Fetch dataset with query controlsimport { useDataset } from "@bluecopa/react";
function DatasetViewer({ datasetId }) {
const { data, isLoading } = useDataset(datasetId, {
limit: 500,
staleTime: 10 * 60 * 1000, // 10 minutes
});
if (isLoading) return <div>Loading dataset...</div>;
return (
<div>
{data?.name} ({data?.records?.length} records)
</div>
);
}
useRows - Fetch input table rows with Supabase-style filteringimport { useRows } from "@bluecopa/react";
function TableRows({ tableId }) {
const { data, isLoading, error } = useRows(tableId, {
status: "active",
price: "gte.100",
limit: 25,
offset: 0,
});
if (isLoading) return <div>Loading rows...</div>;
if (error) return <div>Error: {error.message}</div>;
return (
<div>
<div>Total: {data?.total_count ?? 0}</div>
{data?.data?.map((row) => (
<div key={row._copa_id}>{JSON.stringify(row)}</div>
))}
</div>
);
}
π For detailed documentation on useRows including filtering, pagination, and advanced usage, see docs/useRows.md
useGetFileByFolderIdAndName - Look up a filebox file by folder + nameimport { useGetFileByFolderIdAndName } from "@bluecopa/react";
function FileBadge({ folderId, fileName }) {
const { data, isLoading, error } = useGetFileByFolderIdAndName(
folderId,
fileName,
{
staleTime: 60 * 1000, // 1 minute
retry: 1,
},
);
if (!folderId || !fileName) return <div>Pick a folder and a file.</div>;
if (isLoading) return <div>Resolving fileβ¦</div>;
if (error) return <div>Could not find β{fileName}β: {error.message}</div>;
if (!data) return null;
return (
<div>
<strong>{data.name}</strong> Β· {data.type} Β·{" "}
<code>{data.blobFileId}</code>
{data.status === "PUBLISHED" ? " (published)" : " (draft)"}
</div>
);
}
The query is auto-disabled until both folderId and name are truthy, so you can safely pass null/undefined while the user is still picking inputs.
useUser(options?)Fetches authenticated user details with query controls.
Parameters:
options (optional): Query options extending TanStack React Query's UseQueryOptionsReturns:
data: User object or undefinedisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseDataset(datasetId, options?)Fetches dataset data by ID with configurable parameters.
Parameters:
datasetId: ID of the dataset to fetchoptions (optional): Query options with:
limit: Maximum records to fetchstaleTime: Duration (ms) before data is considered staleReturns:
data: Dataset object containing name and recordsisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseDatasetSample(datasetId, options?)Fetches a representative sample of dataset data.
Parameters:
datasetId: ID of the datasetoptions (optional): Query options with enabled flagReturns:
data: Object containing sample dataisLoading: Boolean indicating loading staterefetch: Function to manually trigger refetchuseMetric(metricId, options?)Fetches metric data by ID.
Parameters:
metricId: ID of the metricoptions (optional): Query optionsReturns:
data: Metric object with name and valueisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseInputTable(inputTableId, options?)Fetches input table data with limit parameters.
Parameters:
inputTableId: ID of the input tableoptions (optional): Query options with limitParams:
limit: Maximum rows to fetchlimitFrom: Direction to apply limit from ('top' or 'bottom')Returns:
data: Input table object with rowsisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseRows(tableId, options?)Fetches rows from an input table with Supabase-style filtering, pagination, and sorting. Supports advanced filtering operators and group expressions.
Parameters:
tableId: ID of the input table (string | null | undefined)options (optional): Query options extending GetRowsOptions and BaseQueryOptions:
limit: Maximum rows to fetch (1-10000)offset: Number of rows to skiporder: Sort order ('asc' or 'desc')order_by: Column name to sort bystatus: 'active', price: 'gte.100', status: 'in.(active,pending)')or: Supabase/PostgREST group expression for OR conditionsand: Supabase/PostgREST group expression for AND conditionsenabled, staleTime, gcTime, retry, retryDelay, onSuccess, onErrorReturns:
data: GetRowsResponse object containing:
data: Array of row objectscount: Number of rows in current pagetotal_count: Total rows availableisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchExample:
const { data, isLoading } = useRows("table-123", {
status: "active",
price: "gte.100",
limit: 25,
offset: 0,
});
π For comprehensive documentation including all supported operators, filtering patterns, and advanced usage, see docs/useRows.md
useGetFileUrlByFileId(fileId, options?)Fetches the URL for a file by its ID.
Parameters:
fileId: ID of the file to fetch URL foroptions (optional): Query options extending TanStack React Query's UseQueryOptionsReturns:
data: Object containing file URLisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseGetFileByFolderIdAndName(folderId, name, options?)Fetches a filebox file by its parent folder id and exact name. The query is disabled until both folderId and name are truthy.
Parameters:
folderId: Parent folder id (null/undefined disables the query)name: Exact file name to look up (null/undefined disables the query)options (optional): Query options extending TanStack React Query's UseQueryOptionsReturns:
data: FileboxFile β file metadata (id, name, type, parentId, blobFileId, status, β¦)isLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseGetPublishedWorkbookById(workbookId, options?)Fetches published workbook details by ID.
Parameters:
workbookId: ID of the published workbookoptions (optional): Query optionsReturns:
data: Published workbook objectisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseGetTableById(tableId, options?)Fetches table metadata by ID.
Parameters:
tableId: ID of the tableoptions (optional): Query optionsReturns:
data: Table metadata objectisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseGetWorkbooksByType(workbookType, options?)Fetches workbooks filtered by type.
Parameters:
workbookType: Type of workbooks to fetchoptions (optional): Query optionsReturns:
data: Array of workbook objectsisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseGetWorkflowInstanceStatusById(instanceId, options?)Fetches workflow instance status by ID.
Parameters:
instanceId: ID of the workflow instanceoptions (optional): Query optionsReturns:
data: Workflow status objectisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseGetWorksheets(options?)Fetches all available worksheets.
Parameters:
options (optional): Query optionsReturns:
data: Array of worksheet objectsisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseGetWorksheetsByType(worksheetType, options?)Fetches worksheets filtered by type.
Parameters:
worksheetType: Type of worksheets to fetchoptions (optional): Query optionsReturns:
data: Array of worksheet objectsisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseRunDefinition(definitionId, options?)Executes a run definition.
Parameters:
definitionId: ID of the run definitionoptions (optional): Query optionsReturns:
data: Execution resultisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseRunPublishedDefinition(publishedDefinitionId, options?)Executes a published run definition.
Parameters:
publishedDefinitionId: ID of the published definitionoptions (optional): Query optionsReturns:
data: Execution resultisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseRunSampleDefinition(sampleDefinitionId, options?)Executes a sample run definition.
Parameters:
sampleDefinitionId: ID of the sample definitionoptions (optional): Query optionsReturns:
data: Sample execution resultisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseTriggerHttpWorkflow(workflowId, payload, options?)Triggers an HTTP workflow execution.
Parameters:
workflowId: ID of the workflowpayload: Request payloadoptions (optional): Query optionsReturns:
data: Workflow execution responseisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseTriggerWorkflow(workflowId, options?)Triggers a workflow execution.
Parameters:
workflowId: ID of the workflowoptions (optional): Query optionsReturns:
data: Workflow execution responseisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseWorkbook(workbookId, options?)Fetches workbook details by ID.
Parameters:
workbookId: ID of the workbookoptions (optional): Query optionsReturns:
data: Workbook objectisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseWorkflow(workflowId, options?)Fetches workflow configuration by ID.
Parameters:
workflowId: ID of the workflowoptions (optional): Query optionsReturns:
data: Workflow configuration objectisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchuseWorksheet(worksheetId, options?)Fetches worksheet details by ID.
Parameters:
worksheetId: ID of the worksheetoptions (optional): Query optionsReturns:
data: Worksheet objectisLoading: Boolean indicating loading stateerror: Error object if request failedrefetch: Function to manually trigger refetchMutation hooks below follow TanStack Query's
useMutationshape. Their returns includemutate(variables)andmutateAsync(variables)to trigger the action,isPending(loading),data(on success),error,isError,isSuccess, andreset(). Theoptionsparameter accepts the standardUseMutationOptions(includingonSuccess,onError,onSettled,retry, etc.).
β Audit hooks
useCreateAuditLog(options?)Records an audit log entry.
Parameters:
options (optional): Mutation options. mutate(request: CreateAuditLogRequest) triggers the action.Returns: Mutation result with data: CreateAuditLogResponse.
useGetAuditLogs(options?)Fetches audit log entries on demand. Implemented as a mutation so the request payload can be passed at call time.
Parameters:
options (optional): Mutation options. mutate(request: GetAuditLogsRequest) triggers the fetch.Returns: Mutation result with data: AuditLogResponse.
β Chat hooks
useCreateThread(options?)Creates a new chat thread.
Parameters:
options (optional): Mutation options including onSuccess, onError, retry, retryDelay.Returns: Mutation result with data: copaApi.chat.CreateThreadResponse.
useGetCommentsByThreadId(threadId, options?)Fetches comments for a chat thread. Disabled until threadId is set.
Parameters:
threadId: Thread id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with data: copaApi.chat.GetCommentsByThreadIdResponse.
usePostComment(options?)Posts a new comment to a thread.
Parameters:
options (optional): Mutation options. mutate(request: PostCommentRequest) triggers the post.Returns: Mutation result with data: copaApi.chat.PostCommentResponse.
useUpdateComment(options?)Updates an existing comment.
Parameters:
options (optional): Mutation options. mutate(request: UpdateCommentRequest) triggers the update.Returns: Mutation result with data: copaApi.chat.UpdateCommentResponse.
useDeleteComment(options?)Deletes a comment by id.
Parameters:
options (optional): Mutation options. mutate(commentId: string) triggers the delete.Returns: Mutation result with data: copaApi.chat.DeleteCommentResponse.
useSubscribeUser(options?)Subscribes a user to chat updates.
Parameters:
options (optional): Mutation options. mutate(request: SubscribeUserRequest) triggers the action.Returns: Mutation result with data: copaApi.chat.SubscribeUserResponse.
useUnsubscribeUser(options?)Unsubscribes a user from chat updates.
Parameters:
options (optional): Mutation options. mutate(request: UnsubscribeUserRequest) triggers the action.Returns: Mutation result with data: copaApi.chat.UnsubscribeUserResponse.
useCheckSubscriptionStatus(userId, threadId, options?)Checks whether a user is subscribed to a thread.
Parameters:
userId: User id (null/undefined disables the query)threadId: Thread id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with data: copaApi.chat.CheckSubscriptionStatusResponse.
β Email Engine hooks
useGetAllConversations(params?, options?)Lists email conversations (paginated).
Parameters:
params (optional): GetAllConversationsParams filtersoptions (optional): Query optionsReturns: Query result with data: PageChunkEmailConversation.
useGetConversation(conversationId, options?)Fetches a single email conversation by id.
Parameters:
conversationId: Conversation id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with data: EmailConversation.
useCreateConversation(options?)Creates a new email conversation.
Parameters:
options (optional): Mutation options. mutate(request: CreateConversationRequest) triggers the create.Returns: Mutation result with data: EmailConversation.
useReplyToConversation(options?)Sends a reply on an email conversation.
Parameters:
options (optional): Mutation options. mutate(request: ReplyToConversationRequest) triggers the reply.Returns: Mutation result.
useFilterMessagesBySenderId(params, options?)Fetches messages filtered by sender id.
Parameters:
params: FilterOnSenderId β sender id and pagingoptions (optional): Query optionsReturns: Query result with data: PageChunkEmailMessage.
β File hooks (mutations & download)
useFileUpload(options?)Uploads file data to storage and returns the resulting file id/path.
Parameters:
options (optional): Mutation options. mutate(request: FileUploadRequest) triggers the upload.Returns: Mutation result with data: FileUploadResponse.
useFileDownload(params, options?)Downloads a file by id. Implemented as a query (auto-fetches when params are valid).
Parameters:
params: { fileId: string; contentType: string; method: 'GET' | 'PUT' }options (optional): Query optionsReturns: Query result with the downloaded data.
β Form hooks
useGetFormById(formId, options?)Fetches a form by id.
Parameters:
formId: Form id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with the form definition.
useGetFormSchema(formInstanceId, formRevision, options?)Fetches a form's schema for a given instance + revision.
Parameters:
formInstanceId: Form instance id (null/undefined disables the query)formRevision: Schema revision (string or number, null/undefined disables the query)options (optional): Query optionsReturns: Query result with the form schema.
useGetFormData(formId, options?)Fetches submitted form data.
Parameters:
formId: Form id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with the form data.
useCreateOrUpdateForm(options?)Creates or updates a form definition.
Parameters:
options (optional): Mutation options. mutate(request: CreateOrUpdateFormRequest) triggers the save.Returns: Mutation result.
β Inbox Items hooks
useGetAllInboxItems(params?, options?)Lists inbox items.
Parameters:
params (optional): GetAllInboxItemsRequest filtersoptions (optional): Query optionsReturns: Query result with the items array.
useCreateInboxItemPerUser(options?)Creates an inbox item for a specific user.
Parameters:
options (optional): Mutation options. mutate(request) triggers the create.Returns: Mutation result with the created inbox items.
useMarkItemAsRead(options?)Marks an inbox item as read.
Parameters:
options (optional): Mutation options. mutate(request: MarkItemAsReadRequest) triggers the action.Returns: Mutation result.
useMarkItemAsUnread(options?)Marks an inbox item as unread.
Parameters:
options (optional): Mutation options. mutate(request: MarkItemAsUnreadRequest) triggers the action.Returns: Mutation result.
β Input Table mutation hooks
useInsertRow(options?)Inserts a new row into an input table.
Parameters:
options (optional): Mutation options. mutate(request: InsertRowRequest) triggers the insert.Returns: Mutation result.
useUpdateRow(options?)Updates an existing row in an input table.
Parameters:
options (optional): Mutation options. mutate(request: UpdateRowRequest) triggers the update.Returns: Mutation result.
useDeleteRow(options?)Deletes a row by id from an input table.
Parameters:
options (optional): Mutation options. mutate(request: DeleteRowRequest) triggers the delete.Returns: Mutation result.
β Permissions hooks
useDocumentPermissions(objectId, objectType, options?)Fetches permissions for a given document/object.
Parameters:
objectId: Object id (undefined disables the query)objectType: Object type (e.g. Workbook, Dashboard)options (optional): Query optionsReturns: Query result with data: PermissionsResponse.
β Process hooks
useGetTriggersBySheet(sheetId, options?)Lists process triggers attached to a sheet.
Parameters:
sheetId: Sheet idoptions (optional): TanStack UseQueryOptions (omit queryKey/queryFn/enabled)Returns: Query result with data: ProcessTrigger[].
useRegisterProcessTrigger(options?)Registers a new process trigger.
Parameters:
options (optional): Mutation options. mutate(trigger: ProcessTrigger) triggers the register.Returns: Mutation result with data: ProcessTrigger.
useDeleteProcessTrigger(options?)Deletes a process trigger by id. Invalidates the corresponding trigger list query.
Parameters:
options (optional): Mutation options. mutate({ id, sheetId? }) triggers the delete.Returns: Mutation result with data: DeleteProcessTriggerResponse.
useMarkTaskDone(options?)Marks a process task as done.
Parameters:
options (optional): Mutation options. mutate(request: MarkTaskDoneRequest) triggers the action.Returns: Mutation result.
useReassignTask(options?)Reassigns a process task to a different user.
Parameters:
options (optional): Mutation options. mutate(request: ReassignTaskRequest) triggers the action.Returns: Mutation result.
β Recon hooks
useGetAllRecon(options?)Lists all recon workflows.
Parameters:
options (optional): Query optionsReturns: Query result with data: ReconWorkflow[].
useRunRecon(options?)Triggers a recon workflow run.
Parameters:
options (optional): Mutation options. mutate(request: RunReconRequest) triggers the run.Returns: Mutation result with data: RunReconResponse.
β Statement hooks
useGetStatementData(statementId, viewId?, runId?, options?)Fetches statement data for a given statement/view/run.
Parameters:
statementId: Statement id (null/undefined disables the query)viewId (optional): View idrunId (optional): Run idoptions (optional): Query optionsReturns: Query result with the statement data.
useGetViewsBySheetId(sheetId, options?)Lists statement views for a sheet.
Parameters:
sheetId: Sheet id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with the array of views.
useGetViewById(viewId, options?)Fetches a single statement view by id.
Parameters:
viewId: View id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with the view.
useGetRunsByViewId(viewId, options?)Lists statement runs for a given view.
Parameters:
viewId: View id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with the runs array.
useGetRunResultById(runId, options?)Fetches the result of a statement run.
Parameters:
runId: Run id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with the run result.
useCreateStatementRun(options?)Creates a new statement run.
Parameters:
options (optional): Mutation options. mutate(params: CreateStatementRunParams) triggers the create.Returns: Mutation result with data: CreateStatementRunResult.
β Task hook
useGetTaskDetails(taskId, options?)Fetches detailed information about a task.
Parameters:
taskId: Task id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with the task details.
β Templated Pipeline hooks
useGetAllTemplatedPipelines(options?)Lists all templated pipelines.
Parameters:
options (optional): Query optionsReturns: Query result with data: TemplatedPipelineWorkflow[].
β Template hooks
useRenderTemplate(options?)Renders a template with the provided variables.
Parameters:
options (optional): Mutation options. mutate(request: RenderTemplateRequest) triggers the render.Returns: Mutation result with data: RenderTemplateResponse.
β TCN hooks
All TCN mutation hooks take their TCN
token(and other identifiers) as part ofmutate(variables). Theoptionsparameter is standardUseMutationOptions.
useTcnAuthUrl(options?)Returns the TCN OAuth authorization URL.
Parameters:
options (optional): Query optionsReturns: Query result with data: { url: string }.
useTcnExchangeCode(options?)Exchanges an OAuth code for TCN tokens.
Parameters: mutate({ code }) triggers the exchange.
Returns: Mutation result with data: TcnTokenData.
useTcnRefreshToken(options?)Refreshes a TCN access token.
Parameters: mutate({ refresh_token }).
Returns: Mutation result with data: TcnTokenData.
useTcnCurrentAgent(options?)Fetches the currently signed-in TCN agent.
Parameters: mutate({ token }).
Returns: Mutation result with data: TcnAgentData.
useTcnAgentSkills(options?)Lists skills available to the agent in a hunt group.
Parameters: mutate({ token, huntGroupSid }).
Returns: Mutation result with data: TcnSkillsData.
useTcnCreateSession(options?)Creates a new TCN agent session.
Parameters: mutate({ token, huntGroupSid, skills }).
Returns: Mutation result with data: TcnSessionData.
useTcnKeepAlive(options?)Pings the TCN session to keep it alive.
Parameters: mutate({ token, sessionSid }).
Returns: Mutation result.
useTcnAgentGetStatus(options?)Returns the current agent status.
Parameters: mutate({ token }).
Returns: Mutation result with data: TcnStatusData.
useTcnAgentSetReady(options?)Marks the agent as ready.
Parameters: mutate({ token, sessionSid }).
Returns: Mutation result.
useTcnAgentPause(options?)Pauses the agent.
Parameters: mutate({ token, sessionSid }).
Returns: Mutation result.
useTcnAgentDisconnect(options?)Disconnects the agent.
Parameters: mutate({ token, sessionSid, reason? }).
Returns: Mutation result.
useTcnConnectedParty(options?)Returns the currently connected party for the agent.
Parameters: mutate({ token, sessionSid }).
Returns: Mutation result with data: TcnConnectedParty.
useTcnAgentPutCallOnHold(options?)Puts the agent's current call on hold.
Parameters: mutate({ token, sessionSid, holdType? }).
Returns: Mutation result.
useTcnAgentGetCallFromHold(options?)Resumes the agent's held call.
Parameters: mutate({ token, sessionSid, holdType? }).
Returns: Mutation result.
useTcnHuntGroupSettings(options?)Fetches hunt-group settings for the agent.
Parameters: mutate({ token, huntGroupSid }).
Returns: Mutation result with data: TcnDialSettings.
useTcnCallData(options?)Retrieves data for an active call.
Parameters: mutate({ token, callSid }).
Returns: Mutation result with data: TcnCallData.
useTcnDialManualPrepare(options?)Prepares a manual dial.
Parameters: mutate({ token, sessionSid }).
Returns: Mutation result.
useTcnManualDialStart(options?)Starts a prepared manual dial.
Parameters: mutate({ token, agentSessionSid, huntGroupSid, simpleCallData }).
Returns: Mutation result.
useTcnProcessManualDial(options?)Processes the result of a manual dial.
Parameters: mutate({ token, call }).
Returns: Mutation result.
β User hooks (extras)
useGetAllUsers(options?)Lists all users in the workspace.
Parameters:
options (optional): Query optionsReturns: Query result with data: User[].
β Workbook hooks (mutations)
useGetWorkbookDetails(workbookId, options?)Fetches workbook metadata/details.
Parameters:
workbookId: Workbook id (null/undefined disables the query)options (optional): Query optionsReturns: Query result with the workbook details.
useSaveWorkbook(options?)Saves a workbook draft.
Parameters: mutate(request: SaveWorkbookRequest).
Returns: Mutation result.
usePublishWorkbook(options?)Publishes a workbook.
Parameters: mutate(request: PublishWorkbookRequest).
Returns: Mutation result.
β Workflow hooks (extras)
useGetAllHttpTriggers(options?)Lists all HTTP triggers.
Parameters:
options (optional): Query optionsReturns: Query result with data: HttpTrigger[].
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: 3,
staleTime: 1000 * 60 * 5, // 5 minutes
gcTime: 1000 * 60 * 10, // 10 minutes
},
},
});
All hooks accept standard TanStack React Query options:
interface QueryOptions {
enabled?: boolean; // Enable/disable query
staleTime?: number; // Duration (ms) before data is stale
gcTime?: number; // Duration (ms) to keep data in cache
retry?: number | boolean; // Number of retries or disable retries
onSuccess?: (data: any) => void; // Success callback
onError?: (error: Error) => void; // Error callback
}
useUser({
onError: (error) => {
console.error("User fetch failed:", error.message);
// Custom error recovery logic
},
});
function ManualRefetch() {
const { data, refetch } = useUser();
return (
<div>
<button onClick={() => refetch()}>Refresh</button>
</div>
);
}
This package re-exports core TanStack React Query utilities:
import {
useQuery,
useMutation,
QueryClient,
QueryClientProvider,
ReactQueryDevtools,
} from "@bluecopa/react";
Fully typed with TypeScript. All hooks provide proper type inference and IntelliSense support. Extend types for custom use cases:
import { User } from "@bluecopa/react";
interface CustomUser extends User {
role: string;
permissions: string[];
}
# Install dependencies
pnpm install
# Build the package
pnpm build
# Run development server
pnpm dev
# Run tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Lint code
pnpm lint
# Format code
pnpm format
FAQs
Bluecopa react library with TanStack Query integration
We found that @bluecopa/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socketβs first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.