blurpritn adn site builde cleanup
This commit is contained in:
@@ -2297,104 +2297,8 @@ export async function deleteTaxonomy(id: number): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
// Site Builder API
|
||||
export interface SiteBlueprint {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
config_json: Record<string, any>;
|
||||
structure_json: Record<string, any>;
|
||||
status: string;
|
||||
hosting_type: string;
|
||||
version: number;
|
||||
deployed_version?: number;
|
||||
account_id?: number;
|
||||
site_id?: number;
|
||||
sector_id?: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
pages?: PageBlueprint[];
|
||||
gating_messages?: string[];
|
||||
}
|
||||
|
||||
export interface PageBlueprint {
|
||||
id: number;
|
||||
site_blueprint_id: number;
|
||||
site_blueprint?: number;
|
||||
slug: string;
|
||||
title: string;
|
||||
type: string;
|
||||
blocks_json: any[];
|
||||
status: string;
|
||||
order: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
|
||||
export async function fetchSiteBlueprints(filters?: {
|
||||
site_id?: number;
|
||||
sector_id?: number;
|
||||
status?: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}): Promise<{ count: number; next: string | null; previous: string | null; results: SiteBlueprint[] }> {
|
||||
const params = new URLSearchParams();
|
||||
if (filters?.site_id) params.append('site_id', filters.site_id.toString());
|
||||
if (filters?.sector_id) params.append('sector_id', filters.sector_id.toString());
|
||||
if (filters?.status) params.append('status', filters.status);
|
||||
if (filters?.page) params.append('page', filters.page.toString());
|
||||
if (filters?.page_size) params.append('page_size', filters.page_size.toString());
|
||||
|
||||
const queryString = params.toString();
|
||||
const endpoint = queryString
|
||||
? `/v1/site-builder/blueprints/?${queryString}`
|
||||
: `/v1/site-builder/blueprints/`;
|
||||
return fetchAPI(endpoint);
|
||||
}
|
||||
|
||||
export async function fetchSiteBlueprintById(id: number): Promise<SiteBlueprint> {
|
||||
return fetchAPI(`/v1/site-builder/blueprints/${id}/`);
|
||||
}
|
||||
|
||||
// Stage 3: Site Progress API
|
||||
export interface SiteProgress {
|
||||
blueprint_id: number;
|
||||
blueprint_name: string;
|
||||
overall_status: 'in_progress' | 'complete' | 'blocked';
|
||||
cluster_coverage?: {
|
||||
total_clusters: number;
|
||||
covered_clusters: number;
|
||||
details: Array<{
|
||||
cluster_id: number;
|
||||
cluster_name: string;
|
||||
role: string;
|
||||
coverage_status: string;
|
||||
validation_messages: string[];
|
||||
tasks_count: number;
|
||||
content_count: number;
|
||||
hub_pages: number;
|
||||
supporting_pages: number;
|
||||
attribute_pages: number;
|
||||
is_complete: boolean;
|
||||
}>;
|
||||
};
|
||||
taxonomy_coverage?: {
|
||||
total_taxonomies: number;
|
||||
defined_taxonomies: number;
|
||||
details: any[];
|
||||
};
|
||||
validation_flags?: {
|
||||
clusters_attached: boolean;
|
||||
taxonomies_defined: boolean;
|
||||
sitemap_generated: boolean;
|
||||
all_pages_generated: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchSiteProgress(blueprintId: number): Promise<SiteProgress> {
|
||||
return fetchAPI(`/v1/site-builder/blueprints/${blueprintId}/progress/`);
|
||||
}
|
||||
// Legacy: Site Builder API removed
|
||||
// SiteBlueprint, PageBlueprint, and related functions deprecated
|
||||
|
||||
// Stage 4: Sync Health API
|
||||
export interface SyncStatus {
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
/**
|
||||
* Site Builder API Service
|
||||
* Uses fetchAPI pattern (not axios) - handles authentication automatically
|
||||
*/
|
||||
import { fetchAPI } from './api';
|
||||
import type {
|
||||
SiteBlueprint,
|
||||
PageBlueprint,
|
||||
SiteStructure,
|
||||
BuilderFormData,
|
||||
SiteBuilderMetadata,
|
||||
} from '../types/siteBuilder';
|
||||
|
||||
export interface CreateBlueprintPayload {
|
||||
name: string;
|
||||
description?: string;
|
||||
site_id: number;
|
||||
sector_id: number;
|
||||
hosting_type: BuilderFormData['hostingType'];
|
||||
config_json: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface GenerateStructurePayload {
|
||||
business_brief: string;
|
||||
objectives: string[];
|
||||
style: BuilderFormData['style'];
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Site Builder API functions
|
||||
*/
|
||||
export const siteBuilderApi = {
|
||||
/**
|
||||
* List all site blueprints
|
||||
*/
|
||||
async listBlueprints(siteId?: number): Promise<SiteBlueprint[]> {
|
||||
const params = siteId ? `?site=${siteId}` : '';
|
||||
const response = await fetchAPI(`/v1/site-builder/blueprints/${params}`);
|
||||
// Handle paginated response
|
||||
if (response?.results) {
|
||||
return response.results as SiteBlueprint[];
|
||||
}
|
||||
// Handle direct array response
|
||||
return Array.isArray(response) ? response : [];
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a single blueprint by ID
|
||||
*/
|
||||
async getBlueprint(id: number): Promise<SiteBlueprint> {
|
||||
return fetchAPI(`/v1/site-builder/blueprints/${id}/`);
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new site blueprint
|
||||
*/
|
||||
async createBlueprint(payload: CreateBlueprintPayload): Promise<SiteBlueprint> {
|
||||
return fetchAPI('/v1/site-builder/blueprints/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Generate site structure for a blueprint
|
||||
*/
|
||||
async generateStructure(
|
||||
blueprintId: number,
|
||||
payload: GenerateStructurePayload,
|
||||
): Promise<{ task_id?: string; success?: boolean; structure?: SiteStructure }> {
|
||||
return fetchAPI(`/v1/site-builder/blueprints/${blueprintId}/generate_structure/`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* List pages for a blueprint
|
||||
*/
|
||||
async listPages(blueprintId: number): Promise<PageBlueprint[]> {
|
||||
const response = await fetchAPI(`/v1/site-builder/pages/?site_blueprint=${blueprintId}`);
|
||||
// Handle paginated response
|
||||
if (response?.results) {
|
||||
return response.results as PageBlueprint[];
|
||||
}
|
||||
// Handle direct array response
|
||||
return Array.isArray(response) ? response : [];
|
||||
},
|
||||
|
||||
/**
|
||||
* Generate all pages for a blueprint
|
||||
*/
|
||||
async generateAllPages(
|
||||
blueprintId: number,
|
||||
options?: { pageIds?: number[]; force?: boolean },
|
||||
): Promise<{ success: boolean; pages_queued: number; task_ids: number[]; celery_task_id?: string }> {
|
||||
const response = await fetchAPI(`/v1/site-builder/blueprints/${blueprintId}/generate_all_pages/`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
page_ids: options?.pageIds,
|
||||
force: options?.force || false,
|
||||
}),
|
||||
});
|
||||
// Handle unified response format
|
||||
return response?.data || response;
|
||||
},
|
||||
|
||||
/**
|
||||
* Create tasks for pages
|
||||
*/
|
||||
async createTasksForPages(
|
||||
blueprintId: number,
|
||||
pageIds?: number[],
|
||||
): Promise<{ tasks: unknown[]; count: number }> {
|
||||
const response = await fetchAPI(`/v1/site-builder/blueprints/${blueprintId}/create_tasks/`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
page_ids: pageIds,
|
||||
}),
|
||||
});
|
||||
// Handle unified response format
|
||||
return response?.data || response;
|
||||
},
|
||||
|
||||
/**
|
||||
* Load dropdown metadata for wizard fields
|
||||
*/
|
||||
async getMetadata(): Promise<SiteBuilderMetadata> {
|
||||
return fetchAPI('/v1/site-builder/metadata/');
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete a blueprint
|
||||
*/
|
||||
async deleteBlueprint(id: number): Promise<void> {
|
||||
return fetchAPI(`/v1/site-builder/blueprints/${id}/`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete a page blueprint
|
||||
*/
|
||||
async deletePage(id: number): Promise<void> {
|
||||
return fetchAPI(`/v1/site-builder/pages/${id}/`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Bulk delete blueprints
|
||||
*/
|
||||
async bulkDeleteBlueprints(ids: number[]): Promise<{ deleted_count: number }> {
|
||||
return fetchAPI('/v1/site-builder/blueprints/bulk_delete/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ ids }),
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Deploy a blueprint to Sites renderer
|
||||
*/
|
||||
async deployBlueprint(blueprintId: number): Promise<{ success: boolean; deployment_url?: string; deployment_id?: number }> {
|
||||
// PublisherViewSet is now registered with empty prefix, so URL is /publisher/deploy/{id}/
|
||||
const response = await fetchAPI(`/v1/publisher/deploy/${blueprintId}/`, {
|
||||
method: 'POST',
|
||||
});
|
||||
// Handle unified response format
|
||||
return response?.data || response;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
export type HostingType = 'igny8_sites' | 'wordpress' | 'shopify' | 'multi';
|
||||
|
||||
export interface StylePreferences {
|
||||
palette: string;
|
||||
typography: string;
|
||||
personality: string;
|
||||
heroImagery: string;
|
||||
}
|
||||
|
||||
export interface BuilderFormData {
|
||||
siteId: number | null;
|
||||
sectorIds: number[];
|
||||
siteName: string;
|
||||
businessTypeId: number | null;
|
||||
businessType: string;
|
||||
customBusinessType?: string;
|
||||
industry: string;
|
||||
targetAudienceIds: number[];
|
||||
targetAudience: string;
|
||||
customTargetAudience?: string;
|
||||
hostingType: HostingType;
|
||||
businessBrief: string;
|
||||
objectives: string[];
|
||||
brandPersonalityIds: number[];
|
||||
customBrandPersonality?: string;
|
||||
heroImageryDirectionId: number | null;
|
||||
customHeroImageryDirection?: string;
|
||||
style: StylePreferences;
|
||||
}
|
||||
|
||||
export interface SiteBlueprint {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
status: 'draft' | 'generating' | 'ready' | 'deployed';
|
||||
hosting_type: HostingType;
|
||||
config_json: Record<string, unknown>;
|
||||
structure_json: SiteStructure | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
site?: number;
|
||||
sector?: number;
|
||||
}
|
||||
|
||||
export interface PageBlueprint {
|
||||
id: number;
|
||||
site_blueprint: number;
|
||||
slug: string;
|
||||
title: string;
|
||||
type: string;
|
||||
status: string;
|
||||
order: number;
|
||||
blocks_json: PageBlock[];
|
||||
}
|
||||
|
||||
export interface PageBlock {
|
||||
type: string;
|
||||
heading?: string;
|
||||
subheading?: string;
|
||||
layout?: string;
|
||||
content?: string[] | Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface SiteStructure {
|
||||
site?: {
|
||||
name?: string;
|
||||
primary_navigation?: string[];
|
||||
secondary_navigation?: string[];
|
||||
hero_message?: string;
|
||||
tone?: string;
|
||||
};
|
||||
pages: Array<{
|
||||
slug: string;
|
||||
title: string;
|
||||
type: string;
|
||||
status?: string;
|
||||
objective?: string;
|
||||
primary_cta?: string;
|
||||
blocks?: PageBlock[];
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface ApiListResponse<T> {
|
||||
count?: number;
|
||||
next?: string | null;
|
||||
previous?: string | null;
|
||||
results?: T[];
|
||||
data?: T[] | T;
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
message?: string;
|
||||
error?: string;
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
export interface SiteBuilderMetadataOption {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface SiteBuilderMetadata {
|
||||
business_types: SiteBuilderMetadataOption[];
|
||||
audience_profiles: SiteBuilderMetadataOption[];
|
||||
brand_personalities: SiteBuilderMetadataOption[];
|
||||
hero_imagery_directions: SiteBuilderMetadataOption[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user