Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 23, 2025

Problem

The application was experiencing console errors and unnecessary complexity due to two unused services:

  1. Tempo Labs: Causing GET https://api.tempolabs.ai/proxy-asset net::ERR_ADDRESS_INVALID errors in the browser console
  2. EmailJS: No longer needed for the chat functionality and contained hardcoded credentials

Solution

This PR performs a comprehensive cleanup by removing all references to Tempo Labs and EmailJS from the codebase.

Changes Made

Tempo Labs Removal

  • Removed Tempo error-handling script tag from index.html
  • Removed TempoDevtools import and initialization from src/main.tsx
  • Removed tempo-routes import and conditional routing logic from src/routes/index.tsx
  • Cleaned up vite.config.ts by removing Tempo plugin imports, conditional Babel plugins, and allowedHosts configuration
  • Removed tempo-devtools package from devDependencies in package.json

EmailJS Removal

  • Removed @emailjs/browser import from src/components/chat/useChatState.ts
  • Simplified setUserName function by removing async email notification logic (removed try-catch block with emailjs.send)
  • Removed EmailJS configuration variables from .env.example
  • Removed @emailjs/browser package from dependencies in package.json

Impact

Performance & Size:

  • Main JS bundle reduced from 48.80 kB to 44.53 kB (-4.27 kB / -8.7%)
  • Total dependencies reduced from 294 to 272 packages (-22 packages)
  • Build time slightly improved (3.56s → 3.53s)

Security:

  • Fixed 1 moderate severity vulnerability
  • Removed hardcoded EmailJS credentials from codebase
  • Removed external script loading from untrusted domain
  • CodeQL Analysis: 0 alerts found

Code Quality:

  • Simplified Vite configuration
  • Removed unused conditional logic
  • Cleaner routing structure
  • More maintainable codebase

Testing

  • ✅ Lint passes with no errors
  • ✅ Build completes successfully
  • ✅ Dev server starts on port 3000
  • ✅ No remaining references to Tempo or EmailJS in codebase
  • ✅ CodeQL security scan passes

Expected Behavior After Merge

  • No more ERR_ADDRESS_INVALID errors in browser console
  • Chat functionality continues to work (accepts names and displays messages)
  • All core features remain functional (video banner, contact card, routing)
  • Cleaner browser console output
  • Faster page load due to smaller bundle size

Files Modified

  • index.html - Removed Tempo script tag
  • src/main.tsx - Removed Tempo initialization
  • src/routes/index.tsx - Removed Tempo routes
  • src/components/chat/useChatState.ts - Removed EmailJS integration
  • vite.config.ts - Simplified configuration
  • package.json - Removed both dependencies
  • .env.example - Removed EmailJS variables
  • package-lock.json - Auto-updated from npm install
Original prompt

COMPREHENSIVE CLEANUP - Remove Tempo Labs AND EmailJS from main2

Objective

Clean up main2 branch by removing all Tempo Labs and EmailJS references to fix errors and simplify the codebase.

Current Problems on main2

  1. Tempo Labs: Causing GET https://api.tempolabs.ai/proxy-asset net::ERR_ADDRESS_INVALID error
  2. EmailJS: No longer needed (user request to remove)

Files to Modify on main2 Branch

1. Remove Tempo script from index.html

File: index.html (line 17)

Current:

<body class="overflow-hidden">
  <div id="root"></div>
  <script type="module" src="/src/main.tsx"></script>
  <script src="https://api.tempolabs.ai/proxy-asset?url=https://storage.googleapis.com/tempo-public-assets/error-handling.js"></script>
</body>

Change to:

<body class="overflow-hidden">
  <div id="root"></div>
  <script type="module" src="/src/main.tsx"></script>
</body>

2. Remove TempoDevtools from main.tsx

File: src/main.tsx

Remove lines 6 and 9:

import { TempoDevtools } from "tempo-devtools";

// Initialize Tempo Devtools
TempoDevtools.init();

Result should be:

import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { RouterProvider } from "react-router-dom";
import { router } from "./routes";
import "./index.css";

createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <RouterProvider router={router} />
  </StrictMode>,
);

3. Remove EmailJS from useChatState.ts

File: src/components/chat/useChatState.ts

Remove line 2:

import emailjs from "@emailjs/browser";

Remove the entire async emailjs.send block (lines ~16-34) and simplify setUserName:

