Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

remove templates page

Ahmed Essam9b0e26a2e820
diff --git a/packages/app/src/builder-ui/constants.ts b/packages/app/src/builder-ui/constants.ts
index e662a9dc..3ebdaa9c 100644
--- a/packages/app/src/builder-ui/constants.ts
+++ b/packages/app/src/builder-ui/constants.ts
@@ -2,16 +2,6 @@
export const BINARY_INPUT_TYPES = ['Image', 'Audio', 'Video', 'Binary'];
-export const OUT_OF_BOX_TEMPLATES = [
- 'linkedin-post-generator-m7ltws9o6z',
- 'seo-blog-post-writer-m7mi0bksagu',
- 'lead-enrichment-agent-m7md03n6g4a',
- 'email-outreach-writer-m7ng6dj21g',
- 'competitor-researcher-and-analyzer-m7t0ab0h49g',
- 'essay-reviewer-m7t1xpx5utc',
- 'founder-research-agent-m82y1ovmv5c',
-];
-
export const JSON_FIELD_CLASS = '_smythos_json_field';
export enum LLM_PROVIDERS {
diff --git a/packages/app/src/react/app/routeMap.tsx b/packages/app/src/react/app/routeMap.tsx
index 5c3acd5b..8ae75aec 100644
--- a/packages/app/src/react/app/routeMap.tsx
+++ b/packages/app/src/react/app/routeMap.tsx
@@ -7,13 +7,10 @@ import AgentSettingsPage from '../features/agent-settings/pages/AgentSettingsPag
import AIChatPage from '../features/ai-chat/pages/ai-chat';
-import TemplatesPage from '../features/templates/pages/TemplatesPage';
export const routeMap: IPageRoute[] = [
- { path: '/templates', component: TemplatesPage, title: 'Templates' },
-
{ path: '/account', component: AccountPage, title: 'Account' },
diff --git a/packages/app/src/react/features/agents/components/TemplatesSection.tsx b/packages/app/src/react/features/agents/components/TemplatesSection.tsx
deleted file mode 100644
index d227440c..00000000
--- a/packages/app/src/react/features/agents/components/TemplatesSection.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import TemplateCard from '@react/features/templates/components/templateCard';
-import { Template } from '@src/react/features/agents/types/agents.types';
-import { FaArrowRight } from 'react-icons/fa6';
-import { useNavigate } from 'react-router-dom';
-
-interface TemplatesSectionProps {
- templates: Template[];
- userJobRole?: string;
-}
-
-/**
- * Component for displaying templates section with job role specific templates
- */
-export function TemplatesSection({ templates, userJobRole }: TemplatesSectionProps) {
- const navigate = useNavigate();
-
- if (!templates?.length) {
- return null;
- }
-
- return (
- <div data-qa="templates-section" className="pb-4">
- <div className="flex justify-between align-middle mb-4 text-lg">
- <p>
- {userJobRole ? (
- <>
- Templates for <span className="capitalize">{userJobRole}</span>
- </>
- ) : (
- 'Featured Templates'
- )}
- </p>
- </div>
-
- <div className="grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-4">
- {templates.slice(0, 8).map((template) => (
- <TemplateCard
- data={{
- ...template,
- jobType: userJobRole,
- }}
- key={template.id}
- type="template"
- suggestedTamplate
- />
- ))}
- </div>
-
- <button
- onClick={() => navigate('/templates')}
- type="button"
- className="group mt-3 float-right mr-0 flex justify-center items-center text-gray-700
- relative py-2 text-sm hover:no-underline after:absolute after:bottom-0 after:left-0
- after:h-[2px] after:w-0 after:bg-current after:transition-all after:duration-300"
- >
- <span>
- View all templates <FaArrowRight className="inline-block ml-1" />
- </span>
- </button>
- </div>
- );
-}
\ No newline at end of file
diff --git a/packages/app/src/react/features/agents/components/index.ts b/packages/app/src/react/features/agents/components/index.ts
index 1246af5c..fa1e0114 100644
--- a/packages/app/src/react/features/agents/components/index.ts
+++ b/packages/app/src/react/features/agents/components/index.ts
@@ -2,4 +2,3 @@ export { AgentsGrid } from './AgentsGrid';
export { AgentsHeader } from './AgentsHeader';
export { GenerateAgentForm } from './GenerateAgentForm';
export { SkeletonLoader } from './SkeletonLoader';
-export { TemplatesSection } from './TemplatesSection';
diff --git a/packages/app/src/react/features/agents/pages/AgentsPage.tsx b/packages/app/src/react/features/agents/pages/AgentsPage.tsx
index c10f8fec..480a1a61 100644
--- a/packages/app/src/react/features/agents/pages/AgentsPage.tsx
+++ b/packages/app/src/react/features/agents/pages/AgentsPage.tsx
@@ -1,8 +1,7 @@
import {
AgentsGrid,
AgentsHeader,
- GenerateAgentForm,
- TemplatesSection
+ GenerateAgentForm
} from '@react/features/agents/components';
import ModelAgentsSection from '@react/features/agents/components/model-agents-section';
import { useOnboarding } from '@react/features/agents/contexts/OnboardingContext';
@@ -12,10 +11,8 @@ import {
Learn,
OnboardingTasks,
} from '@react/features/onboarding/components/agent-onboarding-section';
-import { getTemplatesForJobRole } from '@react/features/onboarding/data/onboarding-mappings';
import { useGetOnboardingData } from '@react/features/onboarding/hooks/useGetUserOnboardingSettings';
import useMutateOnboardingData from '@react/features/onboarding/hooks/useMutateOnboardingData';
-import { filterTemplates } from '@react/features/templates/utils';
import { FeatureFlagged } from '@react/shared/components/featureFlags';
import { useAuthCtx } from '@react/shared/contexts/auth.context';
import { OnboardingTaskType } from '@react/shared/types/onboard.types';
@@ -23,10 +20,11 @@ import { FEATURE_FLAGS } from '@shared/constants/featureflags';
import { V4_ALL_PLANS } from '@shared/constants/general';
import { Analytics } from '@shared/posthog/services/analytics';
import { UserSettingsKey } from '@src/backend/types/user-data';
-import { GenerateAgentFormData, Template } from '@src/react/features/agents/types/agents.types';
+import { GenerateAgentFormData } from '@src/react/features/agents/types/agents.types';
+import { PluginComponents } from '@src/react/shared/plugins/PluginComponents';
+import { plugins, PluginTarget } from '@src/react/shared/plugins/Plugins';
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
-import { useFetchTemplates } from '../../templates/hooks/useFetchTemplates';
import UpSellModal from '../components/meta/up-sell';
/**
@@ -36,12 +34,14 @@ function AgentsPage() {
const navigate = useNavigate();
const [searchParams] = useSearchParams();
const switchteamid = searchParams.get('switchteamid');
- const [templates, setTemplates] = useState<Template[]>([]);
const endOfPageRef = useRef<HTMLDivElement>(null);
const saveUserSettingsMutation = useMutateOnboardingData();
const { isOnboardingDismissed, setOnboardingDismissed } = useOnboarding();
const [showUpsellModal, setShowUpsellModal] = useState(false);
+ // console the plugins
+ console.log('plugins', plugins.getPluginsByTarget(PluginTarget.AgentsPageSection));
+
// Authentication and permissions
const { getPageAccess, userInfo, hasReadOnlyPageAccess } = useAuthCtx();
const { subs } = userInfo;
@@ -67,10 +67,7 @@ function AgentsPage() {
handleLoadMore,
} = useAgentsData();
- // API hooks
- const { data: templatesData } = useFetchTemplates({
- options: { refetchOnWindowFocus: false },
- });
+
const { data: userSettings, isFetched: isUserSettingsFetched } = useGetOnboardingData({
options: {
@@ -84,25 +81,7 @@ function AgentsPage() {
// Trigger first-visit tutorial
useAgentsPageTutorial();
- // Templates processing
- useEffect(() => {
- if (!!templatesData && !!userSettings) {
- const userJobRole = userSettings?.jobRoleLabel;
-
- // First get all templates
- const allTemplates = JSON.parse(JSON.stringify(templatesData));
-
- // Then filter for marketing templates if needed
- const marketingTemplates = userJobRole
- ? getTemplatesForJobRole(userJobRole, allTemplates)?.relevantTemplates || templatesData
- : templatesData;
-
- // Apply the template filtering but don't add missing OUT_OF_BOX_TEMPLATES
- const processedTemplates = filterTemplates(marketingTemplates, 'All', '', 'name', 'asc');
-
- setTemplates(processedTemplates);
- }
- }, [templatesData, userSettings]);
+
// Scroll to bottom when agents are updated
useLayoutEffect(() => {
@@ -232,8 +211,7 @@ function AgentsPage() {
<ModelAgentsSection />
)}
- {/* Templates Section */}
- <TemplatesSection templates={templates} userJobRole={userSettings?.jobRoleLabel} />
+ <PluginComponents targetId={PluginTarget.AgentsPageSection} />
{/* Learn Section */}
<Learn />
diff --git a/packages/app/src/react/features/onboarding/data/onboarding-mappings.ts b/packages/app/src/react/features/onboarding/data/onboarding-mappings.ts
index 45e76482..4b10a78f 100644
--- a/packages/app/src/react/features/onboarding/data/onboarding-mappings.ts
+++ b/packages/app/src/react/features/onboarding/data/onboarding-mappings.ts
@@ -57,129 +57,3 @@ export const UserOnboardingTeams: ISingleTeam[] = [
{ name: 'Other / Personal', icon: FaUser, value: 'other_personal', category: 'Student/Other' },
{ name: 'Student', icon: FaUserGraduate, value: 'student', category: 'Student/Other' },
];
-
-const agentsByJobType = {
- Marketing: [
- 'customer-review-analysis-lxxqii7231',
- 'email-sender-lu2lt72m98k',
- 'mobile-message-sender-lu2mg4z5i4f',
- 'product-recommendation-agent-lxx90ja8zki',
- 'blog-manager-Shopify',
- 'content_keyphrase_analyzer_agent',
- 'backlink-analysis-agent-lxnw3jp8qz',
- 'content-strategy-generator-luszv3obqx',
- 'smt_basic_content_writer',
- 'youtube-to-seo-content-maker-lxk52qawtmm',
- 'product-description-writer-with-vision',
- 'seo-keyword-researcher-lxngosjnsxb',
- 'document-summarizer-lxx4fegp1b',
- ],
- 'Sales & Account Management': [
- 'lead-contacts-scraper',
- 'linkedin-leads-builder-lwexzixchw',
- 'zendesk-leads-manager-ltinilztfg9',
- 'transcript-analyzer-lx581qpwcq',
- 'hubspot-contacts-creator-ltf6vxjevaq',
- ],
- 'Product & Design': [
- 'customer-review-analysis-lxxqii7231',
- 'email-sender-lu2lt72m98k',
- 'mobile-message-sender-lu2mg4z5i4f',
- 'product-recommendation-agent-lxx90ja8zki',
- 'transparent-bg-image-generator-ltqbf8r3j47',
- ],
- 'Creative Production': [
- 'transparent-bg-image-generator-ltqbf8r3j47',
- 'midjourney-agent-lv443mu22rd',
- 'tutorial__meme_maker',
- 'text-translator-with-audio-converter-ltrsknn0vxi',
- 'smt_template__multimodal_thinking',
- ],
- Operations: [
- 'inflow_inventory_agent',
- 'basic-folder-creator-dropbox',
- 'content-extractor-url-to-text',
- 'document-summarizer-lxx4fegp1b',
- 'azure-ai-vision-ocr-ltgkv9ncjh',
- ],
- Engineering: [
- 'github-content-manager-ltghaklwrs',
- 'email-sender-lu2lt72m98k',
- 'content-extractor-url-to-text',
- 'document-summarizer-lxx4fegp1b',
- 'asana-tasks-manager-lx8ypir4kou',
- ],
- Finance: [
- 'inflow_inventory_agent',
- 'basic-folder-creator-dropbox',
- 'zendesk-leads-manager-ltinilztfg9',
- 'transcript-analyzer-lx581qpwcq',
- 'hubspot-contacts-creator-ltf6vxjevaq',
- ],
- 'HR & Legal': [
- 'pdf-to-text-converter-ltq92c1ba38',
- 'document-summarizer-lxx4fegp1b',
- 'content-extractor-url-to-text',
- 'email-sender-lu2lt72m98k',
- 'basic-folder-creator-dropbox',
- ],
- 'Customer Service': [
- 'product-recommendation-agent-lxx90ja8zki',
- 'bidirectional-messaging-agent-lvy9xokeesu',
- 'tutorial__brand_agent',
- 'customer-review-analysis-lxxqii7231',
- 'mobile-message-sender-lu2mg4z5i4f',
- ],
- 'IT & Support': [
- 'bidirectional-messaging-agent-lvy9xokeesu',
- 'email-sender-lu2lt72m98k',
- 'customer-review-analysis-lxxqii7231',
- 'github-content-manager-ltghaklwrs',
- 'mobile-message-sender-lu2mg4z5i4f',
- ],
- Manufacturing: [
- 'inflow_inventory_agent',
- 'basic-folder-creator-dropbox',
- 'content-extractor-url-to-text',
- 'document-summarizer-lxx4fegp1b',
- 'azure-ai-vision-ocr-ltgkv9ncjh',
- ],
- Student: [
- 'smt_template__multimodal_thinking',
- 'midjourney-agent-lv443mu22rd',
- 'tutorial__meme_maker',
- 'content-extractor-url-to-text',
- 'document-summarizer-lxx4fegp1b',
- ],
- 'Other / Personal': [
- 'smt_template__multimodal_thinking',
- 'midjourney-agent-lv443mu22rd',
- 'tutorial__meme_maker',
- 'content-extractor-url-to-text',
- 'document-summarizer-lxx4fegp1b',
- ],
-};
-
-export const getTemplatesForJobRole = (jobRole, templates) => {
- // Get the array of agent titles for the given job role
- const agentTitlesForJobType = agentsByJobType[jobRole] || [];
-
- // Initialize arrays to hold relevant and other templates
- const relevantTemplates = [];
- const otherTemplates = [];
-
- // Iterate over the templates and categorize them into relevant and other templates
- templates.forEach((template) => {
- if (agentTitlesForJobType.includes(template.id)) {
- relevantTemplates.push(template);
- } else {
- otherTemplates.push(template);
- }
- });
-
- // Return an object with relevant and other templates
- return {
- relevantTemplates,
- otherTemplates,
- };
-};
diff --git a/packages/app/src/react/features/templates/components/templateCard/index.css b/packages/app/src/react/features/templates/components/templateCard/index.css
deleted file mode 100644
index e271f7e4..00000000
--- a/packages/app/src/react/features/templates/components/templateCard/index.css
+++ /dev/null
@@ -1,11 +0,0 @@
-.template-card-tooltip-container button {
- background-image: url('/img/template-card/iconly-king.svg');
- width: 32px;
- height: 32px;
- background-size: contain;
- margin-top: -4px;
-}
-
-.template-card-tooltip-container button:hover {
- background-image: url('/img/template-card/iconly-king-hover.svg');
-}
diff --git a/packages/app/src/react/features/templates/components/templateCard/index.tsx b/packages/app/src/react/features/templates/components/templateCard/index.tsx
deleted file mode 100644
index 1506d9a5..00000000
--- a/packages/app/src/react/features/templates/components/templateCard/index.tsx
+++ /dev/null
@@ -1,431 +0,0 @@
-import { getAgentFallbackDescription } from '@src/react/features/agents/components/agentCard/hooks/useAgentData';
-import { EAgentSettings, TAgentSettings } from '@src/react/features/agents/types/agents.types';
-import { TEMPLATE_DATA } from '@src/react/features/templates/constants/templateData';
-import { Button as CustomButton } from '@src/react/shared/components/ui/newDesign/button';
-import { useAuthCtx } from '@src/react/shared/contexts/auth.context';
-import { navigateTo } from '@src/react/shared/utils/general';
-import { ENTERPRISE_COLLECTION_TEMPLATE_NAMES } from '@src/shared/constants/general';
-import { EVENTS } from '@src/shared/posthog/constants/events';
-import { Analytics } from '@src/shared/posthog/services/analytics';
-import classNames from 'classnames';
-import { Tooltip } from 'flowbite-react';
-import { X } from 'lucide-react';
-import React, { useEffect, useMemo, useState } from 'react';
-import { FaFileAlt } from 'react-icons/fa';
-import { Link, useNavigate } from 'react-router-dom';
-import './index.css';
-
-const sizes = {
- sm: 'w-6 h-6 max-w-6 max-h-6',
- md: 'w-10 h-10 max-w-10 max-h-10',
- lg: 'w-14 h-14 max-w-14 max-h-14',
- xl: 'w-20 h-20 max-w-20 max-h-20',
- '3lg': 'w-[72px] h-[72px] max-w-[72px] max-h-[72px]',
- 'template-card': 'w-6 h-10 max-w-6 max-h-10',
-};
-
-const DEFAULT_AVATAR = '/img/user_default.svg';
-
-interface TemplateCardProps {
- data: any;
- type: 'template' | 'agent';
- suggestedTamplate?: boolean;
-}
-
-function CategoryPill({ category, handleCategoryClick }) {
- return (
- <button
- onClick={() => handleCategoryClick(category.toLowerCase())}
- className={
- 'px-3 py-2 rounded-full dark:border-gray-600 text-gray-500 dark:text-white text-sm bg-gray-100 font-medium font-sans transition-colors duration-300 capitalize'
- }
- >
- {category}
- </button>
- );
-}
-
-const TemplateCard: React.FC<TemplateCardProps> = ({ data, type, suggestedTamplate = false }) => {
- const [showModal, setShowModal] = useState(false);
- const navigate = useNavigate();
- const isEnterpriseCollection = ENTERPRISE_COLLECTION_TEMPLATE_NAMES.includes(data?.name);
- const {
- userInfo: { subs },
- isCustomUser,
- } = useAuthCtx();
- const premiumPlans = [
- 'SmythOS PRO',
- 'Premium',
- 'SmythOS Free',
- 'SmythOS Premium',
- 'SmythOS Starter',
- ];
- const isPremiumProFreeUser = premiumPlans?.includes(subs?.plan?.name || '');
-
- /**
- * Handles click on the card to show the template modal
- * @param {React.MouseEvent} e - The click event
- */
- const handleCardClick = (e) => {
- e.preventDefault();
- e.stopPropagation();
-
- if (suggestedTamplate) {
- Analytics.track(EVENTS.TEMPLATES_EVENTS.SUGGESTED_TEMPLATE_SELECTED, {
- jobType: data?.jobType,
- templateName: data?.name,
- });
- }
- setShowModal(true);
- };
-
- /**
- * Handles direct remix button click to bypass modal
- * @param {React.MouseEvent} e - The click event
- */
- const handleRemixClick = (e) => {
- e.preventDefault();
- e.stopPropagation();
-
- // Track analytics if it's a suggested template
- if (suggestedTamplate) {
- Analytics.track(EVENTS.TEMPLATES_EVENTS.SUGGESTED_TEMPLATE_SELECTED, {
- jobType: data?.jobType,
- templateName: data?.name,
- });
- }
-
- // Navigate directly to builder with template and behavior in new tab
- navigateTo(`/builder?templateId=${data?.file}`, false, '_blank');
- };
-
- const renderIcon = (template) => {
- let { icon, color } = template;
-
- if (typeof icon === 'string' && (icon.startsWith('fa ') || icon.startsWith('fa-'))) {
- const style = color ? { color: color } : {};
- return <i className={`fa ${icon} text-2xl ${sizes['md']}`} style={style}></i>;
- } else {
- const container = document.createElement('div');
- container.innerHTML = icon;
- const svg = container.querySelector('svg');
-
- if (svg) {
- const paths = svg.querySelectorAll('path[fill]');
- let hasFill = false;
-
- paths.forEach((path) => {
- if (path.getAttribute('fill') && path.getAttribute('fill') !== 'none') {
- hasFill = true;
- }
- });
-
- if (!hasFill && color) {
- svg.setAttribute('fill', color);
- }
-
- icon = container.innerHTML;
- }
-
- return (
- <div
- className={classNames('agent-svg-icon mr-2', sizes['template-card'])}
- dangerouslySetInnerHTML={{ __html: icon }}
- />
- );
- }
- };
-
- const openAgentSettings = () => {
- navigate(`/agent-settings/${data.id}`);
- };
-
- // for getting decription of agent and template
- const agentOwner = useMemo(
- () => data?.contributors?.find((contributor) => contributor?.isCreator),
- [data?.contributors],
- );
- const userName = agentOwner?.user?.name || agentOwner?.user?.email || 'User';
- const description = data.description
- ? data.description
- : type === 'agent'
- ? getAgentFallbackDescription(userName, data?.createdAt)
- : '';
-
- // for getting avatar of agent
- const flatSettings = useMemo(
- () =>
- data?.aiAgentSettings?.reduce(
- (acc, setting) => ({ ...acc, [setting.key]: setting.value }),
- {},
- ) as TAgentSettings,
- [data?.aiAgentSettings],
- );
- const avatarImage = flatSettings?.[EAgentSettings.AVATAR] || DEFAULT_AVATAR;
-
- // New pricing plan checks strictly using TypeScript types.
- const planName: string = subs?.plan?.name ?? '';
- // For free, builder, and startup users we want to show an upgrade prompt.
- const isUpgradePlan: boolean =
- planName === 'SmythOS Free' || planName === 'Builder' || planName === 'Startup';
- // For scaleup, enterprise, or custom users we want to show an "Enterprise Collection" message.
- const isEnterprisePlan: boolean =
- planName === 'Scaleup' ||
- planName === 'Enterprise' ||
- planName === 'Enterprise T1' ||
- planName === 'Enterprise T2' ||
- planName === 'Enterprise T3' ||
- planName === 'Enterprise T4' ||
- isCustomUser;
-
- /**
- * Define tooltip content based on the new pricing plan logic.
- */
- let tooltipContent: JSX.Element | null = null;
- if (isUpgradePlan) {
- tooltipContent = (
- <div className="text-center min-w-[200px] text-sm">
- <Link to="/plans" className="underline underline-offset-2 font-bold">
- Upgrade
- </Link>{' '}
- to access this template.
- </div>
- );
- } else if (isEnterprisePlan) {
- tooltipContent = (
- <div className="text-center min-w-[145px] text-sm py-2">Enterprise Collection</div>
- );
- }
-
- // Convert template name to lookup key
- const getTemplateLookupKey = (name: string): string => {
- return name.toLowerCase().replace(/[\s-]/g, '_');
- };
-
- // Get template data from the constant
- const templateKey = getTemplateLookupKey(data?.name);
- const templateData = TEMPLATE_DATA[templateKey] || { videoLink: null, docLink: null };
- // Add modal component
- const TemplateModal = () => {
- // Add useEffect for keyboard event handling
- useEffect(() => {
- const handleEscapeKey = (e: KeyboardEvent) => {
- if (e.key === 'Escape') {
- setShowModal(false);
- }
- };
-
- // Add event listener when modal is shown
- document.addEventListener('keydown', handleEscapeKey);
-
- // Clean up event listener when modal is closed
- return () => {
- document.removeEventListener('keydown', handleEscapeKey);
- };
- }, []);
-
- if (!showModal) return null;
-
- const handleBackdropClick = (e: React.MouseEvent<HTMLDivElement>) => {
- if (e.target === e.currentTarget) {
- setShowModal(false);
- }
- };
-
- // Extract video ID from tutorial URL
- const getVideoId = (url: string) => {
- if (!url) return null;
- const match = url.match(
- /(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([^&?]+)/,
- );
- return match ? match[1] : null;
- };
-
- // Get video ID from templateData
- const videoId = getVideoId(templateData.videoLink);
-
- return (
- <div
- className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50"
- onClick={handleBackdropClick}
- >
- <div className="bg-white rounded-lg shadow-lg p-6 max-w-xl w-full">
- <button
- onClick={(e) => {
- e.stopPropagation();
- setShowModal(false);
- }}
- className={`absolute top-5 right-5 z-50 flex items-center justify-center
- hover:bg-gray-200 p-2 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white
- transition duration-300 rounded-md`}
- >
- <X className="w-5 h-5" color="#1E1E1E" />
- </button>
-
- <div className="flex items-center gap-4 mb-6">
- <div className="flex-shrink-0 w-8 h-8 mr-[-8px]">
- {data?.icon ? (
- renderIcon(data)
- ) : (
- <FaFileAlt className="w-full h-full text-primary-100" />
- )}
- </div>
- <h1 className="text-[20px] leading-[20px] tracking-[0.15px] font-inter font-semibold text-[#1E1E1E]">
- {data?.name}
- </h1>
- </div>
-
- <p className="text-[#1E1E1E] mb-6 font-inter font-normal text-base leading-[22.4px]">
- {data?.description}
- </p>
-
- {/* Video embed - show for all templates with videoLink */}
- {videoId && (
- <div className="relative aspect-video w-full mb-6">
- <iframe
- src={`https://www.youtube.com/embed/${videoId}`}
- title={`${data.name} tutorial video`}
- className="absolute inset-0 w-full h-full rounded-lg"
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
- allowFullScreen
- />
- </div>
- )}
-
- <div className="flex justify-end space-x-3">
- {/* Learn More button - show for all templates with docLink */}
- {templateData.docLink && (
- <CustomButton
- isLink
- reloadDocument
- linkTo={templateData.docLink}
- external
- className="h-[48px] px-8 rounded-lg"
- variant="secondary"
- >
- Learn More
- </CustomButton>
- )}
-
- {/* Video Tutorial button - show if video exists but not embedded */}
- {templateData.videoLink && !videoId && (
- <CustomButton
- isLink
- reloadDocument
- linkTo={templateData.videoLink}
- external
- className="h-[48px] px-8 rounded-lg"
- variant="secondary"
- >
- Watch Tutorial
- </CustomButton>
- )}
-
- <CustomButton
- isLink
- external
- linkTo={`/builder?templateId=${data?.file}`}
- disabled={isEnterpriseCollection && isUpgradePlan}
- label="Remix"
- className="h-[48px] px-8 rounded-lg"
- />
- </div>
- </div>
- </div>
- );
- };
-
- return (
- <>
- <div
- key={data?.id}
- onClick={type === 'agent' ? openAgentSettings : handleCardClick}
- className="bg-gray-50 p-4 border cursor-pointer h-min-[160px] rounded-lg border-solid transition duration-300 border-gray-300 hover:border-blue-500 hover:shadow-md flex flex-col justify-between"
- >
- <div className={classNames('flex justify-between mb-2', { 'gap-4': type === 'agent' })}>
- <div>
- {type === 'template' && (
- <div>
- {data?.icon ? (
- renderIcon(data)
- ) : (
- <FaFileAlt fontSize={24} className="text-primary-100 mr-100" />
- )}
- </div>
- )}
-
- {type === 'agent' && (
- <div className="self-start shrink-0">
- <img
- className={classNames('rounded-full overflow-hidden', sizes['md'])}
- src={avatarImage}
- alt={data?.name || 'Avatar'}
- onError={(e: any) => {
- e.target.src = '/img/use_default_cropped.svg';
- }}
- />
- </div>
- )}
- </div>
- <div className="flex-1">
- <div className="flex flex-col gap-2">
- <div className="flex gap-2 items-center">
- <h3 className="text-base font-medium leading-none">{data?.name}</h3>
- {isEnterpriseCollection &&
- (tooltipContent ? (
- <Tooltip
- content={tooltipContent}
- trigger="hover"
- placement="top"
- style="dark"
- theme={{
- target: 'flex ml-auto template-card-tooltip-container',
- }}
- >
- <button className="template-card-tooltip-button" />
- </Tooltip>
- ) : (
- <div className="flex ml-auto template-card-tooltip-container">
- <button className="template-card-tooltip-button" />
- </div>
- ))}
- </div>
- <p className="text-gray-500 text-sm overflow-hidden text-ellipsis h-10 line-clamp line-clamp-2">
- {description}
- </p>
- </div>
- </div>
- </div>
-
- <div
- className={`flex justify-between mt-auto items-end ${
- !data?.category ? 'flex-row-reverse' : ''
- }`}
- >
- {data?.category && (
- <CategoryPill category={data?.category} handleCategoryClick={() => {}} />
- )}
-
- {!data?.publish && type === 'template' ? (
- <span className="w-auto bg-primary-pink text-white text-xs font-medium px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300">
- Not Published
- </span>
- ) : (
- <CustomButton
- isLink={type === 'agent'}
- reloadDocument={type === 'agent'}
- linkTo={type === 'agent' ? `/builder/${data.id}` : undefined}
- dataAttributes={{ 'data-test': 'edit-agent-button' }}
- handleClick={type === 'template' ? handleRemixClick : undefined}
- variant="tertiary"
- disabled={isEnterpriseCollection && isUpgradePlan}
- label={type === 'agent' ? 'Edit' : 'Remix'}
- />
- )}
- </div>
- </div>
- <TemplateModal />
- </>
- );
-};
-export default TemplateCard;
diff --git a/packages/app/src/react/features/templates/constants/index.ts b/packages/app/src/react/features/templates/constants/index.ts
deleted file mode 100644
index 797a6e96..00000000
--- a/packages/app/src/react/features/templates/constants/index.ts
+++ /dev/null
@@ -1,94 +0,0 @@
-export const SORT_FIELDS_TEMPLATES = [
- {
- title: 'Recommended',
- value: 'recommended',
- isDefault: true,
- },
- {
- title: 'Name',
- value: 'name',
- isDefault: false,
- },
-];
-
-export const TEMPLATE_REQUEST_FORM =
- 'https://forms.clickup.com/8591381/f/8660n-19378/MMG0TYTPJZAL32MZXC';
-
-/**
- * Recommended order mapping based on weighted scores from analytics data
- * Lower numbers indicate higher priority (will appear first)
- */
-export const RECOMMENDED_TEMPLATE_ORDER: Record<string, number> = {
- 'linkedin-post-generator-m7ltws9o6z': 1,
- 'lead-enrichment-agent-m7md03n6g4a': 2,
- 'competitor-researcher-and-analyzer-m7t0ab0h49g': 3,
- 'academic-quiz-master-m8cvyskbuqs': 4,
- 'youtube-to-seo-content-maker-lxk52qawtmm': 5,
- 'content-extractor-url-to-text': 6,
- 'document-summarizer-lxx4fegp1b': 7,
- 'seo-blog-post-writer-m7mi0bksagu': 8,
- 'github-content-manager-ltghaklwrs': 9,
- 'content-strategy-generator-luszv3obqx': 10,
- 'email-outreach-writer-m7ng6dj21g': 11,
- 'amazon-product-review-writer-m17vyjiw43g': 12,
- 'knowledge-base-search-with-genai-m0v85uyy4n': 13,
- 'blog-to-social-converter-m7ojhswtglp': 14,
- 'business-expense-analyzer-m8x189zd53u': 15,
- 'financial-statement-analyzer-m8wz9u9sls': 16,
- 'hubspot-contacts-creator-ltf6vxjevaq': 17,
- 'email-sender-lu2lt72m98k': 18,
- 'tutorial__brand_agent': 19,
- 'case-law-statute-researcher-m8hararxu9': 20,
- 'product-recommendation-agent-lxx90ja8zki': 21,
- 'founder-research-agent-m82y1ovmv5c': 22,
- 'invoice-classifier-agent-m92jjh6n6k': 23,
- 'bidirectional-messaging-agent-lvy9xokeesu': 24,
- 'linkedin-leads-builder-lwexzixchw': 25,
- 'azure-ai-vision-ocr-ltgkv9ncjh': 26,
- 'resume-improvement-assistant-m91akqus6nu': 27,
- 'meeting-preparation-agent-m91dusawyam': 28,
- 'model-comparison-agent-m86hadsis8b': 29,
- 'midjourney-agent-lv443mu22rd': 30,
- 'news_research_agent': 31,
- 'jira-service-desk-agent-m0fkbsvsec': 32,
- 'content-summarizer-reviewer-m86cs7g39wa': 33,
- 'invoice-processing-assistant-m87p24qq4e': 34,
- 'kwrds-ai-seo-content-outliner-m73snf4n71r': 35,
- 'transcript-analyzer-lx581qpwcq': 36,
- 'tutorial__meme_maker': 37,
- 'essay-writer-m87d3gfrpyd': 38,
- 'file-analysis-agent-lxx540tx6a': 39,
- 'seo-keyword-researcher-lxngosjnsxb': 40,
- 'cover-letter-generator-m8x0w64icf': 41,
- 'content_keyphrase_analyzer_agent': 42,
- 'legal-document-review-agent-m8r8kqiylgd': 43,
- 'backlink-analysis-agent-lxnw3jp8qz': 44,
- 'mobile-message-sender-lu2mg4z5i4f': 45,
- 'financial-news-podcaster-m87ly11j6rb': 46,
- 'product-description-writer-with-vision': 47,
- 'legal-document-creator-m88l4otwko7': 48,
- 'smt_template__multimodal_thinking': 49,
- 'transparent-bg-image-generator-ltqbf8r3j47': 50,
- 'survey-response-analyzer-m8x076vajp': 51,
- 'smt_basic_content_writer': 52,
- 'blog-manager-Shopify': 53,
- 'linkedin-news-roundup-maker-ly6730hdd4q': 54,
- 'sentiment-and-emotion-analysis-agent': 55,
- 'inflow_inventory_agent': 56,
- 'essay-reviewer-m7t1xpx5utc': 57,
- 'pdf-to-text-converter-ltq92c1ba38': 58,
- 'lead-contacts-scraper': 59,
- 'seo-keyword-researcher-ltgomx7lhn': 60,
- 'job-interview-question-generator-m919qt551nt': 61,
- 'press-release-agent-m0wisp23bi': 62,
- 'estate-planner-agent-m87nhulxpf': 63,
- 'customer-review-analysis-lxxqii7231': 64,
- 'basic-folder-creator-dropbox': 65,
- 'text-translator-with-audio-converter-ltrsknn0vxi': 66,
- 'zendesk-leads-manager-ltinilztfg9': 67,
- 'job-description-compliance-agent-m8x1p5x8ji': 68,
- 'asana-tasks-manager-lx8ypir4kou': 69,
- 'employee-onboarding-agent-lza2lnxbrlj': 70,
- 'employee-onboarding-agent-m0v9951345': 71,
- 'knowledge-checker-m7t57na7c3e': 72,
-};
diff --git a/packages/app/src/react/features/templates/constants/templateData.ts b/packages/app/src/react/features/templates/constants/templateData.ts
deleted file mode 100644
index 8edac19e..00000000
--- a/packages/app/src/react/features/templates/constants/templateData.ts
+++ /dev/null
@@ -1,175 +0,0 @@
-import { SMYTHOS_DOCS_URL } from '@src/shared/constants/general';
-
-/**
- * Template metadata containing video and documentation links
- */
-export const TEMPLATE_DATA: Record<string, { videoLink: string | null; docLink: string | null }> = {
- amazon_product_review_writer: {
- videoLink: null,
- docLink: null,
- },
- asana_tasks_manager: {
- videoLink: 'https://www.youtube.com/watch?v=jPBCl1Fy9hk',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/ops/asana-task-manager`,
- },
- azure_vision_ocr_agent: {
- videoLink: 'https://www.youtube.com/watch?v=H_7Ipun6nLI',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/azure-vision`,
- },
- backlink_analysis_agent: {
- videoLink: 'https://www.youtube.com/watch?v=kIGjHSSUgjg',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/backlinks-analysis`,
- },
- bidirectional_messaging_agent: {
- videoLink: 'https://www.youtube.com/watch?v=x7b99ekK9oA',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/success/bidirectional-messaging`,
- },
- brand_agent: {
- videoLink: 'https://www.youtube.com/watch?v=3tpI32BH778',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/brand-agent`,
- },
- content_extractor: {
- videoLink: 'https://www.youtube.com/watch?v=ui9_W-JXmH8',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/content-extractor`,
- },
- content_keyphrase_analyzer: {
- videoLink: 'https://www.youtube.com/watch?v=izIPFZzETnA',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/seo-keyword-analyzer`,
- },
- content_strategy_generator: {
- videoLink: 'https://www.youtube.com/watch?v=sD2bchP-Uoo',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/content-strategy-generator`,
- },
- customer_review_analysis: {
- videoLink: 'https://www.youtube.com/watch?v=G09R9NRB37w',
- docLink: null,
- },
- document_summarizer: {
- videoLink: 'https://www.youtube.com/watch?v=I4PLRHQA8Vc',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/success/document-summarizer`,
- },
- dropbox_folder_creator: {
- videoLink: 'https://www.youtube.com/watch?v=cGlk4ONgWVU',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/folder-creator-dropbox`,
- },
- email_sender: {
- videoLink: 'https://www.youtube.com/watch?v=BjuW0cOsbpo',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/sales/email-sender`,
- },
- employee_onboarding_agent: {
- videoLink: null,
- docLink: null,
- },
- file_analysis_agent: {
- videoLink: null,
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/file-analysis`,
- },
- git_hub_content_manager: {
- videoLink: 'https://www.youtube.com/watch?v=HCzyC1vAd7Q',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/github-content-manager`,
- },
- hubspot_contacts_manager: {
- videoLink: 'https://www.youtube.com/watch?v=zICb8AOinDg',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/sales/hubspot-contacts-manager`,
- },
- in_flow_inventory_agent: {
- videoLink: 'https://www.youtube.com/watch?v=w8FG8yaAYcE',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/ops/inflow-inventory`,
- },
- jira_service_desk_agent: {
- videoLink: null,
- docLink: null,
- },
- knowledge_base_search_with_gen_ai: {
- videoLink: null,
- docLink: null,
- },
- 'kwrds.ai_seo_content_outliner': {
- videoLink: 'https://www.youtube.com/watch?v=IdakDNPxpno',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/kwrdsai-seo-content-outliner`,
- },
- lead_contacts_scraper: {
- videoLink: 'https://www.youtube.com/watch?v=RuRIS6a4ANU',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/sales/lead-contacts-scraper`,
- },
- linked_in_leads_builder: {
- videoLink: null,
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/sales/linkedin-leads-builder`,
- },
- meme_maker: {
- videoLink: 'https://www.youtube.com/watch?v=ClvdsDXI-PI',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/meme-agent`,
- },
- midjourney_agent: {
- videoLink: 'https://www.youtube.com/watch?v=uDja74GKMlc',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/midjourney`,
- },
- mobile_message_sender: {
- videoLink: 'https://www.youtube.com/watch?v=j5LDedUh0_g',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/sales/mobile-message-sender`,
- },
- multimodal_thinker: {
- videoLink: 'https://www.youtube.com/watch?v=9bQwHZy-cL0',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/multimodal-thinker`,
- },
- news_researcher: {
- videoLink: 'https://www.youtube.com/watch?v=SgJCK41SzJg',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/news-researcher`,
- },
- pdf_to_text_converter: {
- videoLink: 'https://www.youtube.com/watch?v=5J3OGs0VIck',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/pdf-text-converter`,
- },
- press_release_agent: {
- videoLink: null,
- docLink: null,
- },
- product_description_writer: {
- videoLink: 'https://www.youtube.com/watch?v=JGzVwz-cn0M',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/product-description-writer`,
- },
- product_recommendation_agent: {
- videoLink: null,
- docLink: null,
- },
- sentiment_emotion_analyzer: {
- videoLink: 'https://www.youtube.com/watch?v=3vBinvVJZvE',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/sentiment-emotion-analysis`,
- },
- content_writer: {
- videoLink: 'https://www.youtube.com/watch?v=ClKVBqY3_t8',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/seo-content-writer`,
- },
- seo_keyword_analyzer: {
- videoLink: null,
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/seo-keyword-analyzer`,
- },
- seo_keyword_researcher: {
- videoLink: 'https://www.youtube.com/watch?v=17XGx6tDRWs',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/seo-keyword-researcher`,
- },
- shopify_blog_manager: {
- videoLink: 'https://www.youtube.com/watch?v=qD4Ig_2df-g',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/shopify-blog-manager`,
- },
- text_to_audio_translator: {
- videoLink: 'https://www.youtube.com/watch?v=roQRFVEbprA',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/text-audio-translator`,
- },
- transcript_analyzer: {
- videoLink: 'https://www.youtube.com/watch?v=gsRJ_46GFPw',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/success/transcript-analyzer`,
- },
- transparent_image_maker: {
- videoLink: 'https://www.youtube.com/watch?v=85LcMniv_Zw',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/dev/transparent-image-maker`,
- },
- youtube_to_seo_content_maker: {
- videoLink: 'https://www.youtube.com/watch?v=DAMe6I9nZZ8',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/marketing/youtube-to-seo-content-maker`,
- },
- zendesk_leads_manager: {
- videoLink: 'https://www.youtube.com/watch?v=z-mMICXkuX4',
- docLink: `${SMYTHOS_DOCS_URL}/agent-templates/sales/zendesk-leads-manager`,
- },
-} as const;
diff --git a/packages/app/src/react/features/templates/data/templates.json b/packages/app/src/react/features/templates/data/templates.json
deleted file mode 100644
index 2d376f3e..00000000
--- a/packages/app/src/react/features/templates/data/templates.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "categories": ["All", "Marketing", "Sales", "Dev", "Research", "Platform", "Analysis", "Chat", "Legal", "HR", "Education", "Finance", "Ops", "Success"]
-}
diff --git a/packages/app/src/react/features/templates/hooks/useFetchTemplates.ts b/packages/app/src/react/features/templates/hooks/useFetchTemplates.ts
deleted file mode 100644
index 05d92cdf..00000000
--- a/packages/app/src/react/features/templates/hooks/useFetchTemplates.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-============= Hook usage ===============
-const { data, error, isLoading, refetch, invalidate, setData } = useFetchTemplates({
- options: { refetchOnWindowFocus: false } // Your query options
-});
-*/
-
-import { useQuery, useQueryClient } from '@tanstack/react-query';
-
-const fetchTemplates = async () => {
- const res = await fetch('/api/page/templates/agent-templates');
-
- if (!res.ok) {
- throw new Error('Network response was not ok');
- }
- const { data } = await res.json();
-
- // Converting agentTemplates object of objects into an array of [key, value] pairs for processing
- const templatesArray = Object.entries(data)?.map(([key, value]: any) => ({
- ...value,
- file: key,
- }));
-
- return templatesArray;
-};
-
-export const useFetchTemplates = ({ options = {} } = {}) => {
- const queryClient = useQueryClient();
-
- const queryResult = useQuery({
- queryKey: ['fetch_templates'],
- queryFn: () => fetchTemplates(),
- ...options, // Additional options for useQuery
- });
-
- // Refetch the query manually
- const refetch = queryResult.refetch;
-
- // Invalidate the query to force a refetch
- const invalidate = () => queryClient.invalidateQueries(['fetch_templates']);
-
- // Set new data for the query
- const setData = (newData) => queryClient.setQueryData(['fetch_templates'], newData);
-
- return {
- ...queryResult, // Include all returned data and methods from useQuery
- refetch,
- invalidate,
- setData,
- };
-};
diff --git a/packages/app/src/react/features/templates/pages/TemplatesPage.tsx b/packages/app/src/react/features/templates/pages/TemplatesPage.tsx
deleted file mode 100644
index 22c5df45..00000000
--- a/packages/app/src/react/features/templates/pages/TemplatesPage.tsx
+++ /dev/null
@@ -1,253 +0,0 @@
-import { debounce } from 'lodash-es';
-import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
-
-import TemplateCard from '@src/react/features/templates/components/templateCard';
-import {
- RECOMMENDED_TEMPLATE_ORDER,
- SORT_FIELDS_TEMPLATES,
- TEMPLATE_REQUEST_FORM,
-} from '@src/react/features/templates/constants';
-import { categories } from '@src/react/features/templates/data/templates.json';
-import HeaderSearch from '@src/react/shared/components/headerSearch';
-import {
- AscendingIcon,
- AvatarIcon,
- DescendingIcon,
- FileIcon,
-} from '@src/react/shared/components/svgs';
-import { useAuthCtx } from '@src/react/shared/contexts/auth.context';
-import { FRONTEND_USER_SETTINGS } from '@src/react/shared/enums';
-import { navigateTo } from '@src/react/shared/utils/general';
-
-const CategoryPill = ({ category, handleCategoryClick, isActive }) => {
- return (
- <button
- onClick={() => handleCategoryClick(category.toLowerCase())}
- className={`px-4 py-1 capitalize rounded-full dark:border-gray-600 text-gray-900 dark:text-white text-sm bg-gray-200 hover:bg-v2-blue hover:text-white font-medium font-sans transition-colors duration-100 ${
- isActive ? 'bg-v2-blue text-white' : ''
- }`}
- >
- {category}
- </button>
- );
-};
-
-const TemplatesPage = () => {
- const [agentTemplates, setAgentTemplates] = useState([]);
- const [searchQuery, setSearchQuery] = useState<string>('');
- const [sortCriteria, setSortCriteria] = useState<string>(() => {
- // Load from localStorage to meet requirement: "If switched back, order should persist across sessions"
- // Defaults to "Recommended" as specified: "Recommended should be the default order"
- const saved = localStorage.getItem(FRONTEND_USER_SETTINGS.TEMPLATES_SORT_CRITERIA);
- return (saved || SORT_FIELDS_TEMPLATES.find((s) => s.isDefault)?.value) ?? 'recommended';
- });
- const [sortOrder, setSortOrder] = useState('asc');
- const [isLoadingMore, setIsLoadingMore] = useState(false);
- const [isInitialLoading, setIsInitialLoading] = useState(true);
- const [isLoadingAfterAction, setIsLoadingAfterAction] = useState(false);
- const [activeCategory, setActiveCategory] = useState('All');
-
- const endOfPageRef = useRef(null);
- const { hasReadOnlyPageAccess } = useAuthCtx();
- const isReadOnlyAccess = hasReadOnlyPageAccess('/templates');
- const toggleSortOrder = () => setSortOrder((sortOrder) => (sortOrder === 'asc' ? 'desc' : 'asc'));
-
- /**
- * Handle sort criteria change with localStorage persistence
- *
- * We use localStorage to meet the requirement:
- * "If switched back, order should persist across sessions"
- *
- * When user switches from default "Recommended" to "Name" sorting,
- * their choice must persist when they close/reopen the browser.
- * localStorage provides this cross-session persistence for the sorting preference.
- */
- const handleSortCriteriaChange = (newCriteria: string) => {
- setSortCriteria(newCriteria);
- localStorage.setItem(FRONTEND_USER_SETTINGS.TEMPLATES_SORT_CRITERIA, newCriteria);
- };
-
- /**
- * Get recommended order for a template based on its ID
- */
- const getRecommendedOrder = (templateId: string): number => {
- return RECOMMENDED_TEMPLATE_ORDER[templateId] ?? 9999; // Default to end if not found
- };
-
- useEffect(() => {
- setIsLoadingAfterAction(true);
- fetch('/api/page/templates/agent-templates')
- .then((response) => response.json())
- .then(({ data }) => {
- setAgentTemplates(data);
- })
- .catch((error) => {
- console.error(`Error fetching templates: ${error}`);
- })
- .finally(() => {
- setIsInitialLoading(false);
- setIsLoadingMore(false);
- setIsLoadingAfterAction(false);
- });
- }, []);
-
- const handleSearch = useCallback(debounce(setSearchQuery, 200), []);
-
- const handleCreateTemplateClick = () => navigateTo(TEMPLATE_REQUEST_FORM, false, '_blank');
-
- const sortedAndFilteredTemplates = useMemo(() => {
- // Converting agentTemplates object of objects into an array of [key, value] pairs for processing
- const templatesArray = Object.entries(agentTemplates).map(([key, value]) => ({
- ...value,
- file: key,
- }));
-
- // First apply filters
- let filtered = templatesArray;
- if (activeCategory !== 'All') {
- filtered = filtered.filter(
- (item) => item.category?.toLowerCase() === activeCategory.toLowerCase(),
- );
- }
-
- if (searchQuery) {
- const query = searchQuery.toLowerCase();
- filtered = filtered.filter(
- (item) =>
- item.name?.toLowerCase().includes(query) ||
- item.description?.toLowerCase().includes(query),
- );
- }
-
- // Then apply sorting
- return filtered.sort((a, b) => {
- if (sortCriteria === 'recommended') {
- // For recommended sorting, use the predefined order
- const aOrder = getRecommendedOrder(a.id);
- const bOrder = getRecommendedOrder(b.id);
-
- // Apply sort direction to recommended order
- return sortOrder === 'asc' ? aOrder - bOrder : bOrder - aOrder;
- } else {
- // For other criteria (like name), use string comparison
- const aValue = a[sortCriteria];
- const bValue = b[sortCriteria];
-
- if (typeof aValue === 'string' && typeof bValue === 'string') {
- return sortOrder === 'asc' ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
- }
- return 0;
- }
- });
- }, [agentTemplates, searchQuery, sortCriteria, sortOrder, activeCategory]);
-
- const renderSkeletonLoading = () => {
- return Array(5)
- .fill(0)
- .map((_, index) => (
- <div
- role="status"
- key={`${_}${index}`}
- className="w-full p-4 border border-gray-200 rounded shadow animate-pulse md:p-6 dark:border-gray-700"
- >
- <div className="flex items-center justify-center h-12 mb-4 bg-gray-300 rounded dark:bg-gray-700">
- <FileIcon />
- </div>
- <div className="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
- <div className="h-2 bg-gray-200 rounded-full dark:bg-gray-700 mb-2.5"></div>
- <div className="h-2 bg-gray-200 rounded-full dark:bg-gray-700 mb-2.5"></div>
- <div className="h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
- <div className="flex items-center mt-4 space-x-3">
- <AvatarIcon />
- <div>
- <div className="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-32 mb-2"></div>
- <div className="w-48 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
- </div>
- </div>
- <span className="sr-only">Loading...</span>
- </div>
- ));
- };
-
- const handleCategoryClick = (category: string) => setActiveCategory(category);
-
- const renderTemplateCategories = () => {
- return (
- <div className="flex flex-wrap gap-2 w-full justify-center sm:justify-start">
- {categories.map((category) => (
- <CategoryPill
- key={category}
- category={category}
- handleCategoryClick={() => handleCategoryClick(category)}
- isActive={activeCategory.toLowerCase() === category.toLowerCase()}
- />
- ))}
- </div>
- );
- };
-
- return (
- <div>
- <main className="pl-12 md:pl-0">
- <div className="flex mb-4 justify-between flex-wrap gap-4 sm:items-center">
- <div className="w-full sm:w-auto self-center flex justify-center sm:justify-start">
- {renderTemplateCategories()}
- </div>
- <div className="w-full sm:w-max flex justify-between gap-2 flex-col sm:flex-row sm:flex-nowrap">
- <div className="flex items-center">
- <select
- id="sorting"
- onChange={(e) => handleSortCriteriaChange(e.target.value)}
- value={sortCriteria}
- className="bg-gray-50 w-36 border border-gray-300 text-gray-900 text-sm rounded focus:ring-blue-500 focus:border-blue-500 block px-4 py-2 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
- >
- {SORT_FIELDS_TEMPLATES.map((s) => (
- <option key={s.value} value={s.value}>
- {s.title}
- </option>
- ))}
- </select>
-
- <button onClick={toggleSortOrder} className="mx-2" aria-label="Sort agents">
- {sortOrder === 'asc' ? <AscendingIcon /> : <DescendingIcon />}
- </button>
- </div>
- <HeaderSearch
- handleChange={(e) => handleSearch(e.target.value)}
- handleClick={() => handleCreateTemplateClick()}
- label="Request a Template"
- addIcon={false}
- search
- placeholder="Search Templates"
- isReadOnlyAccess={isReadOnlyAccess}
- btnAttributes={{ 'data-test': 'add-template-button' }}
- />
- </div>
- </div>
-
- <div className="py-5 mx-auto">
- <div className="grid gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-3 min-[1900px]:grid-cols-5 ">
- {isInitialLoading || isLoadingAfterAction ? (
- renderSkeletonLoading()
- ) : sortedAndFilteredTemplates?.length === 0 ? (
- <div className="py-5 mx-auto w-11/12">
- <p className="secondary-grey mt-15">No templates available.</p>
- </div>
- ) : (
- <>
- {sortedAndFilteredTemplates &&
- sortedAndFilteredTemplates.map((template, index) => (
- <TemplateCard data={template} key={template.name + index} type="template" />
- ))}
- {isLoadingMore && renderSkeletonLoading()}
- </>
- )}
- </div>
- <div ref={endOfPageRef}></div>
- </div>
- </main>
- </div>
- );
-};
-
-export default TemplatesPage;
diff --git a/packages/app/src/react/features/templates/utils.ts b/packages/app/src/react/features/templates/utils.ts
deleted file mode 100644
index 9cc62942..00000000
--- a/packages/app/src/react/features/templates/utils.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { OUT_OF_BOX_TEMPLATES } from '@src/builder-ui/constants';
-
-export const filterTemplates = (
- templatesArray,
- activeCategory = 'All',
- searchQuery = '',
- sortCriteria = 'name',
- sortOrder = 'asc',
-) => {
- // Filter by category if not 'All'
- const categoryFilteredTemplates =
- activeCategory.toLowerCase() === 'all'
- ? templatesArray
- : templatesArray.filter((template) => template.category.toLowerCase() === activeCategory);
-
- const filteredTemplates = categoryFilteredTemplates.filter(({ name, description }) => {
- const searchFields = [name, description];
- return searchFields.some(
- (field) => field && field.toLowerCase().includes(searchQuery.toLowerCase()),
- );
- });
-
- // Get non-priority templates
- const nonPriorityTemplates = filteredTemplates.filter((template) => {
- return !OUT_OF_BOX_TEMPLATES.includes(template.id);
- });
-
- // Sort non-priority templates
- const sortedNonPriorityTemplates = nonPriorityTemplates.sort((a, b) => {
- const aValue = a[sortCriteria];
- const bValue = b[sortCriteria];
- if (aValue === undefined || bValue === undefined) return 0;
- return sortOrder === 'asc' ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
- });
-
- // Find priority templates from templatesArray in OUT_OF_BOX_TEMPLATES order
- const sortedPriorityTemplates = OUT_OF_BOX_TEMPLATES.map((id) =>
- templatesArray.find((template) => template.id === id),
- ).filter(Boolean); // Remove undefined entries
-
- return [...sortedPriorityTemplates, ...sortedNonPriorityTemplates];
-};
diff --git a/packages/app/src/react/shared/constants/navigation.ts b/packages/app/src/react/shared/constants/navigation.ts
index 3810546e..3d67fb86 100644
--- a/packages/app/src/react/shared/constants/navigation.ts
+++ b/packages/app/src/react/shared/constants/navigation.ts
@@ -1,6 +1,6 @@
import { plugins, PluginTarget, PluginType } from '@src/react/shared/plugins/Plugins';
import { SMYTHOS_DOCS_URL } from '@src/shared/constants/general';
-import { BookIcon, DiscordIcon, GridIcon, HomeIcon, KeyIcon } from '../components/svgs';
+import { BookIcon, DiscordIcon, HomeIcon, KeyIcon } from '../components/svgs';
export const PRICING_PLAN_REDIRECT = 'https://smythos.com/pricing/';
@@ -15,7 +15,7 @@ export type SidebarMenuItem = {
};
export const getSidebarMenuItems = (): SidebarMenuItem[] => {
- let pluginItems = (
+ const pluginItems = (
plugins.getPluginsByTarget(PluginTarget.SidebarMenuItems, PluginType.Config) as {
config: SidebarMenuItem;
}[]
@@ -24,7 +24,6 @@ export const getSidebarMenuItems = (): SidebarMenuItem[] => {
return [
{ url: '/agents', name: 'Home', icon: HomeIcon, visible: true, order: 1 },
{ url: '/vault', name: 'Vault', icon: KeyIcon, visible: true, order: 5 },
- { url: '/templates', name: 'Templates', icon: GridIcon, visible: true, order: 6 },
...pluginItems,
].sort((a, b) => (a.order || 0) - (b.order || 0));
};
diff --git a/packages/app/src/react/shared/plugins/Plugins.ts b/packages/app/src/react/shared/plugins/Plugins.ts
index ef1dc22a..1ecf52b9 100644
--- a/packages/app/src/react/shared/plugins/Plugins.ts
+++ b/packages/app/src/react/shared/plugins/Plugins.ts
@@ -9,6 +9,7 @@ export enum PluginTarget {
AgentSettingsSkillsWidgetSkillButton = 'agentSettings/skillsWidget/skillButton',
BuilderSidebarComponentItems = 'builder/sidebarComponentItems',
BuilderSREComponents = 'builder/sreComponents',
+ AgentsPageSection = 'agentsPage/section',
}
export enum PluginType {
diff --git a/packages/app/src/react/tsconfig.app.json b/packages/app/src/react/tsconfig.app.json
index 6fb840e7..a5e4126e 100644
--- a/packages/app/src/react/tsconfig.app.json
+++ b/packages/app/src/react/tsconfig.app.json
@@ -40,5 +40,5 @@
"../eslint.config.js",
"../../../../../src/react/features/onboarding/constants",
"../../../../../src/react/features/onboarding/utils"
- ]
+, "../../../../../src/react/features/templates/components/AgentsPageTemplateSection.tsx" ]
}
diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.json
index 4da17943..024c1687 100644
--- a/packages/app/tsconfig.json
+++ b/packages/app/tsconfig.json
@@ -22,7 +22,7 @@
"include": [
"src/**/*",
"node_modules/@types",
- "eslint.config.js", "../../../src/server/api/pages/quota.ts", "../../../src/react/features/subscriptions/utils", "../../../src/react/features/agent-settings/pages/AgentSettingsBulkCallPage.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/BulkSkillCallForm.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/meta/skill-calls-utils.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/meta/UploadDataBtn.tsx",
+ "eslint.config.js", "../../../src/server/api/pages/quota.ts", "../../../src/react/features/subscriptions/utils", "../../../src/react/features/agent-settings/pages/AgentSettingsBulkCallPage.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/BulkSkillCallForm.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/meta/skill-calls-utils.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/meta/UploadDataBtn.tsx", "../../../src/react/features/templates/components/AgentsPageTemplateSection.tsx",
],
"exclude": ["node_modules"]
}