refactor: telephony integration

This commit is contained in:
Sabiha Khan 2025-10-13 17:55:10 +05:30
parent b9d1720d94
commit a01f2df7ea
26 changed files with 1583 additions and 28 deletions

4
ui/package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "ui",
"version": "0.1.0",
"version": "1.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ui",
"version": "0.1.0",
"version": "1.1.0",
"dependencies": {
"@dagrejs/dagre": "^1.1.4",
"@hey-api/client-fetch": "^0.10.0",

View file

@ -25,6 +25,7 @@ import {
} from "@/components/ui/select";
import { useAuth } from "@/lib/auth";
// TODO: Make UI provider-agnostic
interface TelephonyConfigForm {
provider: string;
account_sid: string;

View file

@ -6,7 +6,7 @@ import { useRouter } from "next/navigation";
import { useEffect, useRef, useState } from "react";
import { PhoneInput } from 'react-international-phone';
import { getTelephonyConfigurationApiV1OrganizationsTelephonyConfigGet, initiateCallApiV1TwilioInitiateCallPost } from '@/client/sdk.gen';
import { getTelephonyConfigurationApiV1OrganizationsTelephonyConfigGet, initiateCallApiV1TelephonyInitiateCallPost } from '@/client/sdk.gen';
import { WorkflowError } from '@/client/types.gen';
import { FlowEdge, FlowNode } from "@/components/flow/types";
import { OnboardingTooltip } from '@/components/onboarding/OnboardingTooltip';
@ -117,6 +117,7 @@ const WorkflowHeader = ({ isDirty, workflowName, rfInstance, onRun, workflowId,
});
// If no configuration exists, show configure dialog
// Check if Twilio is configured (currently the only supported provider)
if (configResponse.error || !configResponse.data?.twilio) {
setConfigureDialogOpen(true);
return;
@ -151,7 +152,7 @@ const WorkflowHeader = ({ isDirty, workflowName, rfInstance, onRun, workflowId,
}
// Configuration exists, proceed with call initiation
const response = await initiateCallApiV1TwilioInitiateCallPost({
const response = await initiateCallApiV1TelephonyInitiateCallPost({
body: { workflow_id: workflowId },
headers: { 'Authorization': `Bearer ${accessToken}` },
});

File diff suppressed because one or more lines are too long

View file

@ -621,6 +621,68 @@ export type WorkflowTemplateResponse = {
created_at: string;
};
export type InitiateCallApiV1TelephonyInitiateCallPostData = {
body: InitiateCallRequest;
headers?: {
authorization?: string | null;
};
path?: never;
query?: never;
url: '/api/v1/telephony/initiate-call';
};
export type InitiateCallApiV1TelephonyInitiateCallPostErrors = {
/**
* Not found
*/
404: unknown;
/**
* Validation Error
*/
422: HttpValidationError;
};
export type InitiateCallApiV1TelephonyInitiateCallPostError = InitiateCallApiV1TelephonyInitiateCallPostErrors[keyof InitiateCallApiV1TelephonyInitiateCallPostErrors];
export type InitiateCallApiV1TelephonyInitiateCallPostResponses = {
/**
* Successful Response
*/
200: unknown;
};
export type HandleStatusCallbackApiV1TelephonyStatusCallbackWorkflowRunIdPostData = {
body?: never;
headers?: {
'x-twilio-signature'?: string | null;
};
path: {
workflow_run_id: number;
};
query?: never;
url: '/api/v1/telephony/status-callback/{workflow_run_id}';
};
export type HandleStatusCallbackApiV1TelephonyStatusCallbackWorkflowRunIdPostErrors = {
/**
* Not found
*/
404: unknown;
/**
* Validation Error
*/
422: HttpValidationError;
};
export type HandleStatusCallbackApiV1TelephonyStatusCallbackWorkflowRunIdPostError = HandleStatusCallbackApiV1TelephonyStatusCallbackWorkflowRunIdPostErrors[keyof HandleStatusCallbackApiV1TelephonyStatusCallbackWorkflowRunIdPostErrors];
export type HandleStatusCallbackApiV1TelephonyStatusCallbackWorkflowRunIdPostResponses = {
/**
* Successful Response
*/
200: unknown;
};
export type InitiateCallApiV1TwilioInitiateCallPostData = {
body: InitiateCallRequest;
headers?: {