Skip to content

Vituali/Chrome-Extension-ATI-V2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

59 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ATI Logo

ATI β€” Customer Support Assistant

Chrome extension to streamline customer support via ChatMix, integrated with SGP.

πŸ‡§πŸ‡· PortuguΓͺs Β· πŸ‡ΊπŸ‡Έ English

Chrome Web Store Chrome Web Store Users Manifest V3 TypeScript React

πŸ”§ Admin Panel Β· πŸ“¦ Chrome Web Store Β· πŸ“‹ Changelog


πŸ“Έ Screenshots

Sidebar with Quick Replies & Buttons Create Service Order Modal
ATI sidebar with action buttons and categorized quick replies injected into ChatMix Create Service Order modal with contract Online status, occurrence type and templates

✨ Features

πŸ”˜ ChatMix Sidebar Buttons

Button Description
πŸ‘€ Contact Copies formatted name and phone number
πŸ€– Chat Generates a clean AI prompt from the chat history
πŸ“„ CPF Copies the CPF/CNPJ detected in the messages
πŸ“ O.S Opens the service order creation modal
πŸ”„ Refresh Clears cache and reloads client data
↗️ SGP Opens the client's profile directly in SGP
πŸ’¬ Chat Internal Chat for agent communication

πŸ’¬ Internal Chat & Notifications (New!)

  • Live Embed: Loads the official ATI chat system via a high-performance Iframe.
  • Background Monitor: Polls Firebase for new messages even when the extension is closed.
  • Smart UI: Floating blue button with "active" state detection.
  • Badge Alerts: Visual "!" indicator on the extension icon for unread messages.
  • Sector Monitoring: Monitors geral, ti, financeiro, suporte and comercial rooms.

πŸ“ Service Order Modal

  • Contract selection with real-time Online/Offline status
  • Occurrence type selector with search
  • Per-agent O.S templates
  • Automatic form fill in SGP
  • Auto-draft β€” saves text as you type and restores on reopen
  • Automatically cleared when the attendance is closed

⚑ Quick Replies

  • Categorized quick replies injected above the message input
  • Two-level navigation: categories β†’ replies
  • One-click insert into the text field
  • In-memory cache β€” single Firebase read per session

πŸ€– AI Prompt Generator

  • Clean history: strips automation messages, transfers and bot menus
  • Identifies client vs agent messages from the DOM
  • Ready to paste into ChatGPT, Claude or any AI

πŸ” Authentication

  • Firebase-backed per-agent login
  • Session persisted in chrome.storage.local
  • Access control by status (active / blocked)

πŸ—οΈ Architecture

src/
β”œβ”€β”€ background/                  # Service Worker (network & CORS logic)
β”‚   β”œβ”€β”€ index.ts                 # Entry point β€” message listener
β”‚   β”œβ”€β”€ firebase.ts              # Auth, templates and quick replies
β”‚   └── sgp/
β”‚       β”œβ”€β”€ constants.ts         # URLs, TTLs and interfaces
β”‚       β”œβ”€β”€ cache.ts             # Form cache (max 50 entries)
β”‚       β”œβ”€β”€ auth.ts              # SGP login with session cache
β”‚       β”œβ”€β”€ search.ts            # Client search (CPF, name, phone)
β”‚       β”œβ”€β”€ contracts.ts         # Contracts + online/offline status
β”‚       └── occurrence.ts        # Forms, occurrences and tab management
β”‚
β”œβ”€β”€ contentScript/
β”‚   β”œβ”€β”€ chatmix/
β”‚   β”‚   β”œβ”€β”€ index.ts             # Entry point β€” buttons, observer, init
β”‚   β”‚   β”œβ”€β”€ state.ts             # Global state, selectors, debug
β”‚   β”‚   β”œβ”€β”€ helpers.ts           # CPF/CNPJ, formatting, setNativeValue
β”‚   β”‚   β”œβ”€β”€ getClientData.ts     # DOM data extraction
β”‚   β”‚   β”œβ”€β”€ buildAIPrompt.ts     # AI prompt generator
β”‚   β”‚   β”œβ”€β”€ Quickreply.ts        # Quick replies with in-memory cache
β”‚   β”‚   β”œβ”€β”€ style.css
β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”‚   β”œβ”€β”€ firebase.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ session.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ login.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ loginModal.ts
β”‚   β”‚   β”‚   └── login.css
β”‚   β”‚   └── os/
β”‚   β”‚       β”œβ”€β”€ osModal.ts       # Full service order modal
β”‚   β”‚       β”œβ”€β”€ osDraft.ts       # Per-chat draft in sessionStorage
β”‚   β”‚       └── osModal.css
β”‚   └── sgp/
β”‚       β”œβ”€β”€ actions.ts
β”‚       β”œβ”€β”€ fillForm.ts
β”‚       β”œβ”€β”€ sgpFill.js
β”‚       └── types.ts
β”‚
β”œβ”€β”€ popup/
β”‚   β”œβ”€β”€ Popup.html
β”‚   β”œβ”€β”€ Popup.tsx
β”‚   β”œβ”€β”€ Popup.css
β”‚   └── main.tsx
β”‚
β”œβ”€β”€ assets/
β”‚   └── logo.png
β”‚
β”œβ”€β”€ global.d.ts
└── manifest.ts

