feat: Brainstorm Topics with GSC + Issue #518 fixes + Blog Editor enhancements
Issue #518 - Subscription not updating after checkout: - Fix stale closure in SubscriptionContext checkout polling (use subscriptionRef) - Move checkout success polling from InitialRouteHandler into SubscriptionContext - Remove redundant polling code from InitialRouteHandler - Fix plan label: 'Free' instead of 'No Plan', proper capitalization - Add plan refresh button in UserBadge - Add 'View Costing Details' to UserBadge dropdown - Rename 'ALwrity Podcast Maker' to 'Podcast Creator' across UI - Clean subscription=success URL param after verification Blog Writer WYSIWYG Editor enhancements: - Per-section preview toggle (view/edit icons) - Enhanced hover-based toolbar - Circular SVG progress stats bar with detailed tooltip - Research tool chips in stats bar footer - Per-section TTS with useTextToSpeech hook (browser native) - Full blog preview modal with print/PDF support - PlayAllTTSButton: sequential playback with progress bar - OnThisPageNav: floating sidebar with scroll tracking - Section data attributes for scroll anchoring GSC Brainstorm Topics feature: - Backend: gsc_brainstorm_service.py (rule-based + LLM recommendations) - Backend: POST /gsc/brainstorm endpoint with 3-word minimum validation - Frontend: gscBrainstorm.ts API client - Frontend: useGSCBrainstormConnection hook (popup OAuth, no /onboarding redirect) - Frontend: useGSCBrainstorm hook (connect check + brainstorm call) - Frontend: GSCBrainstormModal (3-tab results: Opportunities, Gaps, AI Recs) - Frontend: BrainstormButton (visible at 3+ words, GSC connect overlay) - Wire BrainstormButton into ManualResearchForm and ResearchAction - Add blog_writer to gsc_auth router features for ALWRITY_ENABLED_FEATURES
This commit is contained in:
69
frontend/src/services/linkApi.ts
Normal file
69
frontend/src/services/linkApi.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import { aiApiClient } from '../api/client';
|
||||
|
||||
export interface LinkSearchRequest {
|
||||
query: string;
|
||||
link_type: 'internal' | 'external';
|
||||
site_url?: string;
|
||||
num_results?: number;
|
||||
}
|
||||
|
||||
export interface LinkSearchResult {
|
||||
title: string;
|
||||
url: string;
|
||||
text: string;
|
||||
publishedDate: string;
|
||||
author: string;
|
||||
score: number;
|
||||
}
|
||||
|
||||
export interface LinkSearchResponse {
|
||||
results: LinkSearchResult[];
|
||||
warnings: string[];
|
||||
}
|
||||
|
||||
export interface RewordRequest {
|
||||
section_text: string;
|
||||
selected_text?: string;
|
||||
section_heading?: string;
|
||||
links: Array<{ url: string; title: string }>;
|
||||
}
|
||||
|
||||
export interface RewordResponse {
|
||||
reworded_text: string;
|
||||
warnings: string[];
|
||||
}
|
||||
|
||||
class LinkApiService {
|
||||
private baseUrl: string;
|
||||
|
||||
constructor() {
|
||||
const url = process.env.REACT_APP_API_URL;
|
||||
if (process.env.NODE_ENV === 'production' && !url) {
|
||||
throw new Error('REACT_APP_API_URL environment variable is required for production');
|
||||
}
|
||||
this.baseUrl = url || 'http://localhost:8000';
|
||||
}
|
||||
|
||||
async searchLinks(params: LinkSearchRequest): Promise<LinkSearchResponse> {
|
||||
const { data } = await aiApiClient.post('/api/links/search', {
|
||||
query: params.query,
|
||||
link_type: params.link_type,
|
||||
site_url: params.site_url || '',
|
||||
num_results: params.num_results || 5,
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
async rewordWithLinks(params: RewordRequest): Promise<RewordResponse> {
|
||||
const { data } = await aiApiClient.post('/api/links/reword', {
|
||||
section_text: params.section_text,
|
||||
selected_text: params.selected_text,
|
||||
section_heading: params.section_heading,
|
||||
links: params.links,
|
||||
});
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
export const linkApi = new LinkApiService();
|
||||
export default linkApi;
|
||||
Reference in New Issue
Block a user