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
refactor: remove react-toastify integration and replace with custom toast components
Muhammad Hamza Khan28a581bbadd3
diff --git a/packages/app/package.json b/packages/app/package.jsonindex 497da91a..395feded 100644--- a/packages/app/package.json+++ b/packages/app/package.json@@ -103,7 +103,6 @@"react-router": "6.17.0","react-router-dom": "^6.16.0","react-syntax-highlighter": "^15.5.0",- "react-toastify": "^9.1.3","remark-gfm": "^4.0.0","rollup-plugin-typescript-paths": "^1.5.0","run-parallel": "1.2.0",@@ -136,7 +135,6 @@"@types/react": "^18.2.23","@types/react-dom": "^18.2.8","@types/react-syntax-highlighter": "^15.5.11",- "@types/react-toastify": "^4.1.0","@types/uuid": "^9.0.4","@vitejs/plugin-react-swc": "^3.8.0","autoprefixer": "^10.4.16",diff --git a/packages/app/src/builder-ui/utils/component.utils/index.ts b/packages/app/src/builder-ui/utils/component.utils/index.tsindex c7aadefd..26a4e2e5 100644--- a/packages/app/src/builder-ui/utils/component.utils/index.ts+++ b/packages/app/src/builder-ui/utils/component.utils/index.ts@@ -254,14 +254,14 @@ export async function promptVaultInfo(if (!target) return;const formGroup = target.closest('.form-group');- const vaultToast = formGroup.querySelector('.toast-vault');+ const vaultInfoMsg = formGroup.querySelector('.vault-info-msg');if (target.value && !isKeyTemplateVariable(target.value)) {- if (!vaultToast) {+ if (!vaultInfoMsg) {// create the toast message to show the link to save Access Token in the Vault- const vaultToast = document.createElement('div');- vaultToast.classList.add('toast-vault');- vaultToast.textContent = 'To save your Access Token in the Vault - ';+ const vaultInfoMsg = document.createElement('div');+ vaultInfoMsg.classList.add('vault-info-msg');+ vaultInfoMsg.textContent = 'To save your Access Token in the Vault - ';const link = document.createElement('a');link.href = '#';@@ -298,8 +298,6 @@ export async function promptVaultInfo(console.log(error);} finally {spinner.remove();- if (saveBtn) saveBtn.disabled = false;-// focus is required to check the value and show/hide the toastfield.focus();}@@ -309,11 +307,11 @@ export async function promptVaultInfo(target.removeAttribute('data-waiting');};- vaultToast.appendChild(link);- formGroup.appendChild(vaultToast);+ vaultInfoMsg.appendChild(link);+ formGroup.appendChild(vaultInfoMsg);}} else {- vaultToast?.remove();+ vaultInfoMsg?.remove();}}@@ -439,9 +437,8 @@ const _compMenuMarkup = ({ data, compName, placeholderLogo, compDisplayName }: Creturn `<div class="h-9"><a href="#"title="${data?.name}"- class="group flex items-center py-2 mx-2 pl-4 pr-2 text-sm text-black rounded-md bg-white ${- isDisabled ? 'disabled opacity-70' : ''- }"+ class="group flex items-center py-2 mx-2 pl-4 pr-2 text-sm text-black rounded-md bg-white ${isDisabled ? 'disabled opacity-70' : ''+ }"${compAttr}data-label="${label}"smt-id="${data?.id}"@@ -457,9 +454,8 @@ const _compMenuMarkup = ({ data, compName, placeholderLogo, compDisplayName }: C<span class="icon">- <img src="${- data?.logoUrl || placeholderLogo- }" class=" w-6 h-6 rounded-lg border-solid border-gray-200" style="border-width:3px" onerror='this.setAttribute("src", "${placeholderLogo}")' />+ <img src="${data?.logoUrl || placeholderLogo+ }" class=" w-6 h-6 rounded-lg border-solid border-gray-200" style="border-width:3px" onerror='this.setAttribute("src", "${placeholderLogo}")' /></span>diff --git a/packages/app/src/builder-ui/workspace/hotkeys.ts b/packages/app/src/builder-ui/workspace/hotkeys.tsindex aa23dd9b..3f1e6674 100644--- a/packages/app/src/builder-ui/workspace/hotkeys.ts+++ b/packages/app/src/builder-ui/workspace/hotkeys.ts@@ -175,26 +175,6 @@ export function registerHotkeys(workspace: Workspace) {await workspace.exportTemplate();});- // hotkey('ctrl+alt+t,command+alt.t', async (event, handler) => {- // if (workspace.locked) return false;- // console.log('exporting component template');- // const elements = document.querySelectorAll('.component.selected, .component.active');- // if (elements.length <= 0 || elements.length > 1) return;-- // const activeElement: any = elements[0];- // const component = activeElement?._control;- // if (!component) return;- // const templateData = component.exportTemplate();- // if (!templateData) return;- // //let templateName = await prompt('Template name', 'Enter a name for the template');- // //if (!templateName) templateName = component.constructor.name + ' template';- // //templateData.name = templateName;- // let textConfig = JSON.stringify(templateData);-- // workspace.writeToClipboard(textConfig);- // toast('Component template copied to clipboard');- // });-hotkey(keys.componentPriorityUp, (event, handler) => {if (workspace.locked) return false;if (diff --git a/packages/app/src/react/app/App.tsx b/packages/app/src/react/app/App.tsxindex f1e07008..c9b00ca3 100644--- a/packages/app/src/react/app/App.tsx+++ b/packages/app/src/react/app/App.tsx@@ -1,11 +1,10 @@// src/webapp/index.jsimport { OnboardingProvider } from '@src/react/features/agents/contexts/OnboardingContext';-import { SidebarProvider } from '@src/react/shared/contexts/SidebarContext';import { TooltipProvider } from '@src/react/shared/components/ui/tooltip';+import { SidebarProvider } from '@src/react/shared/contexts/SidebarContext';import { queryClient } from '@src/react/shared/query-client';import { QueryClientProvider } from '@tanstack/react-query';import { BrowserRouter as Router } from 'react-router-dom';-import { ToastContainer } from 'react-toastify';import { routeMap } from './routeMap';import RoutesWrapper from './routes';@@ -21,7 +20,6 @@ const App = () => {</SidebarProvider></TooltipProvider></Router>- <ToastContainer /></QueryClientProvider>);};diff --git a/packages/app/src/react/features/account/modals/deleteAccountModal.tsx b/packages/app/src/react/features/account/modals/deleteAccountModal.tsxindex d48c60bf..3043400b 100644--- a/packages/app/src/react/features/account/modals/deleteAccountModal.tsx+++ b/packages/app/src/react/features/account/modals/deleteAccountModal.tsx@@ -3,9 +3,9 @@ import { Input as CustomInput } from '@src/react/shared/components/ui/input';import Modal from '@src/react/shared/components/ui/modals/Modal';import { Button as CustomButton } from '@src/react/shared/components/ui/newDesign/button';import { SmythAPIError } from '@src/react/shared/types/api-results.types';+import { errorToast, successToast } from '@src/shared/components/toast';import { useMutation } from '@tanstack/react-query';import { useState } from 'react';-import { toast } from 'react-toastify';type Props = {onClose: () => void;@@ -19,11 +19,11 @@ const DeleteAccountModal = ({ onClose }: Props) => {mutationFn: deleteAccount,onError: (error: SmythAPIError) => {- toast.error(error.error.message ?? 'Error deleting account');+ errorToast(error.error.message ?? 'Error deleting account');console.log(error);},onSuccess: () => {- toast.success('Account deleted successfully');+ successToast('Account deleted successfully');},});diff --git a/packages/app/src/react/features/agent-settings/components/AgentInfoWidget/Avatar.tsx b/packages/app/src/react/features/agent-settings/components/AgentInfoWidget/Avatar.tsxindex 4462a7be..7dd743c3 100644--- a/packages/app/src/react/features/agent-settings/components/AgentInfoWidget/Avatar.tsx+++ b/packages/app/src/react/features/agent-settings/components/AgentInfoWidget/Avatar.tsx@@ -2,7 +2,6 @@ import classNames from 'classnames';import React, { useEffect, useMemo } from 'react';import { FaCircleNotch, FaUpload } from 'react-icons/fa6';import { IoMdAdd } from 'react-icons/io';-import { toast } from 'react-toastify';import AvatarModal from '@react/features/agent-settings/components/AgentInfoWidget/AvatarModal';import { useAgentSettingsCtx } from '@react/features/agent-settings/contexts/agent-settings.context';@@ -10,6 +9,7 @@ import AgentAvatar from '@react/features/agents/components/agentCard/AgentAvatarimport { EAgentSettings } from '@react/features/agents/types/agents.types';import { processAvatar } from '@react/features/agents/utils';import { Tooltip, TooltipContent, TooltipTrigger } from '@src/react/shared/components/ui/tooltip';+import { errorToast } from '@src/shared/components/toast';import { useMutation, useQueryClient } from '@tanstack/react-query';interface AgentInfoWidgetAvatarProps {@@ -96,7 +96,7 @@ const AgentInfoWidgetAvatar: React.FC<AgentInfoWidgetAvatarProps> = ({ data, too}},onError() {- toast.error('We could not generate an avatar. Please try again.');+ errorToast('We could not generate an avatar. Please try again.');},});@@ -214,7 +214,7 @@ const AgentInfoWidgetAvatar: React.FC<AgentInfoWidgetAvatarProps> = ({ data, too}}} catch (error) {- toast.error('Failed to upload avatar');+ errorToast('Failed to upload avatar');} finally {setIsLoading(false);}diff --git a/packages/app/src/react/features/agents/components/agentCard/hooks/useAgentOperations.ts b/packages/app/src/react/features/agents/components/agentCard/hooks/useAgentOperations.tsindex db89a69e..8aa97297 100644--- a/packages/app/src/react/features/agents/components/agentCard/hooks/useAgentOperations.ts+++ b/packages/app/src/react/features/agents/components/agentCard/hooks/useAgentOperations.ts@@ -1,10 +1,11 @@import { DuplicateAgentResponse, IAgent } from '@react/features/agents/components/agentCard/types';import { accquireLock } from '@react/features/agents/utils';import { Agent, AgentData } from '@src/react/shared/types/agent-data.types';+import { errorToast, successToast } from '@src/shared/components/toast';import { builderStore } from '@src/shared/state_stores/builder/store';import { useQueryClient } from '@tanstack/react-query';import { useCallback } from 'react';-import { toast } from 'react-toastify';+interface UseAgentOperationsProps {agent: IAgent;@@ -164,14 +165,14 @@ export function useAgentOperations({const result = await createDuplicateAgent();if (result.success) {- toast.success(result.message);+ successToast(result.message);onAgentDuplicated?.();} else {- toast.error(result.message);+ errorToast(result.message);}} catch (error) {console.error('Failed to duplicate agent:', error);- toast.error('Failed to duplicate agent');+ errorToast('Failed to duplicate agent');}}, [createDuplicateAgent, onAgentDuplicated]);@@ -191,18 +192,18 @@ export function useAgentOperations({console.error('Lock acquisition failed:', error);if (error && typeof error === 'object' && 'status' in error && error.status === 403) {- toast.error('You do not have access to delete this agent.');+ errorToast('You do not have access to delete this agent.');} else if (error &&typeof error === 'object' &&'error' in error &&error.error === 'Request failed with status code 409') {- toast.error(+ errorToast('Failed to delete agent as the agent is being edited by another user. Please try again later.',);} else {- toast.error('Unable to delete agent. Please try again later.');+ errorToast('Unable to delete agent. Please try again later.');}return;}@@ -215,14 +216,14 @@ export function useAgentOperations({const result = await response.json();if (result.success) {- toast.success('Agent deleted successfully');+ successToast('Agent deleted successfully');onAgentDeleted?.();} else {- toast.error('Failed to delete agent');+ errorToast('Failed to delete agent');}} catch (error) {console.error('Failed to delete agent:', error);- toast.error('Failed to delete agent');+ errorToast('Failed to delete agent');}}, [agent.id, onAgentDeleted]);@@ -257,7 +258,7 @@ export function useAgentOperations({isPinned: newPinnedState,};- toast.success(`Agent ${newPinnedState ? 'pinned' : 'unpinned'} successfully`);+ successToast(`Agent ${newPinnedState ? 'pinned' : 'unpinned'} successfully`);// Update the agent in place instead of reloading the entire listonAgentPinned?.(updatedAgent);} catch (error) {@@ -265,9 +266,9 @@ export function useAgentOperations({// Check if error has a message, if not use generic errorif (error && typeof error === 'object' && 'message' in error) {- toast.error(error.message);+ errorToast(error.message);} else {- toast.error(`Failed to ${actionText} agent. Please try again.`);+ errorToast(`Failed to ${actionText} agent. Please try again.`);}}}, [agent, onAgentPinned]);diff --git a/packages/app/src/react/features/vault/components/use-vault-oauth.ts b/packages/app/src/react/features/vault/components/use-vault-oauth.tsindex bf7d7893..8af8b1a0 100644--- a/packages/app/src/react/features/vault/components/use-vault-oauth.ts+++ b/packages/app/src/react/features/vault/components/use-vault-oauth.ts@@ -634,14 +634,10 @@ export function useInitiateOAuth() {// Add listener here or manage globally? Usually managed where the hook is called.} else {console.error('Authentication URL was not returned from the server.');- // Optionally show a toast message to the user- // toast({ title: 'Error', description: 'Could not start authentication.', variant: 'destructive' });}},onError: (error) => {console.error('Failed to initiate OAuth:', error);- // Optionally show a toast message to the user- // toast({ title: 'Error', description: `Authentication failed: ${error.message}`, variant: 'destructive' });},});}@@ -742,8 +738,6 @@ export function useSignOutOAuth() {},onError: (error) => {console.error('Failed to sign out:', error);- // Optionally show a toast message to the user- // toast({ title: 'Error', description: `Sign out failed: ${error.message}`, variant: 'destructive' });},});}diff --git a/packages/app/src/react/features/vault/helpers/vault.helper.ts b/packages/app/src/react/features/vault/helpers/vault.helper.tsindex 2d35c127..9bedc7bb 100644--- a/packages/app/src/react/features/vault/helpers/vault.helper.ts+++ b/packages/app/src/react/features/vault/helpers/vault.helper.ts@@ -1,4 +1,4 @@-import { toast } from 'react-toastify';+import { errorToast } from '@src/shared/components/toast';import { ERR_MSG_VAULT_KEY_NAME } from '../../../../shared/constants/general';import * as validate from './validate-form.helper';@@ -57,8 +57,7 @@ export const isValid = async ({ field, value, keyId, functions }: IsValidParams)isValid = false;}} catch (error) {- // TODO: Show toast message- toast.error('Something went wrong. Please try again later.');+ errorToast('Something went wrong. Please try again later.');console.error(error);}diff --git a/packages/app/src/react/index.html b/packages/app/src/react/index.htmlindex 1901bf99..bc916d51 100644--- a/packages/app/src/react/index.html+++ b/packages/app/src/react/index.html@@ -30,7 +30,6 @@<!-- <link rel="stylesheet" href="/css/smyth-domain.css" /> --><link rel="stylesheet" href="/css/smyth-vector.css" /><link rel="stylesheet" href="/css/smyth-form.css" />- <link rel="stylesheet" href="/css/react-toastify.css" /><link rel="stylesheet" href="/css/icons.css" />diff --git a/packages/app/src/react/index.tsx b/packages/app/src/react/index.tsxindex 62a73590..b35d0150 100644--- a/packages/app/src/react/index.tsx+++ b/packages/app/src/react/index.tsx@@ -2,8 +2,6 @@import { createRoot } from 'react-dom/client';import App from './app/App.js';import './index.css';-import 'react-toastify/dist/ReactToastify.css';-import { StrictMode } from 'react';const root = createRoot(document.getElementById('root')!);diff --git a/packages/app/src/react/shared/hooks/useFileAttachment.tsx b/packages/app/src/react/shared/hooks/useFileAttachment.tsxindex e8b0e252..0874f285 100644--- a/packages/app/src/react/shared/hooks/useFileAttachment.tsx+++ b/packages/app/src/react/shared/hooks/useFileAttachment.tsx@@ -1,5 +1,5 @@+import { errorToast } from '@src/shared/components/toast';import { ChangeEvent, useRef, useState } from 'react';-import { toast } from 'react-toastify';import { MAX_ATTACHMENT_SIZE } from '../../../shared/constants/general';interface UseFileAttachmentProps {@@ -20,7 +20,7 @@ export const useFileAttachment = ({const handleFileSelect = (file: File) => {if (file.size > maxSize) {- toast('File exceeds 5MB size limit', { type: 'error' });+ errorToast('File exceeds 5MB size limit');return false;}@@ -30,7 +30,7 @@ export const useFileAttachment = ({return ext === '*' ? file.type.startsWith(category) : file.type === type;})) {- toast('Unsupported file type', { type: 'error' });+ errorToast('Unsupported file type');return false;}diff --git a/packages/app/src/shared/components/toast.ts b/packages/app/src/shared/components/toast.tsindex 63762f52..58d86c04 100644--- a/packages/app/src/shared/components/toast.ts+++ b/packages/app/src/shared/components/toast.ts@@ -4,6 +4,7 @@ import {ArrowRightSvg,CloseSvg,ErrorSvg,+ InfoSvg,SuccessSvg,WarningSvg,} from '../../../static/js/icons';@@ -19,7 +20,7 @@ import {* @returns {HTMLElement} - The created toast element*/export function toastWithIcon(- type: 'success' | 'warning' | 'error',+ type: 'success' | 'warning' | 'error' | 'info',message: string,title: string,options: {@@ -54,6 +55,12 @@ export function toastWithIcon(progressBarColor: '#C4314B',progressBarBackgroundColor: '#FCF4F6',},+ info: {+ iconHtml: InfoSvg,+ cls: 'info-toast',+ progressBarColor: '#0F6CBD',+ progressBarBackgroundColor: '#F0F9FF',+ },};const config = typeConfig[type];@@ -212,7 +219,12 @@ export function errorToast(message: string, title: string = 'Error', options = {return toastWithIcon('error', message, title, options);}+export function infoToast(message: string, title: string = 'Info', options = {}) {+ return toastWithIcon('info', message, title, options);+}+// Add to window object for global accesswindow['successToast'] = successToast;window['warningToast'] = warningToast;window['errorToast'] = errorToast;+window['infoToast'] = infoToast;diff --git a/packages/app/static/css/smyth-form.css b/packages/app/static/css/smyth-form.cssindex 7e139395..6b1746e6 100644--- a/packages/app/static/css/smyth-form.css+++ b/packages/app/static/css/smyth-form.css@@ -220,7 +220,7 @@display: block !important;margin-top: 5px;}-.toast-vault {+.vault-info-msg {margin-top: 10px;}a.inner-link,diff --git a/packages/app/static/css/smyth-global.css b/packages/app/static/css/smyth-global.cssindex 51fbb6cb..5ae59b5e 100644--- a/packages/app/static/css/smyth-global.css+++ b/packages/app/static/css/smyth-global.css@@ -802,7 +802,8 @@ input:disabled {.notify-container > div.success-toast,.notify-container > div.warning-toast,-.notify-container > div.error-toast {+.notify-container > div.error-toast,+.notify-container > div.info-toast {border-bottom: none !important;border-radius: 4px !important;padding: 12px !important;diff --git a/packages/app/static/js/icons.js b/packages/app/static/js/icons.jsindex b9b6fd8a..ce843fc2 100644--- a/packages/app/static/js/icons.js+++ b/packages/app/static/js/icons.js@@ -22,3 +22,8 @@ export const ArrowRightSvg = `<svg class="ml-1" width="18" height="19" viewBox="<path d="M9.57511 6.5H2.375" stroke="#3C89F9" stroke-width="0.75" stroke-linecap="square"/><path d="M6.85059 3.48828L9.87559 6.50028L6.85059 9.51278" stroke="#3C89F9" stroke-width="0.75" stroke-linecap="square"/></svg>`;++// Info SVG content - blue themed+export const InfoSvg = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path d="M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0ZM8 7C7.58579 7 7.25 7.33579 7.25 7.75V11.25C7.25 11.6642 7.58579 12 8 12C8.41421 12 8.75 11.6642 8.75 11.25V7.75C8.75 7.33579 8.41421 7 8 7ZM8 4C7.44772 4 7 4.44772 7 5C7 5.55228 7.44772 6 8 6C8.55228 6 9 5.55228 9 5C9 4.44772 8.55228 4 8 4Z" fill="#0F6CBD"/>+</svg>`;diff --git a/packages/app/views/index.ejs b/packages/app/views/index.ejsindex 0f374109..06189a04 100644--- a/packages/app/views/index.ejs+++ b/packages/app/views/index.ejs@@ -30,7 +30,6 @@<!-- <link rel="stylesheet" href="/css/smyth-domain.css" /> --><link rel="stylesheet" href="/css/smyth-vector.css" /><link rel="stylesheet" href="/css/smyth-form.css" />- <link rel="stylesheet" href="/css/react-toastify.css" /><link rel="stylesheet" href="/css/icons.css" />diff --git a/packages/app/views/pages/partials/studio/feedback-modal.ejs b/packages/app/views/pages/partials/studio/feedback-modal.ejsindex 25adfa1f..9bb064de 100644--- a/packages/app/views/pages/partials/studio/feedback-modal.ejs+++ b/packages/app/views/pages/partials/studio/feedback-modal.ejs@@ -246,8 +246,8 @@const errors = validateFeedback(feedbackText, selectedEmoji);if (errors.length > 0) {- if (typeof toast === 'function') {- toast(`${errors.join(' and ')}`, 'Error', 'alert');+ if (typeof errorToast === 'function') {+ errorToast(`${errors.join(' and ')}`);}return;}@@ -265,13 +265,13 @@if (result && result.success) {closeFeedbackModal();- if (typeof toast === 'function') {- toast('Thank you for your feedback!', 'Success', 'success');+ if (typeof successToast === 'function') {+ successToast('Thank you for your feedback!');}console.log('Feedback submitted successfully to HubSpot');} else {- if (typeof toast === 'function') {- toast('Failed to submit feedback. Please try again.', 'Error', 'alert');+ if (typeof errorToast === 'function') {+ errorToast('Failed to submit feedback. Please try again.');}console.error('Failed to submit feedback to HubSpot');}