feat(editor): Implement suggested workflows experiment (no-changelog) (#17499)

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
Romeo Balta
2025-07-21 14:45:07 +01:00
committed by GitHub
parent 785b75d279
commit e0cb747f0d
11 changed files with 331 additions and 28 deletions

View File

@@ -31,6 +31,10 @@ export declare namespace Cloud {
email: string;
hasEarlyAccess?: boolean;
role?: string;
selectedApps?: string;
information?: {
[key: string]: string | string[];
};
};
}

View File

@@ -113,6 +113,9 @@ export interface ITemplatesWorkflowFull extends ITemplatesWorkflowResponse {
export interface ITemplatesQuery {
categories: string[];
search: string;
apps?: string[];
sort?: string;
combineWith?: string;
}
export interface ITemplatesCategory {
@@ -150,24 +153,31 @@ export async function getCollections(
export async function getWorkflows(
apiEndpoint: string,
query: { page: number; limit: number; categories: string[]; search: string },
query: {
page: number;
limit: number;
categories: string[];
search: string;
sort?: string;
apps?: string[];
combineWith?: string;
},
headers?: RawAxiosRequestHeaders,
): Promise<{
totalWorkflows: number;
workflows: ITemplatesWorkflow[];
filters: TemplateSearchFacet[];
}> {
return await get(
apiEndpoint,
'/templates/search',
{
page: query.page,
rows: query.limit,
category: stringifyArray(query.categories),
search: query.search,
},
headers,
);
const { apps, sort, combineWith, categories, ...restQuery } = query;
const finalQuery = {
...restQuery,
category: stringifyArray(categories),
...(apps && { app: stringifyArray(apps) }),
...(sort && { sort }),
...(combineWith && { combineWith }),
};
return await get(apiEndpoint, '/templates/search', finalQuery, headers);
}
export async function getCollectionById(