Compare commits

..

11 Commits

Author SHA1 Message Date
Deep Koluguri 12b44584aa refactor: apply responsive CSS grid layout across all portals
Build Curio HMS / build-and-deploy (push) Failing after 20s Details
2026-07-10 13:04:21 -04:00
Deep Koluguri 51690a803d fix: remove extra div closing tag that broke main layout structure
Build Curio HMS / build-and-deploy (push) Successful in 50s Details
2026-07-09 00:17:23 -04:00
Deep Koluguri 2ef518f30e feat: add operational database schema and live queue walk-in flow
Build Curio HMS / build-and-deploy (push) Successful in 57s Details
2026-07-08 23:58:08 -04:00
Deep Koluguri ba88e9094d chore: remove hardcoded whatsapp urls and numbers
Build Curio HMS / build-and-deploy (push) Successful in 1m4s Details
2026-06-15 13:22:51 -04:00
Deep Koluguri 3410976b21 refactor: integrate prescription builder seamlessly into doctor workspace
Build Curio HMS / build-and-deploy (push) Successful in 1m5s Details
2026-06-03 01:33:00 -04:00
Deep Koluguri 4a5ea663b6 fix: seed demo users for doctor and pharmacy to fix 401 on login
Build Curio HMS / build-and-deploy (push) Successful in 1m10s Details
2026-06-03 01:16:12 -04:00
Deep Koluguri 1559e9f505 feat: add doctor dashboard and postgres prescription storage
Build Curio HMS / build-and-deploy (push) Successful in 1m12s Details
2026-06-02 23:18:02 -04:00
deepkoluguri bb7038eb29 fix(keycloak): add pvc to keycloak-db statefulset
Build Curio HMS / build-and-deploy (push) Successful in 1m29s Details
2026-06-02 18:45:23 -04:00
Deep Koluguri 15aa8be96c chore: add keycloak deployment, custom theme, and apisix ingress routing config
Build Curio HMS / build-and-deploy (push) Successful in 1m9s Details
2026-05-29 15:08:20 -04:00
Deep Koluguri a2ee8ad71c feat: Configure local WhatsApp Web gateway in app.yaml
Build Curio HMS / build-and-deploy (push) Successful in 1m37s Details
2026-05-28 23:37:23 -04:00
Deep Koluguri f68afed992 fix(auth): secure logout routing and fix role visibility bypass 2026-05-26 23:32:03 -04:00
23 changed files with 1578 additions and 148 deletions

View File

@ -10,15 +10,20 @@
body.admin-body {
background: var(--admin-bg);
font-family: 'Inter', sans-serif;
display: grid;
grid-template-columns: var(--sidebar-width) 1fr;
min-height: 100vh;
}
.admin-sidebar {
width: var(--sidebar-width);
background: var(--admin-primary);
position: sticky;
top: 0;
height: 100vh;
position: fixed;
padding: 2rem;
color: white;
display: flex;
flex-direction: column;
overflow-y: auto;
}
.admin-sidebar .logo,
@ -72,7 +77,6 @@ body.admin-body {
}
.admin-main {
margin-left: var(--sidebar-width);
padding: 3rem;
}
@ -239,20 +243,15 @@ body.admin-body {
}
@media (max-width: 768px) {
body.admin-body {
grid-template-columns: 1fr;
}
.admin-main {
margin-left: 0;
padding: 1.5rem;
padding-top: 2rem;
}
.admin-sidebar {
position: relative;
width: 100%;
height: auto;
}
.admin-sidebar .user-profile {
position: static;
margin-top: 2rem;
}
}

View File