πŸ› οΈ Tech Stack

  • React 18 + TypeScript β€” Popup UI
  • Vite β€” Manifest V3 build pipeline
  • Firebase Realtime Database β€” Templates, quick replies and auth
  • Chrome Extensions API β€” Storage, Tabs, SidePanel
  • MutationObserver with debounce β€” Attendance change detection

πŸš€ Development

Prerequisites

  • Node.js 18+
  • npm or yarn

Setup

git clone https://github.com/Vituali/Chrome-Extension-ATI-V2.git
cd Chrome-Extension-ATI-V2
npm install

Build

# Development build with watch
npm run build -- --watch

# Production build
npm run build

# Build and package for Chrome Web Store submission
npm run zip

Load in Chrome

  1. Go to chrome://extensions/
  2. Enable Developer mode
  3. Click Load unpacked
  4. Select the dist/ folder

βš™οΈ Configuration

The admin panel is available at vituali.github.io/ATI, where administrators can:

  • πŸ‘₯ Manage agents (create, block, assign roles)
  • πŸ“‹ Create and edit O.S templates per agent
  • ⚑ Create and edit quick replies with categories and subcategories

Firebase Structure

admins/{uid}                     β†’ true
atendentes/{username}            β†’ { email, nomeCompleto, role, uid, status }
modelos_os/{username}/{id}       β†’ { id, title, text, category, occurrenceTypeId }
respostas/{username}/[]          β†’ { category, subCategory, text, title }

πŸ“‹ Changelog

v2.2.0 [2026.04.11]

  • βœ… Internal Chat Embed β€” Migrated chat logic to an Iframe-based system for instant updates.
  • βœ… Background Notifications β€” Real-time polling of message metadata with browser alerts.
  • βœ… Extension Badge β€” Icon badge "!" for unread messages.
  • βœ… Performance Fixes β€” Resolved Vite build errors and optimized Service Worker memory.

v2.1.0 [2026.04.08]

  • βœ… Memory Cache on Service Worker β€” Migrated from global variables to chrome.storage.session to prevent data loss during SW suspension.
  • βœ… Pending SGP Data Fix β€” Storage keys now include a unique client identifier to prevent race conditions during simultaneous chats.
  • βœ… Parallel SGP Searches β€” Name and Phone searches now run in parallel via Promise.all when CPF returns no results, reducing load time.
  • βœ… Smart Tab Navigation β€” SGP button now detects existing client tabs by page title and focuses them instead of opening duplicates.
  • βœ… Security Hardening β€” Removed innerHTML (replaced with textContent), and implemented crypto.randomUUID() validation for postMessage origins.
  • βœ… Server Selector Respected β€” All generated URLs (contracts, services, autocomplete) now strictly follow the user-selected server.
  • βœ… Blocking Dialogs Removed β€” replaced alert() and confirm() with non-blocking Toasts and React modals.
  • βœ… Optimized MutationObserver β€” restricted target to the specific sidebar/message container with a 150ms debounce.

v2.0.5-beta

  • βœ… Status Colors for contracts (Active, Reduced Speed, Suspended, etc.)
  • βœ… Design System standardized with rgba transparencies and :hover states
  • βœ… Status Summary and counter in the client selection modal
  • βœ… osModal refactored into sub-modules (UI, SGP, Handlers, Types)
  • βœ… Zero any in firebase.ts and cache.ts with strict TypeScript interfaces
  • βœ… Online status refresh without reloading the entire SGP form
  • βœ… ExtensionRequest standardized for all Background/Content messaging
  • βœ… botPatterns isolated for clean chat history stripping
  • βœ… CLAUDE.md context-shielded with strict naming rules for AIs

v2.0.4

  • βœ… Online/Offline status for contracts in the O.S modal
  • βœ… Background refactored into modules (firebase, sgp/auth, sgp/contracts, etc.)
  • βœ… Auto-draft per attendance in sessionStorage
  • βœ… Quick reply in-memory cache β€” single Firebase read per session
  • βœ… MutationObserver debounce β€” Vue virtual scroller compatibility
  • βœ… Guards against simultaneous inits and duplicate loads
  • βœ… SGP form cache capped at 50 entries
  • βœ… AbortSignal.timeout on all SGP fetches
  • βœ… AI prompt with clean history (strips automation/transfers)
  • βœ… Toggle switches in the O.S modal

v2.0.0

  • πŸŽ‰ Full rewrite β€” React + TypeScript + Manifest V3
  • πŸ” Firebase-backed per-agent login system
  • πŸ“ O.S modal with automatic SGP form fill
  • ⚑ Categorized quick replies
  • πŸ€– Automatic attendance change detection

πŸ‘€ Author

Built by Vituali for internal use at ATI Internet.


Available on the Chrome Web Store

About

Chrome extension built with React, Vite and TypeScript for internal tools and productivity features used at ATI Internet.

Topics

Resources

License

Stars

Watchers

Forks

Contributors