- Build complete Next.js CRM for commercial real estate - Add authentication with JWT sessions and role-based access - Add GoHighLevel API integration for contacts, conversations, opportunities - Add AI-powered Control Center with tool calling - Add Setup page with onboarding checklist (/setup) - Add sidebar navigation with Setup menu item - Fix type errors in onboarding API, GHL services, and control center tools - Add Prisma schema with SQLite for local development - Add UI components with clay morphism design system Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
58 lines
2.2 KiB
TypeScript
58 lines
2.2 KiB
TypeScript
import { GHLClient, GHLClientConfig } from './client';
|
|
import { GHLAgencyClient, AgencyClientConfig } from './agency-client';
|
|
import { ContactsService } from './services/contacts';
|
|
import { ConversationsService } from './services/conversations';
|
|
import { OpportunitiesService, PipelinesService } from './services/opportunities';
|
|
import { WorkflowsService } from './services/workflows';
|
|
import { CustomFieldsService } from './services/custom-fields';
|
|
import { LocationsService } from './services/locations';
|
|
|
|
export * from './client';
|
|
export * from './agency-client';
|
|
export * from './errors';
|
|
export type { CustomValue } from './services/custom-fields';
|
|
export * from './services/locations';
|
|
export * from './services/user-provisioning';
|
|
export * from './services/workflows';
|
|
export * from './services/admin-tagging';
|
|
export { adminTaggingService } from './services/admin-tagging';
|
|
|
|
// Full GHL client with all services
|
|
export class GHL {
|
|
private client: GHLClient;
|
|
|
|
public contacts: ContactsService;
|
|
public conversations: ConversationsService;
|
|
public opportunities: OpportunitiesService;
|
|
public pipelines: PipelinesService;
|
|
public workflows: WorkflowsService;
|
|
public customFields: CustomFieldsService;
|
|
|
|
constructor(config: GHLClientConfig) {
|
|
this.client = new GHLClient(config);
|
|
|
|
this.contacts = new ContactsService(this.client);
|
|
this.conversations = new ConversationsService(this.client);
|
|
this.opportunities = new OpportunitiesService(this.client);
|
|
this.pipelines = new PipelinesService(this.client);
|
|
this.workflows = new WorkflowsService(this.client);
|
|
this.customFields = new CustomFieldsService(this.client, config.locationId);
|
|
}
|
|
|
|
get locationId() {
|
|
return this.client.locationID;
|
|
}
|
|
}
|
|
|
|
// Factory function to create GHL client for a user
|
|
export async function createGHLClientForUser(userId: string): Promise<GHL> {
|
|
// This will be implemented to fetch user's GHL credentials from database
|
|
// For now, throw an error indicating it needs implementation
|
|
throw new Error('createGHLClientForUser not yet implemented - needs database integration');
|
|
}
|
|
|
|
// Factory function for agency-level operations
|
|
export function createAgencyClient(config: AgencyClientConfig): GHLAgencyClient {
|
|
return new GHLAgencyClient(config);
|
|
}
|