@ -84,11 +84,51 @@ CREATE TABLE IF NOT EXISTS agent_configs (
UNIQUE(tenant_id, agent_type)
);
CREATE TABLE IF NOT EXISTS prescriptions (
id TEXT PRIMARY KEY,
tenant_id TEXT REFERENCES tenants(id) ON DELETE CASCADE,
doctor_id INTEGER REFERENCES users(id),
patient_id TEXT NOT NULL,
patient_name TEXT NOT NULL,
diagnosis TEXT,
medicines JSONB DEFAULT '[]',
lab_tests JSONB DEFAULT '[]',
status TEXT DEFAULT 'pending' CHECK (status IN ('pending', 'ready', 'dispensed')),
created_at TIMESTAMPTZ DEFAULT now()
);
CREATE TABLE IF NOT EXISTS patients (
id SERIAL PRIMARY KEY,
tenant_id TEXT REFERENCES tenants(id) ON DELETE CASCADE,
display_id TEXT NOT NULL,
name TEXT NOT NULL,
whatsapp_number TEXT NOT NULL,
age INTEGER,
gender TEXT,
created_at TIMESTAMPTZ DEFAULT now(),
UNIQUE(tenant_id, whatsapp_number)
);
CREATE TABLE IF NOT EXISTS visits (
id SERIAL PRIMARY KEY,
tenant_id TEXT REFERENCES tenants(id) ON DELETE CASCADE,
patient_id INTEGER REFERENCES patients(id) ON DELETE CASCADE,
token_number TEXT NOT NULL,
status TEXT DEFAULT 'waiting' CHECK (status IN ('waiting', 'in-room', 'completed', 'cancelled')),
type TEXT DEFAULT 'walk-in' CHECK (type IN ('walk-in', 'online')),
triage_category TEXT DEFAULT 'Routine',
payment_status TEXT DEFAULT 'unpaid' CHECK (payment_status IN ('unpaid', 'paid')),
fee INTEGER DEFAULT 0,
notes TEXT,
created_at TIMESTAMPTZ DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_users_tenant ON users(tenant_id);
CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);
CREATE INDEX IF NOT EXISTS idx_pending_status ON pending_registrations(status);
CREATE INDEX IF NOT EXISTS idx_transactions_order ON transactions(order_id);
CREATE INDEX IF NOT EXISTS idx_agent_configs_tenant ON agent_configs(tenant_id);
CREATE INDEX IF NOT EXISTS idx_prescriptions_tenant_status ON prescriptions(tenant_id, status);
-- Migrations for existing DBs
@ -120,6 +160,28 @@ async function seedSuperAdmin() {
console.log(`[DB] Super admin seeded: ${email}`);
}
async function seedDemoUsers() {
const defaultPassword = 'password';
const hash = await bcrypt.hash(defaultPassword, 10);
const demoUsers = [
{ email: 'doctor@curio.app', name: 'Dr. Sharma', role: 'DOCTOR', tenant_id: 'default' },
{ email: 'reception@curio.app', name: 'Front Desk', role: 'RECEPTIONIST', tenant_id: 'default' },
{ email: 'pharmacy@curio.app', name: 'Pharmacist', role: 'PHARMACIST', tenant_id: 'default' },
];
for (const u of demoUsers) {
const existing = await pool.query('SELECT id FROM users WHERE email = $1', [u.email]);
if (existing.rows.length === 0) {
await pool.query(
`INSERT INTO users (tenant_id, email, password_hash, name, role)
VALUES ($1, $2, $3, $4, $5)`,
[u.tenant_id, u.email, hash, u.name, u.role]
);
console.log(`[DB] Demo user seeded: ${u.email}`);
}
}
}
// ── Seed legacy in-memory tenants into DB ─────────────────────────────────────
async function seedLegacyTenants() {
@ -178,6 +240,7 @@ async function initSchema() {
console.log('[DB] Schema ready.');
await seedSuperAdmin();
await seedLegacyTenants();
await seedDemoUsers();
} catch (err) {
console.error('[DB] Schema init failed:', err.message);
// Don't crash — let server start even if DB is temporarily unavailable

View File

@ -1,35 +1,68 @@
/**
* PrescriptionManager: Handles digital prescription generation.
* PrescriptionManager: Handles digital prescription generation and storage in PostgreSQL.
*/
const db = require('./db');
class PrescriptionManager {
constructor() {
this.prescriptions = [];
}
generate(patientId, doctorId, medicines, diagnosis, labTests = []) {
/**
* Create a new prescription
*/
async generate(tenantId, doctorId, patientId, patientName, diagnosis, medicines = [], labTests = []) {
const id = `RX-${Date.now()}`;
const prescription = {
id,
patientId,
doctorId,
date: new Date().toISOString(),
diagnosis,
medicines, // Array of { name, dosage, frequency, duration, qty }
labTests // Array of { testName, instructions }
};
this.prescriptions.push(prescription);
const query = `
INSERT INTO prescriptions (id, tenant_id, doctor_id, patient_id, patient_name, diagnosis, medicines, lab_tests, status)
VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb, $8::jsonb, 'pending')
RETURNING *;
`;
const values = [
id, tenantId, doctorId, patientId, patientName, diagnosis,
JSON.stringify(medicines), JSON.stringify(labTests)
];
const res = await db.query(query, values);
const prescription = res.rows[0];
// Ensure we format it properly for the whatsapp message
const whatsappMessage = `💊 *Digital Prescription from Curio*\n\n*Patient:* ${patientName}\n*Diagnosis:* ${diagnosis}\n\n*Medicines:*\n${medicines.map(m => `- ${m.name}: ${m.dosage} (${m.frequency}) for ${m.duration}`).join('\n')}\n\n` +
(labTests.length > 0 ? `🔬 *Lab Tests Recommended:*\n${labTests.map(t => `- ${t.testName}`).join('\n')}\n\n` : "") +
`_You can show this message at our pharmacy for a 10% discount._`;
return {
success: true,
prescriptionId: id,
data: prescription,
whatsappMessage: `💊 *Digital Prescription from Dr. Sharma*\n\n*Diagnosis:* ${diagnosis}\n\n*Medicines:*\n${medicines.map(m => `- ${m.name}: ${m.dosage} (${m.frequency}) for ${m.duration}`).join('\n')}\n\n` +
(labTests.length > 0 ? `🔬 *Lab Tests Recommended:*\n${labTests.map(t => `- ${t.testName}`).join('\n')}\n\n` : "") +
`_You can show this message at our pharmacy for a 10% discount._`
whatsappMessage
};
}
/**
* Get pending prescriptions for a tenant (used by Pharmacy)
*/
async getPending(tenantId) {
const query = `
SELECT p.*, u.name as doctor_name
FROM prescriptions p
LEFT JOIN users u ON p.doctor_id = u.id
WHERE p.tenant_id = $1 AND p.status = 'pending'
ORDER BY p.created_at ASC;
`;
const res = await db.query(query, [tenantId]);
return res.rows;
}
/**
* Update prescription status
*/
async updateStatus(tenantId, id, status) {
const query = `
UPDATE prescriptions
SET status = $1
WHERE id = $2 AND tenant_id = $3
RETURNING *;
`;
const res = await db.query(query, [status, id, tenantId]);
return res.rows.length > 0 ? res.rows[0] : null;
}
}
module.exports = new PrescriptionManager();

View File

@ -14,6 +14,7 @@ const { signToken, requireAuth } = require('./authMiddleware');
const Razorpay = require('razorpay');
const { upload, initStorage, uploadFile } = require('./storage');
const AgentManager = require('./agents/AgentManager');
const prescriptionManager = require('./prescriptionManager');
const razorpayInstance = new Razorpay({
key_id: process.env.RAZORPAY_KEY_ID || 'rzp_test_dummy_key_id',
@ -498,6 +499,91 @@ app.patch('/api/clinic/agents/:type', requireAuth('OWNER'), async (req, res) =>
}
});
// ── CLINIC OPERATIONS (QUEUE & PATIENTS) ──────────────────────────────────────
/**
* GET /api/clinic/queue
* Fetch the live queue for the tenant
*/
app.get('/api/clinic/queue', requireAuth(), async (req, res) => {
try {
const tenantId = req.user.tenantId;
const result = await query(
`SELECT v.*, p.name as patient_name, p.whatsapp_number, p.age, p.gender, p.display_id
FROM visits v
JOIN patients p ON v.patient_id = p.id
WHERE v.tenant_id = $1 AND v.status IN ('waiting', 'in-room')
ORDER BY v.created_at ASC`,
[tenantId]
);
res.json(result.rows);
} catch (err) {
console.error('[Clinic Queue]', err);
res.status(500).json({ error: 'Failed to fetch queue' });
}
});
/**
* POST /api/clinic/walk-in
* Register a new walk-in patient and add to queue
*/
app.post('/api/clinic/walk-in', requireAuth(), async (req, res) => {
const { name, whatsappNumber, age, gender, fee } = req.body;
const tenantId = req.user.tenantId;
if (!name || !whatsappNumber) return res.status(400).json({ error: 'Name and WhatsApp number are required' });
try {
await query('BEGIN');
// Find or create patient
let patientResult = await query(
'SELECT id FROM patients WHERE tenant_id = $1 AND whatsapp_number = $2',
[tenantId, whatsappNumber]
);
let patientId;
if (patientResult.rows.length > 0) {
patientId = patientResult.rows[0].id;
} else {
// Generate display ID
const countRes = await query('SELECT count(*) FROM patients WHERE tenant_id = $1', [tenantId]);
const nextNum = parseInt(countRes.rows[0].count) + 1001;
const displayId = `CF-${nextNum}`;
const insertPatient = await query(
`INSERT INTO patients (tenant_id, display_id, name, whatsapp_number, age, gender)
VALUES ($1, $2, $3, $4, $5, $6) RETURNING id`,
[tenantId, displayId, name, whatsappNumber, age || null, gender || null]
);
patientId = insertPatient.rows[0].id;
}
// Generate Token Number (simple count-based for the day)
const todayStr = new Date().toISOString().split('T')[0];
const tokenRes = await query(
`SELECT count(*) FROM visits WHERE tenant_id = $1 AND DATE(created_at) = $2`,
[tenantId, todayStr]
);
const tokenNum = parseInt(tokenRes.rows[0].count) + 1;
const tokenStr = `#${tokenNum.toString().padStart(3, '0')}`;
// Insert Visit
const insertVisit = await query(
`INSERT INTO visits (tenant_id, patient_id, token_number, type, status, fee)
VALUES ($1, $2, $3, 'walk-in', 'waiting', $4) RETURNING *`,
[tenantId, patientId, tokenStr, fee || 0]
);
await query('COMMIT');
res.json({ success: true, visit: insertVisit.rows[0], token: tokenStr });
} catch (err) {
await query('ROLLBACK');
console.error('[Clinic Walk-in]', err);
res.status(500).json({ error: 'Failed to register walk-in' });
}
});
// ── CLINIC OWNER ROUTES ───────────────────────────────────────────────────────
/**
@ -808,6 +894,54 @@ app.get('/api/ai/lab/alerts/:patientId', async (req, res) => {
}
});
// ── Prescriptions API ─────────────────────────────────────────────────────────
app.post('/api/prescriptions', requireAuth('DOCTOR'), async (req, res) => {
try {
const { patientId, patientName, diagnosis, medicines, labTests } = req.body;
const tenantId = req.user.tenantId;
const doctorId = req.user.id;
const result = await prescriptionManager.generate(tenantId, doctorId, patientId, patientName, diagnosis, medicines, labTests);
// Push notification via whatsappService (optional)
if (whatsappService && whatsappService.sendMessage && req.body.patientPhone) {
await whatsappService.sendMessage(req.body.patientPhone, result.whatsappMessage);
}
res.json(result);
} catch (error) {
console.error('[Prescription API] Error:', error);
res.status(500).json({ error: 'Failed to create prescription' });
}
});
app.get('/api/prescriptions/pending', requireAuth(), async (req, res) => {
try {
const tenantId = req.user.tenantId;
const pending = await prescriptionManager.getPending(tenantId);
res.json({ success: true, prescriptions: pending });
} catch (error) {
console.error('[Prescription API] Error:', error);
res.status(500).json({ error: 'Failed to fetch pending prescriptions' });
}
});
app.post('/api/prescriptions/:id/status', requireAuth(), async (req, res) => {
try {
const tenantId = req.user.tenantId;
const { status } = req.body;
const updated = await prescriptionManager.updateStatus(tenantId, req.params.id, status);
if (!updated) {
return res.status(404).json({ error: 'Prescription not found' });
}
res.json({ success: true, prescription: updated });
} catch (error) {
console.error('[Prescription API] Error:', error);
res.status(500).json({ error: 'Failed to update prescription status' });
}
});
// ── START ─────────────────────────────────────────────────────────────────────
initSchema().then(() => {

View File

@ -10,7 +10,9 @@
<link rel="stylesheet" href="billing.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap" rel="stylesheet">
<script src="globals.js"></script>
<script src="tenantLoader.js"></script>
<script>requireLogin(['OWNER']);</script>
</head>
<body class="dashboard-body">
<aside class="sidebar">

View File

@ -5,23 +5,25 @@
/* Layout Foundation */
.dashboard-body {
display: flex;
display: grid;
grid-template-columns: var(--sidebar-width) 1fr;
min-height: 100vh;
}
.sidebar {
width: var(--sidebar-width);
background: var(--sidebar-bg);
color: white;
padding: 2.5rem 1.5rem;
display: flex;
flex-direction: column;
position: fixed;
position: sticky;
top: 0;
height: 100vh;
border-right: 1px solid rgba(255, 255, 255, 0.05);
box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
z-index: 100;
overflow: hidden;
overflow-y: auto;
overflow-x: hidden;
}
.sidebar-footer {
@ -49,10 +51,9 @@
}
.dashboard-main {
margin-left: var(--sidebar-width);
flex: 1;
padding: 2.5rem 3rem;
min-height: 100vh;
overflow-x: hidden;
}
.logo {
@ -1652,52 +1653,38 @@
display: none !important;
}
.sidebar {
transform: translateX(0) !important;
}
.sidebar-backdrop {
display: none !important;
}
}
@media (max-width: 768px) {
.dashboard-body {
grid-template-columns: 1fr;
}
.sidebar-mobile-toggle {
display: block;
}
.sidebar {
transform: translateX(-100%);
transition: transform 0.3s ease;
position: fixed;
left: 0;
top: 0;
bottom: 0;
z-index: 1050;
transform: translateX(-100%);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
width: 280px !important;
border-right: none;
box-shadow: 20px 0 50px rgba(0,0,0,0.5);
}
.sidebar.open {
transform: translateX(0);
}
.sidebar.compact-rail {
width: var(--sidebar-width);
padding: 2.5rem 1.5rem;
align-items: stretch;
}
.sidebar.compact-rail .logo-text,
.sidebar.compact-rail .user-profile .info,
.sidebar.compact-rail .nav-text {
display: block !important;
}
.sidebar.compact-rail .side-nav a {
width: auto;
height: auto;
padding: 0.75rem 1rem;
justify-content: flex-start;
}
.sidebar.compact-rail + .dashboard-main,
.dashboard-main {
margin-left: 0;
padding: 1.25rem;
padding-top: 4.5rem;
}
@ -1760,8 +1747,11 @@ body.zen-mode-active .dash-header {
}
/* Compact Sidebar Rail */
.dashboard-body:has(.sidebar.compact-rail) {
grid-template-columns: 70px 1fr;
}
.sidebar.compact-rail {
width: 70px;
padding: 2.5rem 0.5rem;
align-items: center;
overflow-x: hidden;
@ -1811,9 +1801,6 @@ body.zen-mode-active .dash-header {
font-size: 1.25rem;
margin: 0;
}
.sidebar.compact-rail + .dashboard-main {
margin-left: 70px;
}
@media (min-width: 769px) {
body.zen-mode-active {
@ -1867,3 +1854,25 @@ body.zen-mode-active .dash-header {
gap: 1.5rem;
}
}
/* --- Prescription Builder & Print Styles --- */
.medicines-list { display: flex; flex-direction: column; gap: 0.5rem; }
.medicine-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 0.5rem; align-items: center; background: #f8fafc; padding: 0.75rem; border-radius: 6px; border: 1px solid var(--border-color); }
.medicine-row input { padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9rem; }
.print-only { display: none; }
@media print {
body * { visibility: hidden; }
.sidebar, .dash-header, .header-actions, .actions-row, .sidebar-backdrop, .sidebar-mobile-toggle, .zen-sidebar-right, #aiSummaryCard { display: none !important; }
#prescription-print-area, #prescription-print-area * { visibility: visible; }
#prescription-print-area { position: absolute; left: 0; top: 0; width: 100%; padding: 2rem; border: none !important; background: transparent !important; }
.print-only { display: block; text-align: center; margin-bottom: 2rem; }
.medicine-row { border: none; background: none; border-bottom: 1px dashed #ccc; grid-template-columns: 2fr 1fr 1fr 1fr; padding: 0.5rem 0; }
.medicine-row button { display: none; }
.medicine-row input { border: none; padding: 0; background: transparent; font-weight: 500; color: #000; }
textarea { border: none; resize: none; overflow: hidden; background: transparent; color: #000; height: auto; min-height: unset; }
.soap-field { border: none !important; padding: 0 !important; background: transparent !important; margin-bottom: 1rem; }
.soap-field label { font-size: 1.1rem; color: #000; font-weight: bold; border-bottom: 1px solid #000; display: inline-block; padding-bottom: 2px; margin-bottom: 0.5rem; }
.btn-sync { display: none; }
}

View File

@ -57,7 +57,7 @@
<input type="date" id="queueDate" class="date-input" aria-label="Queue Date">
</div>
<span class="badge counter-badge">Reception Counter: 1</span>
<button class="btn-primary" id="newWalkinBtn">+ New Walk-in (Print Token)</button>
<button class="btn-primary" id="newWalkinBtn" onclick="openWalkinModal()">+ New Walk-in (Print Token)</button>
</div>
</header>
@ -125,21 +125,8 @@
<h3>Up Next <small>(Ctrl+Q)</small></h3>
<span class="badge">4 Waiting</span>
</div>
<div class="pipeline-list">
<div class="pipeline-item next" onclick="switchPatientContext('Anjali Singh', '#013', 'High Fever')">
<div class="p-token">#013</div>
<div class="p-info">
<strong>Anjali Singh</strong>
<span class="triage-pill urgent">High Fever</span>
</div>
</div>
<div class="pipeline-item" onclick="switchPatientContext('Suresh Kumar', '#014', 'Back Pain')">
<div class="p-token">#014</div>
<div class="p-info">
<strong>Suresh Kumar</strong>
<span class="triage-pill">Back Pain</span>
</div>
</div>
<div class="pipeline-list" id="livePipelineList">
<!-- Live queue injected here via JS -->
</div>
</aside>
@ -186,12 +173,38 @@
</div>
</div>
<div id="prescription-print-area" class="prescription-builder" style="margin-top: 1.5rem; background: #fff; padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border-color);">
<div class="print-only">
<h2 style="margin-bottom:0.5rem; color:#0F172A;">Curio Clinic</h2>
<p style="margin-bottom:0.25rem;"><strong><span class="doctor-name-print">Dr. Sharma</span></strong> | <span class="doctor-spec-print">Cardiologist</span></p>
<p style="margin-bottom:1rem; border-bottom: 2px solid #000; padding-bottom: 1rem;">Date: <span id="print-date"></span></p>
<div style="display:flex; justify-content:space-between; margin-bottom: 1.5rem; text-align:left;">
<div><strong>Patient:</strong> <span id="print-patient-name">Rahul Verma</span></div>
<div><strong>ID/Phone:</strong> <span id="print-patient-id">P1</span></div>
</div>
</div>
<div class="form-group" style="margin-bottom: 1rem;">
<label style="font-weight: 600; display: block; margin-bottom: 0.5rem;">Medicines (Rx)</label>
<div id="medicines-container" class="medicines-list">
<!-- Medicine rows injected here -->
</div>
<button class="btn btn-sm btn-secondary actions-row" style="width:fit-content; margin-top: 1rem;" onclick="addMedicineRow()">+ Add Medicine</button>
</div>
<div class="actions-row" style="display: flex; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color);">
<button class="btn btn-primary" onclick="submitPrescription()">✅ Prescribe & Send to Pharmacy</button>
<button class="btn btn-secondary" onclick="window.print()">🖨️ Print Prescription</button>
</div>
</div>
<div id="aiSummaryCard" class="summary-card hidden">
<div class="card-header">✨ AI Clinical Summary</div>
<div id="summaryText" class="summary-content"></div>
<div class="summary-actions">
<button class="btn-small secondary" onclick="shareSummary()">📤 Send</button>
<button class="btn-small secondary" onclick="printSummary()">🖨️ Print</button>
<button class="btn-small secondary" onclick="window.print()">🖨️ Print</button>
</div>
</div>
</main>
@ -279,37 +292,8 @@
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr class="active-row">
<td>#012</td>
<td><strong>Rahul Verma</strong></td>
<td><span class="source-tag online">Online</span></td>
<td><span class="lang-tag">HI</span></td>
<td><span class="triage-pill urgent">High Fever / Cough</span></td>
<td><span class="status-pill in-room">In Room</span></td>
<td>09:15 AM</td>
<td><button class="btn-small">Prescribe</button></td>
</tr>
<tr>
<td>#013</td>
<td><strong>Anjali Singh</strong></td>
<td><span class="source-tag walkin">Walk-in</span></td>
<td><span class="lang-tag">TE</span></td>
<td><span class="triage-pill moderate">General Checkup</span></td>
<td><span class="status-pill pending-pay">Unpaid (₹500)</span></td>
<td>09:30 AM</td>
<td><button class="btn-small secondary">Collect Pay</button></td>
</tr>
<tr>
<td>#014</td>
<td><strong>Suresh Kumar</strong></td>
<td><span class="source-tag online">Online</span></td>
<td><span class="lang-tag">EN</span></td>
<td><span class="triage-pill routine">Back Pain</span></td>
<td><span class="status-pill waiting">Paid (Waiting)</span></td>
<td>09:45 AM</td>
<td><button class="btn-small secondary">Notify</button></td>
</tr>
<tbody id="liveQueueTbody">
<!-- Live queue rows injected here via JS -->
</tbody>
</table>
</div>
@ -545,6 +529,51 @@
</div>
</div>
<!-- Walk-in Modal -->
<div id="walkInModal" class="modal">
<div class="modal-content" style="max-width: 500px;">
<header class="modal-header">
<h2>New Walk-in Patient</h2>
<button type="button" class="close-modal" onclick="closeWalkinModal()">&times;</button>
</header>
<div class="modal-body">
<form id="walkInForm">
<div class="input-group">
<label>Patient Name *</label>
<input type="text" id="walkInName" required placeholder="e.g. Rahul Verma">
</div>
<div class="input-group">
<label>WhatsApp Number *</label>
<input type="tel" id="walkInPhone" required placeholder="+91">
</div>
<div style="display: flex; gap: 1rem;">
<div class="input-group" style="flex:1;">
<label>Age</label>
<input type="number" id="walkInAge" placeholder="e.g. 32">
</div>
<div class="input-group" style="flex:1;">
<label>Gender</label>
<select id="walkInGender">
<option value="">Select...</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
<div class="input-group">
<label>Consultation Fee Collected (₹)</label>
<input type="number" id="walkInFee" value="500">
</div>
</form>
</div>
<footer class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeWalkinModal()">Cancel</button>
<button type="button" class="btn btn-primary" onclick="submitWalkIn()" id="submitWalkInBtn">Register & Print Token</button>
</footer>
</div>
</div>
</main>
<script src="dashboard.js?v=100"></script>
</body>

View File

@ -83,7 +83,7 @@ const ROLE_CONFIG = {
};
function getUserRole() {
return localStorage.getItem('userRole') || 'OWNER';
return localStorage.getItem('userRole');
}
function resolveSectionTarget(sectionId) {
@ -137,7 +137,10 @@ function applyRoleNav() {
// 2. Initialization & Speech Recognition Setup
document.addEventListener("DOMContentLoaded", () => {
const userRole = getUserRole();
const payload = requireLogin(['OWNER', 'DOCTOR', 'RECEPTIONIST']);
if (!payload) return;
const userRole = payload.role || getUserRole();
const userEmail = localStorage.getItem('userEmail') || 'admin@curio.app';
const config = ROLE_CONFIG[userRole] || ROLE_CONFIG.OWNER;
@ -883,3 +886,269 @@ window.saveSettings = async () => {
}, 3000);
}
};
// --- Prescription Builder Logic ---
function addMedicineRow() {
const container = document.getElementById('medicines-container');
if (!container) return;
const row = document.createElement('div');
row.className = 'medicine-row';
row.innerHTML = `
<input type="text" class="form-control med-name" placeholder="Medicine Name">
<input type="text" class="form-control med-dosage" placeholder="Dosage (e.g. 500mg)">
<input type="text" class="form-control med-freq" placeholder="Frequency (e.g. 1-0-1)">
<input type="text" class="form-control med-dur" placeholder="Duration (e.g. 5 days)">
<button class="btn btn-sm btn-secondary actions-row" onclick="this.parentElement.remove()"></button>
`;
container.appendChild(row);
}
// Initial setup when opening a patient
const originalOpenPatient = window.openPatient;
window.openPatient = function(name, id) {
if (originalOpenPatient) originalOpenPatient(name, id);
// Fill print details
const printName = document.getElementById('print-patient-name');
const printId = document.getElementById('print-patient-id');
const printDate = document.getElementById('print-date');
if (printName) printName.innerText = name;
if (printId) printId.innerText = id;
if (printDate) printDate.innerText = new Date().toLocaleDateString();
// Reset medicines
const medContainer = document.getElementById('medicines-container');
if (medContainer) {
medContainer.innerHTML = '';
addMedicineRow();
}
};
// If there was no original openPatient (it was inline or something), let's hook into the global DOM elements instead:
document.addEventListener('DOMContentLoaded', () => {
// If medicines container exists, add the first row
const medContainer = document.getElementById('medicines-container');
if (medContainer && medContainer.children.length === 0) {
addMedicineRow();
}
});
async function submitPrescription() {
// Attempt to pull patient name from the main dashboard header (if openPatient didn't set it)
let patientName = document.getElementById('print-patient-name').innerText;
let patientId = document.getElementById('print-patient-id').innerText;
// Fallback: pull from the h1 element in the clinical workspace if it exists
const titleEl = document.querySelector('.patient-title-bar h1');
if (titleEl && (!patientName || patientName === 'Rahul Verma')) { // 'Rahul Verma' is the default template
patientName = titleEl.childNodes[0].textContent.trim();
patientId = 'N/A'; // We might not have it displayed easily
}
const diagnosis = document.getElementById('soap-a').value;
const medicines = [];
document.querySelectorAll('.medicine-row').forEach(row => {
const name = row.querySelector('.med-name').value;
if (name) {
medicines.push({
name: name,
dosage: row.querySelector('.med-dosage').value,
frequency: row.querySelector('.med-freq').value,
duration: row.querySelector('.med-dur').value
});
}
});
if (!patientName || medicines.length === 0) {
alert("Please fill in at least one medicine and ensure patient name is loaded.");
return;
}
try {
const res = await apiCall('/api/prescriptions', 'POST', {
patientId,
patientName,
diagnosis,
medicines,
labTests: []
});
if (res.success) {
alert('Prescription created and sent to pharmacy! ID: ' + res.prescriptionId);
// Optionally print right away
// window.print();
} else {
alert('Failed to create prescription.');
}
} catch (err) {
console.error(err);
alert('An error occurred while creating the prescription.');
}
}
// ==========================================
// Live Queue & Walk-in UI Logic
// ==========================================
let liveQueuePollingInterval = null;
async function fetchLiveQueue() {
const token = localStorage.getItem("curio_token");
if (!token) return;
try {
const res = await fetch('/api/clinic/queue', {
headers: { 'Authorization': `Bearer ${token}` }
});
if (res.ok) {
const queue = await res.json();
renderLiveQueueTable(queue);
renderZenPipeline(queue);
updateQueueStats(queue);
}
} catch (err) {
console.error("Failed to fetch live queue:", err);
}
}
function updateQueueStats(queue) {
const counterBadge = document.querySelector('.counter-badge');
if (counterBadge) counterBadge.innerText = `Waiting: ${queue.filter(q => q.status === 'waiting').length}`;
const waitingSpan = document.querySelector('.pipeline-header .badge');
if (waitingSpan) waitingSpan.innerText = `${queue.filter(q => q.status === 'waiting').length} Waiting`;
}
function renderLiveQueueTable(queue) {
const tbody = document.getElementById("liveQueueTbody");
if (!tbody) return;
if (queue.length === 0) {
tbody.innerHTML = `<tr><td colspan="8" style="text-align: center; color: var(--text-muted);">Queue is empty</td></tr>`;
return;
}
tbody.innerHTML = queue.map(visit => {
const time = new Date(visit.created_at).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
const sourceClass = visit.type === 'online' ? 'online' : 'walkin';
const sourceText = visit.type === 'online' ? 'Online' : 'Walk-in';
let statusHtml = '';
if (visit.status === 'in-room') {
statusHtml = `<span class="status-pill in-room">In Room</span>`;
} else if (visit.payment_status === 'unpaid') {
statusHtml = `<span class="status-pill pending-pay">Unpaid (₹${visit.fee})</span>`;
} else {
statusHtml = `<span class="status-pill waiting">Paid (Waiting)</span>`;
}
let actionHtml = '';
if (visit.status === 'in-room') {
actionHtml = `<button class="btn-small" onclick="showSection('zen'); switchPatientContext('${visit.patient_name}', '${visit.token_number}', '${visit.triage_category}')">Consult</button>`;
} else if (visit.payment_status === 'unpaid') {
actionHtml = `<button class="btn-small secondary" onclick="alert('Collect Pay Flow...')">Collect Pay</button>`;
} else {
actionHtml = `<button class="btn-small secondary" onclick="alert('Notifying patient...')">Notify</button>`;
}
return `
<tr class="${visit.status === 'in-room' ? 'active-row' : ''}">
<td>${visit.token_number}</td>
<td><strong>${visit.patient_name}</strong><br><small class="text-muted">${visit.display_id}</small></td>
<td><span class="source-tag ${sourceClass}">${sourceText}</span></td>
<td><span class="lang-tag">EN</span></td>
<td><span class="triage-pill ${visit.triage_category === 'Urgent' ? 'urgent' : 'routine'}">${visit.triage_category || 'Routine'}</span></td>
<td>${statusHtml}</td>
<td>${time}</td>
<td>${actionHtml}</td>
</tr>
`;
}).join('');
}
function renderZenPipeline(queue) {
const pipelineList = document.getElementById("livePipelineList");
if (!pipelineList) return;
if (queue.length === 0) {
pipelineList.innerHTML = `<div style="padding: 1rem; color: var(--text-muted); text-align: center; font-size: 0.9rem;">No patients waiting</div>`;
return;
}
pipelineList.innerHTML = queue.map((visit, index) => {
const isNext = index === 0 && visit.status !== 'in-room';
const isActive = visit.status === 'in-room';
const itemClass = isActive ? 'active' : (isNext ? 'next' : '');
const triageClass = visit.triage_category === 'Urgent' ? 'urgent' : 'routine';
return `
<div class="pipeline-item ${itemClass}" onclick="switchPatientContext('${visit.patient_name}', '${visit.token_number}', '${visit.triage_category}')">
<div class="p-token">${visit.token_number}</div>
<div class="p-info">
<strong>${visit.patient_name}</strong>
<span class="triage-pill ${triageClass}">${visit.triage_category || 'Routine'}</span>
</div>
</div>
`;
}).join('');
}
// Walk-in Modal Handlers
window.openWalkinModal = () => {
document.getElementById('walkInModal')?.classList.add('open');
};
window.closeWalkinModal = () => {
document.getElementById('walkInModal')?.classList.remove('open');
document.getElementById('walkInForm')?.reset();
};
window.submitWalkIn = async () => {
const btn = document.getElementById("submitWalkInBtn");
const name = document.getElementById("walkInName").value.trim();
const phone = document.getElementById("walkInPhone").value.trim();
const age = document.getElementById("walkInAge").value;
const gender = document.getElementById("walkInGender").value;
const fee = document.getElementById("walkInFee").value;
if (!name || !phone) {
alert("Name and WhatsApp Number are required.");
return;
}
btn.disabled = true;
btn.innerText = "Registering...";
try {
const token = localStorage.getItem("curio_token");
const res = await fetch('/api/clinic/walk-in', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ name, whatsappNumber: phone, age, gender, fee: parseInt(fee) || 0 })
});
const data = await res.json();
if (data.success) {
closeWalkinModal();
fetchLiveQueue(); // Instantly refresh
alert(`Token ${data.token} generated for ${name}!`);
} else {
alert("Error: " + data.error);
}
} catch (err) {
console.error("Walk-in error:", err);
alert("Failed to register walk-in.");
} finally {
btn.disabled = false;
btn.innerText = "Register & Print Token";
}
};
// Start Polling when DOM loads
document.addEventListener('DOMContentLoaded', () => {
fetchLiveQueue();
liveQueuePollingInterval = setInterval(fetchLiveQueue, 10000); // Poll every 10s
});

View File

@ -54,3 +54,16 @@ window.showToast = function(message, type = 'info') {
window.handleComingSoon = function(featureName = 'This feature') {
window.showToast(`${featureName} is coming soon!`, 'info');
};
/**
* Global Logout Interceptor
* Captures clicks on any logout button across the app, clears session, and redirects securely.
*/
document.addEventListener('click', (e) => {
const logoutBtn = e.target.closest('.logout-btn') || e.target.closest('.logout-link') || e.target.closest('.sa-logout');
if (logoutBtn) {
e.preventDefault();
localStorage.clear();
window.location.href = '/';
}
});

View File

@ -34,6 +34,19 @@ spec:
value: "rN5RpKAbFVCv0G45ehluf1JbTWt2dgNW"
- name: TWILIO_WHATSAPP_FROM
value: "whatsapp:+14155238886"
- name: TWILIO_AUTH_TOKEN
value: "08a68571a251d6d62f60dc83fc725b5a"
- name: PHYSICIAN_WHATSAPP_NUMBER
value: "whatsapp:+918500176938"
- name: ADMIN_WHATSAPP_NUMBER
valueFrom:
configMapKeyRef:
name: whatsapp-config
key: personal-number
- name: USE_LOCAL_WHATSAPP
value: "true"
- name: LOCAL_WHATSAPP_URL
value: "http://whatsapp-gateway.ai-agents.svc.cluster.local:5001/send-message"
- name: ANTHROPIC_API_KEY
value: "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"
- name: LLM_MODEL

191
k8s/keycloak.yaml Normal file
View File

@ -0,0 +1,191 @@
apiVersion: v1
kind: Namespace
metadata:
name: keycloak
---
apiVersion: v1
kind: ConfigMap
metadata:
name: keycloak-theme
namespace: keycloak
data:
theme.properties: |
parent=keycloak
import=common/keycloak
styles=css/styles.css
styles.css: |
body {
background-color: #f8fafc;
font-family: 'Inter', sans-serif;
}
.login-pf body {
background: #f8fafc;
}
.card-pf {
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
border-radius: 8px;
border-top: 4px solid #0F172A;
}
.btn-primary {
background-color: #0F172A !important;
border-color: #0F172A !important;
}
.btn-primary:hover {
background-color: #1E293B !important;
}
#kc-header-wrapper {
color: #0F172A;
font-weight: 700;
font-family: 'Outfit', sans-serif;
text-transform: uppercase;
letter-spacing: 1px;
}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: keycloak-db
namespace: keycloak
spec:
serviceName: keycloak-db
replicas: 1
selector:
matchLabels:
app: keycloak-db
template:
metadata:
labels:
app: keycloak-db
spec:
containers:
- name: postgres
image: postgres:15
env:
- name: POSTGRES_DB
value: "keycloak"
- name: POSTGRES_USER
value: "keycloak"
- name: POSTGRES_PASSWORD
value: "keycloak"
ports:
- containerPort: 5432
volumeMounts:
- name: keycloak-db-data
mountPath: /var/lib/postgresql/data
volumeClaimTemplates:
- metadata:
name: keycloak-db-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: Service
metadata:
name: keycloak-db
namespace: keycloak
spec:
ports:
- port: 5432
selector:
app: keycloak-db
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: keycloak
namespace: keycloak
spec:
replicas: 1
selector:
matchLabels:
app: keycloak
template:
metadata:
labels:
app: keycloak
spec:
containers:
- name: keycloak
image: quay.io/keycloak/keycloak:24.0.5
args: ["start-dev"]
env:
- name: KEYCLOAK_ADMIN
value: "admin"
- name: KEYCLOAK_ADMIN_PASSWORD
value: "Mykeycloakpwd@1"
- name: KC_DB
value: "postgres"
- name: KC_DB_URL
value: "jdbc:postgresql://keycloak-db:5432/keycloak"
- name: KC_DB_USERNAME
value: "keycloak"
- name: KC_DB_PASSWORD
value: "keycloak"
- name: KC_HOSTNAME_STRICT_HTTPS
value: "false"
- name: KC_PROXY_HEADERS
value: "xforwarded"
- name: KC_HOSTNAME_URL
value: "https://sso.applaude.net/"
- name: KC_HTTP_ENABLED
value: "true"
ports:
- name: http
containerPort: 8080
volumeMounts:
- name: theme-volume-properties
mountPath: /opt/keycloak/themes/curaflow/login/theme.properties
subPath: theme.properties
- name: theme-volume-css
mountPath: /opt/keycloak/themes/curaflow/login/css/styles.css
subPath: styles.css
volumes:
- name: theme-volume-properties
configMap:
name: keycloak-theme
items:
- key: theme.properties
path: theme.properties
- name: theme-volume-css
configMap:
name: keycloak-theme
items:
- key: styles.css
path: styles.css
---
apiVersion: v1
kind: Service
metadata:
name: keycloak
namespace: keycloak
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: 8080
selector:
app: keycloak
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: keycloak-ingress
namespace: keycloak
annotations:
k8s.apisix.apache.org/plugin-config-name: "strip-hsts"
spec:
ingressClassName: apisix
rules:
- host: sso.applaude.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: keycloak
port:
number: 8080

9
k8s/keycloak/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM quay.io/keycloak/keycloak:24.0.5
# Copy custom theme
COPY theme /opt/keycloak/themes
# Optimize Keycloak build with health endpoints and metrics
RUN /opt/keycloak/bin/kc.sh build --health-enabled=true --metrics-enabled=true
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]

View File

@ -0,0 +1,26 @@
body {
background-color: #f8fafc;
font-family: 'Inter', sans-serif;
}
.login-pf body {
background: #f8fafc;
}
.card-pf {
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
border-radius: 8px;
border-top: 4px solid #0F172A;
}
.btn-primary {
background-color: #0F172A;
border-color: #0F172A;
}
.btn-primary:hover {
background-color: #1E293B;
}
#kc-header-wrapper {
color: #0F172A;
font-weight: 700;
font-family: 'Outfit', sans-serif;
text-transform: uppercase;
letter-spacing: 1px;
}

View File

@ -0,0 +1,3 @@
parent=keycloak
import=common/keycloak
styles=css/styles.css

20
k8s/strip-hsts.yaml Normal file
View File

@ -0,0 +1,20 @@
apiVersion: apisix.apache.org/v2
kind: ApisixPluginConfig
metadata:
name: strip-hsts
namespace: keycloak
spec:
plugins:
- name: proxy-rewrite
enable: true
config:
headers:
X-Forwarded-Proto: "https"
X-Forwarded-Port: "443"
- name: response-rewrite
enable: true
config:
headers:
Strict-Transport-Security: ""
X-Frame-Options: ""
Content-Security-Policy: "frame-src *; frame-ancestors *; object-src 'none';"

View File

@ -41,7 +41,9 @@
<p class="auth-footer">New to Curio? <a href="register.html">Register your clinic</a></p>
<p class="auth-footer" style="font-size:0.78rem; color: var(--text-muted);">
Demo: <code>admin@curio.app</code> / <code>superadmin</code>
Demo Admin: <code>admin@curio.app</code> / <code>superadmin</code><br>
Demo Doctor: <code>doctor@curio.app</code> / <code>password</code><br>
Demo Pharmacy: <code>pharmacy@curio.app</code> / <code>password</code>
</p>
</div>
</div>

505
node_modules/.package-lock.json generated vendored
View File

@ -25,6 +25,53 @@
}
}
},
"node_modules/@asamuzakjp/css-color": {
"version": "5.1.11",
"resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-5.1.11.tgz",
"integrity": "sha512-KVw6qIiCTUQhByfTd78h2yD1/00waTmm9uy/R7Ck/ctUyAPj+AEDLkQIdJW0T8+qGgj3j5bpNKK7Q3G+LedJWg==",
"license": "MIT",
"dependencies": {
"@asamuzakjp/generational-cache": "^1.0.1",
"@csstools/css-calc": "^3.2.0",
"@csstools/css-color-parser": "^4.1.0",
"@csstools/css-parser-algorithms": "^4.0.0",
"@csstools/css-tokenizer": "^4.0.0"
},
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
}
},
"node_modules/@asamuzakjp/dom-selector": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-7.1.1.tgz",
"integrity": "sha512-67RZDnYRc8H/8MLDgQCDE//zoqVFwajkepHZgmXrbwybzXOEwOWGPYGmALYl9J2DOLfFPPs6kKCqmbzV895hTQ==",
"license": "MIT",
"dependencies": {
"@asamuzakjp/generational-cache": "^1.0.1",
"@asamuzakjp/nwsapi": "^2.3.9",
"bidi-js": "^1.0.3",
"css-tree": "^3.2.1",
"is-potential-custom-element-name": "^1.0.1"
},
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
}
},
"node_modules/@asamuzakjp/generational-cache": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@asamuzakjp/generational-cache/-/generational-cache-1.0.1.tgz",
"integrity": "sha512-wajfB8KqzMCN2KGNFdLkReeHncd0AslUSrvHVvvYWuU8ghncRJoA50kT3zP9MVL0+9g4/67H+cdvBskj9THPzg==",
"license": "MIT",
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
}
},
"node_modules/@asamuzakjp/nwsapi": {
"version": "2.3.9",
"resolved": "https://registry.npmjs.org/@asamuzakjp/nwsapi/-/nwsapi-2.3.9.tgz",
"integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==",
"license": "MIT"
},
"node_modules/@babel/runtime": {
"version": "7.29.7",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz",
@ -34,6 +81,171 @@
"node": ">=6.9.0"
}
},
"node_modules/@bramus/specificity": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz",
"integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==",
"license": "MIT",
"dependencies": {
"css-tree": "^3.0.0"
},
"bin": {
"specificity": "bin/cli.js"
}
},
"node_modules/@csstools/color-helpers": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.0.2.tgz",
"integrity": "sha512-LMGQLS9EuADloEFkcTBR3BwV/CGHV7zyDxVRtVDTwdI2Ca4it0CCVTT9wCkxSgokjE5Ho41hEPgb8OEUwoXr6Q==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT-0",
"engines": {
"node": ">=20.19.0"
}
},
"node_modules/@csstools/css-calc": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.2.1.tgz",
"integrity": "sha512-DtdHlgXh5ZkA43cwBcAm+huzgJiwx3ZTWVjBs94kwz2xKqSimDA3lBgCjphYgwgVUMWatSM0pDd8TILB1yrVVg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"engines": {
"node": ">=20.19.0"
},
"peerDependencies": {
"@csstools/css-parser-algorithms": "^4.0.0",
"@csstools/css-tokenizer": "^4.0.0"
}
},
"node_modules/@csstools/css-color-parser": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.1.1.tgz",
"integrity": "sha512-eZ5XOtyhK+mggRafYUWzA0tvaYOFgdY8AkgQiCJF9qNAePnUo/zmsqqYubBBb3sQ8uNUaSKTY9s9klfRaAXL0g==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"dependencies": {
"@csstools/color-helpers": "^6.0.2",
"@csstools/css-calc": "^3.2.1"
},
"engines": {
"node": ">=20.19.0"
},
"peerDependencies": {
"@csstools/css-parser-algorithms": "^4.0.0",
"@csstools/css-tokenizer": "^4.0.0"
}
},
"node_modules/@csstools/css-parser-algorithms": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz",
"integrity": "sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=20.19.0"
},
"peerDependencies": {
"@csstools/css-tokenizer": "^4.0.0"
}
},
"node_modules/@csstools/css-syntax-patches-for-csstree": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.4.tgz",
"integrity": "sha512-wgsqt92b7C7tQhIdPNxj0n9zuUbQlvAuI1exyzeNrOKOi62SD7ren8zqszmpVREjAOqg8cD2FqYhQfAuKjk4sw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT-0",
"peerDependencies": {
"css-tree": "^3.2.1"
},
"peerDependenciesMeta": {
"css-tree": {
"optional": true
}
}
},
"node_modules/@csstools/css-tokenizer": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.0.tgz",
"integrity": "sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=20.19.0"
}
},
"node_modules/@exodus/bytes": {
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz",
"integrity": "sha512-S6mL0yNB/Abt9Ei4tq8gDhcczc4S3+vQ4ra7vxnAf+YHC02srtqxKKZghx2Dq6p0e66THKwR6r8N6P95wEty7Q==",
"license": "MIT",
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
},
"peerDependencies": {
"@noble/hashes": "^1.8.0 || ^2.0.0"
},
"peerDependenciesMeta": {
"@noble/hashes": {
"optional": true
}
}
},
"node_modules/@grpc/grpc-js": {
"version": "1.14.4",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.4.tgz",
@ -353,6 +565,15 @@
"bcrypt": "bin/bcrypt"
}
},
"node_modules/bidi-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz",
"integrity": "sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==",
"license": "MIT",
"dependencies": {
"require-from-string": "^2.0.2"
}
},
"node_modules/block-stream2": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/block-stream2/-/block-stream2-2.1.0.tgz",
@ -557,6 +778,32 @@
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
"license": "MIT"
},
"node_modules/css-tree": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz",
"integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==",
"license": "MIT",
"dependencies": {
"mdn-data": "2.27.1",
"source-map-js": "^1.2.1"
},
"engines": {
"node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"
}
},
"node_modules/data-urls": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz",
"integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==",
"license": "MIT",
"dependencies": {
"whatwg-mimetype": "^5.0.0",
"whatwg-url": "^16.0.0"
},
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
}
},
"node_modules/dayjs": {
"version": "1.11.20",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.20.tgz",
@ -578,6 +825,12 @@
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
"license": "MIT"
},
"node_modules/decimal.js": {
"version": "10.6.0",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
"integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==",
"license": "MIT"
},
"node_modules/decode-uri-component": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz",
@ -671,6 +924,18 @@
"node": ">= 0.8"
}
},
"node_modules/entities": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-8.0.0.tgz",
"integrity": "sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=20.19.0"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
@ -1032,6 +1297,18 @@
"node": ">= 0.4"
}
},
"node_modules/html-encoding-sniffer": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz",
"integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==",
"license": "MIT",
"dependencies": {
"@exodus/bytes": "^1.6.0"
},
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
}
},
"node_modules/http-errors": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
@ -1124,6 +1401,52 @@
"node": ">=8"
}
},
"node_modules/is-potential-custom-element-name": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
"integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
"license": "MIT"
},
"node_modules/jsdom": {
"version": "29.1.1",
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-29.1.1.tgz",
"integrity": "sha512-ECi4Fi2f7BdJtUKTflYRTiaMxIB0O6zfR1fX0GXpUrf6flp8QIYn1UT20YQqdSOfk2dfkCwS8LAFoJDEppNK5Q==",
"license": "MIT",
"dependencies": {
"@asamuzakjp/css-color": "^5.1.11",
"@asamuzakjp/dom-selector": "^7.1.1",
"@bramus/specificity": "^2.4.2",
"@csstools/css-syntax-patches-for-csstree": "^1.1.3",
"@exodus/bytes": "^1.15.0",
"css-tree": "^3.2.1",
"data-urls": "^7.0.0",
"decimal.js": "^10.6.0",
"html-encoding-sniffer": "^6.0.0",
"is-potential-custom-element-name": "^1.0.1",
"lru-cache": "^11.3.5",
"parse5": "^8.0.1",
"saxes": "^6.0.0",
"symbol-tree": "^3.2.4",
"tough-cookie": "^6.0.1",
"undici": "^7.25.0",
"w3c-xmlserializer": "^5.0.0",
"webidl-conversions": "^8.0.1",
"whatwg-mimetype": "^5.0.0",
"whatwg-url": "^16.0.1",
"xml-name-validator": "^5.0.0"
},
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24.0.0"
},
"peerDependencies": {
"canvas": "^3.0.0"
},
"peerDependenciesMeta": {
"canvas": {
"optional": true
}
}
},
"node_modules/json-schema-to-ts": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-3.1.1.tgz",
@ -1246,6 +1569,15 @@
"integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
"license": "Apache-2.0"
},
"node_modules/lru-cache": {
"version": "11.5.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.0.tgz",
"integrity": "sha512-5YgH9UJd7wVb9hIouI2adWpgqrrICkt070Dnj8EUY1+B4B2P9eRLPAkAAo6NICA7CEhOIeBHl46u9zSNpNu7zA==",
"license": "BlueOak-1.0.0",
"engines": {
"node": "20 || >=22"
}
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@ -1255,6 +1587,12 @@
"node": ">= 0.4"
}
},
"node_modules/mdn-data": {
"version": "2.27.1",
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz",
"integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==",
"license": "CC0-1.0"
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@ -1439,6 +1777,18 @@
}
}
},
"node_modules/parse5": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz",
"integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==",
"license": "MIT",
"dependencies": {
"entities": "^8.0.0"
},
"funding": {
"url": "https://github.com/inikulin/parse5?sponsor=1"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@ -1656,6 +2006,15 @@
"node": ">=10"
}
},
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/qs": {
"version": "6.15.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz",
@ -1745,6 +2104,15 @@
"node": ">=0.10.0"
}
},
"node_modules/require-from-string": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@ -1780,6 +2148,18 @@
"node": ">=11.0.0"
}
},
"node_modules/saxes": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
"integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==",
"license": "ISC",
"dependencies": {
"xmlchars": "^2.2.0"
},
"engines": {
"node": ">=v12.22.7"
}
},
"node_modules/scmp": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz",
@ -1922,6 +2302,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/source-map-js": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/split-on-first": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz",
@ -2038,6 +2427,12 @@
],
"license": "MIT"
},
"node_modules/symbol-tree": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
"license": "MIT"
},
"node_modules/through2": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz",
@ -2047,6 +2442,24 @@
"readable-stream": "3"
}
},
"node_modules/tldts": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.0.tgz",
"integrity": "sha512-yHBe+zVfzNZ3QfTPW/Z6KK1G2t340gFjMHqI/4KKSt/abzYydzuCnpqdaF5gCCABby+9Yfbj59oR5F2Fd5CBzg==",
"license": "MIT",
"dependencies": {
"tldts-core": "^7.4.0"
},
"bin": {
"tldts": "bin/cli.js"
}
},
"node_modules/tldts-core": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.0.tgz",
"integrity": "sha512-/mb9kRld+x1sIMXxWNOAp5m6C+D4GrAORWlJkOJ5dElvxdN1eutz/o7qHLp9gFvDF4Y3/L2xeScoxz6AbEo8rQ==",
"license": "MIT"
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@ -2056,6 +2469,30 @@
"node": ">=0.6"
}
},
"node_modules/tough-cookie": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.1.tgz",
"integrity": "sha512-LktZQb3IeoUWB9lqR5EWTHgW/VTITCXg4D21M+lvybRVdylLrRMnqaIONLVb5mav8vM19m44HIcGq4qASeu2Qw==",
"license": "BSD-3-Clause",
"dependencies": {
"tldts": "^7.0.5"
},
"engines": {
"node": ">=16"
}
},
"node_modules/tr46": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz",
"integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==",
"license": "MIT",
"dependencies": {
"punycode": "^2.3.1"
},
"engines": {
"node": ">=20"
}
},
"node_modules/ts-algebra": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-2.0.0.tgz",
@ -2099,6 +2536,15 @@
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==",
"license": "MIT"
},
"node_modules/undici": {
"version": "7.26.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.26.0.tgz",
"integrity": "sha512-3O9Tf67pGhgOv9jM35AbhkXAKi13f3oy3aE4CSgr+TckGeY+/iu97ZXN+J7DpHPzLbVApFd1IFhcnBjREYXYcg==",
"license": "MIT",
"engines": {
"node": ">=20.18.1"
}
},
"node_modules/undici-types": {
"version": "7.24.6",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
@ -2151,6 +2597,50 @@
"node": ">= 0.8"
}
},
"node_modules/w3c-xmlserializer": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
"integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==",
"license": "MIT",
"dependencies": {
"xml-name-validator": "^5.0.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/webidl-conversions": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz",
"integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=20"
}
},
"node_modules/whatwg-mimetype": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz",
"integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==",
"license": "MIT",
"engines": {
"node": ">=20"
}
},
"node_modules/whatwg-url": {
"version": "16.0.1",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz",
"integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==",
"license": "MIT",
"dependencies": {
"@exodus/bytes": "^1.11.0",
"tr46": "^6.0.0",
"webidl-conversions": "^8.0.1"
},
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
}
},
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
@ -2168,6 +2658,15 @@
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/xml-name-validator": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
"integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==",
"license": "Apache-2.0",
"engines": {
"node": ">=18"
}
},
"node_modules/xml-naming": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/xml-naming/-/xml-naming-0.1.0.tgz",
@ -2214,6 +2713,12 @@
"node": ">=6.0"
}
},
"node_modules/xmlchars": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
"license": "MIT"
},
"node_modules/xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",

