Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

feat(dashboard): add Number Checker page for single and batch recipient validation

Purushotham-Prajapati-24da45fd08dbb9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a3a152d99..c308ed255 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Added
+
+- Add Number Checker page in dashboard for single and bulk WhatsApp recipient pre-validation.
+
## [0.25.0] - 2026-10-15
### Added
diff --git a/dashboard/src/App.tsx b/dashboard/src/App.tsx
index beb7debca..c51e3e24a 100644
--- a/dashboard/src/App.tsx
+++ b/dashboard/src/App.tsx
@@ -21,6 +21,7 @@ const Templates = lazy(() => import('./pages/Templates').then(m => ({ default: m
const Logs = lazy(() => import('./pages/Logs').then(m => ({ default: m.Logs })));
const ApiKeys = lazy(() => import('./pages/ApiKeys').then(m => ({ default: m.ApiKeys })));
const MessageTester = lazy(() => import('./pages/MessageTester').then(m => ({ default: m.MessageTester })));
+const NumberChecker = lazy(() => import('./pages/NumberChecker').then(m => ({ default: m.NumberChecker })));
const Infrastructure = lazy(() => import('./pages/Infrastructure').then(m => ({ default: m.Infrastructure })));
const Plugins = lazy(() => import('./pages/Plugins'));
@@ -122,6 +123,7 @@ function AppContent() {
<Route index element={<Dashboard />} />
<Route path="sessions" element={<Sessions />} />
<Route path="chats" element={<Chats />} />
+ <Route path="number-checker" element={<NumberChecker />} />
<Route path="webhooks" element={<Webhooks />} />
<Route path="templates" element={<Templates />} />
{role === 'admin' && !scoped && <Route path="api-keys" element={<ApiKeys />} />}
diff --git a/dashboard/src/components/Layout.tsx b/dashboard/src/components/Layout.tsx
index fae4fd319..a4513c428 100644
--- a/dashboard/src/components/Layout.tsx
+++ b/dashboard/src/components/Layout.tsx
@@ -21,6 +21,7 @@ import {
ChevronLeft,
ChevronRight,
Languages,
+ UserCheck,
} from 'lucide-react';
import { useTheme } from '../hooks/useTheme';
import { useRole, type UserRole } from '../hooks/useRole';
@@ -38,6 +39,7 @@ const allNavItems = [
{ to: '/', icon: LayoutDashboard, key: 'dashboard' as const, adminOnly: false },
{ to: '/sessions', icon: Smartphone, key: 'sessions' as const, adminOnly: false },
{ to: '/chats', icon: MessageSquare, key: 'chats' as const, adminOnly: false },
+ { to: '/number-checker', icon: UserCheck, key: 'numberChecker' as const, adminOnly: false },
{ to: '/webhooks', icon: Webhook, key: 'webhooks' as const, adminOnly: false },
{ to: '/templates', icon: ClipboardList, key: 'templates' as const, adminOnly: false },
{ to: '/api-keys', icon: Key, key: 'apiKeys' as const, adminOnly: true, unscopedOnly: true },
diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.json
index c49e06a77..835fc967a 100644
--- a/dashboard/src/i18n/locales/ar.json
+++ b/dashboard/src/i18n/locales/ar.json
@@ -70,6 +70,7 @@
"dashboard": "لوحة التحكم",
"sessions": "الجلسات",
"chats": "المحادثات",
+ "numberChecker": "فاحص الأرقام",
"webhooks": "الويب هوك",
"templates": "القوالب",
"apiKeys": "مفاتيح API",
diff --git a/dashboard/src/i18n/locales/de.json b/dashboard/src/i18n/locales/de.json
index 5066067bd..080748838 100644
--- a/dashboard/src/i18n/locales/de.json
+++ b/dashboard/src/i18n/locales/de.json
@@ -62,6 +62,7 @@
"dashboard": "Dashboard",
"sessions": "Sitzungen",
"chats": "Chats",
+ "numberChecker": "Nummernprüfung",
"webhooks": "Webhooks",
"templates": "Vorlagen",
"apiKeys": "API-Schlüssel",
diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.json
index 5fb4afae4..a96b48b0c 100644
--- a/dashboard/src/i18n/locales/en.json
+++ b/dashboard/src/i18n/locales/en.json
@@ -62,6 +62,7 @@
"dashboard": "Dashboard",
"sessions": "Sessions",
"chats": "Chats",
+ "numberChecker": "Number Checker",
"webhooks": "Webhooks",
"templates": "Templates",
"apiKeys": "API Keys",
diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.json
index 68725f88c..f3054a0b8 100644
--- a/dashboard/src/i18n/locales/es.json
+++ b/dashboard/src/i18n/locales/es.json
@@ -64,6 +64,7 @@
"dashboard": "Panel",
"sessions": "Sesiones",
"chats": "Chats",
+ "numberChecker": "Verificador de números",
"webhooks": "Webhooks",
"apiKeys": "Claves API",
"messageTester": "Probador de mensajes",
diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.json
index 85957645a..38ba56ffa 100644
--- a/dashboard/src/i18n/locales/fr.json
+++ b/dashboard/src/i18n/locales/fr.json
@@ -64,6 +64,7 @@
"dashboard": "Tableau de bord",
"sessions": "Sessions",
"chats": "Discussions",
+ "numberChecker": "Vérificateur de numéros",
"webhooks": "Webhooks",
"templates": "Templates",
"apiKeys": "Clés API",
diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.json
index 9c3e55c5b..6034b7fc0 100644
--- a/dashboard/src/i18n/locales/he.json
+++ b/dashboard/src/i18n/locales/he.json
@@ -66,6 +66,7 @@
"dashboard": "דאשבורד",
"sessions": "Sessions",
"chats": "שיחות",
+ "numberChecker": "בודק מספרים",
"webhooks": "Webhooks",
"templates": "תבניות",
"apiKeys": "מפתחות API",
diff --git a/dashboard/src/i18n/locales/hi.json b/dashboard/src/i18n/locales/hi.json
index ac67d27fb..3e7a127be 100644
--- a/dashboard/src/i18n/locales/hi.json
+++ b/dashboard/src/i18n/locales/hi.json
@@ -62,6 +62,7 @@
"dashboard": "डैशबोर्ड",
"sessions": "सत्र (Sessions)",
"chats": "चैट्स",
+ "numberChecker": "नंबर चेकर",
"webhooks": "वेबहुक (Webhooks)",
"templates": "टेम्पलेट्स",
"apiKeys": "API कुंजियाँ",
diff --git a/dashboard/src/i18n/locales/id.json b/dashboard/src/i18n/locales/id.json
index 2359d3af5..f7a351b51 100644
--- a/dashboard/src/i18n/locales/id.json
+++ b/dashboard/src/i18n/locales/id.json
@@ -62,6 +62,7 @@
"dashboard": "Dasbor",
"sessions": "Sesi",
"chats": "Obrolan",
+ "numberChecker": "Pemeriksa Nomor",
"webhooks": "Webhook",
"templates": "Templat",
"apiKeys": "Kunci API",
diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.json
index bb779bef3..7582fe94c 100644
--- a/dashboard/src/i18n/locales/it.json
+++ b/dashboard/src/i18n/locales/it.json
@@ -64,6 +64,7 @@
"dashboard": "Dashboard",
"sessions": "Sessioni",
"chats": "Chat",
+ "numberChecker": "Verifica numeri",
"webhooks": "Webhook",
"templates": "Modelli",
"apiKeys": "Chiavi API",
diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.json
index ca0bd35c0..6bd31f8af 100644
--- a/dashboard/src/i18n/locales/ko.json
+++ b/dashboard/src/i18n/locales/ko.json
@@ -62,6 +62,7 @@
"dashboard": "대시보드",
"sessions": "세션",
"chats": "채팅",
+ "numberChecker": "번호 확인",
"webhooks": "웹훅",
"templates": "템플릿",
"apiKeys": "API 키",
diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.json
index 8faa2e3f9..46173eafa 100644
--- a/dashboard/src/i18n/locales/pt-BR.json
+++ b/dashboard/src/i18n/locales/pt-BR.json
@@ -64,6 +64,7 @@
"dashboard": "Painel",
"sessions": "Sessões",
"chats": "Chats",
+ "numberChecker": "Verificador de números",
"webhooks": "Webhooks",
"apiKeys": "Chaves API",
"messageTester": "Testador de mensagens",
diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.json
index 799959ba8..b687821ab 100644
--- a/dashboard/src/i18n/locales/te.json
+++ b/dashboard/src/i18n/locales/te.json
@@ -62,6 +62,7 @@
"dashboard": "డ్యాష్‌బోర్డ్",
"sessions": "సెషన్స్",
"chats": "చాట్‌లు",
+ "numberChecker": "నంబర్ చెకర్",
"webhooks": "వెబ్‌హుక్స్",
"templates": "టెంప్లేట్‌లు",
"apiKeys": "API కీలు",
diff --git a/dashboard/src/i18n/locales/tr.json b/dashboard/src/i18n/locales/tr.json
index a2b9e76a1..de6e90c7f 100644
--- a/dashboard/src/i18n/locales/tr.json
+++ b/dashboard/src/i18n/locales/tr.json
@@ -62,6 +62,7 @@
"dashboard": "Kontrol Paneli",
"sessions": "Oturumlar",
"chats": "Sohbetler",
+ "numberChecker": "Numara Denetleyicisi",
"webhooks": "Webhook'lar",
"templates": "Şablonlar",
"apiKeys": "API Anahtarları",
diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.json
index 826be3ee6..2682c36ed 100644
--- a/dashboard/src/i18n/locales/zh-CN.json
+++ b/dashboard/src/i18n/locales/zh-CN.json
@@ -62,6 +62,7 @@
"dashboard": "仪表盘",
"sessions": "会话",
"chats": "聊天",
+ "numberChecker": "号码检查",
"webhooks": "Webhooks",
"templates": "模板",
"apiKeys": "API 密钥",
diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.json
index 230c9b385..0bfce5d3d 100644
--- a/dashboard/src/i18n/locales/zh-HK.json
+++ b/dashboard/src/i18n/locales/zh-HK.json
@@ -62,6 +62,7 @@
"dashboard": "控制面板",
"sessions": "工作階段",
"chats": "聊天",
+ "numberChecker": "號碼檢查",
"webhooks": "Webhooks",
"templates": "範本",
"apiKeys": "API 金鑰",
diff --git a/dashboard/src/pages/NumberChecker.css b/dashboard/src/pages/NumberChecker.css
new file mode 100644
index 000000000..cdac872bd
--- /dev/null
+++ b/dashboard/src/pages/NumberChecker.css
@@ -0,0 +1,577 @@
+.number-checker {
+ padding: 2rem;
+ width: 100%;
+ max-width: 1200px;
+ margin: 0 auto;
+ box-sizing: border-box;
+}
+
+.number-checker .page-header {
+ margin-bottom: 2rem;
+}
+
+.number-checker .nc-alert {
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+ padding: 1rem 1.25rem;
+ border-radius: var(--radius);
+ margin-bottom: 1.5rem;
+ font-size: 0.9375rem;
+}
+
+.number-checker .nc-alert.info {
+ background: var(--primary-soft);
+ border: 1px solid var(--border);
+ color: var(--text-primary);
+}
+
+.number-checker .nc-alert.warning {
+ background: rgba(245, 158, 11, 0.1);
+ border: 1px solid rgba(245, 158, 11, 0.3);
+ color: var(--warning-text);
+}
+
+.number-checker .nc-alert-icon {
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.number-checker .nc-alert-content {
+ flex: 1;
+}
+
+.number-checker .nc-alert-action {
+ padding: 0.5rem 1rem;
+ border-radius: 6px;
+ background: var(--primary);
+ color: #fff;
+ border: none;
+ font-size: 0.875rem;
+ font-weight: 600;
+ cursor: pointer;
+ display: inline-flex;
+ align-items: center;
+ gap: 0.5rem;
+ text-decoration: none;
+}
+
+.number-checker .nc-alert-action:hover {
+ background: var(--primary-hover);
+}
+
+.number-checker /* Tabs */
+.nc-tabs {
+ display: flex;
+ gap: 0.5rem;
+ border-bottom: 1px solid var(--border);
+ margin-bottom: 1.5rem;
+}
+
+.number-checker .nc-tab {
+ padding: 0.75rem 1.5rem;
+ background: none;
+ border: none;
+ border-bottom: 2px solid transparent;
+ color: var(--text-secondary);
+ font-size: 0.9375rem;
+ font-weight: 600;
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ transition: all 0.2s ease;
+}
+
+.number-checker .nc-tab:hover {
+ color: var(--text-primary);
+}
+
+.number-checker .nc-tab.active {
+ color: var(--primary-text);
+ border-bottom-color: var(--primary);
+}
+
+.number-checker /* Main Grid */
+.nc-grid {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 1.5rem;
+}
+
+@media (max-width: 900px) {
+ .number-checker .nc-grid {
+ grid-template-columns: 1fr;
+ }
+}
+.number-checker .nc-card {
+ background: var(--bg-white);
+ border-radius: 12px;
+ padding: 1.5rem;
+ box-shadow: var(--shadow-sm);
+ border: 1px solid var(--border);
+}
+
+.number-checker .nc-card-title {
+ font-size: 1.125rem;
+ font-weight: 700;
+ color: var(--text-primary);
+ margin-bottom: 1.25rem;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
+.number-checker .nc-form-group {
+ margin-bottom: 1.25rem;
+}
+
+.number-checker .nc-label {
+ display: block;
+ font-size: 0.75rem;
+ font-weight: 700;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ color: var(--text-secondary);
+ margin-bottom: 0.5rem;
+}
+
+.number-checker .nc-input-row {
+ display: flex;
+ gap: 0.75rem;
+}
+
+.number-checker .nc-input {
+ width: 100%;
+ padding: 0.75rem 1rem;
+ font-size: 0.9375rem;
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ background: var(--bg-white);
+ color: var(--text-primary);
+ transition:
+ border-color 0.2s,
+ box-shadow 0.2s;
+ box-sizing: border-box;
+}
+
+.number-checker .nc-input:focus {
+ outline: none;
+ border-color: var(--primary);
+ box-shadow: 0 0 0 3px var(--primary-soft);
+}
+
+.number-checker .nc-textarea {
+ width: 100%;
+ min-height: 140px;
+ padding: 0.75rem 1rem;
+ font-size: 0.9375rem;
+ font-family: inherit;
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ background: var(--bg-white);
+ color: var(--text-primary);
+ resize: vertical;
+ box-sizing: border-box;
+}
+
+.number-checker .nc-textarea:focus {
+ outline: none;
+ border-color: var(--primary);
+ box-shadow: 0 0 0 3px var(--primary-soft);
+}
+
+.number-checker .nc-hint {
+ display: block;
+ font-size: 0.8125rem;
+ color: var(--text-muted);
+ margin-top: 0.375rem;
+}
+
+.number-checker .nc-btn {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.5rem;
+ padding: 0.75rem 1.25rem;
+ font-size: 0.9375rem;
+ font-weight: 600;
+ border-radius: var(--radius);
+ cursor: pointer;
+ transition: all 0.2s ease;
+ border: 1px solid transparent;
+}
+
+.number-checker .nc-btn-primary {
+ background: var(--primary);
+ color: #fff;
+}
+
+.number-checker .nc-btn-primary:hover:not(:disabled) {
+ background: var(--primary-hover);
+}
+
+.number-checker .nc-btn-secondary {
+ background: var(--bg-light);
+ border-color: var(--border);
+ color: var(--text-primary);
+}
+
+.number-checker .nc-btn-secondary:hover:not(:disabled) {
+ background: var(--border);
+}
+
+.number-checker .nc-btn-danger {
+ background: rgba(239, 68, 68, 0.1);
+ border-color: rgba(239, 68, 68, 0.3);
+ color: var(--error-text);
+}
+
+.number-checker .nc-btn-danger:hover:not(:disabled) {
+ background: rgba(239, 68, 68, 0.2);
+}
+
+.number-checker .nc-btn:disabled {
+ opacity: 0.6;
+ cursor: not-allowed;
+}
+
+.number-checker /* Result Card */
+.nc-result-placeholder {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 3.5rem 1rem;
+ color: var(--text-muted);
+ text-align: center;
+ gap: 0.75rem;
+}
+
+.number-checker .nc-result-card {
+ padding: 1.25rem;
+ border-radius: var(--radius);
+ border: 1px solid var(--border);
+ background: var(--bg-light);
+ display: flex;
+ flex-direction: column;
+ gap: 1rem;
+}
+
+.number-checker .nc-result-card.success {
+ border-color: rgba(34, 197, 94, 0.4);
+ background: rgba(34, 197, 94, 0.04);
+}
+
+.number-checker .nc-result-card.not-found {
+ border-color: rgba(239, 68, 68, 0.4);
+ background: rgba(239, 68, 68, 0.04);
+}
+
+.number-checker .nc-result-top {
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+}
+
+.number-checker .nc-avatar {
+ width: 54px;
+ height: 54px;
+ border-radius: 50%;
+ object-fit: cover;
+ border: 2px solid var(--border);
+ background: var(--bg-white);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-shrink: 0;
+}
+
+.number-checker .nc-avatar-fallback {
+ width: 54px;
+ height: 54px;
+ border-radius: 50%;
+ background: var(--border);
+ color: var(--text-secondary);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-weight: 700;
+ font-size: 1.25rem;
+ flex-shrink: 0;
+}
+
+.number-checker .nc-result-header-text {
+ flex: 1;
+}
+
+.number-checker .nc-result-phone {
+ font-size: 1.25rem;
+ font-weight: 700;
+ color: var(--text-primary);
+ margin-bottom: 0.25rem;
+}
+
+.number-checker .nc-status-badge {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.375rem;
+ padding: 0.25rem 0.75rem;
+ border-radius: 20px;
+ font-size: 0.8125rem;
+ font-weight: 600;
+}
+
+.number-checker .nc-status-badge.registered {
+ background: rgba(34, 197, 94, 0.15);
+ color: var(--success-text);
+ border: 1px solid rgba(34, 197, 94, 0.3);
+}
+
+.number-checker .nc-status-badge.unregistered {
+ background: rgba(239, 68, 68, 0.15);
+ color: var(--error-text);
+ border: 1px solid rgba(239, 68, 68, 0.3);
+}
+
+.number-checker .nc-status-badge.error {
+ background: rgba(245, 158, 11, 0.15);
+ color: var(--warning-text);
+ border: 1px solid rgba(245, 158, 11, 0.3);
+}
+
+.number-checker .nc-details-grid {
+ display: grid;
+ grid-template-columns: 1fr;
+ gap: 0.75rem;
+ background: var(--bg-white);
+ padding: 1rem;
+ border-radius: 8px;
+ border: 1px solid var(--border);
+}
+
+.number-checker .nc-detail-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ font-size: 0.875rem;
+}
+
+.number-checker .nc-detail-label {
+ color: var(--text-secondary);
+ font-weight: 500;
+}
+
+.number-checker .nc-detail-value {
+ color: var(--text-primary);
+ font-weight: 600;
+ font-family: monospace;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.number-checker .nc-copy-btn {
+ background: none;
+ border: 1px solid var(--border);
+ border-radius: 4px;
+ padding: 0.25rem 0.5rem;
+ color: var(--text-secondary);
+ cursor: pointer;
+ display: inline-flex;
+ align-items: center;
+ gap: 0.25rem;
+ font-size: 0.75rem;
+}
+
+.number-checker .nc-copy-btn:hover {
+ background: var(--bg-light);
+ color: var(--text-primary);
+}
+
+.number-checker .nc-result-actions {
+ display: flex;
+ gap: 0.75rem;
+ margin-top: 0.5rem;
+}
+
+.number-checker /* History */
+.nc-history-card {
+ margin-top: 1.5rem;
+ background: var(--bg-white);
+ border-radius: 12px;
+ padding: 1.5rem;
+ box-shadow: var(--shadow-sm);
+ border: 1px solid var(--border);
+}
+
+.number-checker .nc-history-table {
+ width: 100%;
+ border-collapse: collapse;
+ font-size: 0.875rem;
+ margin-top: 0.75rem;
+}
+
+.number-checker .nc-history-table th {
+ text-align: left;
+ padding: 0.75rem 1rem;
+ background: var(--bg-light);
+ color: var(--text-secondary);
+ font-weight: 600;
+ border-bottom: 1px solid var(--border);
+}
+
+.number-checker .nc-history-table td {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid var(--border);
+ color: var(--text-primary);
+}
+
+.number-checker .nc-history-table tr:last-child td {
+ border-bottom: none;
+}
+
+.number-checker /* Batch Stats */
+.nc-batch-stats {
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 1rem;
+ margin-bottom: 1.25rem;
+}
+
+.number-checker .nc-stat-box {
+ background: var(--bg-light);
+ border-radius: 8px;
+ padding: 0.875rem 1rem;
+ border: 1px solid var(--border);
+ text-align: center;
+}
+
+.number-checker .nc-stat-number {
+ font-size: 1.5rem;
+ font-weight: 700;
+ color: var(--text-primary);
+}
+
+.number-checker .nc-stat-label {
+ font-size: 0.75rem;
+ color: var(--text-secondary);
+ text-transform: uppercase;
+ font-weight: 600;
+ margin-top: 0.25rem;
+}
+
+.number-checker .nc-progress-bar-container {
+ width: 100%;
+ height: 8px;
+ background: var(--border);
+ border-radius: 4px;
+ overflow: hidden;
+ margin: 1rem 0;
+}
+
+.number-checker .nc-progress-bar {
+ height: 100%;
+ background: var(--primary);
+ transition: width 0.3s ease;
+}
+
+.number-checker .nc-filter-bar {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-top: 1.25rem;
+ margin-bottom: 0.75rem;
+}
+
+.number-checker .nc-filter-btns {
+ display: flex;
+ gap: 0.5rem;
+}
+
+.number-checker .nc-filter-btn {
+ padding: 0.375rem 0.75rem;
+ border-radius: 6px;
+ border: 1px solid var(--border);
+ background: var(--bg-white);
+ color: var(--text-secondary);
+ font-size: 0.8125rem;
+ font-weight: 500;
+ cursor: pointer;
+}
+
+.number-checker .nc-filter-btn.active {
+ background: var(--primary);
+ color: #fff;
+ border-color: var(--primary);
+}
+
+.number-checker /* Number Formatting Rules & Previews */
+.nc-checkbox-group {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.6rem;
+ margin-top: 0.625rem;
+ cursor: pointer;
+ user-select: none;
+}
+
+.number-checker .nc-checkbox {
+ width: 1.05rem;
+ height: 1.05rem;
+ accent-color: var(--primary);
+ cursor: pointer;
+}
+
+.number-checker .nc-checkbox-label {
+ font-size: 0.84rem;
+ color: var(--text-primary);
+ font-weight: 500;
+}
+
+.number-checker .nc-format-preview {
+ margin-top: 0.6rem;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.5rem;
+}
+
+.number-checker .nc-format-pill {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.35rem;
+ font-size: 0.78rem;
+ padding: 0.3rem 0.65rem;
+ border-radius: 9999px;
+ background: var(--bg-light);
+ border: 1px solid var(--border);
+ color: var(--text-secondary);
+}
+
+.number-checker .nc-format-pill.highlight {
+ background: rgba(37, 211, 102, 0.12);
+ border-color: rgba(37, 211, 102, 0.35);
+ color: #0b8043;
+ font-weight: 600;
+}
+
+.number-checker .nc-batch-parse-summary {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 0.4rem;
+ font-size: 0.8125rem;
+ padding: 0.55rem 0.85rem;
+ border-radius: var(--radius);
+ background: rgba(37, 211, 102, 0.08);
+ border: 1px solid rgba(37, 211, 102, 0.25);
+ color: var(--text-primary);
+ margin-top: 0.5rem;
+}
+
+.number-checker .nc-badge-sub {
+ color: var(--text-muted);
+ font-size: 0.75rem;
+}
diff --git a/dashboard/src/pages/NumberChecker.test.ts b/dashboard/src/pages/NumberChecker.test.ts
new file mode 100644
index 000000000..ce6920220
--- /dev/null
+++ b/dashboard/src/pages/NumberChecker.test.ts
@@ -0,0 +1,77 @@
+import '../test-helpers/register-hooks.ts';
+import { test, before, afterEach } from 'node:test';
+import assert from 'node:assert/strict';
+import { createElement } from 'react';
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+
+type RTL = typeof import('@testing-library/react');
+
+let rtl: RTL;
+let NumberChecker: typeof import('./NumberChecker.tsx').NumberChecker;
+let ToastProvider: typeof import('../components/Toast.tsx').ToastProvider;
+let MemoryRouter: typeof import('react-router-dom').MemoryRouter;
+
+function createTestQueryClient() {
+ return new QueryClient({
+ defaultOptions: {
+ queries: {
+ retry: false,
+ },
+ },
+ });
+}
+
+function renderComponent() {
+ const queryClient = createTestQueryClient();
+ return rtl.render(
+ createElement(
+ QueryClientProvider,
+ { client: queryClient },
+ createElement(ToastProvider, null, createElement(MemoryRouter, null, createElement(NumberChecker))),
+ ),
+ );
+}
+
+before(async () => {
+ const { installJsdomGlobals } = await import('../test-helpers/jsdom.ts');
+ await installJsdomGlobals();
+ globalThis.fetch = (() =>
+ Promise.resolve(
+ new Response(
+ JSON.stringify([
+ {
+ id: 'test-session-1',
+ name: 'Primary Session',
+ status: 'ready',
+ phone: '919876543210',
+ },
+ ]),
+ { headers: { 'Content-Type': 'application/json' } },
+ ),
+ )) as typeof fetch;
+
+ const { i18nReady } = await import('../i18n/index.ts');
+ await i18nReady;
+ rtl = await import('@testing-library/react');
+ ({ MemoryRouter } = await import('react-router-dom'));
+ ({ ToastProvider } = await import('../components/Toast.tsx'));
+ ({ NumberChecker } = await import('./NumberChecker.tsx'));
+});
+
+afterEach(() => {
+ rtl.cleanup();
+});
+
+test('NumberChecker: renders single check form and tabs', () => {
+ const { getByText, getByPlaceholderText } = renderComponent();
+ assert.ok(getByText('Check Single Account'));
+ assert.ok(getByPlaceholderText('e.g. 9876543210 (10 digits) or 919876543210 (12 digits)'));
+});
+
+test('NumberChecker: switches to bulk / batch tab when clicked', () => {
+ const { getByRole, getAllByText } = renderComponent();
+ const bulkTab = getByRole('button', { name: /Bulk/i });
+ rtl.fireEvent.click(bulkTab);
+ const headings = getAllByText('Bulk Number Checker');
+ assert.ok(headings.length >= 1);
+});
diff --git a/dashboard/src/pages/NumberChecker.tsx b/dashboard/src/pages/NumberChecker.tsx
new file mode 100644
index 000000000..f941493b1
--- /dev/null
+++ b/dashboard/src/pages/NumberChecker.tsx
@@ -0,0 +1,779 @@
+import { useState, useMemo, useRef, useCallback } from 'react';
+import { useNavigate } from 'react-router-dom';
+import {
+ UserCheck,
+ CheckCircle2,
+ XCircle,
+ AlertCircle,
+ Loader2,
+ Copy,
+ Check,
+ Send,
+ Download,
+ Trash2,
+ Shield,
+ Smartphone,
+ Phone,
+ Search,
+} from 'lucide-react';
+import { PageHeader } from '../components/PageHeader';
+import { useDocumentTitle } from '../hooks/useDocumentTitle';
+import { useSessionsQuery } from '../hooks/queries';
+import { contactApi, type CheckNumberResponse } from '../services/api';
+import { useToast } from '../hooks/useToast';
+import './NumberChecker.css';
+
+interface CheckResultItem extends CheckNumberResponse {
+ avatarUrl?: string | null;
+ timestamp: string;
+}
+
+export function NumberChecker() {
+ useDocumentTitle('Number Checker - OpenWA');
+ const navigate = useNavigate();
+ const toast = useToast();
+
+ const { data: sessions = [], isLoading: loadingSessions } = useSessionsQuery();
+ const readySessions = useMemo(
+ () => sessions.filter(s => s.status?.toLowerCase() === 'ready' || s.status?.toLowerCase() === 'authenticated'),
+ [sessions],
+ );
+
+ const [selectedSession, setSelectedSession] = useState<string>('');
+ const [activeTab, setActiveTab] = useState<'single' | 'batch'>('single');
+
+ // Set default session when loaded (API requires session UUID)
+ const currentSession = selectedSession || readySessions[0]?.id || '';
+
+ // Single Check State
+ const [phoneNumber, setPhoneNumber] = useState('');
+ const [isCheckingSingle, setIsCheckingSingle] = useState(false);
+ const [singleResult, setSingleResult] = useState<CheckResultItem | null>(null);
+ const [copiedId, setCopiedId] = useState(false);
+ const [recentChecks, setRecentChecks] = useState<CheckResultItem[]>([]);
+
+ // Batch Check State
+ const [batchInput, setBatchInput] = useState('');
+ const [batchDelay, setBatchDelay] = useState<number>(1000);
+ const [isCheckingBatch, setIsCheckingBatch] = useState(false);
+ const [batchResults, setBatchResults] = useState<CheckResultItem[]>([]);
+ const [batchProgress, setBatchProgress] = useState({ current: 0, total: 0 });
+ const [batchFilter, setBatchFilter] = useState<'all' | 'registered' | 'unregistered'>('all');
+ const cancelBatchRef = useRef(false);
+
+ // Auto-prefix country code state
+ const [autoPrefix91, setAutoPrefix91] = useState(true);
+
+ // Format and clean phone number based on digit rules
+ const formatNumberForCheck = useCallback(
+ (raw: string, applyPrefix = autoPrefix91) => {
+ let digits = raw.replace(/[^0-9]/g, '');
+ // 1. If international dial exit code 00 is present (e.g. 009196...), strip '00'
+ if (digits.startsWith('00') && digits.length >= 12) {
+ digits = digits.substring(2);
+ }
+ // 2. If user entered +91 with domestic trunk 0 (e.g. +91 096... -> 13 digits), strip trunk 0
+ if (digits.length === 13 && digits.startsWith('910')) {
+ digits = '91' + digits.substring(3);
+ }
+ // 3. If domestic 11 digits starting with 0 (e.g. 096xxxxxxxx), strip leading 0
+ if (digits.length === 11 && digits.startsWith('0')) {
+ digits = digits.substring(1);
+ }
+ // 4. If exactly 10 digits and autoPrefix is true: impose India country code (+91)
+ if (applyPrefix && digits.length === 10) {
+ return '91' + digits;
+ }
+ // 5. If 12 digits (already has country code, e.g. 91xxxxxxxxxx) or any other format: keep as-is
+ return digits;
+ },
+ [autoPrefix91],
+ );
+
+ // Preview formatted single number
+ const singleFormattedNumber = useMemo(() => {
+ return formatNumberForCheck(phoneNumber);
+ }, [phoneNumber, formatNumberForCheck]);
+
+ // Batch parsing statistics
+ const batchParsedStats = useMemo(() => {
+ const lines = batchInput
+ .split(/[\n,;]+/)
+ .map(n => n.trim())
+ .filter(n => n.length > 0);
+
+ let tenDigitsCount = 0;
+ let twelveDigitsCount = 0;
+ let otherCount = 0;
+
+ const uniqueFormatted = new Set<string>();
+
+ for (const raw of lines) {
+ let d = raw.replace(/[^0-9]/g, '');
+ if (d.startsWith('00') && d.length >= 12) d = d.substring(2);
+ if (d.length === 13 && d.startsWith('910')) d = '91' + d.substring(3);
+ if (d.length === 11 && d.startsWith('0')) d = d.substring(1);
+
+ if (d.length === 10) {
+ tenDigitsCount++;
+ } else if (d.length === 12) {
+ twelveDigitsCount++;
+ } else if (d.length >= 7) {
+ otherCount++;
+ }
+ const formatted = formatNumberForCheck(raw, autoPrefix91);
+ if (formatted.length >= 7) {
+ uniqueFormatted.add(formatted);
+ }
+ }
+
+ return {
+ totalLines: lines.length,
+ uniqueCount: uniqueFormatted.size,
+ tenDigitsCount,
+ twelveDigitsCount,
+ otherCount,
+ list: Array.from(uniqueFormatted),
+ };
+ }, [batchInput, autoPrefix91, formatNumberForCheck]);
+
+ // Perform single check
+ const handleSingleCheck = async () => {
+ const formatted = formatNumberForCheck(phoneNumber);
+ if (!formatted) {
+ toast.error('Please enter a phone number to check.');
+ return;
+ }
+ if (!currentSession) {
+ toast.error('No ready WhatsApp session available.');
+ return;
+ }
+
+ setIsCheckingSingle(true);
+ try {
+ const res = await contactApi.checkNumber(currentSession, formatted);
+ let avatar: string | null = null;
+ if (res.exists && res.whatsappId) {
+ try {
+ const pic = await contactApi.profilePicture(currentSession, res.whatsappId);
+ avatar = pic.url;
+ } catch {
+ // Profile picture is optional
+ }
+ }
+
+ const item: CheckResultItem = {
+ ...res,
+ avatarUrl: avatar,
+ timestamp: new Date().toLocaleTimeString(),
+ };
+
+ setSingleResult(item);
+ setRecentChecks(prev => [item, ...prev.filter(p => p.number !== item.number).slice(0, 9)]);
+ } catch (err) {
+ toast.error('Check failed', err instanceof Error ? err.message : 'Unknown lookup error');
+ } finally {
+ setIsCheckingSingle(false);
+ }
+ };
+
+ // Copy WhatsApp ID
+ const handleCopy = (id: string) => {
+ navigator.clipboard.writeText(id);
+ setCopiedId(true);
+ setTimeout(() => setCopiedId(false), 2000);
+ };
+
+ // Perform batch check
+ const handleStartBatch = async () => {
+ const numbers = batchParsedStats.list;
+
+ if (numbers.length === 0) {
+ toast.error('Please enter valid phone numbers (one per line or comma-separated).');
+ return;
+ }
+ if (!currentSession) {
+ toast.error('No ready WhatsApp session available.');
+ return;
+ }
+
+ setIsCheckingBatch(true);
+ cancelBatchRef.current = false;
+ setBatchResults([]);
+ setBatchProgress({ current: 0, total: numbers.length });
+
+ const results: CheckResultItem[] = [];
+
+ for (let i = 0; i < numbers.length; i++) {
+ if (cancelBatchRef.current) break;
+
+ const num = numbers[i];
+ try {
+ const res = await contactApi.checkNumber(currentSession, num);
+ const item: CheckResultItem = {
+ ...res,
+ timestamp: new Date().toLocaleTimeString(),
+ };
+ results.push(item);
+ setBatchResults([...results]);
+ } catch {
+ results.push({
+ number: num,
+ exists: false,
+ whatsappId: null,
+ timestamp: new Date().toLocaleTimeString(),
+ });
+ setBatchResults([...results]);
+ }
+
+ setBatchProgress({ current: i + 1, total: numbers.length });
+
+ if (i < numbers.length - 1 && batchDelay > 0) {
+ await new Promise(resolve => setTimeout(resolve, batchDelay));
+ }
+ }
+
+ setIsCheckingBatch(false);
+ toast.success(`Completed checking ${results.length} numbers.`);
+ };
+
+ const handleStopBatch = () => {
+ cancelBatchRef.current = true;
+ setIsCheckingBatch(false);
+ };
+
+ // Filter batch results
+ const filteredBatchResults = useMemo(() => {
+ if (batchFilter === 'registered') return batchResults.filter(r => r.exists);
+ if (batchFilter === 'unregistered') return batchResults.filter(r => !r.exists);
+ return batchResults;
+ }, [batchResults, batchFilter]);
+
+ // Export batch results as CSV
+ const handleExportCSV = () => {
+ if (batchResults.length === 0) return;
+ const header = 'Phone Number,Has WhatsApp,WhatsApp ID,Checked At\n';
+ const rows = batchResults
+ .map(r => `"${r.number}","${r.exists ? 'Yes' : 'No'}","${r.whatsappId || ''}","${r.timestamp}"`)
+ .join('\n');
+ const blob = new Blob([header + rows], { type: 'text/csv;charset=utf-8;' });
+ const url = URL.createObjectURL(blob);
+ const link = document.createElement('a');
+ link.href = url;
+ link.setAttribute('download', `whatsapp_account_check_${Date.now()}.csv`);
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ };
+
+ const registeredCount = batchResults.filter(r => r.exists).length;
+ const unregisteredCount = batchResults.filter(r => !r.exists).length;
+
+ return (
+ <div className="number-checker">
+ <PageHeader
+ title="Number Checker"
+ subtitle="Verify if phone numbers have active WhatsApp accounts silently without sending messages"
+ badge={
+ <span className="nc-status-badge registered">
+ <Shield size={14} /> Zero Messages Sent
+ </span>
+ }
+ />
+
+ {/* Session Alert if none ready */}
+ {!loadingSessions && readySessions.length === 0 && (
+ <div className="nc-alert warning">
+ <div className="nc-alert-icon">
+ <AlertCircle size={22} />
+ </div>
+ <div className="nc-alert-content">
+ <strong>No active WhatsApp session connected.</strong>
+ <p style={{ margin: '0.25rem 0 0' }}>
+ To check phone numbers, OpenWA requires at least one authenticated session.
+ </p>
+ </div>
+ <button className="nc-alert-action" onClick={() => navigate('/sessions')}>
+ <Smartphone size={16} /> Go to Sessions
+ </button>
+ </div>
+ )}
+
+ {/* Mode Tabs */}
+ <div className="nc-tabs">
+ <button className={`nc-tab ${activeTab === 'single' ? 'active' : ''}`} onClick={() => setActiveTab('single')}>
+ <Phone size={18} /> Single Check
+ </button>
+ <button className={`nc-tab ${activeTab === 'batch' ? 'active' : ''}`} onClick={() => setActiveTab('batch')}>
+ <UserCheck size={18} /> Bulk Number Checker
+ </button>
+ </div>
+
+ {activeTab === 'single' ? (
+ <>
+ <div className="nc-grid">
+ {/* Input Card */}
+ <div className="nc-card">
+ <h2 className="nc-card-title">Check Single Account</h2>
+
+ <div className="nc-form-group">
+ <label htmlFor="nc-single-session" className="nc-label">
+ WhatsApp Session
+ </label>
+ <select
+ id="nc-single-session"
+ aria-label="WhatsApp Session"
+ className="nc-input"
+ value={currentSession}
+ onChange={e => setSelectedSession(e.target.value)}
+ disabled={readySessions.length === 0}
+ >
+ {readySessions.length === 0 ? (
+ <option value="">No ready sessions available</option>
+ ) : (
+ readySessions.map(s => (
+ <option key={s.id} value={s.id}>
+ {s.name} {s.phone ? `(${s.phone})` : ''}
+ </option>
+ ))
+ )}
+ </select>
+ <span className="nc-hint">Queries are routed through this connected WhatsApp account.</span>
+ </div>
+
+ <div className="nc-form-group">
+ <label className="nc-label">Phone Number</label>
+ <div className="nc-input-row">
+ <input
+ type="text"
+ className="nc-input"
+ placeholder="e.g. 9876543210 (10 digits) or 919876543210 (12 digits)"
+ value={phoneNumber}
+ onChange={e => setPhoneNumber(e.target.value)}
+ onKeyDown={e => {
+ if (e.key === 'Enter') handleSingleCheck();
+ }}
+ disabled={isCheckingSingle}
+ />
+ <button
+ className="nc-btn nc-btn-primary"
+ onClick={handleSingleCheck}
+ disabled={isCheckingSingle || !phoneNumber.trim() || readySessions.length === 0}
+ >
+ {isCheckingSingle ? <Loader2 size={18} className="animate-spin" /> : <Search size={18} />}
+ {isCheckingSingle ? 'Checking...' : 'Check'}
+ </button>
+ </div>
+
+ <label className="nc-checkbox-group">
+ <input
+ type="checkbox"
+ className="nc-checkbox"
+ checked={autoPrefix91}
+ onChange={e => setAutoPrefix91(e.target.checked)}
+ disabled={isCheckingSingle}
+ />
+ <span className="nc-checkbox-label">
+ Auto-prefix <strong>+91</strong> for 10-digit numbers (keep 12-digit numbers as-is)
+ </span>
+ </label>
+
+ {phoneNumber.trim() && (
+ <div className="nc-format-preview">
+ {phoneNumber.replace(/[^0-9]/g, '').length === 10 && autoPrefix91 ? (
+ <span className="nc-format-pill highlight">
+ Will check as: <strong>+{singleFormattedNumber}</strong> (10 digits &rarr; auto-prefixed with
+ 91)
+ </span>
+ ) : phoneNumber.replace(/[^0-9]/g, '').length === 12 ? (
+ <span className="nc-format-pill">
+ Will check as: <strong>+{singleFormattedNumber}</strong> (12 digits &rarr; kept as-is)
+ </span>
+ ) : (
+ <span className="nc-format-pill">
+ Will check as: <strong>+{singleFormattedNumber}</strong> ({singleFormattedNumber.length} digits)
+ </span>
+ )}
+ </div>
+ )}
+ <span className="nc-hint">
+ {autoPrefix91
+ ? '10-digit numbers automatically get +91 prepended. 12-digit numbers remain unchanged.'
+ : 'Numbers are checked exactly as entered.'}
+ </span>
+ </div>
+
+ <div className="nc-alert info" style={{ marginTop: '1.5rem', marginBottom: 0 }}>
+ <div className="nc-alert-icon">
+ <Shield size={20} />
+ </div>
+ <div className="nc-alert-content" style={{ fontSize: '0.8125rem' }}>
+ <strong>Completely Silent:</strong> This query queries WhatsApp&apos;s registration registry directly.
+ The contact receives no notification, sound, or message.
+ </div>
+ </div>
+ </div>
+
+ {/* Result Card */}
+ <div className="nc-card">
+ <h2 className="nc-card-title">Verification Result</h2>
+
+ {isCheckingSingle ? (
+ <div className="nc-result-placeholder">
+ <Loader2 size={36} className="animate-spin" style={{ color: 'var(--primary)' }} />
+ <span>Querying WhatsApp servers...</span>
+ </div>
+ ) : singleResult ? (
+ <div className={`nc-result-card ${singleResult.exists ? 'success' : 'not-found'}`}>
+ <div className="nc-result-top">
+ {singleResult.avatarUrl ? (
+ <img src={singleResult.avatarUrl} alt="Avatar" className="nc-avatar" />
+ ) : (
+ <div className="nc-avatar-fallback">{singleResult.exists ? 'WA' : '?'}</div>
+ )}
+ <div className="nc-result-header-text">
+ <div className="nc-result-phone">+{singleResult.number}</div>
+ {singleResult.exists ? (
+ <span className="nc-status-badge registered">
+ <CheckCircle2 size={15} /> Registered on WhatsApp
+ </span>
+ ) : (
+ <span className="nc-status-badge unregistered">
+ <XCircle size={15} /> Not Registered
+ </span>
+ )}
+ </div>
+ </div>
+
+ <div className="nc-details-grid">
+ <div className="nc-detail-row">
+ <span className="nc-detail-label">Status</span>
+ <span className="nc-detail-value" style={{ fontFamily: 'inherit' }}>
+ {singleResult.exists ? 'Active Account' : 'No Account Found'}
+ </span>
+ </div>
+
+ {singleResult.exists && singleResult.whatsappId && (
+ <div className="nc-detail-row">
+ <span className="nc-detail-label">WhatsApp JID</span>
+ <span className="nc-detail-value">
+ {singleResult.whatsappId}
+ <button
+ className="nc-copy-btn"
+ onClick={() => handleCopy(singleResult.whatsappId!)}
+ title="Copy JID"
+ >
+ {copiedId ? <Check size={12} /> : <Copy size={12} />}
+ {copiedId ? 'Copied' : 'Copy'}
+ </button>
+ </span>
+ </div>
+ )}
+
+ <div className="nc-detail-row">
+ <span className="nc-detail-label">Checked At</span>
+ <span className="nc-detail-value" style={{ fontFamily: 'inherit', fontWeight: 'normal' }}>
+ {singleResult.timestamp}
+ </span>
+ </div>
+ </div>
+
+ {singleResult.exists && (
+ <div className="nc-result-actions">
+ <button
+ className="nc-btn nc-btn-primary"
+ style={{ flex: 1 }}
+ onClick={() => navigate('/message-tester')}
+ >
+ <Send size={16} /> Open in Message Tester
+ </button>
+ </div>
+ )}
+ </div>
+ ) : (
+ <div className="nc-result-placeholder">
+ <UserCheck size={40} />
+ <span>Enter a phone number on the left and click &quot;Check&quot; to see its WhatsApp status.</span>
+ </div>
+ )}
+ </div>
+ </div>
+
+ {/* Recent Checks Table */}
+ {recentChecks.length > 0 && (
+ <div className="nc-history-card">
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
+ <h2 className="nc-card-title" style={{ margin: 0 }}>
+ Recent Checks
+ </h2>
+ <button
+ className="nc-btn nc-btn-secondary"
+ style={{ padding: '0.4rem 0.8rem', fontSize: '0.8125rem' }}
+ onClick={() => setRecentChecks([])}
+ >
+ <Trash2 size={14} /> Clear History
+ </button>
+ </div>
+
+ <table className="nc-history-table">
+ <thead>
+ <tr>
+ <th>Phone Number</th>
+ <th>WhatsApp Status</th>
+ <th>WhatsApp ID</th>
+ <th>Time</th>
+ </tr>
+ </thead>
+ <tbody>
+ {recentChecks.map((item, idx) => (
+ <tr key={`${item.number}-${idx}`}>
+ <td style={{ fontWeight: 600 }}>+{item.number}</td>
+ <td>
+ {item.exists ? (
+ <span className="nc-status-badge registered">
+ <CheckCircle2 size={13} /> Registered
+ </span>
+ ) : (
+ <span className="nc-status-badge unregistered">
+ <XCircle size={13} /> Unregistered
+ </span>
+ )}
+ </td>
+ <td style={{ fontFamily: 'monospace', fontSize: '0.8125rem' }}>{item.whatsappId || '—'}</td>
+ <td style={{ color: 'var(--text-muted)' }}>{item.timestamp}</td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ )}
+ </>
+ ) : (
+ /* Batch / Bulk Number Checker Tab */
+ <div className="nc-card">
+ <h2 className="nc-card-title">Bulk Number Checker</h2>
+
+ <div className="nc-grid" style={{ marginBottom: '1.5rem' }}>
+ <div>
+ <div className="nc-form-group">
+ <label htmlFor="nc-batch-session" className="nc-label">
+ WhatsApp Session
+ </label>
+ <select
+ id="nc-batch-session"
+ aria-label="WhatsApp Session"
+ className="nc-input"
+ value={currentSession}
+ onChange={e => setSelectedSession(e.target.value)}
+ disabled={readySessions.length === 0 || isCheckingBatch}
+ >
+ {readySessions.length === 0 ? (
+ <option value="">No ready sessions available</option>
+ ) : (
+ readySessions.map(s => (
+ <option key={s.id} value={s.id}>
+ {s.name} {s.phone ? `(${s.phone})` : ''}
+ </option>
+ ))
+ )}
+ </select>
+ </div>
+
+ <div className="nc-form-group">
+ <label htmlFor="nc-batch-delay" className="nc-label">
+ Safe Pacing Delay (ms)
+ </label>
+ <select
+ id="nc-batch-delay"
+ aria-label="Safe Pacing Delay (ms)"
+ className="nc-input"
+ value={batchDelay}
+ onChange={e => setBatchDelay(Number(e.target.value))}
+ disabled={isCheckingBatch}
+ >
+ <option value={500}>500 ms (Fast)</option>
+ <option value={1000}>1000 ms / 1 sec (Recommended)</option>
+ <option value={2000}>2000 ms / 2 sec (Extra Safe)</option>
+ <option value={3000}>3000 ms / 3 sec (High Volume Safe)</option>
+ </select>
+ <span className="nc-hint">
+ Adds spacing between consecutive queries to prevent WhatsApp rate limits.
+ </span>
+ </div>
+
+ <div className="nc-form-group">
+ <label className="nc-label">Country Code Rule</label>
+ <label className="nc-checkbox-group" style={{ marginTop: 0 }}>
+ <input
+ type="checkbox"
+ className="nc-checkbox"
+ checked={autoPrefix91}
+ onChange={e => setAutoPrefix91(e.target.checked)}
+ disabled={isCheckingBatch}
+ />
+ <span className="nc-checkbox-label">
+ Auto-prefix <strong>+91</strong> (India) for 10-digit numbers
+ </span>
+ </label>
+ <span className="nc-hint">
+ 10-digit numbers (e.g. 96...) will get +91 prepended. 12-digit numbers will be checked as-is.
+ </span>
+ </div>
+ </div>
+
+ <div>
+ <div className="nc-form-group">
+ <label className="nc-label">Numbers to Check (One per line or comma-separated)</label>
+ <textarea
+ className="nc-textarea"
+ placeholder="9612345678 (10 digits)&#10;919612345678 (12 digits)&#10;14155552671"
+ value={batchInput}
+ onChange={e => setBatchInput(e.target.value)}
+ disabled={isCheckingBatch}
+ />
+ {batchInput.trim() ? (
+ <div className="nc-batch-parse-summary">
+ <span>
+ 📋 <strong>{batchParsedStats.uniqueCount}</strong> unique numbers parsed
+ </span>
+ {autoPrefix91 && (
+ <span className="nc-badge-sub">
+ ({batchParsedStats.tenDigitsCount} ten-digit &rarr; +91 added
+ {batchParsedStats.twelveDigitsCount > 0
+ ? `, ${batchParsedStats.twelveDigitsCount} twelve-digit preserved`
+ : ''}
+ )
+ </span>
+ )}
+ </div>
+ ) : (
+ <span className="nc-hint">
+ Paste raw 10-digit or 12-digit phone numbers. One per line or comma-separated.
+ </span>
+ )}
+ </div>
+ </div>
+ </div>
+
+ <div style={{ display: 'flex', gap: '0.75rem', marginBottom: '1.5rem' }}>
+ {!isCheckingBatch ? (
+ <button
+ className="nc-btn nc-btn-primary"
+ onClick={handleStartBatch}
+ disabled={!batchInput.trim() || readySessions.length === 0}
+ >
+ <UserCheck size={18} /> Start Batch Check
+ </button>
+ ) : (
+ <button className="nc-btn nc-btn-danger" onClick={handleStopBatch}>
+ <Trash2 size={18} /> Stop Checking
+ </button>
+ )}
+
+ {batchResults.length > 0 && !isCheckingBatch && (
+ <button className="nc-btn nc-btn-secondary" onClick={handleExportCSV}>
+ <Download size={18} /> Export Results (CSV)
+ </button>
+ )}
+ </div>
+
+ {/* Progress & Counters */}
+ {(isCheckingBatch || batchResults.length > 0) && (
+ <>
+ {isCheckingBatch && (
+ <div className="nc-progress-bar-container">
+ <div
+ className="nc-progress-bar"
+ style={{
+ width: `${(batchProgress.current / (batchProgress.total || 1)) * 100}%`,
+ }}
+ />
+ </div>
+ )}
+
+ <div className="nc-batch-stats">
+ <div className="nc-stat-box">
+ <div className="nc-stat-number">{batchResults.length}</div>
+ <div className="nc-stat-label">Checked</div>
+ </div>
+ <div className="nc-stat-box">
+ <div className="nc-stat-number" style={{ color: 'var(--success-text)' }}>
+ {registeredCount}
+ </div>
+ <div className="nc-stat-label">Registered</div>
+ </div>
+ <div className="nc-stat-box">
+ <div className="nc-stat-number" style={{ color: 'var(--error-text)' }}>
+ {unregisteredCount}
+ </div>
+ <div className="nc-stat-label">Not Registered</div>
+ </div>
+ <div className="nc-stat-box">
+ <div className="nc-stat-number">{Math.max(0, batchProgress.total - batchProgress.current)}</div>
+ <div className="nc-stat-label">Remaining</div>
+ </div>
+ </div>
+
+ {/* Table Filters */}
+ <div className="nc-filter-bar">
+ <div className="nc-filter-btns">
+ <button
+ className={`nc-filter-btn ${batchFilter === 'all' ? 'active' : ''}`}
+ onClick={() => setBatchFilter('all')}
+ >
+ All ({batchResults.length})
+ </button>
+ <button
+ className={`nc-filter-btn ${batchFilter === 'registered' ? 'active' : ''}`}
+ onClick={() => setBatchFilter('registered')}
+ >
+ Registered ({registeredCount})
+ </button>
+ <button
+ className={`nc-filter-btn ${batchFilter === 'unregistered' ? 'active' : ''}`}
+ onClick={() => setBatchFilter('unregistered')}
+ >
+ Not Registered ({unregisteredCount})
+ </button>
+ </div>
+ </div>
+
+ <table className="nc-history-table">
+ <thead>
+ <tr>
+ <th>#</th>
+ <th>Phone Number</th>
+ <th>WhatsApp Status</th>
+ <th>WhatsApp ID</th>
+ <th>Time</th>
+ </tr>
+ </thead>
+ <tbody>
+ {filteredBatchResults.map((item, idx) => (
+ <tr key={`${item.number}-${idx}`}>
+ <td style={{ color: 'var(--text-muted)' }}>{idx + 1}</td>
+ <td style={{ fontWeight: 600 }}>+{item.number}</td>
+ <td>
+ {item.exists ? (
+ <span className="nc-status-badge registered">
+ <CheckCircle2 size={13} /> Registered
+ </span>
+ ) : (
+ <span className="nc-status-badge unregistered">
+ <XCircle size={13} /> Unregistered
+ </span>
+ )}
+ </td>
+ <td style={{ fontFamily: 'monospace', fontSize: '0.8125rem' }}>{item.whatsappId || '—'}</td>
+ <td style={{ color: 'var(--text-muted)' }}>{item.timestamp}</td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </>
+ )}
+ </div>
+ )}
+ </div>
+ );
+}