const setUserName = (name: string, chatLanguage: "fr" | "en") => {
  setState((prev) => ({
    ...prev,
    userName: name,
    chatLanguage,
    messages: [
      {
        id: "1",
        text: t.chat.initialGreeting.replace("{name}", name),
        sender: "agent",
        timestamp: new Date(),
      },
    ],
  }));
};

4. Clean up vite.config.ts

File: vite.config.ts

Remove:

  • Line 4: import { tempo } from "tempo-devtools/dist/vite";
  • Lines 7-10: Conditional plugins array
  • Lines 12-13: allowedHosts code
  • Line 75: tempo(), from plugins array

Update Content Security Policy (line 27-38):
Remove Tempo and EmailJS URLs from CSP:

'Content-Security-Policy': [
  "default-src 'self'",
  "script-src 'self' 'unsafe-inline' 'unsafe-eval'",
  "style-src 'self' 'unsafe-inline'",
  "img-src 'self' data: https:",
  "font-src 'self' data:",
  "connect-src 'self'",
  "frame-ancestors 'none'",
  "base-uri 'self'",
  "form-action 'self'",
  "upgrade-insecure-requests"
].join('; '),

Simplify plugins array (around line 69):

export default defineConfig({
  plugins: [
    react(),
  ],
  server: serverConfig,
  build: {
    rollupOptions: {
      output: {
        manualChunks: {
          "react-vendor": ["react", "react-dom", "react-router-dom"],
          "ui-vendor": ["lucide-react"],
        },
      },
    },
  },
});

5. Update package.json

File: package.json

Remove from dependencies (line 13):

"@emailjs/browser": "^4.1.0",

Remove from devDependencies (line 33):

"tempo-devtools": "^2.0.109",

Final dependencies should be:

"dependencies": {
  "lucide-react": "^0.546.0",
  "react": "^18.3.1",
  "react-dom": "^18.3.1",
  "react-icons": "^5.5.0",
  "react-router-dom": "^6.22.2"
}

6. Clean up .env.example

File: .env.example

Remove EmailJS section (lines 9-11):

# EmailJS configuration
VITE_EMAILJS_SERVICE_ID=your_service_id
VITE_EMAILJS_TEMPLATE_ID=your_template_id
VITE_EMAILJS_USER_ID=your_user_id

Keep only:

# Example environment variables file
# Copy this file to .env and fill in your values

# Admin credentials
VITE_ADMIN_EMAIL=admin@example.com
VITE_ADMIN_PASSWORD=adminpassword

Expected Results After Cleanup

✅ No ERR_ADDRESS_INVALID errors from Tempo Labs
✅ No EmailJS dependencies or imports
✅ Cleaner, lighter codebase
✅ All core features still work (video banner, contact card, routing)
✅ Chat interface works (without email notifications)
✅ Faster build and smaller bundle size

Testing

After merge:

  1. Browser console shows no Tempo errors
  2. Site loads cleanly without warnings
  3. Video banner plays correctly
  4. Contact card displays properly
  5. All buttons and toggles work

This pull request was created as a result of the following prompt from Copilot chat.

COMPREHENSIVE CLEANUP - Remove Tempo Labs AND EmailJS from main2

Objective

Clean up main2 branch by removing all Tempo Labs and EmailJS references to fix errors and simplify the codebase.

Current Problems on main2

  1. Tempo Labs: Causing GET https://api.tempolabs.ai/proxy-asset net::ERR_ADDRESS_INVALID error
  2. EmailJS: No longer needed (user request to remove)

Files to Modify on main2 Branch

1. Remove Tempo script from index.html

File: index.html (line 17)

Current:

<body class="overflow-hidden">
  <div id="root"></div>
  <script type="module" src="/src/main.tsx"></script>
  <script src="https://api.tempolabs.ai/proxy-asset?url=https://storage.googleapis.com/tempo-public-assets/error-handling.js"></script>
</body>

Change to:

<body class="overflow-hidden">
  <div id="root"></div>
  <script type="module" src="/src/main.tsx"></script>
</body>

2. Remove TempoDevtools from main.tsx

File: src/main.tsx

Remove lines 6 and 9:

import { TempoDevtools } from "tempo-devtools";

// Initialize Tempo Devtools
TempoDevtools.init();

Result should be:

