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.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
migrate agent-settings widgets, plans managemnt pages
Ahmed Essam3993a92e5806
diff --git a/packages/app/eslint.config.js b/packages/app/eslint.config.jsindex 186d350a..d8328e2a 100644--- a/packages/app/eslint.config.js+++ b/packages/app/eslint.config.js@@ -40,6 +40,8 @@ export default tseslint.config('no-debugger': 'warn','no-empty': 'warn',+ 'max-len': 'off',+// TypeScript'@typescript-eslint/no-unused-vars': 'warn','@typescript-eslint/explicit-module-boundary-types': 'off',@@ -58,7 +60,6 @@ export default tseslint.config(quotes: ['warn', 'single'],semi: ['warn', 'always'],'comma-dangle': ['warn', 'only-multiline'],- 'max-len': ['warn', { code: 120 }],// '@typescript-eslint/no-unnecessary-condition': 'warn',},},diff --git a/packages/app/src/backend/routes/api/page/aiagents.ts b/packages/app/src/backend/routes/api/page/aiagents.tsdeleted file mode 100644index b627f856..00000000--- a/packages/app/src/backend/routes/api/page/aiagents.ts+++ /dev/null@@ -1,91 +0,0 @@-import express from 'express';-import { authHeaders, smythAPIReq } from '../../../utils';-import { getAgents } from '../../../services/user-data.service';-const router = express.Router();--// routes for dynamic content goes here--router.get('/agent/:id/settings', async (req, res) => {- const { id } = req.params;- try {- const response = await smythAPIReq.get(`/ai-agent/${id}/settings`, await authHeaders(req));-- return res.json(response.data.settings);- } catch (error) {- return res.status(500).json({ error: 'Something went wrong while fetching agent settings' });- }-});--router.put('/agent/:id/settings', async (req, res) => {- const { id } = req.params;- const data = req.body;- try {- const response = await smythAPIReq.put(- `/ai-agent/${id}/settings`,- data,- await authHeaders(req),- );-- return res.json(response.data.message);- } catch (error) {- console.log(error.message);- return res.status(500).json({ error: 'Something went wrong while updating agent settings' });- }-});--router.post('/embodiment', async (req, res) => {- try {- const response = await smythAPIReq.post(`/embodiments`, req.body, await authHeaders(req));-- return res.json(response.data);- } catch (error) {- console.log(error.message);- return res.status(500).json({ error: 'Something went wrong while saving the embodiment' });- }-});--router.put('/embodiment', async (req, res) => {- try {- const response = await smythAPIReq.put(`/embodiments`, req.body, await authHeaders(req));-- return res.json(response.data);- } catch (error) {- console.log(error.message);- return res.status(500).json({ error: 'Something went wrong while updating the embodiment' });- }-});--router.get('/embodiments/:id', async (req, res) => {- try {- const { id } = req.params;- const response = await smythAPIReq.get(`/embodiments?aiAgentId=${id}`, await authHeaders(req));-- return res.json(response.data);- } catch (error) {- console.log(error.message);- return res.status(500).json({ error: 'Something went wrong while fetching the embodiment' });- }-});--router.get('/agents', async (req, res) => {- try {- const { page, limit, search, sortField, order } = req.query;- const includeSettings = true;- const _agents = await getAgents(- req,- includeSettings,- page.toString(),- limit.toString(),- search,- sortField,- order,- );-- return res.json(_agents);- } catch (error) {- console.log(error.message);- return res.status(500).json({ error: 'Something went wrong while fetching agents list' });- }-});--export default router;diff --git a/packages/app/src/backend/routes/api/page/index.ts b/packages/app/src/backend/routes/api/page/index.tsindex 03098766..b21cc371 100644--- a/packages/app/src/backend/routes/api/page/index.ts+++ b/packages/app/src/backend/routes/api/page/index.ts@@ -1,14 +1,11 @@import account from './account';import agentSettings from './agent-settings';import agents from './agents';-import aiagents from './aiagents';import builder from './builder';import { chatRouter } from './chat';import collection from './collection';import logs from './logs';import { onboardRouter } from './onboard';-import plans from './plans';-import quota from './quota';import teams from './teams';import templates from './templates';import user from './user';@@ -21,10 +18,7 @@ const routers = {user,builder,vault,- plans,- quota,account,- aiagents,agent_settings: agentSettings,logs,chat: chatRouter,diff --git a/packages/app/src/backend/routes/api/page/plans.ts b/packages/app/src/backend/routes/api/page/plans.tsdeleted file mode 100644index 50591dbd..00000000--- a/packages/app/src/backend/routes/api/page/plans.ts+++ /dev/null@@ -1,34 +0,0 @@-import express from 'express';-import { authHeaders, forwardToSmythAPIMiddleware, smythAPI } from '../../../utils';--const router = express.Router();-const smythProxy = forwardToSmythAPIMiddleware();--router.get('/subscriptions/*', smythProxy);--router.post('/subscriptions/checkout/generate-session', async (req, res) => {- const tid = req.cookies['_fprom_tid'];-- try {- const response = await smythAPI.post(- '/subscriptions/checkout/generate-session',- {- ...req.body,- tid,- },- await authHeaders(req),- );-- return res.json(response.data);- } catch (error) {- return res- .status(error.response?.status || 500)- .json(error.response?.data || { error: 'Internal Server Error' });- }-});--router.post('/subscriptions/*', smythProxy);-router.put('/subscriptions/*', smythProxy);-router.delete('/subscriptions/*', smythProxy);--export default router;diff --git a/packages/app/src/backend/routes/api/page/quota.ts b/packages/app/src/backend/routes/api/page/quota.tsdeleted file mode 100644index 00255812..00000000--- a/packages/app/src/backend/routes/api/page/quota.ts+++ /dev/null@@ -1,12 +0,0 @@-import express from 'express';-import { forwardToSmythAPIMiddleware } from '../../../utils';--const router = express.Router();-const smythProxy = forwardToSmythAPIMiddleware();--router.get('/quota/*', smythProxy);-router.post('/quota/*', smythProxy);-router.put('/quota/*', smythProxy);-router.delete('/quota/*', smythProxy);--export default router;diff --git a/packages/app/src/react/app/routeMap.tsx b/packages/app/src/react/app/routeMap.tsxindex adbb487c..8eb133d6 100644--- a/packages/app/src/react/app/routeMap.tsx+++ b/packages/app/src/react/app/routeMap.tsx@@ -8,16 +8,7 @@ import AgentSettingsPage from '../features/agent-settings/pages/AgentSettingsPagimport AIChatPage from '../features/ai-chat/pages/ai-chat';import PartnersPage from '../features/partners/pages/PartnersPage';import FeaturePageUpsell from '../features/subscriptions/components/paywalls/feature-page-upsell';-import {- EnterpriseT1PageV4,- EnterpriseT2PageV4,- EnterpriseT3PageV4,- EnterpriseT4PageV4,- PartnerPageV4,-} from '../features/subscriptions/pages/EnterpriseTierPagesV4';-import MultiComponentSubscriptionPage from '../features/subscriptions/pages/MultiComponentSubscriptionPage';-import { PlansPricingPage } from '../features/subscriptions/pages/PlansPricingPage';-import SinglePriceSubscriptionPage from '../features/subscriptions/pages/SinglePriceSubscriptionPage';+import TemplatesPage from '../features/templates/pages/TemplatesPage';@@ -26,18 +17,9 @@ export const routeMap: IPageRoute[] = [{ path: '/templates', component: TemplatesPage, title: 'Templates' },- {- path: '/plans',- component: PlansPricingPage,- title: 'Plans',- },+{ path: '/partners', component: PartnersPage, title: 'Partners' },- {- path: '/subscriptions/:priceId',- component: SinglePriceSubscriptionPage,- title: 'Subscription',- },- { path: '/subscriptions', component: MultiComponentSubscriptionPage, title: 'Subscription' },+{ path: '/account', component: AccountPage, title: 'Account' },{path: '/account-deleted',@@ -84,49 +66,10 @@ export const routeMap: IPageRoute[] = [},},- {- path: '/enterprise-t1',- component: EnterpriseT1PageV4,- title: 'Enterprise T1',- skipAuth: true,- layoutOptions: {- sidebar: true,- topMenu: true,- },- },- {- path: '/enterprise-t2',- component: EnterpriseT2PageV4,- title: 'Enterprise T2',- skipAuth: true,- layoutOptions: {- sidebar: true,- topMenu: true,- },- },- {- path: '/enterprise-t3',- component: EnterpriseT3PageV4,- title: 'Enterprise T3',- skipAuth: true,- layoutOptions: {- sidebar: true,- topMenu: true,- },- },- {- path: '/enterprise-t4',- component: EnterpriseT4PageV4,- title: 'Enterprise T4',- skipAuth: true,- layoutOptions: {- sidebar: true,- topMenu: true,- },- },+{path: '/partner',- component: PartnerPageV4,+ component: PartnersPage,title: 'Partner',skipAuth: true,layoutOptions: {diff --git a/packages/app/src/react/features/agent-settings/components/CapabilitiesWidget/index.tsx b/packages/app/src/react/features/agent-settings/components/CapabilitiesWidget/index.tsxindex dd4cb260..ef9825f0 100644--- a/packages/app/src/react/features/agent-settings/components/CapabilitiesWidget/index.tsx+++ b/packages/app/src/react/features/agent-settings/components/CapabilitiesWidget/index.tsx@@ -13,11 +13,11 @@ import { useState } from 'react';import { FaPlay } from 'react-icons/fa';type Props = {- isSubscribedToPlan?: boolean;+ isOnPaidPlan?: boolean;isWriteAccess: boolean;};-const CapabilitiesWidget = ({ isSubscribedToPlan, isWriteAccess }: Props) => {+const CapabilitiesWidget = ({ isOnPaidPlan: isSubscribedToPlan, isWriteAccess }: Props) => {const { latestAgentDeploymentQuery } = useAgentSettingsCtx();return (<WidgetCard isWriteAccess={isWriteAccess} showOverflow={true}>diff --git a/packages/app/src/react/features/agent-settings/components/LogsWidget.tsx b/packages/app/src/react/features/agent-settings/components/LogsWidget.tsxdeleted file mode 100644index e039a391..00000000--- a/packages/app/src/react/features/agent-settings/components/LogsWidget.tsx+++ /dev/null@@ -1,115 +0,0 @@-import WidgetCard from '@react/features/agent-settings/components/WidgetCard';-import {- V4_ENTERPRISE_PLANS-} from '@react/features/agent-settings/constants';-import { useAgentSettingsCtx } from '@react/features/agent-settings/contexts/agent-settings.context';-import ExportChatLogsModal from '@react/features/agent-settings/modals/ExportChatLogsModal';-import { useAuthCtx } from '@react/shared/contexts/auth.context';-import { EVENTS } from '@src/shared/posthog/constants/events';-import { PostHog } from '@src/shared/posthog/index';-import { useState } from 'react';-import { createPortal } from 'react-dom';-import { FaRegListAlt } from 'react-icons/fa';-import { FaArrowRight, FaDownload } from 'react-icons/fa6';--type Props = {- isWriteAccess?: boolean;- isSubscribedToPlan?: boolean;- userInfo?: {- subs?: {- plan?: {- paid: boolean;- name?: string;- };- };- isCustomUser?: boolean;- };-};--const LogsWidget = ({ isSubscribedToPlan, isWriteAccess, userInfo }: Props) => {- const { agentId } = useAgentSettingsCtx();- const { userInfo: authUserInfo } = useAuthCtx();- const [showExportLogs, setShowExportLogs] = useState(false);-- const getLogRetentionDays = (): number => {- if (userInfo?.isCustomUser) return 90;-- switch (userInfo?.subs?.plan?.name) {- case 'Scaleup':- return 90;- case 'Startup':- case 'Builder':- return 30;- default:- return 7;- }- };-- const logRetentionDays = getLogRetentionDays();- const hasMaxRetention = logRetentionDays === 90;-- // Check if user has access to export logs (enterprise plans only)- const canExportLogs = V4_ENTERPRISE_PLANS.includes(authUserInfo?.subs?.plan?.name);-- return (- <WidgetCard title="" isWriteAccess={isWriteAccess}>- <div className={'bg-gray-50 p-4 space-y-6'} data-qa="agent-history-container">- {/* Agent History Section */}- <div>- <h3 className="text-gray-700 text-sm font-semibold mb-2">Agent History</h3>-- <p className="text-sm text-gray-500 mb-4">- {hasMaxRetention- ? 'Agent logs for up to 90 days are available.'- : `Logs are currently available for up to ${logRetentionDays} days. Upgrade to access up to 90 days of log storage.`}- </p>-- <div className="flex justify-end">- <a- href={`/logs/${agentId}`}- target="_blank"- className="text-sm text-blue-500 hover:text-blue-700 flex items-center gap-2"- onClick={() => {- PostHog.track(EVENTS.AGENT_SETTINGS_EVENTS.app_view_logs_click, {});- }}- >- <FaRegListAlt className="w-4 h-4" />- <span>View logs</span>- <FaArrowRight className="w-3 h-3" />- </a>- </div>- </div>-- {/* Export Logs Section */}- {canExportLogs && (- <div className="border-t border-gray-200 pt-4">- <h3 className="text-gray-700 text-sm font-semibold mb-2">Export Chat Conversations</h3>- <p className="text-sm text-gray-500 mb-4">- Download your chat conversation history as a JSON file for analysis or backup- purposes.- </p>-- <div className="flex justify-end">- <button- onClick={() => setShowExportLogs(true)}- className="text-sm text-blue-500 hover:text-blue-700 flex items-center gap-2"- >- <FaDownload className="w-4 h-4" />- <span>Export Conversations</span>- </button>- </div>- </div>- )}- </div>-- {/* Export Logs Modal */}- {showExportLogs &&- createPortal(- <ExportChatLogsModal onClose={() => setShowExportLogs(false)} agentId={agentId} />,- document.body,- )}- </WidgetCard>- );-};--export default LogsWidget;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/index.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/index.tsxdeleted file mode 100644index 1accddeb..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/index.tsx+++ /dev/null@@ -1,65 +0,0 @@-import CreateSchedule from '@react/features/agent-settings/components/ScheduleWidget/modes/create/CreateSchedule';-import ScheduleInfoView from '@react/features/agent-settings/components/ScheduleWidget/modes/job_info/ScheduleInfoView';-import ListSchedules from '@react/features/agent-settings/components/ScheduleWidget/modes/list/ListSchedules';-import WidgetSubscribeInfo from '@react/features/agent-settings/components/widget-subscribe-info';-import WidgetCard from '@react/features/agent-settings/components/WidgetCard';-import { WIDGETS_PRICING_ALERT_TEXT } from '@react/features/agent-settings/constants';-import { AgentScheduledJob } from '@react/shared/types/api-results.types';-import { useState } from 'react';--type Props = {- isSubscribedToPlan?: boolean;- isWriteAccess: boolean;-};-type Mode = {- id: 'LIST' | 'EDIT' | 'CREATE' | 'INFO';- data: { job?: AgentScheduledJob };-};--const ScheduleWidget = ({ isSubscribedToPlan, isWriteAccess }: Props) => {- const [currMode, setCurrMode] = useState<Mode>({ id: 'LIST', data: {} });-- const modeToComponent: {- [key in Mode['id']]: JSX.Element;- } = {- LIST: <ListSchedules changeView={changeView} />,- EDIT: <div></div>,- CREATE: <CreateSchedule changeView={changeView} />,- INFO: <ScheduleInfoView changeView={changeView} contextData={currMode.data} />,- };-- const viewComponent = modeToComponent[currMode.id];-- function changeView(id: Mode['id'], data: Mode['data']) {- setCurrMode({ id, data });- }-- if (!isSubscribedToPlan) {- return (- <WidgetCard title="" showOverflow>- <div className="bg-gray-50 p-4" data-qa="schedule-container">- <h3 className="flex items-center gap-2 text-gray-700 text-sm font-semibold mb-2">- Schedule- </h3>- <p className="text-sm text-gray-500">- Plan and automate task execution with agent work scheduler.- </p>- <WidgetSubscribeInfo- infoText={WIDGETS_PRICING_ALERT_TEXT.SCHEDULE}- analytics={{ page_url: '/agent-settings', source: 'schedule' }}- />- </div>- </WidgetCard>- );- }-- return (- <WidgetCard title="" isWriteAccess={isWriteAccess} showOverflow>- <div className="bg-gray-50 p-4" data-qa="schedule-container">- {viewComponent}- </div>- </WidgetCard>- );-};--export default ScheduleWidget;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/Mini-Components.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/Mini-Components.tsxdeleted file mode 100644index 7dad29db..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/Mini-Components.tsx+++ /dev/null@@ -1,138 +0,0 @@-import { InputHTMLAttributes, ReactNode, SelectHTMLAttributes } from 'react';--export const baseStyle = {- background: '#ffffff',- color: '#696969',-};-export function UnitSelector({- unit,- onChange: handleUnitChange,- unitOptions,- currentCount,- ...htmlSelectRestProps-}: {- unit: string;- onChange: (unit: string) => void;- currentCount: number;- unitOptions: { value: string; labelSingular: string; labelPlural: string }[];-} & SelectHTMLAttributes<HTMLSelectElement>) {- return (- <div className="relative">- <select- {...htmlSelectRestProps}- value={unit}- onChange={(e) => handleUnitChange(e.target.value)}- className="py-2 px-3 border text-gray-900 rounded block w-full outline-none- focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-shadow-none- text-sm font-normal placeholder:text-sm placeholder:font-normal box-border mb-[1px] focus:mb-0- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500- appearance-none pr-8"- >- {unitOptions.map((option) => (- <option key={option.value} value={option.value}>- {currentCount === 1 ? option.labelSingular : option.labelPlural}- </option>- ))}- </select>- </div>- );-}--export function UnitNumberInput({- count,- onChange,- unit,- min,- max,- ...htmlInputRestProps-}: {- count: number;- onChange: (count: number) => void;- unit: string;- min: number;- max: number;-} & InputHTMLAttributes<HTMLInputElement>) {- return (- <input- {...htmlInputRestProps}- type="number"- value={count}- onChange={(e) =>- onChange(- Number.isNaN(parseInt(e.target.value)) ? min : Math.min(max, parseInt(e.target.value)),- )- }- className="py-2 px-3 border text-gray-900 rounded block w-16 outline-none- focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-shadow-none- text-sm font-normal placeholder:text-sm placeholder:font-normal box-border mb-[1px] focus:mb-0- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500- input-no-spinners appearance-none"- />- );-}--export function DaySelector({- selectedDaysIndices,- toggleDay,-}: {- selectedDaysIndices: number[];- toggleDay: (index: number) => void;-}) {- return (- <div className="flex items-center mb-4 mt-1">- {['S', 'M', 'T', 'W', 'T', 'F', 'S'].map((day, index) => (- <button- key={index}- onClick={() => toggleDay(index)}- style={{- ...baseStyle,- margin: '0 2px',- width: '35px',- height: '35px',- display: 'inline-flex',- alignItems: 'center',- justifyContent: 'center',- borderRadius: '50%',- cursor: 'pointer',- border: selectedDaysIndices.includes(index) ? '1px solid #1A73E8' : '1px solid #E0E0E0',- backgroundColor: selectedDaysIndices.includes(index) ? '#1A73E8' : baseStyle.background,- color: selectedDaysIndices.includes(index) ? '#FFFFFF' : baseStyle.color,- }}- >- {day}- </button>- ))}- </div>- );-}--export function RadioButton({- name,- value,- checked,- onChange,- label,- content,-}: {- name: string;- value: string;- checked: boolean;- onChange: () => void;- label: string;- content?: ReactNode;-}) {- return (- <label className="flex items-center mb-2">- <input- type="radio"- name={name}- value={value}- checked={checked}- onChange={onChange}- className="form-radio h-4 w-4"- />- <span className="ml-2">{label}</span>- {content}- </label>- );-}diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/SectionTitle.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/SectionTitle.tsxdeleted file mode 100644index c8a79ce2..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/SectionTitle.tsx+++ /dev/null@@ -1,16 +0,0 @@-import { FC } from 'react';--type SectionTitleProps = {- className?: string; // Additional CSS classes- title: string; // The text content for the title- subtitle?: string; // Optional subtitle-};--const SectionHeader: FC<SectionTitleProps> = ({ title, subtitle }) => (- <div className="w-full">- <h3 className="font-semibold mb-1 text-sm">{title}</h3>- {subtitle && <p className="text-sm text-gray-500">{subtitle}</p>}- </div>-);--export default SectionHeader;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/TransitionWrapper.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/TransitionWrapper.tsxdeleted file mode 100644index bdccd251..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/TransitionWrapper.tsx+++ /dev/null@@ -1,30 +0,0 @@-import { Transition } from '@headlessui/react';-import { ReactNode, useEffect, useState } from 'react';--type Props = {- children: ReactNode;-};--const TransitionWrapper = (props: Props) => {- const [show, setShow] = useState(false);-- useEffect(() => {- setShow(true);- }, []);-- return (- <Transition- show={show}- enter="transform transition ease-in-out duration-500 sm:duration-700"- enterFrom="translate-x-full"- enterTo="translate-x-0"- leave="transform transition ease-in-out duration-500 sm:duration-700"- leaveFrom="translate-x-0"- leaveTo="translate-x-full"- >- <div className="overflow-hidden">{props.children}</div>- </Transition>- );-};--export default TransitionWrapper;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/cache-keys.ts b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/cache-keys.tsdeleted file mode 100644index 587369c2..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/cache-keys.ts+++ /dev/null@@ -1,3 +0,0 @@-export const schedulerCacheKeys = {- getScheduleListKey: (agentId: string) => ['agent_jobs', agentId],-};diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/helpers.ts b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/helpers.tsdeleted file mode 100644index a5164beb..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/helpers.ts+++ /dev/null@@ -1,78 +0,0 @@-import cronstrue from 'cronstrue';--export function extractTimeZoneOffset(timeZoneStr) {- const matches = timeZoneStr.match(/GMT([+-]\d{2}:\d{2})/);- if (!matches) {- throw new Error('Invalid time zone string format.');- }- const [hours, minutes] = matches[1].split(':').map((num) => parseInt(num, 10));- return hours * 60 + Math.sign(hours) * minutes; // Convert to total minutes-}--export const calculateDelay = (targetTimeIso: string): number => {- const targetTime = new Date(targetTimeIso).getTime(); // Convert target time from ISO string to timestamp- const currentTime = Date.now(); // Get current time as a timestamp- const delay = targetTime - currentTime; // Calculate delay-- return delay > 0 ? delay : 0; // Return the delay if it's in the future, otherwise return 0-};-export function timeAgo(date: Date): string {- const dateNum = date.getTime();- const now = new Date().getTime();- const secondsAgo = Math.round((now - dateNum) / 1000);- const minutesAgo = Math.round(secondsAgo / 60);- const hoursAgo = Math.round(minutesAgo / 60);- const daysAgo = Math.round(hoursAgo / 24);- const monthsAgo = Math.round(daysAgo / 30);- const yearsAgo = Math.round(daysAgo / 365);-- const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });-- if (secondsAgo < 60) {- return rtf.format(-secondsAgo, 'second');- } else if (minutesAgo < 60) {- return rtf.format(-minutesAgo, 'minute');- } else if (hoursAgo < 24) {- return rtf.format(-hoursAgo, 'hour');- } else if (daysAgo < 30) {- return rtf.format(-daysAgo, 'day');- } else if (monthsAgo < 12) {- return rtf.format(-monthsAgo, 'month');- } else {- return rtf.format(-yearsAgo, 'year');- }-}--export function timeAfter(date: Date): string {- const dateNum = date.getTime();- const now = new Date().getTime();- const secondsAfter = Math.round((dateNum - now) / 1000);- const minutesAfter = Math.round(secondsAfter / 60);- const hoursAfter = Math.round(minutesAfter / 60);- const daysAfter = Math.round(hoursAfter / 24);- const monthsAfter = Math.round(daysAfter / 30);- const yearsAfter = Math.round(daysAfter / 365);-- const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });-- if (secondsAfter < 60) {- return rtf.format(secondsAfter, 'second');- } else if (minutesAfter < 60) {- return rtf.format(minutesAfter, 'minute');- } else if (hoursAfter < 24) {- return rtf.format(hoursAfter, 'hour');- } else if (daysAfter < 30) {- return rtf.format(daysAfter, 'day');- } else if (monthsAfter < 12) {- return rtf.format(monthsAfter, 'month');- } else {- return rtf.format(yearsAfter, 'year');- }-}--export function getCronReadableStr(cronExpression: string, inLocalTime?: boolean): string {- return cronstrue.toString(cronExpression, {- // note: tzOffset is in hours, so we need to convert minutes to hours. also it is sign sensitive- tzOffset: inLocalTime ? -new Date().getTimezoneOffset() / 60 : 0,- });-}diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/timezone.json b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/timezone.jsondeleted file mode 100644index 13e2db04..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/meta/timezone.json+++ /dev/null@@ -1,360 +0,0 @@-{- "ific/Niue": "(GMT-11:00) Niue Time",- "Pacific/Pago_Pago": "(GMT-11:00) Samoa Standard Time",- "Pacific/Rarotonga": "(GMT-10:00) Cook Islands Standard Time",- "Pacific/Honolulu": "(GMT-10:00) Hawaii-Aleutian Standard Time",- "Pacific/Tahiti": "(GMT-10:00) Tahiti Time",- "Pacific/Marquesas": "(GMT-09:30) Marquesas Time",- "Pacific/Gambier": "(GMT-09:00) Gambier Time",- "America/Adak": "(GMT-09:00) Hawaii-Aleutian Time (Adak)",- "America/Anchorage": "(GMT-08:00) Alaska Time - Anchorage",- "America/Juneau": "(GMT-08:00) Alaska Time - Juneau",- "America/Metlakatla": "(GMT-08:00) Alaska Time - Metlakatla",- "America/Nome": "(GMT-08:00) Alaska Time - Nome",- "America/Sitka": "(GMT-08:00) Alaska Time - Sitka",- "America/Yakutat": "(GMT-08:00) Alaska Time - Yakutat",- "Pacific/Pitcairn": "(GMT-08:00) Pitcairn Time",- "America/Hermosillo":- "(GMT-07:00) Mexican Pacific Standard Time - Hermosillo",- "America/Mazatlan": "(GMT-07:00) Mexican Pacific Standard Time - Mazatlan",- "America/Dawson_Creek": "(GMT-07:00) Mountain Standard Time - Dawson Creek",- "America/Fort_Nelson": "(GMT-07:00) Mountain Standard Time - Fort Nelson",- "America/Phoenix": "(GMT-07:00) Mountain Standard Time - Phoenix",- "America/Los_Angeles": "(GMT-07:00) Pacific Time - Los Angeles",- "America/Tijuana": "(GMT-07:00) Pacific Time - Tijuana",- "America/Vancouver": "(GMT-07:00) Pacific Time - Vancouver",- "America/Dawson": "(GMT-07:00) Yukon Time - Dawson",- "America/Whitehorse": "(GMT-07:00) Yukon Time - Whitehorse",- "America/Bahia_Banderas":- "(GMT-06:00) Central Standard Time - Bahía de Banderas",- "America/Belize": "(GMT-06:00) Central Standard Time - Belize",- "America/Chihuahua": "(GMT-06:00) Central Standard Time - Chihuahua",- "America/Costa_Rica": "(GMT-06:00) Central Standard Time - Costa Rica",- "America/El_Salvador": "(GMT-06:00) Central Standard Time - El Salvador",- "America/Guatemala": "(GMT-06:00) Central Standard Time - Guatemala",- "America/Managua": "(GMT-06:00) Central Standard Time - Managua",- "America/Merida": "(GMT-06:00) Central Standard Time - Mérida",- "America/Mexico_City": "(GMT-06:00) Central Standard Time - Mexico City",- "America/Monterrey": "(GMT-06:00) Central Standard Time - Monterrey",- "America/Regina": "(GMT-06:00) Central Standard Time - Regina",- "America/Swift_Current": "(GMT-06:00) Central Standard Time - Swift Current",- "America/Tegucigalpa": "(GMT-06:00) Central Standard Time - Tegucigalpa",- "Pacific/Easter": "(GMT-06:00) Easter Island Time",- "Pacific/Galapagos": "(GMT-06:00) Galapagos Time",- "America/Boise": "(GMT-06:00) Mountain Time - Boise",- "America/Cambridge_Bay": "(GMT-06:00) Mountain Time - Cambridge Bay",- "America/Ciudad_Juarez": "(GMT-06:00) Mountain Time - Ciudad Juárez",- "America/Denver": "(GMT-06:00) Mountain Time - Denver",- "America/Edmonton": "(GMT-06:00) Mountain Time - Edmonton",- "America/Yellowknife": "(GMT-06:00) Mountain Time - Edmonton",- "America/Inuvik": "(GMT-06:00) Mountain Time - Inuvik",- "America/Eirunepe": "(GMT-05:00) Acre Standard Time - Eirunepe",- "America/Rio_Branco": "(GMT-05:00) Acre Standard Time - Rio Branco",- "America/North_Dakota/Beulah":- "(GMT-05:00) Central Time - Beulah, North Dakota",- "America/North_Dakota/Center":- "(GMT-05:00) Central Time - Center, North Dakota",- "America/Chicago": "(GMT-05:00) Central Time - Chicago",- "America/Indiana/Knox": "(GMT-05:00) Central Time - Knox, Indiana",- "America/Matamoros": "(GMT-05:00) Central Time - Matamoros",- "America/Menominee": "(GMT-05:00) Central Time - Menominee",- "America/North_Dakota/New_Salem":- "(GMT-05:00) Central Time - New Salem, North Dakota",- "America/Ojinaga": "(GMT-05:00) Central Time - Ojinaga",- "America/Rankin_Inlet": "(GMT-05:00) Central Time - Rankin Inlet",- "America/Resolute": "(GMT-05:00) Central Time - Resolute",- "America/Indiana/Tell_City": "(GMT-05:00) Central Time - Tell City, Indiana",- "America/Rainy_River": "(GMT-05:00) Central Time - Winnipeg",- "America/Winnipeg": "(GMT-05:00) Central Time - Winnipeg",- "America/Bogota": "(GMT-05:00) Colombia Standard Time",- "America/Cancun": "(GMT-05:00) Eastern Standard Time - Cancún",- "America/Jamaica": "(GMT-05:00) Eastern Standard Time - Jamaica",- "America/Panama": "(GMT-05:00) Eastern Standard Time - Panama",- "America/Guayaquil": "(GMT-05:00) Ecuador Time",- "America/Lima": "(GMT-05:00) Peru Standard Time",- "America/Boa_Vista": "(GMT-04:00) Amazon Standard Time - Boa Vista",- "America/Campo_Grande": "(GMT-04:00) Amazon Standard Time - Campo Grande",- "America/Cuiaba": "(GMT-04:00) Amazon Standard Time - Cuiaba",- "America/Manaus": "(GMT-04:00) Amazon Standard Time - Manaus",- "America/Porto_Velho": "(GMT-04:00) Amazon Standard Time - Porto Velho",- "America/Barbados": "(GMT-04:00) Atlantic Standard Time - Barbados",- "America/Martinique": "(GMT-04:00) Atlantic Standard Time - Martinique",- "America/Puerto_Rico": "(GMT-04:00) Atlantic Standard Time - Puerto Rico",- "America/Santo_Domingo": "(GMT-04:00) Atlantic Standard Time - Santo Domingo",- "America/La_Paz": "(GMT-04:00) Bolivia Time",- "America/Santiago": "(GMT-04:00) Chile Time",- "America/Havana": "(GMT-04:00) Cuba Time",- "America/Detroit": "(GMT-04:00) Eastern Time - Detroit",- "America/Grand_Turk": "(GMT-04:00) Eastern Time - Grand Turk",- "America/Indiana/Indianapolis": "(GMT-04:00) Eastern Time - Indianapolis",- "America/Iqaluit": "(GMT-04:00) Eastern Time - Iqaluit",- "America/Pangnirtung": "(GMT-04:00) Eastern Time - Iqaluit",- "America/Kentucky/Louisville": "(GMT-04:00) Eastern Time - Louisville",- "America/Indiana/Marengo": "(GMT-04:00) Eastern Time - Marengo, Indiana",- "America/Kentucky/Monticello":- "(GMT-04:00) Eastern Time - Monticello, Kentucky",- "America/New_York": "(GMT-04:00) Eastern Time - New York",- "America/Indiana/Petersburg":- "(GMT-04:00) Eastern Time - Petersburg, Indiana",- "America/Port-au-Prince": "(GMT-04:00) Eastern Time - Port-au-Prince",- "America/Nipigon": "(GMT-04:00) Eastern Time - Toronto",- "America/Thunder_Bay": "(GMT-04:00) Eastern Time - Toronto",- "America/Toronto": "(GMT-04:00) Eastern Time - Toronto",- "America/Indiana/Vevay": "(GMT-04:00) Eastern Time - Vevay, Indiana",- "America/Indiana/Vincennes": "(GMT-04:00) Eastern Time - Vincennes, Indiana",- "America/Indiana/Winamac": "(GMT-04:00) Eastern Time - Winamac, Indiana",- "America/Guyana": "(GMT-04:00) Guyana Time",- "America/Asuncion": "(GMT-04:00) Paraguay Time",- "America/Caracas": "(GMT-04:00) Venezuela Time",- "America/Argentina/Buenos_Aires":- "(GMT-03:00) Argentina Standard Time - Buenos Aires",- "America/Argentina/Catamarca":- "(GMT-03:00) Argentina Standard Time - Catamarca",- "America/Argentina/Cordoba": "(GMT-03:00) Argentina Standard Time - Cordoba",- "America/Argentina/Jujuy": "(GMT-03:00) Argentina Standard Time - Jujuy",- "America/Argentina/La_Rioja":- "(GMT-03:00) Argentina Standard Time - La Rioja",- "America/Argentina/Mendoza": "(GMT-03:00) Argentina Standard Time - Mendoza",- "America/Argentina/Rio_Gallegos":- "(GMT-03:00) Argentina Standard Time - Rio Gallegos",- "America/Argentina/Salta": "(GMT-03:00) Argentina Standard Time - Salta",- "America/Argentina/San_Juan":- "(GMT-03:00) Argentina Standard Time - San Juan",- "America/Argentina/San_Luis":- "(GMT-03:00) Argentina Standard Time - San Luis",- "America/Argentina/Tucuman": "(GMT-03:00) Argentina Standard Time - Tucuman",- "America/Argentina/Ushuaia": "(GMT-03:00) Argentina Standard Time - Ushuaia",- "Atlantic/Bermuda": "(GMT-03:00) Atlantic Time - Bermuda",- "America/Glace_Bay": "(GMT-03:00) Atlantic Time - Glace Bay",- "America/Goose_Bay": "(GMT-03:00) Atlantic Time - Goose Bay",- "America/Halifax": "(GMT-03:00) Atlantic Time - Halifax",- "America/Moncton": "(GMT-03:00) Atlantic Time - Moncton",- "America/Thule": "(GMT-03:00) Atlantic Time - Thule",- "America/Araguaina": "(GMT-03:00) Brasilia Standard Time - Araguaina",- "America/Bahia": "(GMT-03:00) Brasilia Standard Time - Bahia",- "America/Belem": "(GMT-03:00) Brasilia Standard Time - Belem",- "America/Fortaleza": "(GMT-03:00) Brasilia Standard Time - Fortaleza",- "America/Maceio": "(GMT-03:00) Brasilia Standard Time - Maceio",- "America/Recife": "(GMT-03:00) Brasilia Standard Time - Recife",- "America/Santarem": "(GMT-03:00) Brasilia Standard Time - Santarem",- "America/Sao_Paulo": "(GMT-03:00) Brasilia Standard Time - Sao Paulo",- "Atlantic/Stanley": "(GMT-03:00) Falkland Islands Standard Time",- "America/Cayenne": "(GMT-03:00) French Guiana Time",- "Antarctica/Palmer": "(GMT-03:00) Palmer Time",- "America/Punta_Arenas": "(GMT-03:00) Punta Arenas Time",- "Antarctica/Rothera": "(GMT-03:00) Rothera Time",- "America/Paramaribo": "(GMT-03:00) Suriname Time",- "America/Montevideo": "(GMT-03:00) Uruguay Standard Time",- "America/St_Johns": "(GMT-02:30) Newfoundland Time",- "America/Noronha": "(GMT-02:00) Fernando de Noronha Standard Time",- "Atlantic/South_Georgia": "(GMT-02:00) South Georgia Time",- "America/Miquelon": "(GMT-02:00) St. Pierre & Miquelon Time",- "Atlantic/Cape_Verde": "(GMT-01:00) Cape Verde Standard Time",- "America/Scoresbysund": "(GMT-01:00) East Greenland Time",- "America/Nuuk": "(GMT-01:00) West Greenland Time",- "Atlantic/Azores": "(GMT+00:00) Azores Time",- "UTC":"(GMT+00:00) Coordinated Universal Time",- "Etc/GMT": "(GMT+00:00) Greenwich Mean Time",- "Africa/Abidjan": "(GMT+00:00) Greenwich Mean Time - Abidjan",- "Africa/Bissau": "(GMT+00:00) Greenwich Mean Time - Bissau",- "America/Danmarkshavn": "(GMT+00:00) Greenwich Mean Time - Danmarkshavn",- "Africa/Monrovia": "(GMT+00:00) Greenwich Mean Time - Monrovia",- "Atlantic/Reykjavik": "(GMT+00:00) Greenwich Mean Time - Reykjavik",- "Africa/Sao_Tome": "(GMT+00:00) Greenwich Mean Time - São Tomé",- "Africa/Algiers": "(GMT+01:00) Central European Standard Time - Algiers",- "Africa/Tunis": "(GMT+01:00) Central European Standard Time - Tunis",- "Europe/Dublin": "(GMT+01:00) Ireland Time",- "Africa/Casablanca": "(GMT+01:00) Morocco Time",- "Europe/London": "(GMT+01:00) United Kingdom Time",- "Africa/Lagos": "(GMT+01:00) West Africa Standard Time - Lagos",- "Africa/Ndjamena": "(GMT+01:00) West Africa Standard Time - Ndjamena",- "Atlantic/Canary": "(GMT+01:00) Western European Time - Canary",- "Atlantic/Faroe": "(GMT+01:00) Western European Time - Faroe",- "Europe/Lisbon": "(GMT+01:00) Western European Time - Lisbon",- "Atlantic/Madeira": "(GMT+01:00) Western European Time - Madeira",- "Africa/El_Aaiun": "(GMT+01:00) Western Sahara Time",- "Africa/Juba": "(GMT+02:00) Central Africa Time - Juba",- "Africa/Khartoum": "(GMT+02:00) Central Africa Time - Khartoum",- "Africa/Maputo": "(GMT+02:00) Central Africa Time - Maputo",- "Africa/Windhoek": "(GMT+02:00) Central Africa Time - Windhoek",- "Europe/Amsterdam": "(GMT+02:00) Central European Time - Amsterdam",- "Europe/Andorra": "(GMT+02:00) Central European Time - Andorra",- "Europe/Belgrade": "(GMT+02:00) Central European Time - Belgrade",- "Europe/Berlin": "(GMT+02:00) Central European Time - Berlin",- "Europe/Brussels": "(GMT+02:00) Central European Time - Brussels",- "Europe/Budapest": "(GMT+02:00) Central European Time - Budapest",- "Africa/Ceuta": "(GMT+02:00) Central European Time - Ceuta",- "Europe/Copenhagen": "(GMT+02:00) Central European Time - Copenhagen",- "Europe/Gibraltar": "(GMT+02:00) Central European Time - Gibraltar",- "Europe/Luxembourg": "(GMT+02:00) Central European Time - Luxembourg",- "Europe/Madrid": "(GMT+02:00) Central European Time - Madrid",- "Europe/Malta": "(GMT+02:00) Central European Time - Malta",- "Europe/Monaco": "(GMT+02:00) Central European Time - Monaco",- "Europe/Oslo": "(GMT+02:00) Central European Time - Oslo",- "Europe/Paris": "(GMT+02:00) Central European Time - Paris",- "Europe/Prague": "(GMT+02:00) Central European Time - Prague",- "Europe/Rome": "(GMT+02:00) Central European Time - Rome",- "Europe/Stockholm": "(GMT+02:00) Central European Time - Stockholm",- "Europe/Tirane": "(GMT+02:00) Central European Time - Tirane",- "Europe/Vienna": "(GMT+02:00) Central European Time - Vienna",- "Europe/Warsaw": "(GMT+02:00) Central European Time - Warsaw",- "Europe/Zurich": "(GMT+02:00) Central European Time - Zurich",- "Europe/Kaliningrad":- "(GMT+02:00) Eastern European Standard Time - Kaliningrad",- "Africa/Tripoli": "(GMT+02:00) Eastern European Standard Time - Tripoli",- "Africa/Cairo": "(GMT+02:00) Eastern European Time (Egypt)",- "Asia/Gaza": "(GMT+02:00) Eastern European Time (Gaza)",- "Asia/Hebron": "(GMT+02:00) Eastern European Time (Hebron)",- "Africa/Johannesburg": "(GMT+02:00) South Africa Standard Time",- "Antarctica/Troll": "(GMT+02:00) Troll Time",- "Asia/Baghdad": "(GMT+03:00) Arabian Standard Time - Baghdad",- "Asia/Qatar": "(GMT+03:00) Arabian Standard Time - Qatar",- "Asia/Riyadh": "(GMT+03:00) Arabian Standard Time - Riyadh",- "Africa/Nairobi": "(GMT+03:00) East Africa Time",- "Europe/Athens": "(GMT+03:00) Eastern European Time - Athens",- "Asia/Beirut": "(GMT+03:00) Eastern European Time - Beirut",- "Europe/Bucharest": "(GMT+03:00) Eastern European Time - Bucharest",- "Europe/Chisinau": "(GMT+03:00) Eastern European Time - Chisinau",- "Europe/Helsinki": "(GMT+03:00) Eastern European Time - Helsinki",- "Europe/Kiev": "(GMT+03:00) Eastern European Time - Kyiv",- "Europe/Uzhgorod": "(GMT+03:00) Eastern European Time - Kyiv",- "Europe/Zaporozhye": "(GMT+03:00) Eastern European Time - Kyiv",- "Asia/Nicosia": "(GMT+03:00) Eastern European Time - Nicosia",- "Europe/Riga": "(GMT+03:00) Eastern European Time - Riga",- "Europe/Sofia": "(GMT+03:00) Eastern European Time - Sofia",- "Europe/Tallinn": "(GMT+03:00) Eastern European Time - Tallinn",- "Europe/Vilnius": "(GMT+03:00) Eastern European Time - Vilnius",- "Asia/Famagusta": "(GMT+03:00) Famagusta Time",- "Asia/Jerusalem": "(GMT+03:00) Israel Time",- "Asia/Amman": "(GMT+03:00) Jordan Time",- "Europe/Kirov": "(GMT+03:00) Kirov Time",- "Europe/Minsk": "(GMT+03:00) Moscow Standard Time - Minsk",- "Europe/Moscow": "(GMT+03:00) Moscow Standard Time - Moscow",- "Europe/Simferopol": "(GMT+03:00) Moscow Standard Time - Simferopol",- "Asia/Damascus": "(GMT+03:00) Syria Time",- "Europe/Istanbul": "(GMT+03:00) Türkiye Time",- "Europe/Volgograd": "(GMT+03:00) Volgograd Standard Time",- "Asia/Tehran": "(GMT+03:30) Iran Standard Time",- "Asia/Yerevan": "(GMT+04:00) Armenia Standard Time",- "Europe/Astrakhan": "(GMT+04:00) Astrakhan Time",- "Asia/Baku": "(GMT+04:00) Azerbaijan Standard Time",- "Asia/Tbilisi": "(GMT+04:00) Georgia Standard Time",- "Asia/Dubai": "(GMT+04:00) Gulf Standard Time",- "Indian/Mauritius": "(GMT+04:00) Mauritius Standard Time",- "Indian/Reunion": "(GMT+04:00) Réunion Time",- "Europe/Samara": "(GMT+04:00) Samara Standard Time",- "Europe/Saratov": "(GMT+04:00) Saratov Time",- "Indian/Mahe": "(GMT+04:00) Seychelles Time",- "Europe/Ulyanovsk": "(GMT+04:00) Ulyanovsk Time",- "Asia/Kabul": "(GMT+04:30) Afghanistan Time",- "Indian/Kerguelen": "(GMT+05:00) French Southern & Antarctic Time",- "Indian/Maldives": "(GMT+05:00) Maldives Time",- "Antarctica/Mawson": "(GMT+05:00) Mawson Time",- "Asia/Karachi": "(GMT+05:00) Pakistan Standard Time",- "Asia/Dushanbe": "(GMT+05:00) Tajikistan Time",- "Asia/Ashgabat": "(GMT+05:00) Turkmenistan Standard Time",- "Asia/Samarkand": "(GMT+05:00) Uzbekistan Standard Time - Samarkand",- "Asia/Tashkent": "(GMT+05:00) Uzbekistan Standard Time - Tashkent",- "Antarctica/Vostok": "(GMT+05:00) Vostok Time",- "Asia/Almaty": "(GMT+05:00) West Kazakhstan Time - Almaty",- "Asia/Aqtau": "(GMT+05:00) West Kazakhstan Time - Aqtau",- "Asia/Aqtobe": "(GMT+05:00) West Kazakhstan Time - Aqtobe",- "Asia/Atyrau": "(GMT+05:00) West Kazakhstan Time - Atyrau",- "Asia/Qostanay": "(GMT+05:00) West Kazakhstan Time - Kostanay",- "Asia/Oral": "(GMT+05:00) West Kazakhstan Time - Oral",- "Asia/Qyzylorda": "(GMT+05:00) West Kazakhstan Time - Qyzylorda",- "Asia/Yekaterinburg": "(GMT+05:00) Yekaterinburg Standard Time",- "Asia/Colombo": "(GMT+05:30) India Standard Time - Colombo",- "Asia/Kolkata": "(GMT+05:30) India Standard Time - Kolkata",- "Asia/Kathmandu": "(GMT+05:45) Nepal Time",- "Asia/Dhaka": "(GMT+06:00) Bangladesh Standard Time",- "Asia/Thimphu": "(GMT+06:00) Bhutan Time",- "Indian/Chagos": "(GMT+06:00) Indian Ocean Time",- "Asia/Bishkek": "(GMT+06:00) Kyrgyzstan Time",- "Asia/Omsk": "(GMT+06:00) Omsk Standard Time",- "Asia/Urumqi": "(GMT+06:00) Urumqi Time",- "Indian/Cocos": "(GMT+06:30) Cocos Islands Time",- "Asia/Yangon": "(GMT+06:30) Myanmar Time",- "Asia/Barnaul": "(GMT+07:00) Barnaul Time",- "Indian/Christmas": "(GMT+07:00) Christmas Island Time",- "Antarctica/Davis": "(GMT+07:00) Davis Time",- "Asia/Hovd": "(GMT+07:00) Hovd Standard Time",- "Asia/Bangkok": "(GMT+07:00) Indochina Time - Bangkok",- "Asia/Ho_Chi_Minh": "(GMT+07:00) Indochina Time - Ho Chi Minh City",- "Asia/Krasnoyarsk": "(GMT+07:00) Krasnoyarsk Standard Time - Krasnoyarsk",- "Asia/Novokuznetsk": "(GMT+07:00) Krasnoyarsk Standard Time - Novokuznetsk",- "Asia/Novosibirsk": "(GMT+07:00) Novosibirsk Standard Time",- "Asia/Tomsk": "(GMT+07:00) Tomsk Time",- "Asia/Jakarta": "(GMT+07:00) Western Indonesia Time - Jakarta",- "Asia/Pontianak": "(GMT+07:00) Western Indonesia Time - Pontianak",- "Australia/Perth": "(GMT+08:00) Australian Western Standard Time",- "Asia/Brunei": "(GMT+08:00) Brunei Darussalam Time",- "Antarctica/Casey": "(GMT+08:00) Casey Time",- "Asia/Makassar": "(GMT+08:00) Central Indonesia Time",- "Asia/Macau": "(GMT+08:00) China Standard Time - Macao",- "Asia/Shanghai": "(GMT+08:00) China Standard Time - Shanghai",- "Asia/Hong_Kong": "(GMT+08:00) Hong Kong Standard Time",- "Asia/Irkutsk": "(GMT+08:00) Irkutsk Standard Time",- "Asia/Kuala_Lumpur": "(GMT+08:00) Malaysia Time - Kuala Lumpur",- "Asia/Kuching": "(GMT+08:00) Malaysia Time - Kuching",- "Asia/Manila": "(GMT+08:00) Philippine Standard Time",- "Asia/Singapore": "(GMT+08:00) Singapore Standard Time",- "Asia/Taipei": "(GMT+08:00) Taipei Standard Time",- "Asia/Choibalsan": "(GMT+08:00) Ulaanbaatar Standard Time - Choibalsan",- "Asia/Ulaanbaatar": "(GMT+08:00) Ulaanbaatar Standard Time - Ulaanbaatar",- "Australia/Eucla": "(GMT+08:45) Australian Central Western Standard Time",- "Asia/Dili": "(GMT+09:00) East Timor Time",- "Asia/Jayapura": "(GMT+09:00) Eastern Indonesia Time",- "Asia/Tokyo": "(GMT+09:00) Japan Standard Time",- "Asia/Pyongyang": "(GMT+09:00) Korean Standard Time - Pyongyang",- "Asia/Seoul": "(GMT+09:00) Korean Standard Time - Seoul",- "Pacific/Palau": "(GMT+09:00) Palau Time",- "Asia/Chita": "(GMT+09:00) Yakutsk Standard Time - Chita",- "Asia/Khandyga": "(GMT+09:00) Yakutsk Standard Time - Khandyga",- "Asia/Yakutsk": "(GMT+09:00) Yakutsk Standard Time - Yakutsk",- "Australia/Darwin": "(GMT+09:30) Australian Central Standard Time",- "Australia/Adelaide": "(GMT+09:30) Central Australia Time - Adelaide",- "Australia/Broken_Hill": "(GMT+09:30) Central Australia Time - Broken Hill",- "Australia/Brisbane":- "(GMT+10:00) Australian Eastern Standard Time - Brisbane",- "Australia/Lindeman":- "(GMT+10:00) Australian Eastern Standard Time - Lindeman",- "Pacific/Guam": "(GMT+10:00) Chamorro Standard Time",- "Pacific/Chuuk": "(GMT+10:00) Chuuk Time",- "Australia/Hobart": "(GMT+10:00) Eastern Australia Time - Hobart",- "Antarctica/Macquarie": "(GMT+10:00) Eastern Australia Time - Macquarie",- "Australia/Melbourne": "(GMT+10:00) Eastern Australia Time - Melbourne",- "Australia/Sydney": "(GMT+10:00) Eastern Australia Time - Sydney",- "Pacific/Port_Moresby": "(GMT+10:00) Papua New Guinea Time",- "Asia/Ust-Nera": "(GMT+10:00) Vladivostok Standard Time - Ust-Nera",- "Asia/Vladivostok": "(GMT+10:00) Vladivostok Standard Time - Vladivostok",- "Australia/Lord_Howe": "(GMT+10:30) Lord Howe Time",- "Pacific/Bougainville": "(GMT+11:00) Bougainville Time",- "Pacific/Kosrae": "(GMT+11:00) Kosrae Time",- "Asia/Magadan": "(GMT+11:00) Magadan Standard Time",- "Pacific/Noumea": "(GMT+11:00) New Caledonia Standard Time",- "Pacific/Norfolk": "(GMT+11:00) Norfolk Island Time",- "Pacific/Pohnpei": "(GMT+11:00) Ponape Time",- "Asia/Sakhalin": "(GMT+11:00) Sakhalin Standard Time",- "Pacific/Guadalcanal": "(GMT+11:00) Solomon Islands Time",- "Asia/Srednekolymsk": "(GMT+11:00) Srednekolymsk Time",- "Pacific/Efate": "(GMT+11:00) Vanuatu Standard Time",- "Asia/Anadyr": "(GMT+12:00) Anadyr Standard Time",- "Pacific/Fiji": "(GMT+12:00) Fiji Standard Time",- "Pacific/Tarawa": "(GMT+12:00) Gilbert Islands Time",- "Pacific/Kwajalein": "(GMT+12:00) Marshall Islands Time - Kwajalein",- "Pacific/Majuro": "(GMT+12:00) Marshall Islands Time - Majuro",- "Pacific/Nauru": "(GMT+12:00) Nauru Time",- "Pacific/Auckland": "(GMT+12:00) New Zealand Time",- "Asia/Kamchatka": "(GMT+12:00) Petropavlovsk-Kamchatski Standard Time",- "Pacific/Funafuti": "(GMT+12:00) Tuvalu Time",- "Pacific/Wake": "(GMT+12:00) Wake Island Time",- "Pacific/Wallis": "(GMT+12:00) Wallis & Futuna Time",- "Pacific/Chatham": "(GMT+12:45) Chatham Time",- "Pacific/Apia": "(GMT+13:00) Apia Standard Time",- "Pacific/Kanton": "(GMT+13:00) Phoenix Islands Time",- "Pacific/Fakaofo": "(GMT+13:00) Tokelau Time",- "Pacific/Tongatapu": "(GMT+13:00) Tonga Standard Time",- "Pacific/Kiritimati": "(GMT+14:00) Line Islands Time",- "Pacific/Niue": "(GMT-11:00) Niue Time"-}\ No newline at end of filediff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/CreateSchedule.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/CreateSchedule.tsxdeleted file mode 100644index 64142cd5..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/CreateSchedule.tsx+++ /dev/null@@ -1,311 +0,0 @@-import { schedulerCacheKeys } from '@react/features/agent-settings/components/ScheduleWidget/meta/cache-keys';-import { calculateDelay } from '@react/features/agent-settings/components/ScheduleWidget/meta/helpers';-import ChooseName from '@react/features/agent-settings/components/ScheduleWidget/modes/create/steps/ChooseName';-import EndpointInputsFillForm from '@react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EndpointInputsFillForm';-import EndpointSelection from '@react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EndpointSelection';-import EventKickOff from '@react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EventKickOff';-import EventOccurences from '@react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EventOccurences';-import { useAgentSettingsCtx } from '@react/features/agent-settings/contexts/agent-settings.context';-import { Spinner } from '@react/shared/components/ui/spinner';-import { queryClient } from '@react/shared/query-client';-import { CreateAgentScheduledJobRequest } from '@react/shared/types/api-payload.types';-import { AgentScheduledJob } from '@react/shared/types/api-results.types';-import { extractError } from '@react/shared/utils/errors';-import { EVENTS } from '@shared/posthog/constants/events';-import { PostHog } from '@src/shared/posthog';-import { useMutation } from '@tanstack/react-query';-import { Ref, useEffect, useRef, useState } from 'react';--type Props = {- changeView: (id: 'LIST' | 'EDIT' | 'CREATE', data: { job?: AgentScheduledJob }) => void;-};--export interface CronPatternDetails {- daysOfWeek: number[];- repeatEveryUnit: 'min' | 'hour' | 'week';- repeatEvery: number;- startDate: string;-}--export type SchedulerFormData = {- name?: string;- componentId?: string;- agentId?: string;- body?: object;-- shouldRepeat: boolean;- startDate?: string;- repeatLimit?: number;- endDate?: string;- endOption?: 'never' | 'on-after-occurrences' | 'on-date';-} & Partial<CronPatternDetails>;--const CreateSchedule = ({ changeView }: Props) => {- const { agentId, latestAgentDeploymentQuery } = useAgentSettingsCtx();- const coreSteps = [- { title: 'Choose Endpoint', component: EndpointSelection },- { title: 'Endpoint Inputs', component: EndpointInputsFillForm },- { title: 'Date and Time', component: EventKickOff },- { title: 'Repeat', component: EventOccurences },- { title: 'Choose A Name', component: ChooseName },- ];-- const [formData, setFormData] = useState<SchedulerFormData>({- agentId: agentId,- shouldRepeat: false,- });-- const [steps, setSteps] = useState(coreSteps);- const [currStep, setCurrStep] = useState(0);- const [stepsValdity, setStepsValidy] = useState<boolean[]>(- Array(Object.keys(steps).length).fill(false),- );- const StepComponent = Object.values(steps)[currStep].component;- const stepIsValid = stepsValdity[currStep];- const stepRef = useRef<StepChildMethods>(null);- const stepHolderRef = useRef<HTMLDivElement>(null);-- const [submitNow, setSubmitNow] = useState(false);-- const addScheduleMutation = useMutation({- mutationFn: (data: CreateAgentScheduledJobRequest) =>- fetch('/api/page/agent_settings/jobs/', {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify(data),- }),- mutationKey: ['add_schedule', agentId],- });-- const submitForm = async () => {- if (!latestAgentDeploymentQuery.isSuccess) return;-- const isOneTimeJob = !formData.shouldRepeat;- const options: CreateAgentScheduledJobRequest['options'] = {};-- if (!isOneTimeJob) {- const {- daysOfWeek,- repeatEveryUnit,- repeatEvery,- startDate,- endDate,- repeatLimit,- endOption,- } = formData;- options['repeat'] = {- patternDetails: {- daysOfWeek,- repeatEveryUnit,- repeatEvery,- },- startDate,- };- if (endOption == 'on-after-occurrences') {- options['repeat']['limit'] = repeatLimit;- } else if (endOption == 'on-date') {- options['repeat']['endDate'] = endDate;- }- } else {- options['delay'] = calculateDelay(formData.startDate);- }-- const data: CreateAgentScheduledJobRequest = {- jobType: 'AGENT_SCHEDULE',- name: formData.name,- data: {- componentId: formData.componentId,- agentId: formData.agentId,- body: formData.body || {},- },- options,- };-- try {- const newJobRes = await addScheduleMutation.mutateAsync(data);- const newJobResJson = await newJobRes.json();- if (newJobResJson?.job) {- queryClient.setQueryData(- schedulerCacheKeys.getScheduleListKey(agentId),- (oldData: { jobs: AgentScheduledJob[] }) => {- return { jobs: [...oldData.jobs, newJobResJson.job] };- },- );- } else {- queryClient.invalidateQueries(schedulerCacheKeys.getScheduleListKey(agentId));- }- PostHog.track(EVENTS.AGENT_SETTINGS_EVENTS.app_add_new_work_schedule, {});- changeView('LIST', {});- } catch (error) {- console.error('Error adding schedule:', error);- }- };-- useEffect(() => {- if (submitNow) {- submitForm();- setSubmitNow(false); // Reset the trigger- }- }, [submitNow, formData]); // Dependency on formData ensures we're working with latest state-- // It was causing a bug on the builder page and causing layout issues. Uncomment if it can be fixed.- // useEffect(- // function scrollToStepView() {- // const stepHolder = stepHolderRef.current;- // if (!stepHolder) return;-- // stepHolder.scrollIntoView({ behavior: 'smooth', block: 'start' });- // },- // [currStep],- // );-- const stepProps: StepProps = {- actions: {- handleFormDataChange(data: SchedulerFormData) {- setFormData((prev) => ({ ...prev, ...data }));- },- setCanSubmit: (isValid: boolean) =>- setStepsValidy((prev) => prev.map((_, i) => (i === currStep ? isValid : prev[i]))),- // setSubmitBtnVisibility,-- nextStep: () => {- if (currStep === Object.keys(steps).length - 1) {- setSubmitNow(true);- } else {- setCurrStep((prev) => prev + 1);- }- },-- removeStepByTitle: (title: string) => {- const newSteps = steps.filter((step) => step.title !== title);- setSteps(newSteps);- },- },-- formData: formData,- };-- if (latestAgentDeploymentQuery.isLoading) {- return (- <div className="w-full h-full flex justify-center items-center">- <Spinner classes="w-12 h-12" />- </div>- );- }-- if (latestAgentDeploymentQuery.isError) {- return (- <div className="text-red-500 text-sm text-center">- An error occurred while fetching agent data.- </div>- );- }-- return (- <div className="w-full">- <div className="mb-6" ref={stepHolderRef}>- {<StepComponent {...stepProps} ref={stepRef} />}- </div>-- {addScheduleMutation.isError && (- <div className="mb-3 text-red-500 text-sm text-center">- {extractError(addScheduleMutation.error) ||- 'An error occurred while adding the schedule.'}- </div>- )}-- <div className="m-auto flex justify-end w-full items-center">- {currStep > 0 ? (- <button- onClick={() => {- if (currStep === 0) return;-- stepRef.current?.handleBeforeStepChange &&- stepRef.current?.handleBeforeStepChange(currStep - 1);- setCurrStep((prev) => prev - 1);- }}- disabled={currStep === 0}- className="mt-4 bg-transparent text-sm text-gray-400 font-semibold"- >- Back- </button>- ) : (- <button- className="mt-4 bg-transparent text-sm text-gray-400 font-semibold "- onClick={() => {- console.log('Cancel');- changeView('LIST', {});- }}- // disabled={isSubmitting}- // loading={isSubmitting}- >- Cancel- </button>- )}-- {currStep < Object.keys(steps).length - 1 ? (- <button- onClick={() => {- stepRef.current?.handleBeforeStepChange &&- stepRef.current?.handleBeforeStepChange(currStep + 1);-- if (stepRef.current?.handleNextClick) {- const isStepValid = stepRef.current.handleNextClick();- if (!isStepValid) return;- }-- if (!stepIsValid || currStep === Object.keys(steps).length - 1) return;- setCurrStep((prev) => prev + 1);- }}- disabled={currStep === Object.keys(steps).length - 1 || !stepIsValid}- className="mt-4 bg-transparent text-sm text-v2-blue ml-5 font-semibold disabled:opacity-50 "- >- Next- </button>- ) : (- <div className="ml-5">- {addScheduleMutation.isLoading && <Spinner classes="w-4 h-4 fill-v2-blue mr-1" />}- <button- className="mt-4 bg-transparent text-sm text-v2-blue font-semibold disabled:opacity-50 "- onClick={() => {- stepRef.current?.handleBeforeStepChange &&- stepRef.current?.handleBeforeStepChange(currStep + 1);- if (stepRef.current?.handleNextClick) {- const isStepValid = stepRef.current.handleNextClick();- if (!isStepValid) return;- }- if (!stepIsValid) return;-- // handleFormSubmit();- setSubmitNow(true);- }}- disabled={!stepIsValid || addScheduleMutation.isLoading}- // loading={isSubmitting}- >- Done- </button>- </div>- )}- </div>- </div>- );-};--export type StepChildMethods = {- handleNextClick?: () => boolean;- handleBeforeStepChange?: (newStep: number) => void;-};--export type StepProps = {- actions: {- handleFormDataChange: (data: Partial<SchedulerFormData>) => void;- setCanSubmit: (isValid: boolean) => void;- // setSubmitBtnVisibility?: (isVisible: boolean) => void;- nextStep: () => void;- removeStepByTitle: (title: string) => void;- };- formData: SchedulerFormData;- ref?: Ref<StepChildMethods>;-};--export default CreateSchedule;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/ChooseName.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/ChooseName.tsxdeleted file mode 100644index 97057062..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/ChooseName.tsx+++ /dev/null@@ -1,37 +0,0 @@-import SectionHeader from '@react/features/agent-settings/components/ScheduleWidget/meta/SectionTitle';-import { StepChildMethods, StepProps } from '@react/features/agent-settings/components/ScheduleWidget/modes/create/CreateSchedule';-import { Input } from '@react/shared/components/ui/input';-import { forwardRef, useEffect } from 'react';--type Props = {};--const ChooseName = forwardRef<StepChildMethods, StepProps>(({ actions, formData }, ref) => {- useEffect(() => {- actions.setCanSubmit(true);- }, []);-- return (- <div className="w-full">- <SectionHeader- title="New Routine"- subtitle="What should your routine be called? (optional)"- />-- {/* Name input */}- <div className="mb-3 mt-5">- <Input- label="Routine Name"- labelClassName="text-gray-700 mb-1 text-sm"- type="text"- name="name"- value={formData.name || ''}- onChange={(e) => actions.handleFormDataChange({ name: e.target.value })}- placeholder="Name your routine"- fullWidth- />- </div>- </div>- );-});--export default ChooseName;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EndpointInputsFillForm.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EndpointInputsFillForm.tsxdeleted file mode 100644index eaad5e3d..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EndpointInputsFillForm.tsx+++ /dev/null@@ -1,95 +0,0 @@-import SectionHeader from '@react/features/agent-settings/components/ScheduleWidget/meta/SectionTitle';-import { StepChildMethods, StepProps } from '@react/features/agent-settings/components/ScheduleWidget/modes/create/CreateSchedule';-import { useAgentSettingsCtx } from '@react/features/agent-settings/contexts/agent-settings.context';-import { generateComponentInputsSchema } from '@react/features/agent-settings/utils';-import AgentComponentInput from '@react/features/agent-settings/utils/AgentComponentInput';-import { useFormik } from 'formik';-import { forwardRef, useEffect, useImperativeHandle } from 'react';--const EndpointInputsFillForm = forwardRef<StepChildMethods, StepProps>(- ({ actions, formData: formData }, ref) => {- const { agentQuery, latestAgentDeploymentQuery } = useAgentSettingsCtx();-- const selectedComponent = formData.componentId;-- // const component = agentQuery.data.data.components.find((component) => component.id === selectedComponent);- const component = latestAgentDeploymentQuery.data.deployment.aiAgentData.components.find(- (component) => component.id === selectedComponent,- );- const inputs = component?.inputs || [];- const hasBinaryInput = inputs.some((input) => input.type === 'Binary');- const _method = component?.data?.method ? component.data.method.toUpperCase() : 'POST';-- // useEffect(() => {- // if (inputs.length === 0) {- // actions.nextStep(); // Skip this step if no inputs- // }- // }, [selectedComponent]);-- const dynamicValidationSchema = generateComponentInputsSchema(inputs);-- const formik = useFormik({- initialValues: formData.body || {},- validationSchema: dynamicValidationSchema,- onSubmit: (values, { setSubmitting }) => {- // Handle form submission-- setSubmitting(false);- },- validateOnMount: true,- });-- useImperativeHandle(ref, () => ({- handleNextClick: () => {- const isValid = formik.isValid;- actions.handleFormDataChange({ body: formik.values }); // Update parent form data- formik.handleSubmit();- return isValid;- },- }));-- useEffect(() => {- actions.setCanSubmit(true);- }, []);-- return (- <div className="w-full">- <SectionHeader title="New Routine" subtitle="Fill in the required inputs" />- <form className="flex flex-col justify-between mt-6 gap-4">- {inputs.length === 0 && (- <div className="text-gray-500 text-sm text-center">No inputs required</div>- )}- {inputs.map((input) => {- return (- <AgentComponentInput- input={input}- key={input.name}- error={- formik.errors[input.name] &&- formik.touched[input.name] &&- formik.errors[input.name]- }- value={formik.values[input.name] || ''}- onChange={formik.handleChange}- onBlur={formik.handleBlur}- onFileChange={(event) => {- if (!event.currentTarget.files) return;- // convert to base64- const reader = new FileReader();- reader.onload = (e) => {- formik.setFieldValue(input.name, reader.result);- };- reader.readAsDataURL(event.currentTarget.files[0]);- }}- inputSize="sm"- addTypeBadge- />- );- })}- </form>- </div>- );- },-);--export default EndpointInputsFillForm;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EndpointSelection.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EndpointSelection.tsxdeleted file mode 100644index 5a5ef0f9..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EndpointSelection.tsx+++ /dev/null@@ -1,65 +0,0 @@-import SectionHeader from '@react/features/agent-settings/components/ScheduleWidget/meta/SectionTitle';-import { StepChildMethods, StepProps } from '@react/features/agent-settings/components/ScheduleWidget/modes/create/CreateSchedule';-import { useAgentSettingsCtx } from '@react/features/agent-settings/contexts/agent-settings.context';-import classNames from 'classnames';-import { forwardRef, useState } from 'react';--const EndpointSelection = forwardRef<StepChildMethods, StepProps>(({ actions, formData }, ref) => {- const { latestAgentDeploymentQuery } = useAgentSettingsCtx();- const [selectedComponentId, setSelectedComponentId] = useState<string | undefined>(- formData.componentId,- );-- const deployedEndpoints =- latestAgentDeploymentQuery?.data?.deployment?.aiAgentData?.components.filter(- (component) => component.name === 'APIEndpoint',- );-- return (- <div className="w-full">- <SectionHeader title="New Routine" subtitle="Choose an endpoint to schedule" />-- <div className="flex flex-col gap-3 w-full mt-5">- {latestAgentDeploymentQuery.isSuccess &&- latestAgentDeploymentQuery?.data.deployment &&- latestAgentDeploymentQuery.data.deployment.aiAgentData?.components- .filter((component) => component.name === 'APIEndpoint')- .map((component) => {- return (- <div className="flex justify-between group cursor-pointer" key={component.id}>- <button- onClick={() => {- setSelectedComponentId(component.id);- actions?.handleFormDataChange({ componentId: component.id });- actions.setCanSubmit(true);- }}- >- <p- className={classNames(- 'text-sm text-one-line font-semibold group-hover:text-blue-500',- selectedComponentId === component.id ? 'text-blue-500' : '',- )}- title={component.description}- >- {component.title}- <span className="text-xs inline text-gray-400">- {' '}- - /{component.data.endpoint}- </span>- </p>- </button>- </div>- );- })}-- {latestAgentDeploymentQuery.isSuccess && deployedEndpoints.length === 0 && (- <div className="text-gray-500 text-sm text-center">- No endpoints available. Please create one first.- </div>- )}- </div>- </div>- );-});--export default EndpointSelection;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EventKickOff.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EventKickOff.tsxdeleted file mode 100644index 4b46c903..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EventKickOff.tsx+++ /dev/null@@ -1,155 +0,0 @@-import SectionHeader from '@react/features/agent-settings/components/ScheduleWidget/meta/SectionTitle';-import timezoneDisplayMap from '@react/features/agent-settings/components/ScheduleWidget/meta/timezone.json';-import { StepChildMethods, StepProps } from '@react/features/agent-settings/components/ScheduleWidget/modes/create/CreateSchedule';-import { ChangeEvent, forwardRef, useEffect, useImperativeHandle, useState } from 'react';--const divStyle = {- fontSize: '14px',- borderRadius: '5px',- maxHeight: '435px',-};--const EventKickOff = forwardRef<StepChildMethods, StepProps>(({ actions, formData }, ref) => {- // add one hour to the current time as the default start time- const [startDateString, setStartDateString] = useState(- formData.startDate || new Date(Date.now() + 60 * 60 * 1000).toISOString(),- );-- const isStartDateToday = new Date(startDateString).toDateString() === new Date().toDateString();-- const [timezone, setTimezone] = useState(- timezoneDisplayMap[Intl.DateTimeFormat().resolvedOptions().timeZone],- );- const [startDateError, setStartDateError] = useState<string | null>(null);-- const handleTimeChange = (e: ChangeEvent<HTMLInputElement>) => {- setStartDateError(null);- const [hours, minutes] = e.target.value.split(':');- const startDate = new Date(startDateString);- startDate.setHours(parseInt(hours));- startDate.setMinutes(parseInt(minutes));- // actions.handleFormDataChange({- // startDate: startDate.toISOString(),- // });-- setStartDateString(startDate.toISOString());- };-- const getStartTimeInHHMM = (_startDate: string) => {- // output sample: 12:00- const startDate = new Date(_startDate);- const hours = startDate.getHours().toString().padStart(2, '0');- const minutes = startDate.getMinutes().toString().padStart(2, '0');- return `${hours}:${minutes}`;- };- const startTime = getStartTimeInHHMM(startDateString);-- useEffect(() => {- actions.setCanSubmit(true);- }, []);-- useImperativeHandle(ref, () => ({- handleBeforeStepChange: () => {- // save form data- actions.handleFormDataChange({- startDate: startDateString,- });- },-- handleNextClick: () => {- // check if the selected time is in the past- if (new Date(startDateString) < new Date()) {- setStartDateError('The time must be in the future');- return false;- } else {- setStartDateError(null);- }-- return true;- },- }));-- return (- <div style={divStyle}>- <SectionHeader- title="New Routine"- subtitle="What day and time should your agent routine kick off?"- />-- <div className="mt-6">- <div className="flex justify-between items-center mb-4">- <span className="text-gray-700">Run first on this day:</span>-- <div className="max-w-[135px]">- <input- type="date"- name="date"- value={new Date(startDateString).toISOString().split('T')[0]}- onChange={(e) => {- setStartDateError(null);- console.log('e.target.value', e.target.value);-- const selectedDate = new Date(e.target.value);- selectedDate.setHours(new Date(startDateString).getHours());- selectedDate.setMinutes(new Date(startDateString).getMinutes());- // actions.handleFormDataChange({- // startDate: selectedDate.toISOString(),- // });- setStartDateString(selectedDate.toISOString());- }}- min={new Date().toISOString().split('T')[0]}- className="py-2 px-3 border text-gray-900 rounded block w-full outline-none- focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-shadow-none- text-sm font-normal placeholder:text-sm placeholder:font-normal box-border mb-[1px] focus:mb-0- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500"- />- </div>- </div>- <div className="flex flex-col">- <div className="flex justify-between items-center mb-4">- <span className="text-gray-700">At this time:</span>- <div className="flex items-center">- <div className="relative">- <div className="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5 pointer-events-none">- <svg- className="w-4 h-4 text-gray-500 dark:text-gray-400"- aria-hidden="true"- xmlns="http://www.w3.org/2000/svg"- fill="currentColor"- viewBox="0 0 24 24"- >- <path- fillRule="evenodd"- d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm11-4a1 1 0 1 0-2 0v4a1 1 0 0 0 .293.707l3 3a1 1 0 0 0 1.414-1.414L13 11.586V8Z"- clipRule="evenodd"- />- </svg>- </div>- <input- type="time"- id="time"- className="py-2 px-3 border text-gray-900 rounded block w-full outline-none- focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-shadow-none- text-sm font-normal placeholder:text-sm placeholder:font-normal box-border mb-[1px] focus:mb-0- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500"- value={startTime}- onChange={handleTimeChange}- required- />- </div>- </div>- </div>-- {startDateError && (- <p className="text-red-500 text-xs mb-4 text-center">{startDateError}</p>- )}- </div>- <div className="flex justify-between items-center mb-4">- <span style={{ marginLeft: 'auto' }}>{timezone}</span>- </div>- </div>- </div>- );-});--export default EventKickOff;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EventOccurences.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EventOccurences.tsxdeleted file mode 100644index 6143bd91..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/create/steps/EventOccurences.tsx+++ /dev/null@@ -1,397 +0,0 @@-import {- DaySelector,- RadioButton,- UnitNumberInput,- UnitSelector,-} from '@react/features/agent-settings/components/ScheduleWidget/meta/Mini-Components';-import SectionHeader from '@react/features/agent-settings/components/ScheduleWidget/meta/SectionTitle';-import {- SchedulerFormData,- StepChildMethods,- StepProps,-} from '@react/features/agent-settings/components/ScheduleWidget/modes/create/CreateSchedule';-import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';-import { BiSolidDownArrow, BiSolidUpArrow } from 'react-icons/bi';--const divStyle = {- fontSize: '14px',- borderRadius: '5px',- maxHeight: '435px',-};--const unitOptions = [- {- labelSingular: 'minute',- labelPlural: 'minutes',- value: 'min',- min: 5,- max: Infinity,- },- {- labelSingular: 'hour',- labelPlural: 'hours',- value: 'hour',- min: 1,- max: Infinity,- },- {- labelSingular: 'week',- labelPlural: 'weeks',- value: 'week',- min: 1,- max: 1,- default: 1,- },-];--const defaultUnitGp = unitOptions.find((unit) => unit.default);--const EventOccurences = forwardRef<StepChildMethods, StepProps>(- ({ actions, formData: formData }, ref) => {- const currDayIndx = new Date().getDay();- const repeatElementRef = useRef<HTMLDivElement>(null);-- type OptionsData = Pick<- SchedulerFormData,- | 'shouldRepeat'- | 'repeatEvery'- | 'repeatLimit'- | 'endDate'- | 'daysOfWeek'- | 'repeatEveryUnit'- | 'endOption'- >;-- const [optionsData, setOptionsData] = useState<OptionsData>({- shouldRepeat: formData.shouldRepeat || false,- daysOfWeek: formData.daysOfWeek || [currDayIndx],- endOption: formData.endOption || 'never',- repeatLimit: formData.repeatLimit || 1,- repeatEveryUnit: formData.repeatEveryUnit || (defaultUnitGp.value as any),- repeatEvery: formData.repeatEvery || defaultUnitGp.min,- });-- const defaultEndOnDate = new Date(+new Date() + 1 * 24 * 60 * 60 * 1000);-- const currRepeatUnitGp =- unitOptions.find((unit) => unit.value === optionsData.repeatEveryUnit) || defaultUnitGp;-- useEffect(() => {- actions.setCanSubmit(true);- }, []);-- // It was causing a bug on the builder page and causing layout issues. Uncomment if it can be fixed.- // useEffect(- // function scrollToStepView() {- // const repeatHolder = repeatElementRef.current;- // if (!repeatHolder) return;-- // repeatHolder.scrollIntoView({ behavior: 'smooth', block: 'start' });- // },- // [optionsData.shouldRepeat],- // );-- useImperativeHandle(ref, () => ({- handleBeforeStepChange: () => {- // save form data-- actions.handleFormDataChange({- // repeatEvery: count,- shouldRepeat: optionsData.shouldRepeat,- endDate: optionsData.endOption === 'on-date' ? optionsData.endDate : null,- daysOfWeek: optionsData.daysOfWeek,- endOption: optionsData.endOption,- repeatLimit:- optionsData.endOption === 'on-after-occurrences' ? optionsData.repeatLimit : null,- repeatEvery: optionsData.repeatEvery,- repeatEveryUnit: optionsData.repeatEveryUnit,- });- },- }));-- function RepeatOptionSelector() {- return (- <div className="mb-4">- <select- value={optionsData.shouldRepeat ? 'repeat' : 'no-repeat'}- className={`py-2 px-3 border text-gray-900 rounded block w-full h-[36px] outline-none- focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-shadow-none- text-sm font-normal placeholder:text-sm placeholder:font-normal box-border mb-[1px] focus:mb-0- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500`}- onChange={(e) => {- const newRepeatOption = e.target.value as 'no-repeat' | 'repeat';- setOptionsData((prev) => {- return {- ...prev,- shouldRepeat: newRepeatOption === 'repeat',- };- });- }}- >- <option value="no-repeat">No Repeat</option>- <option value="repeat">Repeat</option>- </select>- </div>- );- }-- return (- <div style={divStyle}>- <SectionHeader- title="New Routine"- subtitle="How often and when does your agent's routine kick off?"- />- <div className="mt-6">- <RepeatOptionSelector />- {optionsData.shouldRepeat && (- <>- <div className="flex flex-col mb-4" ref={repeatElementRef}>- {/* <label className="relative inline-flex items-center cursor-pointer ">--- <input- type="checkbox"- value=""- checked={optionsData.useInterval}- onChange={(e) => {- setOptionsData((prev) => {- return { ...prev, useInterval: e.target.checked };- });- }}- className="sr-only peer"- />- <div className="w-9 h-5 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all dark:border-gray-600 peer-checked:bg-[#1a73e8]"></div>- </label> */}- <span className="text-sm text-gray-700 dark:text-gray-300 mr-3">Repeat Every</span>- <div className="flex items-center mb-4 mt-3">- <UnitNumberInput- count={optionsData.repeatEvery}- onChange={(newCount) => {- setOptionsData((prev) => {- return { ...prev, repeatEvery: newCount };- });- }}- unit={optionsData.repeatEveryUnit}- min={currRepeatUnitGp.min}- max={currRepeatUnitGp.max}- />- <div className="ml-1 mr-1 flex flex-col items-center">- <button- onClick={() => {- setOptionsData((prev) => {- return {- ...prev,- repeatEvery: Math.min(- currRepeatUnitGp.max || Infinity,- (prev.repeatEvery || 0) + 1,- ),- };- });- }}- className="p-1 disabled:opacity-50"- disabled={optionsData.repeatEvery === currRepeatUnitGp.max}- >- <BiSolidUpArrow fontSize={10} color="#696969" />- </button>- <button- onClick={() => {- setOptionsData((prev) => {- return {- ...prev,- repeatEvery: Math.max(- currRepeatUnitGp.min,- (prev.repeatEvery || 0) - 1,- ),- };- });- }}- className="p-1 disabled:opacity-50"- disabled={optionsData.repeatEvery === currRepeatUnitGp.min}- >- <BiSolidDownArrow fontSize={10} color="#696969" />- </button>- </div>- <UnitSelector- unit={optionsData.repeatEveryUnit}- unitOptions={unitOptions}- currentCount={optionsData.repeatEvery}- onChange={(newUnit) => {- setOptionsData((prev) => {- return {- ...prev,- repeatEveryUnit: newUnit,- repeatEvery: unitOptions.find((unit) => unit.value === newUnit)?.min || 1,- };- });- }}- />- </div>- </div>- {/* REPEAT ON PART */}- <h3 className="text-gray-700 mb-1">Repeat on</h3>- <DaySelector- selectedDaysIndices={optionsData.daysOfWeek}- toggleDay={(weekDayIndx) => {- setOptionsData((prev) => {- let selectedCount = prev.daysOfWeek.length;- // Ensure at least one day is selected- if (prev.daysOfWeek.includes(weekDayIndx) && selectedCount === 1) {- return prev;- }-- const newSelectedDays = new Set(prev.daysOfWeek);- newSelectedDays.has(weekDayIndx)- ? newSelectedDays.delete(weekDayIndx)- : newSelectedDays.add(weekDayIndx);- return {- ...prev,- daysOfWeek: Array.from(newSelectedDays).sort(),- };- });- }}- />- {/* ENDS ON PART */}- <div className="mb-4 mt-2">- <h3 className="text-gray-700 mb-1">Ends</h3>-- <div className="flex flex-col mt-2">- <RadioButton- name="endOption"- value="never"- checked={optionsData.endOption === 'never'}- onChange={() => setOptionsData((prev) => ({ ...prev, endOption: 'never' }))} // actions.handleFormDataChange({ repeatLimit: null, endDate: null })}- label="Never"- />- <RadioButton- name="endOption"- value="on-date"- checked={optionsData.endOption === 'on-date'}- onChange={() => {- // actions.handleFormDataChange({- // repeatLimit: null,- // endDate: new Date().toISOString(),- // });- setOptionsData((prev) => ({- ...prev,- endDate: prev.endDate || defaultEndOnDate.toISOString(),- endOption: 'on-date',- }));- }}- label="On"- content={- <div className="max-w-[135px] ml-4">- <input- type="date"- name="date"- value={- optionsData.endDate- ? new Date(optionsData.endDate).toISOString().split('T')[0]- : defaultEndOnDate.toISOString().split('T')[0]- }- onChange={(e) => {- const selectedDate = new Date(e.target.value);- setOptionsData((prev) => ({- ...prev,- endDate: selectedDate.toISOString(),- }));- }}- min={defaultEndOnDate.toISOString().split('T')[0]}- disabled={optionsData.endOption !== 'on-date'}- className={`py-2 px-3 border text-gray-900 rounded block w-full outline-none- focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-shadow-none- text-sm font-normal placeholder:text-sm placeholder:font-normal box-border mb-[1px] focus:mb-0- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500- ${- optionsData.endOption !== 'on-date'- ? 'opacity-50 cursor-not-allowed'- : ''- }`}- />- </div>- }- />- <RadioButton- name="endOption"- value="on-after-occurrences"- checked={optionsData.endOption === 'on-after-occurrences'}- onChange={() => {- // setEndOption('on-after-occurrences');- // actions.handleFormDataChange({- // endDate: null,- // repeatLimit: 1,- // });- setOptionsData((prev) => ({- ...prev,- repeatLimit: prev.repeatLimit || 1,- endOption: 'on-after-occurrences',- }));- }}- label="After"- content={- <div className="flex items-center ml-4">- <input- type="text"- // value={occurrences === 1 ? `${occurrences} occurrence` : `${occurrences} occurrences`}- value={- optionsData.repeatLimit === 1- ? `${optionsData.repeatLimit} occurrence`- : `${optionsData.repeatLimit} occurrences`- }- readOnly- disabled={optionsData.endOption !== 'on-after-occurrences'} // Disable input if not 'After' option- className={`py-2 px-3 border text-gray-900 rounded block w-[150px] h-[36px] outline-none- focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-shadow-none- text-sm font-normal placeholder:text-sm placeholder:font-normal box-border mb-[1px] focus:mb-0- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500- text-center- ${- optionsData.endOption !== 'on-after-occurrences'- ? 'opacity-50 cursor-not-allowed'- : ''- }`}- />- <div className="ml-1 flex flex-col items-center">- <button- onClick={() => {- if (optionsData.endOption !== 'on-after-occurrences') return;- // setOccurrences(occurrences + 1);- setOptionsData((prev) => {- return { ...prev, repeatLimit: prev.repeatLimit + 1 };- });- }}- className="p-1 disabled:opacity-50"- disabled={optionsData.endOption !== 'on-after-occurrences'}- >- <BiSolidUpArrow fontSize={10} color="#696969" />- </button>- <button- onClick={() => {- if (optionsData.endOption !== 'on-after-occurrences') return;- // setOccurrences(occurrences > 1 ? occurrences - 1 : 1);- setOptionsData((prev) => {- return { ...prev, repeatLimit: Math.max(1, prev.repeatLimit - 1) };- });- }}- className="p-1 disabled:opacity-50"- disabled={- optionsData.endOption !== 'on-after-occurrences' ||- optionsData.repeatLimit === 1- }- >- <BiSolidDownArrow fontSize={10} color="#696969" />- </button>- </div>- </div>- }- />- </div>- </div>- </>- )}- </div>- </div>- );- },-);--export default EventOccurences;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/job_info/ScheduleInfoView.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/job_info/ScheduleInfoView.tsxdeleted file mode 100644index e0912816..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/job_info/ScheduleInfoView.tsx+++ /dev/null@@ -1,292 +0,0 @@-import { getCronReadableStr, timeAfter, timeAgo } from '@react/features/agent-settings/components/ScheduleWidget/meta/helpers';-import { useAgentSettingsCtx } from '@react/features/agent-settings/contexts/agent-settings.context';-import { AgentScheduledJob } from '@react/shared/types/api-results.types';-import { Spinner } from '@src/react/shared/components/ui/spinner';-import { useQuery } from '@tanstack/react-query';-import { Tabs } from 'flowbite-react';-import React, { useEffect } from 'react';-import { GoLog } from 'react-icons/go';-import { HiArrowNarrowRight, HiCalendar } from 'react-icons/hi';-import { MdArrowBackIos } from 'react-icons/md';--type Props = {- changeView: (id: 'LIST' | 'EDIT' | 'CREATE' | 'INFO', data: { job?: AgentScheduledJob }) => void;- contextData: { job?: AgentScheduledJob };-};--const ScheduleInfoView = (props: Props) => {- const { agentId, agentQuery } = useAgentSettingsCtx();- const jobQuery = useQuery({- queryKey: ['agent_routine_job', props.contextData.job?.id],- queryFn: () =>- fetch(`/api/page/agent_settings/jobs/${props.contextData.job?.id}`).then((res) =>- res.json(),- ) as Promise<{ job: AgentScheduledJob }>,- refetchInterval: 10_000, // 10 seconds- refetchOnWindowFocus: false,- refetchOnMount: false,- refetchOnReconnect: false,- cacheTime: 0,- });-- const matchingComponent = agentQuery.data?.data.components.find(- (component) => component.id === props.contextData.job?.componentId,- );-- const [jobDisplayName, setJobDisplayName] = React.useState<string>('');-- // e.g { '2022-01-01': [log1, log2], '2022-01-02': [log3, log4] }- const triggersGroupedByDay = jobQuery.data?.job?.jobLogs- ? jobQuery.data.job.jobLogs- .filter((log) => typeof log !== 'string')- .reduce(- (acc, log) => {- const date = Intl.DateTimeFormat('en-US', {- year: 'numeric',- month: '2-digit',- day: '2-digit',- }).format(new Date(log.timestamp));- if (!acc[date]) {- acc[date] = [];- }- acc[date].push(log);-- // show the most recent logs first- acc[date].sort((a, b) => (new Date(a.timestamp) > new Date(b.timestamp) ? -1 : 1));- return acc;- },- {} as Record<string, AgentScheduledJob['jobLogs']>,- )- : ({} as Record<string, AgentScheduledJob['jobLogs']>);-- const triggersArray = Object.entries(triggersGroupedByDay)- .map(([date, logs]) => {- return {- date,- triggers: logs,- };- })- .sort((a, b) => (new Date(a.date) > new Date(b.date) ? -1 : 1));-- if (jobQuery.isError) {- return <div className="text-sm text-gray-600 dark:text-white">Failed to load job info</div>;- }-- const loadingTabContent = (- <div className="flex justify-center items-center h-40">- <Spinner classes="fill-v2-blue w-8 h-8" />- </div>- );-- useEffect(() => {- if (jobQuery.isLoading || jobQuery.isError || !jobQuery.data) return;-- async function fetchJobDisplayName() {- setJobDisplayName(jobQuery.data.job?.name || 'Untitled Routine');-- if (jobQuery.data.job.options?.repeat?.pattern) {- const patternReadable = await getCronReadableStr(- jobQuery.data.job.options.repeat.pattern,- true,- );- setJobDisplayName(`${jobQuery.data.job.name || 'Untitled Routine'} (${patternReadable})`);- }- }-- fetchJobDisplayName();- }, [jobQuery.isLoading, jobQuery.isError, jobQuery.data]);-- return (- <div className="max-h-[350px] overflow-y-auto px-2">- <div className="flex items-center mb-4 justify-between">- <button- className="flex items-center text-sm text-gray-600 dark:text-white font-semibold"- onClick={() => props.changeView('LIST', {})}- >- <MdArrowBackIos className="text-lg mr-1" />- {props.contextData.job?.name || 'Job Info'}- </button>-- {jobQuery.isRefetching && <Spinner classes="w-4 h-4 fill-v2-blue" />}- </div>-- <Tabs aria-label="Routine job info tabs" style="underline" color="#1A73E8">- <Tabs.Item active title="Info">- {jobQuery.isLoading && loadingTabContent}-- {jobQuery.isSuccess && jobQuery.data && (- <div className="flex flex-col gap-4">- <div className="flex items-center gap-2">- <HiArrowNarrowRight className="text-lg text-gray-400 dark:text-gray-500" />- <p className="text-sm text-gray-600 dark:text-white">{jobDisplayName}</p>- </div>-- {/* the endpoint */}- <div className="flex items-center gap-2">- <HiArrowNarrowRight className="text-lg text-gray-400 dark:text-gray-500" />- <p className="text-sm text-gray-600 dark:text-white">- Endpoint:{' '}- {matchingComponent ? (- ` ${matchingComponent?.title} (/${matchingComponent?.data?.endpoint})`- ) : (- <span>Not found</span>- )}- </p>- </div>-- <div className="flex items-center gap-2">- <HiCalendar className="text-lg text-gray-400 dark:text-gray-500" />- <p className="text-sm text-gray-600 dark:text-white">- Created on{' '}- {Intl.DateTimeFormat('en-US', {- month: 'long',- day: 'numeric',- year: 'numeric',- }).format(new Date(jobQuery.data.job.createdAt))}- </p>- </div>-- {/* Next trigger */}- {jobQuery.data.job.nextRunAt && (- <div className="flex items-center gap-2">- <HiArrowNarrowRight className="text-lg text-gray-400 dark:text-gray-500" />- <p className="text-sm text-gray-600 dark:text-white">- {jobQuery.data.job.options?.repeat?.pattern ? 'Next trigger: ' : 'Scheduled: '}- {timeAfter(new Date(jobQuery.data.job.nextRunAt))}- </p>- </div>- )}-- {/* Previous trigger (job.lastRunAt if available) */}- {jobQuery.data.job.lastRunAt && (- <div className="flex items-center gap-2">- <HiArrowNarrowRight className="text-lg text-gray-400 dark:text-gray-500" />- <p className="text-sm text-gray-600 dark:text-white">- {jobQuery.data.job.options?.repeat?.pattern ? 'Last trigger: ' : 'Ran at: '}- {timeAgo(new Date(jobQuery.data.job.lastRunAt))}- </p>- </div>- )}-- {/* Ends on info (could be after X triggers or on a specific date) */}- {jobQuery.data.job.options?.repeat?.endDate ? (- <div className="flex items-center gap-2">- <HiArrowNarrowRight className="text-lg text-gray-400 dark:text-gray-500" />- <p className="text-sm text-gray-600 dark:text-white">- Ends on{' '}- {Intl.DateTimeFormat('en-US', {- month: 'long',- day: 'numeric',- year: 'numeric',- }).format(new Date(jobQuery.data.job.options.repeat.endDate))}- </p>- </div>- ) : jobQuery.data.job.options?.repeat?.limit ? (- <div className="flex items-center gap-2">- <HiArrowNarrowRight className="text-lg text-gray-400 dark:text-gray-500" />- <p className="text-sm text-gray-600 dark:text-white">- Ends after {jobQuery.data.job.options.repeat.limit} triggers- </p>- </div>- ) : null}-- {/* Job status */}- </div>- )}- </Tabs.Item>- <Tabs.Item title="Triggers">- {jobQuery.isLoading && loadingTabContent}- <ol className="relative border-s border-gray-200 dark:border-gray-700 border-solid">- {triggersArray.map((logGroup) => (- <li className="mb-10 ms-4" key={Math.random().toString(36).substring(7)}>- <div className="absolute w-3 h-3 bg-gray-200 rounded-full mt-1.5 -start-1.5 border border-white dark:border-gray-900 dark:bg-gray-700"></div>- <time className="mb-4 text-sm font-normal leading-none text-gray-400 dark:text-gray-500">- {Intl.DateTimeFormat('en-US', {- month: 'long',- day: 'numeric',- year: 'numeric',- }).format(new Date(logGroup.date))}- </time>-- <ul className="flex flex-col gap-2">- {logGroup.triggers.map((trigger) => (- <li- key={Math.random().toString(36).substring(7)}- className="flex items-center justify-between"- >- <p className="text-sm text-gray-600 dark:text-white flex items-center gap-2">- {trigger.isSuccessful ? (- <span>Job triggered successfully</span>- ) : (- <span className="text-red-500 dark:text-red-400">- Job failed to trigger- </span>- )}-- {trigger.sessionTag && (- <a- href={`/logs/${agentId}/?tag=${trigger.sessionTag}`}- className="text-blue-500 dark:text-blue-400"- >- <GoLog className="text-sm" />- </a>- )}- </p>-- <span className="text-sm text-gray-400 dark:text-gray-500">- {timeAgo(new Date(trigger.timestamp))}- </span>- </li>- ))}- </ul>- </li>- ))}-- {triggersArray.length === 0 && !jobQuery.isLoading && (- <div className="text-gray-500 text-sm text-center">No triggers recorded</div>- )}- </ol>- </Tabs.Item>-- <Tabs.Item title="Logs">- {jobQuery.isLoading && loadingTabContent}- {/* <ol className="relative border-s border-gray-200 dark:border-gray-700 border-solid">- {logsArray.map((log) => (- <li className="mb-10 ms-4" key={Math.random().toString(36).substring(7)}>- <div className="absolute w-3 h-3 bg-gray-200 rounded-full mt-1.5 -start-1.5 border border-white dark:border-gray-900 dark:bg-gray-700"></div>- <time className="mb-2 text-sm font-normal leading-none text-gray-400 dark:text-gray-500">- {Intl.DateTimeFormat('en-US', {- month: 'long',- day: 'numeric',- year: 'numeric',- }).format(new Date(log.date))}- </time>-- <ul className="flex flex-col gap-2">- {log.logs.map((log) => (- <li key={Math.random().toString(36).substring(7)} className="flex items-center justify-between">- <p className="text-sm text-gray-600 dark:text-white">{log.log}</p>- </li>- ))}- </ul>- </li>- ))}-- {logsArray.length === 0 && !jobQuery.isLoading && <div className="text-gray-500 text-sm text-center">No logs recorded</div>}- </ol> */}-- <div className="flex flex-col gap-2 justify-center mt-3">- <a- href={`/logs/${agentId}/?tag=schedule-run-${props.contextData.job?.id}`}- className="text-blue-500 dark:text-blue-400 text-sm font-semibold text-center"- >- View in logs explorer- </a>- </div>- </Tabs.Item>- </Tabs>- </div>- );-};--export default ScheduleInfoView;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/list/ListScheduleItem.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/list/ListScheduleItem.tsxdeleted file mode 100644index 2b73ad64..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/list/ListScheduleItem.tsx+++ /dev/null@@ -1,137 +0,0 @@-import { schedulerCacheKeys } from '@react/features/agent-settings/components/ScheduleWidget/meta/cache-keys';-import { getCronReadableStr } from '@react/features/agent-settings/components/ScheduleWidget/meta/helpers';-import { useAgentSettingsCtx } from '@react/features/agent-settings/contexts/agent-settings.context';-import { queryClient } from '@react/shared/query-client';-import { AgentScheduledJob } from '@react/shared/types/api-results.types';-import { Spinner } from '@src/react/shared/components/ui/spinner';-import { useMutation } from '@tanstack/react-query';-import React, { useEffect } from 'react';-import { FiTrash } from 'react-icons/fi';-import { toast } from 'react-toastify';--type Props = {- changeView: (id: 'LIST' | 'EDIT' | 'CREATE' | 'INFO', data: { job?: AgentScheduledJob }) => void;- job: AgentScheduledJob;-};--const ListScheduleItem = ({ changeView, job }: Props) => {- const [currTempStatus, setCurrTempStatus] = React.useState(job.status);-- const { agentQuery, agentId } = useAgentSettingsCtx();- const jobDeleteMutation = useMutation({- mutationFn: () => fetch(`/api/page/agent_settings/jobs/${job.id}`, { method: 'DELETE' }),- mutationKey: ['delete_job', job.id],- });-- const [jobDisplayName, setJobDisplayName] = React.useState(job.name || 'Untitled Routine');-- useEffect(() => {- async function getCronStr() {- if (!job.options.repeat?.pattern || job.name) return;- const cronStr = await getCronReadableStr(job.options.repeat.pattern, true);- setJobDisplayName(cronStr);- }- getCronStr();- }, []);-- const changeJobStatusMutation = useMutation({- mutationFn: (status: 'ACTIVE' | 'PAUSED') =>- fetch(`/api/page/agent_settings/jobs/${job.id}/status`, {- method: 'PUT',- body: JSON.stringify({ status }),- headers: {- 'Content-Type': 'application/json',- },- }),- });-- const handleStatusChange = async (e: React.ChangeEvent<HTMLInputElement>) => {- const status = e.target.checked ? 'ACTIVE' : 'PAUSED';- try {- await changeJobStatusMutation.mutateAsync(status);- try {- queryClient.setQueryData(- schedulerCacheKeys.getScheduleListKey(agentId),- (oldData: { jobs: AgentScheduledJob[] }) => {- return {- jobs: oldData?.jobs.map((j) => {- if (j.id === job.id) {- return { ...j, status };- }- return j;- }),- };- },- );- } catch (e) {}-- setCurrTempStatus(status);- } catch (e) {- toast.error('Failed to update job status');- }- };-- return (- <div key={job.id} className="flex items-center justify-between">- <button- onClick={() => {- // navigate to info page of the job- changeView('INFO', { job });- }}- >- <p className="flex-1 text-sm">{jobDisplayName}</p>- </button>-- <div className="flex items-center">- <div className="mr-2">- {jobDeleteMutation.isLoading ? (- <Spinner classes="w-4 h-4 fill-primary-500" />- ) : (- <button- className="text-[#3E3E3E]"- onClick={async () => {- try {- await jobDeleteMutation.mutateAsync();- queryClient.setQueryData(- schedulerCacheKeys.getScheduleListKey(agentId),- (oldData: { jobs: AgentScheduledJob[] }) => {- return {- jobs: oldData?.jobs ? oldData.jobs.filter((j) => j.id !== job.id) : [],- };- },- );- } catch (e) {- toast.error('Failed to delete job');- }- }}- >- <FiTrash />- </button>- )}- </div>-- {/* <button className="text-[#3E3E3E]">- <img src="/img/icons/Edit-gray.svg" className="w-4 h-4 mr-2" alt="edit" />- </button> */}-- {changeJobStatusMutation.isLoading ? (- <Spinner classes="w-4 h-4 fill-primary-500 mx-2" />- ) : (- <label className="relative inline-flex items-center cursor-pointer">- <input- type="checkbox"- value=""- checked={currTempStatus === 'ACTIVE'}- disabled={changeJobStatusMutation.isLoading}- onChange={handleStatusChange}- className="sr-only peer"- />- <div className="w-9 h-5 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all dark:border-gray-600 peer-checked:bg-primary-500"></div>- </label>- )}- </div>- </div>- );-};--export default ListScheduleItem;diff --git a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/list/ListSchedules.tsx b/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/list/ListSchedules.tsxdeleted file mode 100644index 613b3b68..00000000--- a/packages/app/src/react/features/agent-settings/components/ScheduleWidget/modes/list/ListSchedules.tsx+++ /dev/null@@ -1,107 +0,0 @@-import { schedulerCacheKeys } from '@react/features/agent-settings/components/ScheduleWidget/meta/cache-keys';-import ListScheduleItem from '@react/features/agent-settings/components/ScheduleWidget/modes/list/ListScheduleItem';-import { useAgentSettingsCtx } from '@react/features/agent-settings/contexts/agent-settings.context';-import { AgentScheduledJob } from '@react/shared/types/api-results.types';-import { useQuery } from '@tanstack/react-query';-import { Tooltip } from 'flowbite-react';-import { Info } from 'lucide-react';--type Props = {- changeView: (id: 'LIST' | 'EDIT' | 'CREATE', data: { job?: AgentScheduledJob }) => void;-};--const ListSchedules = ({ changeView }: Props) => {- const { agentQuery, agentId, latestAgentDeploymentQuery } = useAgentSettingsCtx();-- const jobsQuery = useQuery({- queryKey: schedulerCacheKeys.getScheduleListKey(agentId),- queryFn: () =>- fetch(`/api/page/agent_settings/jobs/agents/${agentId}`).then(- (res) => res.json() as Promise<{ jobs: AgentScheduledJob[] }>,- ),- refetchOnMount: false,- refetchOnReconnect: false,- refetchOnWindowFocus: false,- });-- const isAgentHasDeployment =- latestAgentDeploymentQuery.isSuccess &&- !latestAgentDeploymentQuery.isError &&- latestAgentDeploymentQuery.data?.deployment !== null;- return (- <div className="flex justify-between items-center flex-col ">- <div className="w-full">- <h3 className="flex items-center gap-2 font-semibold mb-2 text-sm">- Schedule- <Tooltip- className="w-52 text-center"- content="Plan and automate task execution with agent work scheduler."- >- <Info className="w-4 h-4" />- </Tooltip>- </h3>- </div>-- <div className="mt-2 w-full">- {(jobsQuery.isLoading || latestAgentDeploymentQuery.isLoading) && (- <div className="flex flex-col gap-3 w-full mt-4">- {Array.from({ length: 4 }).map((_, i) => (- <RowSkeleton key={i} />- ))}- </div>- )}-- {jobsQuery.isSuccess &&- jobsQuery.data?.jobs.filter((job) => job.status !== 'DELETED').length === 0 &&- isAgentHasDeployment && (- <div className="text-gray-500 text-sm text-center mt-3">No scheduled jobs</div>- )}-- {jobsQuery.isError && (- <div className="text-red-500 text-sm text-center">Failed to fetch scheduled jobs</div>- )}-- <div className="flex flex-col gap-3 w-full max-h-[145px] overflow-y-auto mt-4 p-1">- {jobsQuery.isSuccess &&- isAgentHasDeployment &&- jobsQuery.data?.jobs- .filter((job) => job.status !== 'DELETED') // Filter out deleted jobs- .map((job) => <ListScheduleItem key={job.id} job={job} changeView={changeView} />)}-- {jobsQuery.isSuccess &&- !latestAgentDeploymentQuery.isLoading &&- !isAgentHasDeployment && (- <div className="h-[394px] flex items-center justify-center">- <p className="text-gray-500 text-sm">Please deploy your agent to schedule a job</p>- </div>- )}- </div>-- <div className="mt-8 flex justify-end">- <button- onClick={() => {- if (!isAgentHasDeployment) return;- changeView('CREATE', {});- }}- className="rounded-md flex items-center disabled:opacity-50"- disabled={!isAgentHasDeployment}- >- <img src="/img/icons/Edit-blue.svg" className="w-4 h-4 mr-2" alt="edit" />- <p className="text-[#1A73E8] text-sm font-semibold">Add New</p>- </button>- </div>- </div>- </div>- );-};--function RowSkeleton() {- return (- <div className="flex items-center justify-between animate-pulse">- <div className="h-3 bg-gray-200 rounded-sm dark:bg-gray-700 w-1/2"></div>- <div className="h-3 bg-gray-200 rounded-sm dark:bg-gray-700 w-1/4"></div>- </div>- );-}--export default ListSchedules;diff --git a/packages/app/src/react/features/agent-settings/components/index.ts b/packages/app/src/react/features/agent-settings/components/index.tsindex a6dffc41..ed008396 100644--- a/packages/app/src/react/features/agent-settings/components/index.ts+++ b/packages/app/src/react/features/agent-settings/components/index.ts@@ -1,9 +1,8 @@export { default as AgentInfoWidget } from './AgentInfoWidget';export { default as CapabilitiesWidget } from './CapabilitiesWidget';-export { default as MyToolsWidget } from './MyToolsWidget';-export { default as LogsWidget } from './LogsWidget';-export { default as SettingsWidget } from './SettingsWidget';-export { default as ScheduleWidget } from './ScheduleWidget';-export { default as SecurityWidget } from './SecurityWidget';export { default as EmbodimentsWidget } from './EmbodimentsWidget';++export { default as MyToolsWidget } from './MyToolsWidget';export { default as OverviewWidgetsContainer } from './OverviewWidgetsContainer';+export { default as SecurityWidget } from './SecurityWidget';+export { default as SettingsWidget } from './SettingsWidget';diff --git a/packages/app/src/react/features/agent-settings/constants/index.ts b/packages/app/src/react/features/agent-settings/constants/index.tsindex 64a384cc..b881ae5a 100644--- a/packages/app/src/react/features/agent-settings/constants/index.ts+++ b/packages/app/src/react/features/agent-settings/constants/index.ts@@ -1,11 +1,25 @@-import { atomDark, coy, darcula, dark, materialDark, materialLight, materialOceanic, okaidia, oneDark, oneLight, prism, tomorrow, twilight, vs } from "react-syntax-highlighter/dist/esm/styles/prism";+import {+ atomDark,+ coy,+ darcula,+ dark,+ materialDark,+ materialLight,+ materialOceanic,+ okaidia,+ oneDark,+ oneLight,+ prism,+ tomorrow,+ twilight,+ vs,+} from 'react-syntax-highlighter/dist/esm/styles/prism';export const HUMAN_DESCRIPTION_LIMIT = 120;export const HUMAN_DESCRIPTION_THRESHOLD = 120 - 120 * 0.05;export const MODEL_DESCRIPTION_LIMIT = 8000;export const MODEL_DESCRIPTION_THRESHOLD = 8000 - 8000 * 0.05;-export const CHATBOT_DEFAULT_TEXTS = {systemMessage: 'Hello! How can I assist you today?',userMessage: 'Write a Javascript function that adds two numbers.',@@ -91,4 +105,11 @@ export const SYNTAX_HIGHLIGHT_THEMES = [name: 'okaidia',value: okaidia,},-];\ No newline at end of file+];++export const BaseAgentSettingsTabs = {+ Overview: 'Overview',+ Security: 'Security',+ Tasks: 'Tasks',+ Deployments: 'Deployments',+};diff --git a/packages/app/src/react/features/agent-settings/contexts/agent-settings.context.tsx b/packages/app/src/react/features/agent-settings/contexts/agent-settings.context.tsxindex 28d74e5b..eb7b16f7 100644--- a/packages/app/src/react/features/agent-settings/contexts/agent-settings.context.tsx+++ b/packages/app/src/react/features/agent-settings/contexts/agent-settings.context.tsx@@ -13,6 +13,8 @@ import { useParams } from 'react-router';import { useAgentSettings } from '@react/features/ai-chat/hooks/agent-settings';import { Workspace } from '@src/builder-ui/workspace/Workspace.class';+import { useAuthCtx } from '@src/react/shared/contexts/auth.context';+import { PageACL } from '@src/shared/state_stores/auth';declare const workspace: Workspace;@@ -56,6 +58,7 @@ interface AgentSettingsContextType {serverStatusData: ServerStatus | null;refetchAllData: () => Promise<void>;agentAuthData: Record<string, string> | null;+ pageAccess: PageACL;}const initialState: AgentSettingsContextType = {@@ -70,6 +73,7 @@ const initialState: AgentSettingsContextType = {serverStatusQuery: null,serverStatusData: null,agentAuthData: null,+ pageAccess: { read: false, write: false },};const AgentSettingsContext = createContext<AgentSettingsContextType | null>(null);@@ -88,6 +92,10 @@ export const AgentSettingsProvider: FC<AgentSettingsProviderProps> = ({const [workSpaceObj, setWorkSpaceObj] = useState<Workspace | null>(workspace || null);const [agentAuthData, setAgentAuthData] = useState<any>(null);+ const { getPageAccess } = useAuthCtx();++ const pageAccess = getPageAccess('/agent-settings', false);+// Always call useParams to avoid violating Rules of Hooksconst params = useParams<{ agentId: string }>();@@ -294,6 +302,7 @@ export const AgentSettingsProvider: FC<AgentSettingsProviderProps> = ({serverStatusData: serverStatusQuery.data,refetchAllData,agentAuthData,+ pageAccess,}}>{children}diff --git a/packages/app/src/react/features/agent-settings/pages/AgentSettingsPage.tsx b/packages/app/src/react/features/agent-settings/pages/AgentSettingsPage.tsxindex d1ba2d04..a01962ab 100644--- a/packages/app/src/react/features/agent-settings/pages/AgentSettingsPage.tsx+++ b/packages/app/src/react/features/agent-settings/pages/AgentSettingsPage.tsx@@ -2,10 +2,8 @@ import ChatWithAgentWidget from '@react/features/agent-settings/components/Assigimport CapabilitiesWidget from '@react/features/agent-settings/components/CapabilitiesWidget';import EnvironmentWidget from '@react/features/agent-settings/components/Deployments/EnvironmentWidget';import EmbodimentsWidget from '@react/features/agent-settings/components/EmbodimentsWidget';-import LogsWidget from '@react/features/agent-settings/components/LogsWidget';import MyToolsWidget from '@react/features/agent-settings/components/MyToolsWidget';import OverviewWidgetsContainer from '@react/features/agent-settings/components/OverviewWidgetsContainer';-import ScheduleWidget from '@react/features/agent-settings/components/ScheduleWidget';import AuthWidget from '@react/features/agent-settings/components/Security/AuthWidget';import ChangeLogWidget from '@react/features/agent-settings/components/Security/ChangeLogWidget';import {@@ -17,11 +15,13 @@ import { PRICING_PLAN_REDIRECT } from '@react/shared/constants/navigation';import { useAuthCtx } from '@react/shared/contexts/auth.context';import config from '@src/builder-ui/config';import FullScreenError from '@src/react/features/error-pages/pages/FullScreenError';+import { plugins, PluginTarget, PluginType } from '@src/react/shared/plugins/Plugins';import { Analytics } from '@src/shared/posthog/services/analytics';import { Breadcrumb } from 'flowbite-react';import { useEffect, useRef, useState } from 'react';import { FaHome } from 'react-icons/fa';import { Link } from 'react-router-dom';+import { BaseAgentSettingsTabs } from '../constants';const OPEN_TAB = 'Overview';@@ -36,8 +36,8 @@ export const AgentSettingsPage = (props: Props) => {};export const AgentSettingTabs = () => {- const { userInfo, getPageAccess } = useAuthCtx();- const { agentId, agentQuery, allDeploymentsQuery, latestAgentDeploymentQuery } =+ const { userInfo } = useAuthCtx();+ const { agentId, agentQuery, allDeploymentsQuery, latestAgentDeploymentQuery, pageAccess } =useAgentSettingsCtx();// Define type for session storage data@@ -59,11 +59,21 @@ export const AgentSettingTabs = () => {sessionStorage.removeItem('agentSettings');});- const pageAccess = getPageAccess('/agent-settings', false);- const isWriteAccess = pageAccess?.write;- const isSubscribedToPlan = userInfo?.subs?.plan?.paid ?? false;+ const isWriteAccess = pageAccess.write;+ const isOnPaidPlan = userInfo?.subs?.plan?.paid ?? false;++ const pluginWidgets = plugins.getPluginsByTarget(PluginTarget.AgentSettingsWidgets, PluginType.Config).flatMap((plugin) => (plugin as any).config).reduce((acc, plugin) => {+ Object.keys(plugin).forEach((key) => {+ if (!acc[key]) {+ acc[key] = [];+ }+ acc[key].push(...plugin[key]);+ });+ return acc;+ }, {});+- const widgets = {+ const baseWidgets: Record<keyof typeof BaseAgentSettingsTabs, React.ReactNode[]> = {Overview: [<OverviewWidgetsContainer isWriteAccess={isWriteAccess} />],Security: [<AuthWidget isWriteAccess={isWriteAccess} />],Tasks: [@@ -71,9 +81,8 @@ export const AgentSettingTabs = () => {isWriteAccess={isWriteAccess}isAgentDeployed={!!latestAgentDeploymentQuery?.data?.deployment}/>,- <CapabilitiesWidget isSubscribedToPlan={isSubscribedToPlan} isWriteAccess={isWriteAccess} />,+ <CapabilitiesWidget isOnPaidPlan={isOnPaidPlan} isWriteAccess={isWriteAccess} />,<MyToolsWidget isWriteAccess={isWriteAccess} />,- <ScheduleWidget isSubscribedToPlan={isSubscribedToPlan} isWriteAccess={isWriteAccess} />,],Deployments: [<EmbodimentsWidget@@ -87,19 +96,24 @@ export const AgentSettingTabs = () => {/>,<ChangeLogWidget isWriteAccess={isWriteAccess} allDeployments={allDeploymentsQuery} />,],- Logs: [- <LogsWidget- isSubscribedToPlan={isSubscribedToPlan}- isWriteAccess={isWriteAccess}- userInfo={userInfo}- />,- ],};+ let mergedWidgets = {...baseWidgets, ...pluginWidgets};+++ // we need to make sure that the original widgets objects are not overridden by the plugin widgets if the same key exists+ Object.keys(baseWidgets).forEach((key) => {+ if (pluginWidgets[key]) {+ mergedWidgets[key] = [...(baseWidgets[key] || []), ...(pluginWidgets[key] || [])];+ }+ });+++return (<><div className="flex justify-around mb-6 border-solid border-b-2 border-gray-200">- {Object.keys(widgets).map((name, index) => {+ {Object.keys(mergedWidgets).map((name, index) => {return (<buttonkey={index}@@ -117,7 +131,7 @@ export const AgentSettingTabs = () => {})}</div><div className="grid grid-cols-1 gap-6">- {Object.entries(widgets).map(([key, widgetlist], index) =>+ {Object.entries(mergedWidgets).map(([key, widgetlist]: [string, any[]], index) =>widgetlist.map((widget, index) => (<div key={index} hidden={currentTab !== key}>{widget}@@ -132,7 +146,7 @@ export const AgentSettingTabs = () => {export const AgentSettingsPageBody = (props: Props) => {const { agentId, agentQuery, agentTestDomainQuery, settingsQuery } = useAgentSettingsCtx();const { userInfo } = useAuthCtx();- const isSubscribedToPlan = userInfo?.subs?.plan?.paid ?? false;+ const isOnPaidPlan = userInfo?.subs?.plan?.paid ?? false;const containerRef = useRef<HTMLDivElement>(null);if (!agentQuery.isLoading && !agentTestDomainQuery.isLoading) {if (agentQuery?.error?.['status'] == 403 || agentTestDomainQuery?.error?.['status'] == 403) {@@ -194,7 +208,7 @@ export const AgentSettingsPageBody = (props: Props) => {</h2><div className="flex gap-4">- {!isSubscribedToPlan && (+ {!isOnPaidPlan && (<CustomButtonhandleClick={handleUpgrade}variant="tertiary"diff --git a/packages/app/src/react/features/subscriptions/client/myPlanPage.ts b/packages/app/src/react/features/subscriptions/client/myPlanPage.tsdeleted file mode 100644index 013dc958..00000000--- a/packages/app/src/react/features/subscriptions/client/myPlanPage.ts+++ /dev/null@@ -1,69 +0,0 @@-/**- * Represents the structure of usage data- */-interface UsageData {- usage?: {- tasks?: {- used: number;- };- dataPools?: {- usedSize: number;- unit: string;- };- activeAgents?: number;- };-}--/**- * Fetches usage data from the API.- * @throws Error if the request fails- */-export const fetchUsage = async (): Promise<UsageData | null> => {- const res = await fetch('/api/page/quota/quota/usage');- const data = await res.json();- return data?.usage ? { usage: data.usage } : null;-};--/**- * Fetches team features quota from the API.- * @throws Error if the request fails- */-export const fetchTeamFeaturesQuota = async (): Promise<UsageData> => {- const res = await fetch('/api/page/quota/quota/usage/features', {- method: 'GET',- headers: {- Accept: 'application/json',- 'Content-Type': 'application/json',- },- credentials: 'include',- });-- if (!res.ok) {- const errorData = await res.json().catch(() => ({}));- console.error('Quota features error:', {- status: res.status,- statusText: res.statusText,- errorData,- });- throw new Error(`HTTP error! status: ${res.status}`);- }-- return res.json();-};--/**- * Generates a billing portal session for subscription management.- * @returns The session data containing the URL, or throws an error.- */-export const generateBillingPortalSession = async (): Promise<{ sessionUrl: string }> => {- const res = await fetch('/api/page/plans/subscriptions/billing-portal/generate-session', {- method: 'POST',- });-- if (!res.ok) {- throw new Error('Failed to generate session');- }-- const { session } = await res.json();- return { sessionUrl: session.sessionUrl };-};\ No newline at end of filediff --git a/packages/app/src/react/features/subscriptions/components/plans/build-agents.tsx b/packages/app/src/react/features/subscriptions/components/plans/build-agents.tsxdeleted file mode 100644index e56ebac3..00000000--- a/packages/app/src/react/features/subscriptions/components/plans/build-agents.tsx+++ /dev/null@@ -1,132 +0,0 @@-import { FC } from 'react';-import { FaCheck } from 'react-icons/fa6';--import buildAgentsFeaturesData from '@react/features/subscriptions/data/build-agents-features.json';-import subscriptionTiersData from '@react/features/subscriptions/data/subscription-tiers.json';--interface SubscriptionTier {- key: 'free' | 'builder' | 'startup' | 'scaleup' | 'enterprise';- name: string;- displayName: string;-}--interface Feature {- id: string;- name: string;- description: string;- tiers: Record<SubscriptionTier['key'], boolean>;-}--/**- * BuildAgents component displays a comprehensive feature comparison table- * for Build Agents functionality across different subscription tiers- */-export const BuildAgents: FC = () => {- const subscriptionTiers: SubscriptionTier[] = subscriptionTiersData as SubscriptionTier[];- const features: Feature[] = buildAgentsFeaturesData as Feature[];-- // Renders a feature availability indicator- const renderAvailabilityIndicator = (isAvailable: boolean) => {- return isAvailable ? (- <FaCheck- className="h-4 w-4 sm:h-5 sm:w-5 text-emerald-500 mx-auto"- aria-label="Feature available"- />- ) : (- <span- className="text-gray-400 text-xs sm:text-sm font-medium"- aria-label="Feature not available"- >- –- </span>- );- };-- // Renders tier name with responsive display- const renderTierName = (tier: SubscriptionTier): JSX.Element => (- <span className="font-semibold">- <span className="hidden lg:inline">{tier.displayName}</span>- <span className="lg:hidden" title={tier.displayName}>- {tier.displayName.charAt(0)}- </span>- </span>- );-- return (- <section- className="flex flex-col gap-6 py-8 md:py-12 w-full"- aria-labelledby="build-agents-title"- >- {/* Header Section */}- <header className="space-y-2 w-full">- <h2 id="build-agents-title" className="text-2xl font-bold text-gray-900 sm:text-3xl">- Build Agents- </h2>- <p className="text-sm text-gray-600 sm:text-base max-w-2xl">- Build Agents is a comprehensive feature that enables you to create sophisticated AI agents- using an intuitive visual interface with advanced workflow capabilities.- </p>- </header>-- {/* Feature Comparison Table */}- <div className="relative">- <div className="overflow-x-auto rounded-lg border border-gray-200 shadow-sm">- <table- className="min-w-full divide-y divide-gray-200"- role="table"- aria-label="Build Agents feature comparison across subscription tiers"- >- <thead className="bg-gray-50 text-gray-900 text-xs sm:text-sm font-semibold tracking-wide">- <tr>- <th scope="col" className="px-3 py-3 sm:px-4 sm:py-4 text-left">- Feature- </th>- <th- scope="col"- className="px-3 py-3 sm:px-4 sm:py-4 text-left hidden sm:table-cell"- >- Description- </th>- {subscriptionTiers.map((tier) => (- <th key={tier.key} scope="col" className="px-2 py-3 sm:px-4 sm:py-4 text-center">- {renderTierName(tier)}- </th>- ))}- </tr>- </thead>- <tbody className="bg-white divide-y divide-gray-200">- {features.map((feature, index) => (- <tr- key={feature.id}- className={`transition-colors duration-150 ${- index % 2 === 0 ? 'bg-white' : 'bg-gray-50'- }`}- >- <td className="px-3 py-3 sm:px-4 sm:py-4 text-xs sm:text-sm font-medium text-gray-900">- {feature.name}- </td>- <td className="px-3 py-3 sm:px-4 sm:py-4 text-xs sm:text-sm text-gray-600 hidden sm:table-cell">- {feature.description}- </td>- {subscriptionTiers.map((tier) => (- <td key={tier.key} className="px-2 py-3 sm:px-4 sm:py-4 text-center">- {renderAvailabilityIndicator(feature.tiers[tier.key])}- </td>- ))}- </tr>- ))}- </tbody>- </table>- </div>-- {/* Mobile Legend */}- <div className="mt-4 lg:hidden">- <p className="text-xs text-gray-500 text-center">- <span className="font-medium">Legend:</span> F=Free, B=Builder, S=Startup, S=Scaleup,- E=Enterprise- </p>- </div>- </div>- </section>- );-};diff --git a/packages/app/src/react/features/subscriptions/data/build-agents-features.json b/packages/app/src/react/features/subscriptions/data/build-agents-features.jsondeleted file mode 100644index 3b204ba3..00000000--- a/packages/app/src/react/features/subscriptions/data/build-agents-features.json+++ /dev/null@@ -1,110 +0,0 @@-[- {- "id": "visual-builder",- "name": "Visual Builder",- "description": "Drag-and-drop workflow editor",- "tiers": {- "free": true,- "builder": true,- "startup": true,- "scaleup": true,- "enterprise": true- }- },- {- "id": "visual-debugging",- "name": "Visual Debugging",- "description": "Real-time inspection and testing",- "tiers": {- "free": true,- "builder": true,- "startup": true,- "scaleup": true,- "enterprise": true- }- },- {- "id": "integrations",- "name": "Integrations",- "description": "Slack, HubSpot, Zapier, and others",- "tiers": {- "free": true,- "builder": true,- "startup": true,- "scaleup": true,- "enterprise": true- }- },- {- "id": "chat-to-agent",- "name": "Chat-to-Agent (Weaver)",- "description": "Turn plain prompts into workflows",- "tiers": {- "free": false,- "builder": true,- "startup": true,- "scaleup": true,- "enterprise": true- }- },- {- "id": "nodejs-components",- "name": "NodeJS Components",- "description": "Add custom logic in JavaScript",- "tiers": {- "free": false,- "builder": true,- "startup": true,- "scaleup": true,- "enterprise": true- }- },- {- "id": "private-agents",- "name": "Private Agents",- "description": "Restrict visibility and access",- "tiers": {- "free": false,- "builder": true,- "startup": true,- "scaleup": true,- "enterprise": true- }- },- {- "id": "version-control",- "name": "Version Control",- "description": "Track and roll back changes",- "tiers": {- "free": false,- "builder": true,- "startup": true,- "scaleup": true,- "enterprise": true- }- },- {- "id": "rag-capabilities",- "name": "RAG Capabilities",- "description": "Use real-time data in responses",- "tiers": {- "free": false,- "builder": false,- "startup": true,- "scaleup": true,- "enterprise": true- }- },- {- "id": "enterprise-tools",- "name": "Enterprise Tools",- "description": "Templates and deeper integrations",- "tiers": {- "free": false,- "builder": false,- "startup": false,- "scaleup": true,- "enterprise": true- }- }-]diff --git a/packages/app/src/react/features/subscriptions/data/enterprise-tiers-dev-v4.json b/packages/app/src/react/features/subscriptions/data/enterprise-tiers-dev-v4.jsondeleted file mode 100644index 18715603..00000000--- a/packages/app/src/react/features/subscriptions/data/enterprise-tiers-dev-v4.json+++ /dev/null@@ -1,219 +0,0 @@-[- {- "name": "Enterprise T1",- "price": "$3,499",- "priceSubtext": "per month",- "description": "The base enterprise plan unlocks the use of enterprise models, white glove support and our fastest service. Ideal for teams who take AI transformation seriously.",- "features": [- {- "text": "$500 in free credits/mo."- },- {- "text": "10 seats included"- },- {- "text": "500 GB storage"- },- {- "text": "1.1x in model usage cost"- }- ],- "usageDetails": {- "weProvide": "First $500 free each month. Afterwards, 10% orchestration fee for using models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 10% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 10% Orchestration"- },- "buttonText": "Subscribe",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- { "priceId": "price_1QkldUCl0hhyiPf9coAxDgvB", "for": "base price" },- { "priceId": "price_1QtbXdCl0hhyiPf9G5G3nuEZ", "for": "tasks usage" },- { "priceId": "price_1QkldTCl0hhyiPf90MJCMKoO", "for": "user seats" }- ]- },- {- "name": "Enterprise T2",- "price": "$5,499",- "priceSubtext": "per month",- "description": "This is the minimum plan for which we will help the customer install SmythOS agents to a single AWS enterprise instance.",- "features": [- {- "text": "$1,000 in free credits/mo."- },- {- "text": "30 seats included"- },- {- "text": "1000 GB storage"- },- {- "text": "1.08x in model usage cost"- }- ],- "usageDetails": {- "weProvide": "First $1,000 free each month. 8% orchestration fee for models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free. Running tasks on your own cloud is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 8% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 8% Orchestration"- },- "buttonText": "Subscribe",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- {- "priceId": "price_1QkldWCl0hhyiPf91YqUsbDl",- "for": "base price"- },- {- "priceId": "price_1QtbXdCl0hhyiPf9Fhb7Vf1D",- "for": "tasks usage"- },- {- "priceId": "price_1QkldWCl0hhyiPf9hH8rXcGq",- "for": "user seats"- }- ]- },- {- "name": "Enterprise T3",- "price": "$9,995",- "priceSubtext": "per month",- "description": "This is like T2 plan, but we'll support a second enterprise instance installation for SRE. This plan can also make sense to companies who want to support large teams of 100+ at the best price. The modal usage markup is 40% lower than our T1 plan.",- "features": [- {- "text": "$2,000 in free credits/mo."- },- {- "text": "100 seats included"- },- {- "text": "2000 GB storage"- },- {- "text": "1.06x in model usage cost"- }- ],- "usageDetails": {- "weProvide": "First $2,000 free each month. 6% orchestration fee for models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free. Running tasks on your own cloud is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 6% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 8% Orchestration"- },- "buttonText": "Subscribe",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- {- "priceId": "price_1QkldYCl0hhyiPf993Ib5kGM",- "for": "base price"- },- {- "priceId": "price_1QtbXdCl0hhyiPf9Z6j4FGG0",- "for": "tasks usage"- },- {- "priceId": "price_1QkldXCl0hhyiPf94TLc6WLR",- "for": "user seats"- }- ]- },- {- "name": "Enterprise T4",- "price": "$19,995",- "priceSubtext": "per month",- "description": "The secret to this plan is the $10,000 credits included, making it almost as affordable as the T3 plan, except you also double the users, storage, and lower the model usage cost even more. The perfect plan for those who want it all.",- "features": [- {- "text": "$10,000 in free credits/mo."- },- {- "text": "200 seats included"- },- {- "text": "4000 GB storage"- },- {- "text": "1.05x in model usage cost"- }- ],- "usageDetails": {- "weProvide": "First $10,000 free each month. 5% orchestration fee for models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free. Running tasks on your own cloud is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 5% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 8% Orchestration"- },- "buttonText": "Subscribe",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- {- "priceId": "price_1QkldaCl0hhyiPf9Rjch0ojH",- "for": "base price"- },- {- "priceId": "price_1QtbXeCl0hhyiPf9k6hpmbJP",- "for": "tasks usage"- },- {- "priceId": "price_1QkldZCl0hhyiPf9XKw6EKyQ",- "for": "user seats"- }- ]- },- {- "name": "Partner",- "price": "$399",- "priceSubtext": "per month",- "description": "For startups building AI automations, agents, and APIs.",- "features": [- {- "text": "$200 in free credits / mo."- },- {- "text": "50% model usage discount"- },- {- "text": "5000 fast API calls / day"- },- {- "text": "10 team spaces / Unlimited seats"- }- ],- "additionalFeatures": [- {- "text": "RAG Agents"- },- {- "text": "Collaboration Features"- },- {- "text": "Everything in Builder"- }- ],- "usageDetails": {- "weProvide": "First $10,000 free each month. 5% orchestration fee for models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free. Running tasks on your own cloud is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 5% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 8% Orchestration"- },- "buttonText": "Get Started",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- {- "priceId": "price_1RRvF1Cl0hhyiPf9nxXNxw1I",- "for": "base price"- },- {- "priceId": "price_1RRvEBCl0hhyiPf94LmMftfb",- "for": "tasks usage"- },- {- "priceId": "price_1RRvGDCl0hhyiPf9aHbFbyPp",- "for": "user seats"- }- ]- }-]diff --git a/packages/app/src/react/features/subscriptions/data/enterprise-tiers-prod-v4.json b/packages/app/src/react/features/subscriptions/data/enterprise-tiers-prod-v4.jsondeleted file mode 100644index 174c3702..00000000--- a/packages/app/src/react/features/subscriptions/data/enterprise-tiers-prod-v4.json+++ /dev/null@@ -1,228 +0,0 @@-[- {- "name": "Enterprise T1",- "price": "$3,499",- "priceSubtext": "per month",- "description": "The base enterprise plan unlocks the use of enterprise models, white glove support and our fastest service. Ideal for teams who take AI transformation seriously.",- "features": [- {- "text": "$500 in free credits/mo."- },- {- "text": "10 seats included"- },- {- "text": "500 GB storage"- },- {- "text": "1.1x in model usage cost"- }- ],- "usageDetails": {- "weProvide": "First $500 free each month. Afterwards, 10% orchestration fee for using models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 10% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 10% Orchestration"- },- "buttonText": "Subscribe",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- {- "priceId": "price_1QkV7bCl0hhyiPf9naxKSm7t",- "for": "base price"- },- {- "priceId": "price_1QtbcECl0hhyiPf9X61QpW3b",- "for": "tasks usage"- },- {- "priceId": "price_1QkV8JCl0hhyiPf9VWVj92J4",- "for": "user seats"- }- ]- },- {- "name": "Enterprise T2",- "price": "$5,499",- "priceSubtext": "per month",- "description": "This is the minimum plan for which we will help the customer install SmythOS agents to a single AWS enterprise instance.",- "features": [- {- "text": "$1,000 in free credits/mo."- },- {- "text": "30 seats included"- },- {- "text": "1000 GB storage"- },- {- "text": "1.08x in model usage cost"- }- ],- "usageDetails": {- "weProvide": "First $1,000 free each month. 8% orchestration fee for models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free. Running tasks on your own cloud is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 8% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 8% Orchestration"- },- "buttonText": "Subscribe",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- {- "priceId": "price_1QkVBVCl0hhyiPf9DhOz0IY3",- "for": "base price"- },- {- "priceId": "price_1QtbcECl0hhyiPf9LlSFp1as",- "for": "tasks usage"- },- {- "priceId": "price_1QkVBtCl0hhyiPf9YGbqcEZ4",- "for": "user seats"- }- ]- },- {- "name": "Enterprise T3",- "price": "$9,995",- "priceSubtext": "per month",- "description": "This is like T2 plan, but we'll support a second enterprise instance installation for SRE. This plan can also make sense to companies who want to support large teams of 100+ at the best price. The modal usage markup is 40% lower than our T1 plan.",- "features": [- {- "text": "$2,000 in free credits/mo."- },- {- "text": "100 seats included"- },- {- "text": "2000 GB storage"- },- {- "text": "1.06x in model usage cost"- }- ],- "usageDetails": {- "weProvide": "First $2,000 free each month. 6% orchestration fee for models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free. Running tasks on your own cloud is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 6% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 6% Orchestration"- },- "buttonText": "Subscribe",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- {- "priceId": "price_1QkVJOCl0hhyiPf9wqm8pKBZ",- "for": "base price"- },- {- "priceId": "price_1Qtd4gCl0hhyiPf99trrQBpq",- "for": "tasks usage"- },- {- "priceId": "price_1QkVJuCl0hhyiPf9RRaAwc3r",- "for": "user seats"- }- ]- },- {- "name": "Enterprise T4",- "price": "$19,995",- "priceSubtext": "per month",- "description": "The secret to this plan is the $10,000 credits included, making it almost as affordable as the T3 plan, except you also double the users, storage, and lower the model usage cost even more. The perfect plan for those who want it all.",- "features": [- {- "text": "$10,000 in free credits/mo."- },- {- "text": "200 seats included"- },- {- "text": "4000 GB storage"- },- {- "text": "1.05x in model usage cost"- }- ],- "usageDetails": {- "weProvide": "First $10,000 free each month. 5% orchestration fee for models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free. Running tasks on your own cloud is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 5% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 8% Orchestration"- },- "buttonText": "Subscribe",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- {- "priceId": "price_1QkVOFCl0hhyiPf9VL8VdvhS",- "for": "base price"- },- {- "priceId": "price_1QtbcDCl0hhyiPf9JJaMFwwQ",- "for": "tasks usage"- },- {- "priceId": "price_1QkVOxCl0hhyiPf95eUiASfi",- "for": "user seats"- }- ]- },- {- "name": "Partner",- "price": "$399",- "priceSubtext": "per month",- "description": "For startups building AI automations, agents, and APIs.",- "features": [- {- "text": "$200 in free credits / mo."- },- {- "text": "50% model usage discount"- },- {- "text": "5000 fast API calls / day"- },- {- "text": "10 team spaces / Unlimited seats"- }- ],- "additionalFeatures": [- {- "text": "RAG Agents"- },- {- "text": "Collaboration Features"- },- {- "text": "Everything in Builder"- }- ],- "usageDetails": {- "weProvide": "First $10,000 free each month. 5% orchestration fee for models SmythOS provides, including Tasks & Weaver. Bringing your own API keys and models is always free. Running tasks on your own cloud is always free.",- "bringOwn": "Always Free.",- "runTasks": "$1 per 1,000 Tasks + 5% Orchestration",- "runWeaver": "$3 per 1M Input Tokens, $12 per 1M Output Tokens + 8% Orchestration"- },- "buttonText": "Get Started",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "stripePriceIds": [- {- "priceId": "price_1RRxZNCl0hhyiPf9QR7lvWRn",- "for": "base price"- },- {- "priceId": "price_1RRxY8Cl0hhyiPf957ORMhUm",- "for": "tasks usage"- },- {- "priceId": "price_1RRxb6Cl0hhyiPf96CcYWPJm",- "for": "user seats"- }- ]- }-]diff --git a/packages/app/src/react/features/subscriptions/data/plans.v4.dev.json b/packages/app/src/react/features/subscriptions/data/plans.v4.dev.jsondeleted file mode 100644index 24b34d5f..00000000--- a/packages/app/src/react/features/subscriptions/data/plans.v4.dev.json+++ /dev/null@@ -1,126 +0,0 @@-[- {- "name": "Free Forever",- "description": "For enthusiasts and open source developers building modern AI agents and apps.",- "price": "$0",- "priceSubtext": "",- "features": [- { "text": "$5 in free credits / mo." },- { "text": "1 seat included" },- { "text": "2.5x model usage cost" }- ],- "additionalFeatures": [- { "text": "Public Agents" },- { "text": "Visual Agent IDE" },- { "text": "Free Local Deployment" },- { "text": "Bring your own Model" }- ],- "buttonText": "Start Free Now",- "buttonVariant": "secondary",- "buttonAction": "/"- },- {- "name": "Builder",- "description": "For developers building AI powered workflows, agents, and APIs.",- "price": "$39",- "priceSubtext": "per seat/month",- "features": [- { "text": "$20 in free credits / mo." },- { "text": "1 seat included" },- { "text": "3 GB storage" },- { "text": "1.5x model usage cost" }- ],- "additionalFeatures": [- { "text": "Private Agents" },- { "text": "Agent Weaver Chat-to-agent" },- { "text": "Bring your own Model" },- { "text": "100 fast API calls / day" }- ],- "buttonText": "Get Started",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "priceIds": [- { "priceId": "price_1QkldOCl0hhyiPf9BfzQ8dh5", "for": "base price" },- { "priceId": "price_1QtXJ1Cl0hhyiPf90Jgje6W9", "for": "tasks usage" },- { "priceId": "price_1QkldOCl0hhyiPf9giHpuRxZ", "for": "user seats" }- ]- },- {- "name": "Startup",- "description": "For startups building AI automations, agents, and APIs.",- "price": "$399",- "priceSubtext": "per month",- "features": [- { "text": "$200 in free credits / mo." },- { "text": "3 seats included" },- { "text": "50 GB storage" },- { "text": "1.3x model usage cost" }- ],- "additionalFeatures": [- { "text": "RAG Agents" },- { "text": "Powerful Integrations" },- { "text": "10 Team Spaces" },- { "text": "5,000 fast API calls / day" },- { "text": "Everything in Builder" }- ],- "buttonText": "Get Started",- "buttonVariant": "secondary",- "buttonAction": "/subscriptions",- "priceIds": [- { "priceId": "price_1QkldQCl0hhyiPf9QqPpTYCL", "for": "base price" },- { "priceId": "price_1QtbXcCl0hhyiPf9lqgxG6Iu", "for": "tasks usage" },- { "priceId": "price_1QkldPCl0hhyiPf9aualbmo4", "for": "user seats" }- ]- },- {- "name": "Scaleup",- "description": "For growing companies. Let us build with you for ultimate support and hand-holding.",- "price": "$1499",- "priceSubtext": "per month",- "features": [- { "text": "$300 in free credits / mo." },- { "text": "5 seats included" },- { "text": "100 GB storage" },- { "text": "1.1x model usage cost" }- ],- "additionalFeatures": [- { "text": "Founders on WhatsApp/SMS" },- { "text": "White Labeling" },- { "text": "50 Team Spaces" },- { "text": "25,000 fast API calls / day" },- { "text": "Workshop to set up first API" },- { "text": "Forward deployed engineer" },- { "text": "Everything in Startup" }- ],- "buttonText": "Get Started",- "buttonVariant": "secondary",- "buttonAction": "/subscriptions",- "priceIds": [- { "priceId": "price_1QkldSCl0hhyiPf9WYC97XPg", "for": "base price" },- { "priceId": "price_1QtbXcCl0hhyiPf9NuM33IYQ", "for": "tasks usage" },- { "priceId": "price_1QkldSCl0hhyiPf9mhLHSITY", "for": "user seats" }- ]- },- {- "name": "Enterprise",- "description": "Empower your entire organization with AI transformation.",- "price": "Custom",- "priceSubtext": "",- "features": [- { "text": "Onboarding for entire team" },- { "text": "Enterprise & Fine-Tuned Models" },- { "text": "On-Prem & AWS Deployment" },- { "text": "Unlimited fast API calls/day" }- ],- "additionalFeatures": [- { "text": "Monthly workshops" },- { "text": "White glove support" },- { "text": "Custom retention policies" },- { "text": "Compliance tailoring" },- { "text": "Everything in Scaleup" }- ],- "buttonText": "Chat with Us",- "buttonVariant": "secondary",- "buttonAction": "COMPANY_PLAN_REDIRECT"- }-]diff --git a/packages/app/src/react/features/subscriptions/data/plans.v4.prod.json b/packages/app/src/react/features/subscriptions/data/plans.v4.prod.jsondeleted file mode 100644index 963dc31a..00000000--- a/packages/app/src/react/features/subscriptions/data/plans.v4.prod.json+++ /dev/null@@ -1,126 +0,0 @@-[- {- "name": "Free Forever",- "description": "For enthusiasts and open source developers building modern AI agents and apps.",- "price": "$0",- "priceSubtext": "",- "features": [- { "text": "$5 in free credits / mo." },- { "text": "1 seat included" },- { "text": "2.5x model usage cost" }- ],- "additionalFeatures": [- { "text": "Public Agents" },- { "text": "Visual Agent IDE" },- { "text": "Free Local Deployment" },- { "text": "Bring your own Model" }- ],- "buttonText": "Start Free Now",- "buttonVariant": "secondary",- "buttonAction": "/"- },- {- "name": "Builder",- "description": "For developers building AI powered workflows, agents, and APIs.",- "price": "$39",- "priceSubtext": "per seat/month",- "features": [- { "text": "$20 in free credits / mo." },- { "text": "1 seat included" },- { "text": "3 GB storage" },- { "text": "1.5x model usage cost" }- ],- "additionalFeatures": [- { "text": "Private Agents" },- { "text": "Agent Weaver Chat-to-agent" },- { "text": "Bring your own Model" },- { "text": "100 fast API calls / day" }- ],- "buttonText": "Get Started",- "buttonVariant": "primary",- "buttonAction": "/subscriptions",- "priceIds": [- { "priceId": "price_1QkUm1Cl0hhyiPf9UDlhXo3r", "for": "base price" },- { "priceId": "price_1QtbcFCl0hhyiPf9Q8EcHTgJ", "for": "tasks usage" },- { "priceId": "price_1QkUzkCl0hhyiPf9EtYqMH0d", "for": "user seats" }- ]- },- {- "name": "Startup",- "description": "For startups building AI automations, agents, and APIs.",- "price": "$399",- "priceSubtext": "per month",- "features": [- { "text": "$200 in free credits / mo." },- { "text": "3 seats included" },- { "text": "50 GB storage" },- { "text": "1.3x model usage cost" }- ],- "additionalFeatures": [- { "text": "RAG Agents" },- { "text": "Powerful Integrations" },- { "text": "10 Team Spaces" },- { "text": "5,000 fast API calls / day" },- { "text": "Everything in Builder" }- ],- "buttonText": "Get Started",- "buttonVariant": "secondary",- "buttonAction": "/subscriptions",- "priceIds": [- { "priceId": "price_1QkUynCl0hhyiPf9csFwR5rb", "for": "base price" },- { "priceId": "price_1QtbcFCl0hhyiPf9OTxoTVwN", "for": "tasks usage" },- { "priceId": "price_1QkUynCl0hhyiPf98NVcdH42", "for": "user seats" }- ]- },- {- "name": "Scaleup",- "description": "For growing companies. Let us build with you for ultimate support and hand-holding.",- "price": "$1499",- "priceSubtext": "per month",- "features": [- { "text": "$300 in free credits / mo." },- { "text": "5 seats included" },- { "text": "100 GB storage" },- { "text": "1.1x model usage cost" }- ],- "additionalFeatures": [- { "text": "Founders on WhatsApp/SMS" },- { "text": "White Labeling" },- { "text": "50 Team Spaces" },- { "text": "25,000 fast API calls / day" },- { "text": "Workshop to set up first API" },- { "text": "Forward deployed engineer" },- { "text": "Everything in Startup" }- ],- "buttonText": "Get Started",- "buttonVariant": "secondary",- "buttonAction": "/subscriptions",- "priceIds": [- { "priceId": "price_1QkV2xCl0hhyiPf9ux6hdogA", "for": "base price" },- { "priceId": "price_1QtbcFCl0hhyiPf9f1UlZJfX", "for": "tasks usage" },- { "priceId": "price_1QkV3KCl0hhyiPf9FkIGYRxO", "for": "user seats" }- ]- },- {- "name": "Enterprise",- "description": "Empower your entire organization with AI transformation.",- "price": "Custom",- "priceSubtext": "",- "features": [- { "text": "Onboarding for entire team" },- { "text": "Enterprise & Fine-Tuned Models" },- { "text": "On-Prem & AWS Deployment" },- { "text": "Unlimited fast API calls/day" }- ],- "additionalFeatures": [- { "text": "Monthly workshops" },- { "text": "White glove support" },- { "text": "Custom retention policies" },- { "text": "Compliance tailoring" },- { "text": "Everything in Scaleup" }- ],- "buttonText": "Chat with Us",- "buttonVariant": "secondary",- "buttonAction": "COMPANY_PLAN_REDIRECT"- }-]diff --git a/packages/app/src/react/features/subscriptions/data/subscription-tiers.json b/packages/app/src/react/features/subscriptions/data/subscription-tiers.jsondeleted file mode 100644index fe51fcf6..00000000--- a/packages/app/src/react/features/subscriptions/data/subscription-tiers.json+++ /dev/null@@ -1,7 +0,0 @@-[- { "key": "free", "name": "Free", "displayName": "Free" },- { "key": "builder", "name": "Builder", "displayName": "Builder" },- { "key": "startup", "name": "Startup", "displayName": "Startup" },- { "key": "scaleup", "name": "Scaleup", "displayName": "Scaleup" },- { "key": "enterprise", "name": "Enterprise", "displayName": "Enterprise" }-]diff --git a/packages/app/src/react/features/subscriptions/pages/EnterpriseTierFrameV4.tsx b/packages/app/src/react/features/subscriptions/pages/EnterpriseTierFrameV4.tsxdeleted file mode 100644index 15325f4b..00000000--- a/packages/app/src/react/features/subscriptions/pages/EnterpriseTierFrameV4.tsx+++ /dev/null@@ -1,463 +0,0 @@-import config from '@src/builder-ui/config';-import plansDev from '@src/react/features/subscriptions/data/enterprise-tiers-dev-v4.json';-import plansProd from '@src/react/features/subscriptions/data/enterprise-tiers-prod-v4.json';-import { FeatureFlagged } from '@src/react/shared/components/featureFlags';-import { EnterprisePlanIcon } from '@src/react/shared/components/svgs';-import { Input } from '@src/react/shared/components/ui/input';-import ConfirmModal from '@src/react/shared/components/ui/modals/ConfirmModal';-import { Button } from '@src/react/shared/components/ui/newDesign/button';-import { Spinner } from '@src/react/shared/components/ui/spinner';-import { useAuthCtx } from '@src/react/shared/contexts/auth.context';-import { extractError } from '@src/react/shared/utils/errors';-import { navigateTo } from '@src/react/shared/utils/general';-import { FEATURE_FLAGS } from '@src/shared/constants/featureflags';-import { FC, useState } from 'react';-import { createPortal } from 'react-dom';-import { FaArrowRight, FaCheck } from 'react-icons/fa6';-import { toast } from 'react-toastify';--const enterpriseTiersData = config.env.IS_DEV ? plansDev : plansProd;--/**- * Defines the structure for usage details.- */-type UsageDetails = {- weProvide: string;- bringOwn: string;- runTasks: string;- runWeaver: string;-};--/**- * Defines the structure for a feature.- */-type Feature = {- text: string;-};--/**- * Defines the structure for a Stripe price id.- */-type StripePriceId = {- priceId: string;- for: string;-};--/**- * Defines the structure for an enterprise tier.- */-type EnterpriseTier = {- name: string;- price: string;- priceSubtext: string;- description: string;- features: Feature[];- additionalFeatures: Feature[];- usageDetails: UsageDetails;- buttonText: string;- buttonVariant: 'primary' | 'secondary';- buttonAction: string;- stripePriceIds: StripePriceId[];-};--/**- * Parses and validates enterprise tier data from JSON- * @throws {Error} If data does not match expected schema- */-const enterpriseTiers: EnterpriseTier[] = (() => {- /**- * Validates if the given usage details match the expected schema.- * @param details unknown value to be validated- * @returns true if details is a valid UsageDetails object; otherwise, false.- */- const isValidUsageDetails = (details: unknown): details is UsageDetails => {- return (- typeof details === 'object' &&- details !== null &&- typeof (details as { weProvide: unknown }).weProvide === 'string' &&- typeof (details as { bringOwn: unknown }).bringOwn === 'string' &&- typeof (details as { runTasks: unknown }).runTasks === 'string' &&- typeof (details as { runWeaver: unknown }).runWeaver === 'string'- );- };-- /**- * Validates if the given array is a valid StripePriceId array.- * @param arr - unknown value to validate.- * @returns true if valid; false otherwise.- */- const isValidStripePriceIds = (arr: unknown): arr is StripePriceId[] => {- return (- Array.isArray(arr) &&- arr.every(- (item) =>- typeof item === 'object' &&- item !== null &&- typeof (item as { priceId: unknown }).priceId === 'string' &&- typeof (item as { for: unknown }).for === 'string',- )- );- };-- /**- * Validates if the given tier matches the expected EnterpriseTier schema.- * @param tier unknown value to be validated- * @returns true if tier is a valid EnterpriseTier; otherwise, false.- */- const isValidTier = (tier: unknown): tier is EnterpriseTier => {- if (typeof tier !== 'object' || tier === null) return false;- const t = tier as Record<string, unknown>;- return (- typeof t.name === 'string' &&- typeof t.price === 'string' &&- typeof t.priceSubtext === 'string' &&- typeof t.description === 'string' &&- Array.isArray(t.features) &&- t.features.every((f) => typeof (f as Record<string, unknown>).text === 'string') &&- isValidUsageDetails(t.usageDetails) &&- typeof t.buttonText === 'string' &&- (t.buttonVariant === 'primary' || t.buttonVariant === 'secondary') &&- typeof t.buttonAction === 'string' &&- isValidStripePriceIds(t.stripePriceIds)- );- };-- if (!Array.isArray(enterpriseTiersData) || !enterpriseTiersData.every(isValidTier)) {- throw new Error('Enterprise tiers data does not match expected schema');- }-- return enterpriseTiersData;-})();--/**- * Generates a pricing URL by appending Stripe price id query parameters.- * @param baseUrl - Base URL for navigation.- * @param priceIds - Array of Stripe price id mappings.- * @returns The generated URL with query parameters.- */-const generatePricingUrl = (baseUrl: string, priceIds: StripePriceId[]): string => {- const queryParams = priceIds- .map(- ({ priceId, for: forWhat }) =>- `${encodeURIComponent(forWhat)}=${encodeURIComponent(priceId)}`,- )- .join('&');- return `${baseUrl}?${queryParams}`;-};--type Props = {- tierIndex: number;-};--/**- * EnterpriseTierFrameV4 component to display the Enterprise tier information.- *- * @param {Props} props - Contains the index of the tier to display.- * @returns {JSX.Element | null} Rendered enterprise tier UI or null if no tier is found.- */-export const EnterpriseTierFrameV4: FC<Props> = ({ tierIndex }) => {- const [loading, setLoading] = useState(false);- const [showConfirmationDialog, setShowConfirmationDialog] = useState(false);- const { userInfo, loading: authLoading, refreshUserData } = useAuthCtx();- const tier = enterpriseTiers[tierIndex];- const [promoCode, setPromoCode] = useState('');- const [isLoading, setIsLoading] = useState(false);- const [promoCodeInfo, setPromoCodeInfo] = useState({- type: null,- message: null,- });-- /**- * Gets the appropriate height class based on tier index- * @returns {string} Tailwind height class- */- const getTierHeight = (): string => {- switch (tierIndex) {- case 0:- return 'md:h-[485px]';- case 1:- return 'md:h-[465px]';- case 2:- return 'md:h-[525px]';- case 4:- return 'md:h-[580px]';- default:- return 'md:h-[525px]'; // Default fallback height- }- };-- /**- * Handles the subscribe button click.- * Generates a pricing URL with Stripe IDs and navigates to it.- */- const handleSubscribeClick = async (): Promise<void> => {- setLoading(true);- try {- if (userInfo?.subs?.plan?.isCustomPlan) {- toast.warn('You are on a custom plan, please contact support to change your plan.');- return;- }-- if (userInfo?.subs?.plan?.paid) {- setShowConfirmationDialog(true);- return;- }-- if (tier.stripePriceIds && tier.stripePriceIds.length > 0) {- const pricingUrl = generatePricingUrl(tier.buttonAction, tier.stripePriceIds);- navigateTo(pricingUrl);- } else {- navigateTo(tier.buttonAction);- }- } catch (error) {- toast.error(extractError(error) || 'Something went wrong. Please try again.');- } finally {- setLoading(false);- }- };-- const changePaymentPlan = async (): Promise<void> => {- try {- setLoading(true);-- const res = await fetch('/api/page/plans/subscriptions/v2/change-plan', {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- newPriceIds: tier.stripePriceIds,- isUserAcknowledged: true,- ...(promoCode.trim() ? { promoCode: promoCode.trim() } : {}),- }),- });-- const responseData = await res.json();-- try {- let parsedMessage = JSON.parse(responseData?.message);- if (parsedMessage && parsedMessage.warnings && Array.isArray(parsedMessage.warnings)) {- toast.warning(parsedMessage.warnings.join('\n'));- } else {- toast.success('Your subscription has been updated.');- }- } catch {- // do nothing- toast.success('Your subscription has been updated.');- }- await new Promise((resolve) => setTimeout(resolve, 2000));- await refreshUserData();- setTimeout(() => navigateTo('/my-plan', false), 500);- setShowConfirmationDialog(false);- } catch (error) {- const errorMessage = extractError(error);-- if (errorMessage === 'Invalid promo code') {- return setPromoCodeInfo({ type: 'error', message: errorMessage });- }-- setShowConfirmationDialog(false);- toast.error(errorMessage || 'Something went wrong. Please try again.');- } finally {- setLoading(false);- setPromoCode('');- }- };-- const closeConfirmationDialog = (): void => {- setShowConfirmationDialog(false);- setLoading(false);- setIsLoading(false);- setPromoCodeInfo({- type: null,- message: null,- });- setPromoCode('');- };-- const handlePromoCodeValidation = async () => {- if (promoCode.trim() === '') {- return setPromoCodeInfo({ type: 'error', message: 'Please enter a promo code' });- }-- setIsLoading(true);- try {- const res = await fetch('/api/page/plans/subscriptions/validate-promo-code', {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- promoCode: promoCode.trim(),- }),- });- const data = await res.json();- if (data?.valid) {- setPromoCodeInfo({ type: 'success', message: 'Promo code applied' });- }- } catch (error) {- const errorMessage = extractError(error);- setPromoCodeInfo({ type: 'error', message: errorMessage });- setPromoCode('');- } finally {- setIsLoading(false);- }- };-- /**- * Renders the tier UI.- * @returns {JSX.Element | null}- */- const renderTierUI = (): JSX.Element | null => {- if (!tier) return null;-- return (- <>- {/* Subtracting top navbar height (88px) and content padding (48px) from viewport height to maintain vertical centering */}- <div className="font-sans flex items-center justify-center h-full min-h-[calc(100vh-136px)]">- <div className="container mx-auto px-4">- <div className="flex justify-center">- <div- className={`pricing-tier-item bg-white border border-solid border-[#313131] border-opacity-30 rounded-2xl w-full max-w-[360px] md:max-w-[340px] ${getTierHeight()} h-max overflow-hidden flex flex-col`}- >- <div className="pricing-tier-item-header h-[7rem] min-h-[7rem] bg-[#F5F5F5] flex flex-col gap-1 p-4 border-b-1 border-solid border-[#313131] border-opacity-30">- <div className="flex justify-between items-start">- <div className="flex items-center gap-2">- <EnterprisePlanIcon />- <h2 className="text-base font-bold">{tier.name}</h2>- </div>- </div>- <div className="flex flex-col items-start">- <div className="flex items-center gap-1">- <span className="text-[32px] font-semibold">{tier.price}</span>- {tier.priceSubtext && (- <span className="text-[10px] text-[#3D3D3D]">{tier.priceSubtext}</span>- )}- </div>- </div>- </div>-- <div className="pricing-tier-item-content p-4 flex-grow">- <p className="text-sm">{tier.description}</p>-- {/* Button - Forced to Enterprise button style matching EnterprisePlanFrame.tsx */}- <div className="pricing-tier-item-footer mt-6">- <button- onClick={handleSubscribeClick}- disabled={loading || authLoading}- className="- w-full- bg-[#24242403] text-[#242424] hover:bg-[#000000]/10 border-[#474747]- text-[13px] h-12 rounded-xl border border-solid font-bold- flex items-center justify-center gap-3- group- transition-all duration-300 ease-in-out- disabled:opacity-50 disabled:cursor-not-allowed"- >- <span>{loading ? 'Subscribing ... ' : tier.buttonText}</span>- {loading || authLoading ? <Spinner classes="w-4 h-4" /> : null}- </button>- </div>-- {/* Features – Updated to match EnterprisePlanFrame font size */}- <div className="mt-8 text-sm text-[#767676] px-4">- <ul className="flex flex-col gap-4 mt-4">- {tier.features.map((feature, index) => (- <li key={index} className="flex items-center gap-4">- <FaCheck className="flex-shrink-0" />- <span>{feature.text}</span>- </li>- ))}- {tier?.additionalFeatures?.map((feature, index) => (- <li key={index} className="flex items-center gap-4">- <FaCheck className="flex-shrink-0" style={{ color: '#45C9A9' }} />- <span>{feature.text}</span>- </li>- ))}- </ul>- </div>- </div>- </div>- </div>- </div>- </div>- {showConfirmationDialog &&- createPortal(- <ConfirmModal- onClose={() => closeConfirmationDialog()}- handleConfirm={() => changePaymentPlan()}- label="Confirm"- message="Confirm Your Changes"- isLoading={loading}- children={- <div className="pl-4 pr-6 mb-6 mt-4">- <div className="flex items-center justify-start gap-4 mb-6">- <div className="flex items-center justify-center px-4 py-1 rounded-full border border-solid border-[#313131] border-opacity-30">- <span className="text-base font-medium">Current</span>- </div>- <span className="text-base font-medium">{userInfo?.subs?.plan?.name}</span>- <FaArrowRight className="text-gray-400" />- <div className="flex items-center justify-center px-4 py-1 rounded-full bg-blue-500">- <span className="text-base font-medium text-white">New</span>- </div>- <span className="text-base font-medium">{tier?.name}</span>- </div>- <p className="font-normal text-base text-[#1E1E1E] mt-6 mb-6">- Once you confirm, your new plan goes live right away with refreshed credits,- seats, storage, and model usage.- </p>- <div className="flex items-end gap-2">- <Input- label="Have a Coupon?"- onChange={(e) => {- if (promoCodeInfo.type) {- setPromoCodeInfo({- type: null,- message: null,- });- }-- setPromoCode(e.target.value);- }}- value={promoCode}- fullWidth- />- <div className="w-[20%]">- <Button- handleClick={() => handlePromoCodeValidation()}- label="Apply"- variant="secondary"- loading={isLoading}- disabled={isLoading}- fullWidth- />- </div>- </div>-- {promoCodeInfo.type && (- <p- className={`${- promoCodeInfo.type === 'error' ? 'text-red-500' : 'text-blue-500'- } text-sm mt-2`}- >- {promoCodeInfo.message.replace('promo', 'coupon')}- </p>- )}- </div>- }- />,- document.body,- )}- </>- );- };-- return (- <FeatureFlagged- featureFlag={FEATURE_FLAGS.NEW_PRICING_COLUMNS}- alternateContent={renderTierUI()}- >- {renderTierUI()}- </FeatureFlagged>- );-};diff --git a/packages/app/src/react/features/subscriptions/pages/EnterpriseTierPagesV4.tsx b/packages/app/src/react/features/subscriptions/pages/EnterpriseTierPagesV4.tsxdeleted file mode 100644index f016315c..00000000--- a/packages/app/src/react/features/subscriptions/pages/EnterpriseTierPagesV4.tsx+++ /dev/null@@ -1,7 +0,0 @@-import { EnterpriseTierFrameV4 } from '@src/react/features/subscriptions/pages/EnterpriseTierFrameV4';--export const EnterpriseT1PageV4 = () => <EnterpriseTierFrameV4 tierIndex={0} />;-export const EnterpriseT2PageV4 = () => <EnterpriseTierFrameV4 tierIndex={1} />;-export const EnterpriseT3PageV4 = () => <EnterpriseTierFrameV4 tierIndex={2} />;-export const EnterpriseT4PageV4 = () => <EnterpriseTierFrameV4 tierIndex={3} />;-export const PartnerPageV4 = () => <EnterpriseTierFrameV4 tierIndex={4} />;diff --git a/packages/app/src/react/features/subscriptions/pages/MultiComponentSubscriptionPage.tsx b/packages/app/src/react/features/subscriptions/pages/MultiComponentSubscriptionPage.tsxdeleted file mode 100644index 0617d5d5..00000000--- a/packages/app/src/react/features/subscriptions/pages/MultiComponentSubscriptionPage.tsx+++ /dev/null@@ -1,150 +0,0 @@-import { FC, useEffect, useState } from 'react';-import { useNavigate, useSearchParams } from 'react-router-dom';--import { Spinner } from '@src/react/shared/components/ui/spinner';-import { useAuthCtx } from '@src/react/shared/contexts/auth.context';-import { ERROR_TYPES } from '@src/react/shared/enums';--// Module-level variable to persist subscription attempt state-let hasAttemptedSubscription = false;-/*- Moin:- This is a workaround to persist the subscription attempt state between re-mounts.- For some reason, the page/component is being remounted twice when loaded. Initial investigation didn't show any obvious reasons why this is happening.- I suspect other pages may also be affected. I'll look into this more but I'm currently short on time so have to push this out.-*/--const MultiComponentSubscriptionPage: FC = () => {- const [searchParams] = useSearchParams();- const navigate = useNavigate();- const [loading, setLoading] = useState<boolean>(false);- const [isErrorResponse, setIsErrorResponse] = useState<boolean>(false);- const [errorMessage, setErrorMessage] = useState<string>('');- const [errorType, setErrorType] = useState<string>('');-- const {- userInfo: { user, subs },- } = useAuthCtx();-- useEffect(() => {- console.log('user', user);- console.log('subs', subs);- if (user?.id && !hasAttemptedSubscription) {- if (!subs.plan.isCustomPlan) {- const userSeats = searchParams.get('user seats');- const tasksUsage = searchParams.get('tasks usage');- const basePrice = searchParams.get('base price');- console.log('userSeats', userSeats, 'tasksUsage', tasksUsage, 'basePrice', basePrice);- if (userSeats && tasksUsage) {- hasAttemptedSubscription = true;- subscribeToPaymentPlan(userSeats, tasksUsage, basePrice);- } else {- setIsErrorResponse(true);- setErrorType(ERROR_TYPES.GENERIC);- setErrorMessage('Missing required price information.');- }- } else {- setIsErrorResponse(true);- setErrorType(ERROR_TYPES.ALREADY_SUBSCRIBED);- }- }- }, [user, searchParams]);-- const subscribeToPaymentPlan = async (- userSeats: string,- tasksUsage: string,- basePrice?: string,- ) => {- const priceIds = [- { priceId: userSeats, for: 'user seats' },- { priceId: tasksUsage, for: 'tasks usage' },- ];- if (basePrice) {- priceIds.push({ priceId: basePrice, for: 'base price' });- }- try {- setLoading(true);- setErrorMessage('');- setIsErrorResponse(false);- const res = await fetch('/api/page/plans/subscriptions/v2/checkout/generate-session', {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- priceIds,- }),- });-- const { session } = await res.json();- const { sessionUrl } = session;- if (sessionUrl) {- window.location.href = sessionUrl;- } else {- setIsErrorResponse(true);- setErrorType(ERROR_TYPES.GENERIC);- }- } catch (error) {- setIsErrorResponse(true);- setErrorType(ERROR_TYPES.GENERIC);- setErrorMessage(- error?.error?.message || 'Something went wrong while processing your request.',- );- hasAttemptedSubscription = false;- } finally {- setLoading(false);- }- };-- return (- <div className="font-sans h-screen flex items-center justify-center">- {loading && !isErrorResponse && (- <div className="px-8 py-16 bg-white text-gray-900 w-full md:w-1/2 flex items-center justify-center rounded-lg font-sans font-medium">- <h3 className="text-xl text-center">- Your payment is being processed. Please wait...- <span className="px-2">- <Spinner />- </span>- </h3>- </div>- )}- {isErrorResponse && (- <div className="p-8 bg-white text-gray-900 flex items-center flex-col text-center justify-center rounded-lg font-sans">- {errorType === ERROR_TYPES.ALREADY_SUBSCRIBED ? (- <>- <h3 className="text-xl">- You are already subscribed to a custom plan. Please reach out to support if you need- to change your plan.- </h3>- <button- className="text-white mt-6 flex items-center bg-primary-100 hover:opacity-75 focus:ring-4 focus:outline-none disabled:opacity-40 rounded-md text-sm px-5 py-2.5 text-center justify-center"- type="button"- onClick={() => (window.location.href = '/my-plan')}- >- Plan Details- </button>- </>- ) : (- <>- <h3 className="text-xl">- {errorMessage || 'Something went wrong while processing your request.'}- </h3>- <p className="text-gray-700">- Please try again later or contact support if the issue persists.- </p>- <button- className="text-white mt-6 flex items-center bg-primary-100 hover:opacity-75 focus:ring-4 focus:outline-none disabled:opacity-40 rounded-md text-sm px-5 py-2.5 text-center justify-center"- type="button"- onClick={() => navigate('/')}- >- Back to Home- </button>- </>- )}- </div>- )}- </div>- );-};--export default MultiComponentSubscriptionPage;diff --git a/packages/app/src/react/features/subscriptions/pages/PlansPricingPage.tsx b/packages/app/src/react/features/subscriptions/pages/PlansPricingPage.tsxdeleted file mode 100644index a0d9bcfb..00000000--- a/packages/app/src/react/features/subscriptions/pages/PlansPricingPage.tsx+++ /dev/null@@ -1,643 +0,0 @@-import { FC, useCallback, useEffect, useMemo, useState } from 'react';-import { createPortal } from 'react-dom';-import { FaAngleRight, FaArrowRight, FaCheck } from 'react-icons/fa6';-import { toast } from 'react-toastify';--import { BuildAgents } from '@react/features/subscriptions/components/plans/build-agents';-import config from '@src/builder-ui/config';-import plansDev from '@src/react/features/subscriptions/data/plans.v4.dev.json';-import plansProd from '@src/react/features/subscriptions/data/plans.v4.prod.json';-import { generatePricingUrl } from '@src/react/features/subscriptions/utils';-import { FeatureFlagged } from '@src/react/shared/components/featureFlags';-import {- BuilderPlanIcon,- EnterprisePlanIcon,- FreePlanIcon,- ScaleupPlanIcon,- StartupPlanIcon,-} from '@src/react/shared/components/svgs';-import { Input } from '@src/react/shared/components/ui/input';-import ConfirmModal from '@src/react/shared/components/ui/modals/ConfirmModal';-import { Button } from '@src/react/shared/components/ui/newDesign/button';-import { Spinner } from '@src/react/shared/components/ui/spinner';-import { NEW_ENTERPRISE_PLAN_REDIRECT } from '@src/react/shared/constants/navigation';-import { useAuthCtx } from '@src/react/shared/contexts/auth.context';-import { PRICING_PLANS } from '@src/react/shared/enums';-import { TeamSubs } from '@src/react/shared/types/subscription';-import { extractError } from '@src/react/shared/utils/errors';-import { navigateTo } from '@src/react/shared/utils/general';-import { FEATURE_FLAGS } from '@src/shared/constants/featureflags';-import { Analytics } from '@src/shared/posthog/services/analytics';--const pricingTiers = config.env.IS_DEV ? plansDev : plansProd;--type PricingFeature = {- text: string;-};--type PricingTier = {- name: string;- price: string;- subs: TeamSubs;- stripeId?: string;- buttonText: string;- description: string;- priceSubtext: string;- buttonAction: string;- features: PricingFeature[];- additionalFeatures: PricingFeature[];- buttonVariant: 'primary' | 'secondary';- priceIds?: { priceId: string; for: string }[]; // Add this line to type priceIds-};--const PricingTierItem: FC<PricingTier> = ({- name,- price,- subs,- features,- additionalFeatures,- buttonText,- description,- buttonAction,- priceSubtext,- buttonVariant,- priceIds,-}) => {- const { userInfo, refreshUserData } = useAuthCtx();- const [showConfirmationDialog, setShowConfirmationDialog] = useState(false);- const [loading, setLoading] = useState(false);- const isEnterprise = name.toLowerCase() === PRICING_PLANS.ENTERPRISE.toLowerCase();- const isFree = name.toLowerCase() === PRICING_PLANS.FREE_FOREVER.toLowerCase();- const [promoCode, setPromoCode] = useState('');- const [isLoading, setIsLoading] = useState(false);- const [promoCodeInfo, setPromoCodeInfo] = useState({- type: null,- message: null,- });-- const isCurrentPlan = useCallback(- (planName: string) => {- return planName.toLowerCase() === subs?.plan?.name.toLowerCase();- },- [subs?.plan?.name],- );-- const closeConfirmationDialog = () => {- setShowConfirmationDialog(false);- setPromoCodeInfo({- type: null,- message: null,- });- setPromoCode('');- };-- const changePaymentPlan = async () => {- try {- setLoading(true);- const res = await fetch('/api/page/plans/subscriptions/v2/change-plan', {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- newPriceIds: priceIds,- isUserAcknowledged: true,- ...(promoCode.trim() ? { promoCode: promoCode.trim() } : {}),- }),- });- const responseData = await res.json();-- try {- let parsedMessage = JSON.parse(responseData?.message);- if (parsedMessage && parsedMessage.warnings && Array.isArray(parsedMessage.warnings)) {- toast.warning(parsedMessage.warnings.join('\n'));- } else {- toast.success('Your subscription has been updated.');- }- } catch {- // do nothing- toast.success('Your subscription has been updated.');- }- await new Promise((resolve) => setTimeout(resolve, 2000));- await refreshUserData();- setTimeout(() => navigateTo('/my-plan', false), 500);- setShowConfirmationDialog(false);- } catch (error) {- const errorMessage = extractError(error);- if (errorMessage === 'Invalid promo code') {- return setPromoCodeInfo({ type: 'error', message: errorMessage });- }-- setShowConfirmationDialog(false);- if (- errorMessage === 'Team does not subscribe to any paid plan' &&- subs?.plan?.name === 'Early Adopters'- ) {- toast.error(- "Early Adopter is a custom plan and can't be changed directly. Contact support to change your plan.",- );- } else {- toast.error(errorMessage || 'Something went wrong. Please try again.');- }- } finally {- setLoading(false);- setPromoCode('');- }- };-- const getPlanIcon = (planName: string): JSX.Element => {- const lowerCasePlanName = planName.toLowerCase();-- switch (lowerCasePlanName) {- case 'free':- return <FreePlanIcon />;- case 'builder':- return <BuilderPlanIcon />;- case 'startup':- return <StartupPlanIcon />;- case 'scaleup':- return <ScaleupPlanIcon />;- case 'enterprise':- return <EnterprisePlanIcon />;- default:- return <FreePlanIcon />;- }- };-- const handleButtonClick = () => {- Analytics.track(`app_${name.toLowerCase()}_plan_clicked`, {- currentPlan: subs?.plan?.name.toLowerCase(),- userEmail: userInfo?.user?.email,- });-- try {- let url = buttonAction;-- if (name.toLowerCase() === PRICING_PLANS.FREE.toLowerCase()) {- navigateTo('/');- return;- }-- if (isEnterprise) {- // Try using window.open as a fallback if navigateTo doesn't work- const opened = window.open(NEW_ENTERPRISE_PLAN_REDIRECT, '_blank');- if (!opened) {- navigateTo(NEW_ENTERPRISE_PLAN_REDIRECT, false, '_blank');- }- return;- }-- // if user is on a paid plan, redirect to the subscription page- if (subs?.plan?.paid && !subs?.plan?.isCustomPlan) {- setShowConfirmationDialog(true);- return;- }-- // Add query parameters for priceIds if they exist- if (priceIds && priceIds.length > 0) {- url = generatePricingUrl(url, priceIds);- }-- navigateTo(url);- } catch (error) {}- };-- const getButtonContent = () => {- if (loading) return <Spinner classes="w-4 h-4" />;- if (isCurrentPlan(name)) return 'Current Plan';- return buttonText;- };-- const handlePromoCodeValidation = async () => {- if (promoCode.trim() === '') {- return setPromoCodeInfo({ type: 'error', message: 'Please enter a promo code' });- }-- setIsLoading(true);- try {- const res = await fetch('/api/page/plans/subscriptions/validate-promo-code', {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- promoCode: promoCode.trim(),- }),- });- const data = await res.json();- if (data?.valid) {- setPromoCodeInfo({ type: 'success', message: 'Promo code applied' });- }- } catch (error) {- const errorMessage = extractError(error);- setPromoCodeInfo({ type: 'error', message: errorMessage });- setPromoCode('');- } finally {- setIsLoading(false);- }- };-- if (isFree) {- return (- <>- <div className="w-full max-w-[360px] md:max-w-full mx-auto">- <div className="w-full flex items-center gap-2 my-2 md:px-4">- <span className="text-[16px] font-bold">Public</span>- <div className="h-[1px] bg-[#313131] opacity-30 flex-1" />- </div>- <div className="bg-white border border-solid border-[#313131] border-opacity-30 rounded-2xl overflow-hidden">- {/* Add header section to match other cards */}- <div className="pricing-tier-item-header h-[7rem] min-h-[7rem] flex flex-col gap-1 p-4 border-opacity-30 md:hidden">- <div className="flex items-center gap-2">- {getPlanIcon(name.toLowerCase())}- <h2 className="text-base font-bold">{name}</h2>- </div>- <div className="flex flex-col items-start">- <div className="flex items-center gap-1">- <span className="text-[32px] font-semibold">{price}</span>- </div>- </div>- </div>-- <div className="p-4 md:p-8">- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-6 md:gap-8">- {/* Column 1: Info */}- <div className="flex flex-col md:col-span-2 lg:col-span-1">- <div className="hidden md:flex items-center gap-2">- {getPlanIcon(name.toLowerCase())}- <h2 className="text-base font-bold">{name}</h2>- </div>- <div className="hidden md:block mt-2">- <span className="text-[32px] font-bold">{price}</span>- </div>- <p className="text-[13px] font-normal tracking-[-0.02em] md:mt-2">- {description}- </p>-- {/* Mobile-only button */}- <div className="mt-4 -mb-2 lg:hidden">- <button- onClick={handleButtonClick}- disabled={loading || isCurrentPlan(name)}- className={`- w-full- ${- buttonVariant === 'primary'- ? 'bg-[#43caa9] text-white hover:bg-[#43caa9]/90 border-[#43caa9]'- : 'bg-[#24242403] text-[#242424] hover:bg-[#000000]/10 border-[#474747]'- }- text-[13px] h-12 rounded-xl border border-solid font-bold- flex items-center justify-center gap-3- group- transition-all duration-300 ease-in-out- disabled:opacity-50 disabled:cursor-not-allowed- `}- >- <span>{getButtonContent()}</span>- </button>- </div>- </div>- {/* Features Container */}- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-3 md:gap-10 md:col-span-2 lg:col-span-3 px-4 md:px-0">- <div className="flex flex-col gap-1 md:px-4">- {features.slice(0, 4).map((feature, index) => (- <div- key={index}- className="flex items-center text-[#6B7280] text-[12px] font-medium gap-2"- >- <FaCheck className="flex-shrink-0" />- <span>{feature.text}</span>- </div>- ))}- <div>- <hr className="border-[#313131] border-opacity-30 my-1 mb-2 md:mb-1" />- </div>- {additionalFeatures?.map((feature, index) => (- <div key={index} className="flex items-center text-[11px] font-medium gap-2">- <FaCheck className="text-[#45C9A9] flex-shrink-0" />- <span className="text-[#6B7280]">{feature.text}</span>- </div>- ))}- </div>-- <div className="flex flex-col gap-3 md:px-4 mt-4 md:mt-0">- <h3 className="text-[#242424] text-[12px] font-bold tracking-[-0.02em]">- Commitment to Open Agents- </h3>- <p className="text-[12px] font-normal tracking-[-0.02em]">- <span className="font-bold">SmythOS</span> believes the AI Agent revolution- should be accessible to everyone.- </p>- <p className="text-[12px] font-normal tracking-[-0.02em]">- So we made our world class visual IDE free for building public, open source- agents. Moreover, you can run them on your own hardware at no cost.- </p>- <p className="text-[#0366D6] text-[12px] italic">- - Michael, Alexander & Gary, SmythOS founders- </p>- </div>- </div>-- {/* Column 5: Button (Desktop only) */}- <div className="hidden lg:flex justify-center items-center h-full">- <button- onClick={handleButtonClick}- disabled={loading || isCurrentPlan(name)}- className={`- w-full- ${- buttonVariant === 'primary'- ? 'bg-[#43caa9] text-white hover:bg-[#43caa9]/90 border-[#43caa9]'- : 'bg-[#24242403] text-[#242424] hover:bg-[#000000]/10 border-[#474747]'- }- text-[13px] h-12 rounded-xl border border-solid font-bold- flex items-center justify-center gap-3- group- transition-all duration-300 ease-in-out- disabled:opacity-50 disabled:cursor-not-allowed- `}- >- <span>{getButtonContent()}</span>- </button>- </div>- </div>- </div>- </div>- <div className="w-full flex items-center gap-2 mt-4 md:px-4">- <span className="text-[16px] font-bold">Private</span>- <div className="h-[1px] bg-[#313131] opacity-30 flex-1" />- </div>- </div>- </>- );- }-- return (- <>- <div className="pricing-tier-item bg-white border border-solid border-[#313131] border-opacity-30 rounded-2xl w-full min-w-[260px] max-w-[360px] md:max-w-[340px] md:h-[610px] h-max overflow-hidden flex flex-col">- <div className="pricing-tier-item-header h-[7rem] min-h-[7rem] bg-[#F5F5F5] flex flex-col gap-1 p-4 border-b-1 border-solid border-[#313131] border-opacity-30">- <div className="flex justify-between items-start">- <div className="flex items-center gap-2">- {getPlanIcon(name.toLowerCase())}- <h2 className="text-base font-bold">{name}</h2>- </div>-- {name === 'Builder' && (- <span className="bg-[#43caa9] text-white text-xs font-semibold px-2 py-1 rounded">- Most Popular- </span>- )}- </div>- <div className="flex flex-col items-start">- <div className="flex items-center gap-1">- <span className="text-[32px] font-semibold">{price}</span>- {priceSubtext && <span className="text-[12px] text-[#3D3D3D]">{priceSubtext}</span>}- </div>- </div>- </div>- <div className="pricing-tier-item-content p-4 flex-grow">- <p className="text-[13px] font-normal tracking-[-0.02em]">{description}</p>- <div className="pricing-tier-item-footer mt-4">- <button- onClick={handleButtonClick}- disabled={loading || isCurrentPlan(name)}- className={`- w-full- ${- buttonVariant === 'primary'- ? 'bg-[#43caa9] text-white hover:bg-[#43caa9]/90 border-[#43caa9]'- : 'bg-[#24242403] text-[#242424] hover:bg-[#000000]/10 border-[#474747]'- }- text-[13px] h-12 rounded-xl border border-solid font-bold- flex items-center justify-center gap-3- group- transition-all duration-300 ease-in-out- disabled:opacity-50 disabled:cursor-not-allowed- `}- >- <span>{getButtonContent()}</span>- </button>- </div>- <div className="mt-2 text-[12px] font-medium text-[#767676] px-4">- <ul className="flex flex-col gap-1 mt-4">- {features.map((feature, index) => (- <li key={index} className="flex items-center gap-4">- <FaCheck /> {feature.text}- </li>- ))}- {additionalFeatures && additionalFeatures.length > 0 && (- <li>- <hr className="border-[#313131] border-opacity-30 my-1 mb-2" />- </li>- )}- {additionalFeatures?.map((feature, index) => (- <li key={`additional-${index}`} className="flex items-center gap-4">- <FaCheck color="#45C9A9" /> {feature.text}- </li>- ))}- </ul>- </div>- </div>- </div>- {showConfirmationDialog &&- createPortal(- <ConfirmModal- onClose={() => closeConfirmationDialog()}- handleConfirm={() => changePaymentPlan()}- label="Confirm"- message="Confirm Your Changes"- isLoading={loading}- children={- <div className="pl-4 pr-6 mb-6 mt-4">- <div className="flex items-center justify-start gap-4 mb-6">- <div className="flex items-center justify-center px-4 py-1 rounded-full border border-solid border-[#313131] border-opacity-30">- <span className="text-base font-medium">Current</span>- </div>- <span className="text-base font-medium">{subs?.plan?.name}</span>- <FaArrowRight className="text-gray-400" />- <div className="flex items-center justify-center px-4 py-1 rounded-full bg-blue-500">- <span className="text-base font-medium text-white">New</span>- </div>- <span className="text-base font-medium">{name}</span>- </div>- <p className="font-normal text-base text-[#1E1E1E] mt-6 mb-6">- Once you confirm, your new plan goes live right away with refreshed credits,- seats, storage, and model usage.- </p>- <div className="flex items-end gap-2">- <Input- label="Have a Coupon?"- onChange={(e) => {- if (promoCodeInfo.type) {- setPromoCodeInfo({- type: null,- message: null,- });- }-- setPromoCode(e.target.value);- }}- value={promoCode}- fullWidth- />- <div className="w-[20%]">- <Button- handleClick={() => handlePromoCodeValidation()}- label="Apply"- variant="secondary"- loading={isLoading}- disabled={isLoading}- fullWidth- />- </div>- </div>-- {promoCodeInfo.type && (- <p- className={`${- promoCodeInfo.type === 'error' ? 'text-red-500' : 'text-blue-500'- } text-sm mt-2`}- >- {promoCodeInfo.message.replace('promo', 'coupon')}- </p>- )}- </div>- }- />,- document.body,- )}- </>- );-};--/**- * PlansFrameV4 component renders the pricing plans.- *- * When embedded as an auto-expanding iframe, we override the scroll styles- * on the root containers (html, body, main) to remove duplicate scrollbars.- */-export const PlansPricingPage: FC<{ isInternalPage?: boolean }> = ({ isInternalPage }) => {- const { userInfo } = useAuthCtx();- const subs = userInfo?.subs;-- // If this page is embedded inside an iframe, remove the internal scrollbar.- useEffect(() => {- // Check if the current window is inside an iframe.- if (window.self !== window.top) {- // Create a new style element with high specificity.- const styleElement: HTMLStyleElement = document.createElement('style');- styleElement.type = 'text/css';- styleElement.id = 'iframe-scrollbar-override';- // Override scroll settings for the root elements.- styleElement.innerHTML = `- html, body, main {- overflow: visible !important;- height: auto !important;- }- `;- document.head.appendChild(styleElement);-- // Cleanup: remove the style element on unmount.- return () => {- const existingStyleElement = document.getElementById('iframe-scrollbar-override');- if (existingStyleElement && existingStyleElement.parentNode) {- existingStyleElement.parentNode.removeChild(existingStyleElement);- }- };- }- }, []);-- const renderPlanFrameUI = () => {- const filteredPaidTiers = useMemo(- () =>- pricingTiers.filter((tier) => {- return tier.name.toLowerCase() !== PRICING_PLANS.FREE_FOREVER.toLowerCase();- }),- [userInfo?.user?.id],- );- const filteredFreeTiers = useMemo(- () =>- pricingTiers.filter((tier) => {- return tier.name.toLowerCase() === PRICING_PLANS.FREE_FOREVER.toLowerCase();- }),- [userInfo?.user?.id],- );-- return (- <div className="pricing-page-iframe ml-16 md:ml-0" data-iframe-height>- {isInternalPage && (- <div className="flex flex-col items-center md:items-start my-4">- <h2 className="text-lg font-bold">Manage Your Subscription</h2>- <p className="text-base text-gray-700">Current Plan: {subs?.plan?.name}</p>- </div>- )}- <div className="pricing-plans-container flex flex-col items-center gap-3 w-full">- {!userInfo?.user?.id && filteredFreeTiers.length > 0 && (- <div className="w-full md:w-[96%] lg:w-full xl:w-full 2xl:w-[98%] flex flex-wrap justify-center gap-3">- {filteredFreeTiers.map((tier: any, index) => (- <PricingTierItem- key={index}- {...tier}- subs={subs}- buttonVariant={tier.buttonVariant as 'primary' | 'secondary'}- />- ))}- </div>- )}- <div className="w-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 place-items-center">- {filteredPaidTiers.map((tier: any, index) => (- <PricingTierItem- key={index}- {...tier}- subs={subs}- buttonVariant={tier.buttonVariant as 'primary' | 'secondary'}- />- ))}- </div>- </div>-- {/* Rest of the existing content */}- {isInternalPage && (- <div className="flex justify-center mt-8">- <button- onClick={() => navigateTo('https://smythos.com/pricing/', false, '_blank')}- className="- w-48 bg-[#242424] text-white hover:bg-[#242424d9]- text-[13px] h-10 rounded-lg border border-solid border-[#474747] font-medium- flex items-center justify-center gap-3 group transition-all duration-300 ease-in-out"- >- <span>Compare All Plans</span>- <FaAngleRight- fontSize={13}- color="#fff"- className="transition-transform duration-300 ease-in-out group-hover:translate-x-1"- />- </button>- </div>- )}-- {/* <div className="mt-8 md:mt-12 flex gap-6 md:gap-12 flex-col md:flex-row justify-center items-center text-center">- <div>- <StartIcon className="mx-auto mb-2" />- <p>Rated 4.9/5 stars in 100+ reviews</p>- </div>- <div>- <UserFeedbackIcon className="mx-auto mb-2" />- <p>Incredible Support Community</p>- </div>- </div> */}-- <BuildAgents />- </div>- );- };-- return (- <FeatureFlagged- featureFlag={FEATURE_FLAGS.NEW_PRICING_COLUMNS}- alternateContent={renderPlanFrameUI()}- >- {renderPlanFrameUI()}- </FeatureFlagged>- );-};diff --git a/packages/app/src/react/features/subscriptions/pages/SinglePriceSubscriptionPage.tsx b/packages/app/src/react/features/subscriptions/pages/SinglePriceSubscriptionPage.tsxdeleted file mode 100644index b6375a47..00000000--- a/packages/app/src/react/features/subscriptions/pages/SinglePriceSubscriptionPage.tsx+++ /dev/null@@ -1,117 +0,0 @@-import { useEffect, useState } from 'react';-import { useNavigate, useParams } from 'react-router-dom';--import { Spinner } from '@src/react/shared/components/ui/spinner';-import { useAuthCtx } from '@src/react/shared/contexts/auth.context';-import { ERROR_TYPES } from '@src/react/shared/enums';--const SinglePriceSubscriptionPage = () => {- const params = useParams();- const navigate = useNavigate();- const [loading, setLoading] = useState<boolean>(false);- const [isErrorResponse, setIsErrorResponse] = useState<boolean>(false);- const [errorMessage, setErrorMessage] = useState<string>('');- const [errorType, setErrorType] = useState<string>('');-- const {- userInfo: { user, subs },- } = useAuthCtx();-- useEffect(() => {- const { priceId } = params;- if (priceId && user?.id) {- if (!subs.plan.isCustomPlan) {- subscribeToPaymentPlan(priceId);- } else {- setIsErrorResponse(true);- setErrorType(ERROR_TYPES.ALREADY_SUBSCRIBED);- }- }- }, [params, user]);-- const subscribeToPaymentPlan = async (priceId: string) => {- try {- setLoading(true);- setErrorMessage('');- setIsErrorResponse(false);- const res = await fetch('/api/page/plans/subscriptions/checkout/generate-session', {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- priceId,- }),- });-- const { session } = await res.json();- const { sessionUrl } = session;- if (sessionUrl) {- window.location.href = sessionUrl;- } else {- setIsErrorResponse(true);- setErrorType(ERROR_TYPES.GENERIC);- }- } catch (error) {- setIsErrorResponse(true);- setErrorType(ERROR_TYPES.GENERIC);- setErrorMessage(- error?.error?.message || 'Something went wrong while processing your request.',- );- } finally {- setLoading(false);- }- };-- return (- <div className="font-sans h-screen flex items-center justify-center">- {loading && !isErrorResponse && (- <div className="px-8 py-16 bg-white text-gray-900 w-full md:w-1/2 flex items-center justify-center rounded-lg font-sans font-medium">- <h3 className="text-xl text-center">- Your payment is being processed. Please wait...- <span className="px-2">- <Spinner />- </span>- </h3>- </div>- )}- {isErrorResponse && (- <div className="p-8 bg-white text-gray-900 flex items-center flex-col text-center justify-center rounded-lg font-sans">- {errorType === ERROR_TYPES.ALREADY_SUBSCRIBED ? (- <>- <h3 className="text-xl">- You are already subscribed to a custom plan. Please reach out to support if you need- to change your plan.- </h3>- <button- className="text-white mt-6 flex items-center bg-primary-100 hover:opacity-75 focus:ring-4 focus:outline-none disabled:opacity-40 rounded-md text-sm px-5 py-2.5 text-center justify-center"- type="button"- onClick={() => (window.location.href = '/my-plan')}- >- Plan Details- </button>- </>- ) : (- <>- <h3 className="text-xl">- {errorMessage || 'Something went wrong while processing your request.'}- </h3>- <p className="text-gray-700">- Please try again later or contact support if the issue persists.- </p>- <button- className="text-white mt-6 flex items-center bg-primary-100 hover:opacity-75 focus:ring-4 focus:outline-none disabled:opacity-40 rounded-md text-sm px-5 py-2.5 text-center justify-center"- type="button"- onClick={() => navigate('/')}- >- Back to Home- </button>- </>- )}- </div>- )}- </div>- );-};--export default SinglePriceSubscriptionPage;diff --git a/packages/app/src/react/shared/plugins/Plugins.ts b/packages/app/src/react/shared/plugins/Plugins.tsindex 536d049f..81729b1d 100644--- a/packages/app/src/react/shared/plugins/Plugins.ts+++ b/packages/app/src/react/shared/plugins/Plugins.ts@@ -4,6 +4,8 @@ export enum PluginTarget {Onboarding = 'onboarding',SidebarMenuItems = 'sidebarMenuItems',TopMenuProfileDropdownItems = 'topMenuProfileDropdownItems',+ AgentSettingsTasksTabWidget = 'agentSettings/tasksTabWidget',+ AgentSettingsWidgets = 'agentSettings/widgets',}export enum PluginType {diff --git a/packages/app/src/shared/state_stores/auth/types.ts b/packages/app/src/shared/state_stores/auth/types.tsindex fe59fe81..a1ae126f 100644--- a/packages/app/src/shared/state_stores/auth/types.ts+++ b/packages/app/src/shared/state_stores/auth/types.ts@@ -1,8 +1,13 @@-import { TeamSubs, TeamSubsV2 } from '../../../react/shared/types/subscription';-import { IMembershipTeam, User, UserOnBoarding } from '../../../react/shared/types/entities';import { apiResultsTypes } from '../../../react/shared/types';+import { IMembershipTeam, User, UserOnBoarding } from '../../../react/shared/types/entities';+import { TeamSubs, TeamSubsV2 } from '../../../react/shared/types/subscription';import { Slice } from '../index';+export type PageACL = {+ read: boolean;+ write: boolean;+};+export interface AuthState {// User InfouserInfo: {@@ -37,8 +42,8 @@ export interface AuthState {refreshUserData: () => Promise<void>;isProtectedRoute: (route: string) => boolean;hasReadOnlyPageAccess: (route: string, useParentTeamRoles?: boolean) => boolean;- getPageAccess: (route: string, useParentTeamRoles?: boolean) => { read: boolean; write: boolean };- getPageAccessParentTeam: (route: string) => { read: boolean; write: boolean };+ getPageAccess: (route: string, useParentTeamRoles?: boolean) => PageACL;+ getPageAccessParentTeam: (route: string) => PageACL;hasReadOnlyAPIAccess: (route: string) => boolean;updateUserTeam: (teamId: string, teamData: Partial<IMembershipTeam>) => void;}diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.jsonindex 6f0ba0d8..adc88941 100644--- a/packages/app/tsconfig.json+++ b/packages/app/tsconfig.json@@ -22,7 +22,7 @@"include": ["src/**/*","node_modules/@types",- "eslint.config.js",+ "eslint.config.js", "../../../src/server/api/pages/quota.ts",],"exclude": ["node_modules"]}