View File

@ -9,6 +9,8 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap" rel="stylesheet">
<script src="globals.js"></script>
<script src="tenantLoader.js"></script>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<style>
.patient-layout {
@ -97,8 +99,8 @@
<script>
document.addEventListener('DOMContentLoaded', () => {
const token = localStorage.getItem('curio_token');
if (!token) window.location.href = 'login.html';
const payload = requireLogin(['PATIENT']);
if (!payload) return;
const name = localStorage.getItem('userName') || 'Patient';
document.getElementById('patientName').innerText = name;

View File

@ -84,23 +84,8 @@
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr class="active-row">
<td>#RX-901</td>
<td><strong>Suresh Kumar</strong></td>
<td>Amoxicillin, Paracetamol</td>
<td>Dr. Sharma</td>
<td><span class="badge badge-warning">Waiting for Dispense</span></td>
<td><button class="btn btn-sm btn-primary" onclick="handleComingSoon('Dispense')">Dispense</button></td>
</tr>
<tr>
<td>#RX-902</td>
<td><strong>Anjali Singh</strong></td>
<td>Thyroxine 50mcg</td>
<td>Dr. Sharma</td>
<td><span class="badge badge-success">Ready</span></td>
<td><button class="btn btn-sm btn-secondary" onclick="handleComingSoon('Ready')">Ready</button></td>
</tr>
<tbody id="pending-queue">
<tr><td colspan="6" style="text-align: center;">Loading prescriptions...</td></tr>
</tbody>
</table>
</div>
@ -127,5 +112,53 @@
</div>
</section>
</main>
<script>
async function fetchPending() {
try {
const res = await apiCall('/api/prescriptions/pending');
if (res && res.success) {
const tbody = document.getElementById('pending-queue');
if (res.prescriptions.length === 0) {
tbody.innerHTML = '<tr><td colspan="6" style="text-align: center;">No pending prescriptions</td></tr>';
return;
}
tbody.innerHTML = '';
res.prescriptions.forEach(p => {
const tr = document.createElement('tr');
tr.innerHTML = `
<td>${p.id}</td>
<td><strong>${p.patient_name}</strong></td>
<td>${(p.medicines || []).map(m => m.name).join(', ')}</td>
<td>${p.doctor_name || 'Dr. Sharma'}</td>
<td><span class="badge badge-warning">${p.status}</span></td>
<td>
<button class="btn btn-sm btn-primary" onclick="updateStatus('${p.id}', 'dispensed')">Dispense</button>
</td>
`;
tbody.appendChild(tr);
});
}
} catch (err) {
console.error("Failed to fetch pending prescriptions", err);
}
}
async function updateStatus(id, status) {
try {
const res = await apiCall(\`/api/prescriptions/\${id}/status\`, 'POST', { status });
if (res.success) {
fetchPending();
}
} catch (err) {
console.error("Failed to update status", err);
}
}
// Poll every 5 seconds
setInterval(fetchPending, 5000);
fetchPending();
</script>
</body>
</html>

View File

@ -12,6 +12,8 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap" rel="stylesheet">
<script src="globals.js"></script>
<script src="tenantLoader.js"></script>
<script>requireLogin(['OWNER', 'DOCTOR', 'SUPER_ADMIN']);</script>
</head>
<body class="dashboard-body">
<aside class="sidebar">

View File

@ -12,6 +12,8 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap" rel="stylesheet">
<script src="globals.js"></script>
<script src="tenantLoader.js"></script>
<script>requireLogin(['OWNER', 'SUPER_ADMIN']);</script>
</head>
<body class="dashboard-body">
<aside class="sidebar">

View File

@ -14,11 +14,11 @@
<script src="tenantLoader.js"></script>
<style>
:root { --sidebar-w: 230px; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text-main); display: flex; min-height: 100vh; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text-main); display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
/* ── Sidebar ── */
.sa-sidebar { width: var(--sidebar-w); background: var(--primary); color: white; display: flex; flex-direction: column;
position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
/* 🟦 Sidebar 🟦 */
.sa-sidebar { background: var(--primary); color: white; display: flex; flex-direction: column;
position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sa-logo { padding: 1.5rem 1.25rem; display: flex; align-items: center; gap: 0.75rem;
border-bottom: 1px solid rgba(255,255,255,0.1); }
.sa-logo-icon { width: 36px; height: 36px; background: rgba(255,255,255,0.15); border-radius: 10px;
@ -45,8 +45,8 @@
text-decoration: none; font-size: 0.8rem; padding: 0.4rem 0; transition: color 0.2s; }
.sa-logout:hover { color: white; }
/* ── Main area ── */
.sa-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
/* 🟦 Main area 🟦 */
.sa-main { display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }
.sa-header { background: white; border-bottom: 1px solid var(--border); padding: 1rem 2rem;
display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.sa-header h1 { font-family: 'Outfit', sans-serif; font-size: 1.25rem; font-weight: 700; }

71
test_ui.js Normal file
View File

@ -0,0 +1,71 @@
const fs = require('fs');
const path = require('path');
const { JSDOM } = require('jsdom');
const filesToTest = [
'dashboard.html',
'lab.html',
'pharmacy.html',
'staff.html',
'settings.html',
'style-guide.html'
];
async function runTests() {
console.log('--- UI Frontend Tests ---');
let allPassed = true;
for (const file of filesToTest) {
const filePath = path.join(__dirname, file);
const html = fs.readFileSync(filePath, 'utf8');
// Setup DOM
const dom = new JSDOM(html, { runScripts: "dangerously" });
const { window } = dom;
const { document } = window;
// Verify globals.js is included
const scripts = Array.from(document.querySelectorAll('script'));
const hasGlobalsJS = scripts.some(s => s.src.includes('globals.js'));
if (!hasGlobalsJS) {
console.error(`❌ [FAILED] ${file}: Missing globals.js inclusion!`);
allPassed = false;
}
// Check buttons
const buttons = document.querySelectorAll('button');
let deadButtons = 0;
buttons.forEach(btn => {
const hasOnClick = btn.hasAttribute('onclick');
const hasId = btn.hasAttribute('id');
const isSubmit = btn.type === 'submit';
const hasClass = btn.className.includes('btn');
// If it's a structural button without logic, it's a dead click
if (!hasOnClick && !hasId && !isSubmit && !btn.className.includes('close')) {
deadButtons++;
console.error(`❌ [FAILED] ${file}: Dead button found -> "${btn.textContent.trim()}"`);
}
// Ensure global classes are used
if (!hasClass && !btn.className.includes('opt') && !btn.className.includes('close')) {
console.warn(`⚠️ [WARNING] ${file}: Button missing global .btn class -> "${btn.textContent.trim()}"`);
}
});
if (hasGlobalsJS && deadButtons === 0) {
console.log(`✅ [PASSED] ${file}: All ${buttons.length} buttons are wired and globals.js is loaded.`);
} else {
allPassed = false;
}
}
if (allPassed) {
console.log('\n✅✅ ALL UI TESTS PASSED! Zero dead clicks confirmed.');
} else {
console.log('\n❌❌ SOME UI TESTS FAILED. Please review the logs above.');
}
}
runTests().catch(console.error);