import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { RouterProvider } from "react-router-dom";
import { router } from "./routes";
import "./index.css";

createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <RouterProvider router={router} />
  </StrictMode>,
);

3. Remove EmailJS from useChatState.ts

File: src/components/chat/useChatState.ts

Remove line 2:

import emailjs from "@emailjs/browser";

Remove the entire async emailjs.send block (lines ~16-34) and simplify setUserName:

const setUserName = (name: string, chatLanguage: "fr" | "en") => {
  setState((prev) => ({
    ...prev,
    userName: name,
    chatLanguage,
    messages: [
      {
        id: "1",
        text: t.chat.initialGreeting.replace("{name}", name),
        sender: "agent",
        timestamp: new Date(),
      },
    ],
  }));
};

4. Clean up vite.config.ts

File: vite.config.ts

Remove:

  • Line 4: import { tempo } from "tempo-devtools/dist/vite";
  • Lines 7-10: Conditional plugins array
  • Lines 12-13: allowedHosts code
  • Line 75: tempo(), from plugins array

Update Content Security Policy (line 27-38):
Remove Tempo and EmailJS URLs from CSP:

'Content-Security-Policy': [
  "default-src 'self'",
  "script-src 'self' 'unsafe-inline' 'unsafe-eval'",
  "style-src 'self' 'unsafe-inline'",
  "img-src 'self' data: https:",
  "font-src 'self' data:",
  "connect-src 'self'",
  "frame-ancestors 'none'",
  "base-uri 'self'",
  "form-action 'self'",
  "upgrade-insecure-requests"
].join('; '),

Simplify plugins array (around line 69):

export default defineConfig({
  plugins: [
    react(),
  ],
  server: serverConfig,
  build: {
    rollupOptions: {
      output: {
        manualChunks: {
          "react-vendor": ["react", "react-dom", "react-router-dom"],
          "ui-vendor": ["lucide-react"],
        },
      },
    },
  },
});

5. Update package.json

File: package.json

Remove from dependencies (line 13):

"@emailjs/browser": "^4.1.0",

Remove from devDependencies (line 33):

"tempo-devtools": "^2.0.109",

Final dependencies should be:

"dependencies": {
  "lucide-react": "^0.546.0",
  "react": "^18.3.1",
  "react-dom": "^18.3.1",
  "react-icons": "^5.5.0",
  "react-router-dom": "^6.22.2"
}

6. Clean up .env.example

File: .env.example

Remove EmailJS section (lines 9-11):

# EmailJS configuration
VITE_EMAILJS_SERVICE_ID=your_service_id
VITE_EMAILJS_TEMPLATE_ID=your_template_id
VITE_EMAILJS_USER_ID=your_user_id

Keep only:

# Example environment variables file
# Copy this file to .env and fill in your values

# Admin credentials
VITE_ADMIN_EMAIL=admin@example.com
VITE_ADMIN_PASSWORD=adminpassword

Expected Results After Cleanup

✅ No ERR_ADDRESS_INVALID errors from Tempo Labs
✅ No EmailJS dependencies or imports
✅ Cleaner, lighter codebase
✅ All core features still work (video banner, contact card, routing)
✅ Chat interface works (without email notifications)
✅ Faster build and smaller bundle size

Testing

After merge:

  1. Browser console shows no Tempo errors
  2. Site loads cleanly without warnings
  3. Video banner plays correctly
  4. Contact card displays properly
  5. All buttons and toggles work

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@docs-page
Copy link

docs-page bot commented Oct 23, 2025

To view this pull requests documentation preview, visit the following URL:

docs.page/hlsitechio/hlsitech.com~17

Documentation is deployed and generated using docs.page.

@netlify
Copy link

netlify bot commented Oct 23, 2025

Deploy Preview for hlsitech ready!

Name Link
🔨 Latest commit 1f8f1a1
🔍 Latest deploy log https://app.netlify.com/projects/hlsitech/deploys/68fa456e51eb9100085dd189
😎 Deploy Preview https://deploy-preview-17.hlsitech.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-authored-by: hlsitechio <68784598+hlsitechio@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove Tempo Labs and EmailJS from main2 branch Remove Tempo Labs and EmailJS dependencies to fix errors and simplify codebase Oct 23, 2025
Copilot AI requested a review from hlsitechio October 23, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants