elevenlabs-webhook-nodejs 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +27 -0
- package/.dockerignore +6 -0
- package/.env.example +43 -0
- package/BEFORE-PRODUCTION.md +32 -0
- package/Dockerfile +23 -0
- package/SYSTEM_OVERVIEW.md +942 -0
- package/SYSTEM_STATUS.md +332 -0
- package/backup_script/main.py +146 -0
- package/baileys/.dockerignore +7 -0
- package/baileys/Dockerfile +13 -0
- package/baileys/README.md +412 -0
- package/baileys/index.js +499 -0
- package/baileys/package-lock.json +2532 -0
- package/baileys/package.json +25 -0
- package/baileys/server.js +96 -0
- package/baileys/src/config.js +55 -0
- package/baileys/src/middleware/api-key.js +16 -0
- package/baileys/src/routes/accounts.js +51 -0
- package/baileys/src/routes/chats.js +103 -0
- package/baileys/src/routes/webhooks.js +34 -0
- package/baileys/src/services/account-store.js +259 -0
- package/baileys/src/services/webhook-dispatcher.js +161 -0
- package/baileys/src/services/worker-manager.js +597 -0
- package/baileys/src/utils/jid.js +79 -0
- package/baileys/src/utils/logger.js +16 -0
- package/baileys/src/utils/use-mongodb-auth-state.js +122 -0
- package/baileys/worker.js +721 -0
- package/dist/app.d.ts +1 -0
- package/dist/app.js +84 -0
- package/dist/app.js.map +1 -0
- package/dist/config/agentPrompts.json +19 -0
- package/dist/config/database.d.ts +1 -0
- package/dist/config/database.js +26 -0
- package/dist/config/database.js.map +1 -0
- package/dist/config/env.d.ts +41 -0
- package/dist/config/env.js +81 -0
- package/dist/config/env.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +73 -0
- package/dist/config/index.js.map +1 -0
- package/dist/controllers/webhook.controller.d.ts +10 -0
- package/dist/controllers/webhook.controller.js +128 -0
- package/dist/controllers/webhook.controller.js.map +1 -0
- package/dist/errors/index.d.ts +4 -0
- package/dist/errors/index.js +13 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/hooks/webhookValidator.d.ts +2 -0
- package/dist/hooks/webhookValidator.js +47 -0
- package/dist/hooks/webhookValidator.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/001_session-architecture.d.ts +3 -0
- package/dist/migrations/001_session-architecture.js +119 -0
- package/dist/migrations/001_session-architecture.js.map +1 -0
- package/dist/migrations/002_agent-ref.d.ts +3 -0
- package/dist/migrations/002_agent-ref.js +55 -0
- package/dist/migrations/002_agent-ref.js.map +1 -0
- package/dist/migrations/003_shift-schedule.d.ts +3 -0
- package/dist/migrations/003_shift-schedule.js +48 -0
- package/dist/migrations/003_shift-schedule.js.map +1 -0
- package/dist/migrations/004_invert-shift-to-clinic-hours.d.ts +3 -0
- package/dist/migrations/004_invert-shift-to-clinic-hours.js +27 -0
- package/dist/migrations/004_invert-shift-to-clinic-hours.js.map +1 -0
- package/dist/migrations/005_composite-baileys-chat-ids.d.ts +3 -0
- package/dist/migrations/005_composite-baileys-chat-ids.js +47 -0
- package/dist/migrations/005_composite-baileys-chat-ids.js.map +1 -0
- package/dist/migrations/migration.model.d.ts +18 -0
- package/dist/migrations/migration.model.js +45 -0
- package/dist/migrations/migration.model.js.map +1 -0
- package/dist/migrations/migration.routes.d.ts +2 -0
- package/dist/migrations/migration.routes.js +37 -0
- package/dist/migrations/migration.routes.js.map +1 -0
- package/dist/migrations/migration.runner.d.ts +19 -0
- package/dist/migrations/migration.runner.js +74 -0
- package/dist/migrations/migration.runner.js.map +1 -0
- package/dist/models/ConversationClaim.d.ts +13 -0
- package/dist/models/ConversationClaim.js +44 -0
- package/dist/models/ConversationClaim.js.map +1 -0
- package/dist/models/ConversationEvaluation.d.ts +23 -0
- package/dist/models/ConversationEvaluation.js +92 -0
- package/dist/models/ConversationEvaluation.js.map +1 -0
- package/dist/models/Summary.d.ts +37 -0
- package/dist/models/Summary.js +78 -0
- package/dist/models/Summary.js.map +1 -0
- package/dist/models/Transcription.d.ts +34 -0
- package/dist/models/Transcription.js +71 -0
- package/dist/models/Transcription.js.map +1 -0
- package/dist/models/WhatsAppRecipient.d.ts +23 -0
- package/dist/models/WhatsAppRecipient.js +53 -0
- package/dist/models/WhatsAppRecipient.js.map +1 -0
- package/dist/modules/admin/admin.routes.d.ts +2 -0
- package/dist/modules/admin/admin.routes.js +1966 -0
- package/dist/modules/admin/admin.routes.js.map +1 -0
- package/dist/modules/admin/elevenlabs-test-chat.routes.d.ts +2 -0
- package/dist/modules/admin/elevenlabs-test-chat.routes.js +158 -0
- package/dist/modules/admin/elevenlabs-test-chat.routes.js.map +1 -0
- package/dist/modules/admin/whatsapp-test-chat.routes.d.ts +2 -0
- package/dist/modules/admin/whatsapp-test-chat.routes.js +204 -0
- package/dist/modules/admin/whatsapp-test-chat.routes.js.map +1 -0
- package/dist/modules/agents/agent.model.d.ts +38 -0
- package/dist/modules/agents/agent.model.js +92 -0
- package/dist/modules/agents/agent.model.js.map +1 -0
- package/dist/modules/agents/agent.routes.d.ts +2 -0
- package/dist/modules/agents/agent.routes.js +61 -0
- package/dist/modules/agents/agent.routes.js.map +1 -0
- package/dist/modules/appointment-validation/appointment-validation.model.d.ts +76 -0
- package/dist/modules/appointment-validation/appointment-validation.model.js +118 -0
- package/dist/modules/appointment-validation/appointment-validation.model.js.map +1 -0
- package/dist/modules/appointment-validation/appointment-validation.routes.d.ts +2 -0
- package/dist/modules/appointment-validation/appointment-validation.routes.js +202 -0
- package/dist/modules/appointment-validation/appointment-validation.routes.js.map +1 -0
- package/dist/modules/appointment-validation/appointment-validation.service.d.ts +53 -0
- package/dist/modules/appointment-validation/appointment-validation.service.js +827 -0
- package/dist/modules/appointment-validation/appointment-validation.service.js.map +1 -0
- package/dist/modules/auth/auth.model.d.ts +17 -0
- package/dist/modules/auth/auth.model.js +64 -0
- package/dist/modules/auth/auth.model.js.map +1 -0
- package/dist/modules/auth/auth.routes.d.ts +2 -0
- package/dist/modules/auth/auth.routes.js +202 -0
- package/dist/modules/auth/auth.routes.js.map +1 -0
- package/dist/modules/auth/auth.service.d.ts +28 -0
- package/dist/modules/auth/auth.service.js +183 -0
- package/dist/modules/auth/auth.service.js.map +1 -0
- package/dist/modules/auth/refresh-token.model.d.ts +13 -0
- package/dist/modules/auth/refresh-token.model.js +52 -0
- package/dist/modules/auth/refresh-token.model.js.map +1 -0
- package/dist/modules/billing/billing-alert.model.d.ts +16 -0
- package/dist/modules/billing/billing-alert.model.js +47 -0
- package/dist/modules/billing/billing-alert.model.js.map +1 -0
- package/dist/modules/billing/billing-period-snapshot.model.d.ts +35 -0
- package/dist/modules/billing/billing-period-snapshot.model.js +68 -0
- package/dist/modules/billing/billing-period-snapshot.model.js.map +1 -0
- package/dist/modules/billing/billing.model.d.ts +18 -0
- package/dist/modules/billing/billing.model.js +62 -0
- package/dist/modules/billing/billing.model.js.map +1 -0
- package/dist/modules/billing/billing.routes.d.ts +2 -0
- package/dist/modules/billing/billing.routes.js +63 -0
- package/dist/modules/billing/billing.routes.js.map +1 -0
- package/dist/modules/billing/billing.service.d.ts +69 -0
- package/dist/modules/billing/billing.service.js +498 -0
- package/dist/modules/billing/billing.service.js.map +1 -0
- package/dist/modules/billing/payment.model.d.ts +24 -0
- package/dist/modules/billing/payment.model.js +57 -0
- package/dist/modules/billing/payment.model.js.map +1 -0
- package/dist/modules/calls/call.model.d.ts +41 -0
- package/dist/modules/calls/call.model.js +97 -0
- package/dist/modules/calls/call.model.js.map +1 -0
- package/dist/modules/calls/call.routes.d.ts +2 -0
- package/dist/modules/calls/call.routes.js +103 -0
- package/dist/modules/calls/call.routes.js.map +1 -0
- package/dist/modules/campaigns/campaign.model.d.ts +45 -0
- package/dist/modules/campaigns/campaign.model.js +98 -0
- package/dist/modules/campaigns/campaign.model.js.map +1 -0
- package/dist/modules/campaigns/campaign.routes.d.ts +2 -0
- package/dist/modules/campaigns/campaign.routes.js +323 -0
- package/dist/modules/campaigns/campaign.routes.js.map +1 -0
- package/dist/modules/campaigns/campaign.service.d.ts +11 -0
- package/dist/modules/campaigns/campaign.service.js +86 -0
- package/dist/modules/campaigns/campaign.service.js.map +1 -0
- package/dist/modules/google-calendar/google-calendar.routes.d.ts +2 -0
- package/dist/modules/google-calendar/google-calendar.routes.js +32 -0
- package/dist/modules/google-calendar/google-calendar.routes.js.map +1 -0
- package/dist/modules/inbound-call/inbound-call-config.model.d.ts +20 -0
- package/dist/modules/inbound-call/inbound-call-config.model.js +68 -0
- package/dist/modules/inbound-call/inbound-call-config.model.js.map +1 -0
- package/dist/modules/inbound-call/inbound-call.routes.d.ts +2 -0
- package/dist/modules/inbound-call/inbound-call.routes.js +243 -0
- package/dist/modules/inbound-call/inbound-call.routes.js.map +1 -0
- package/dist/modules/leads/lead.model.d.ts +24 -0
- package/dist/modules/leads/lead.model.js +54 -0
- package/dist/modules/leads/lead.model.js.map +1 -0
- package/dist/modules/leads/lead.routes.d.ts +2 -0
- package/dist/modules/leads/lead.routes.js +201 -0
- package/dist/modules/leads/lead.routes.js.map +1 -0
- package/dist/modules/plans/plan.model.d.ts +25 -0
- package/dist/modules/plans/plan.model.js +59 -0
- package/dist/modules/plans/plan.model.js.map +1 -0
- package/dist/modules/surveys/survey.model.d.ts +30 -0
- package/dist/modules/surveys/survey.model.js +75 -0
- package/dist/modules/surveys/survey.model.js.map +1 -0
- package/dist/modules/surveys/survey.routes.d.ts +2 -0
- package/dist/modules/surveys/survey.routes.js +153 -0
- package/dist/modules/surveys/survey.routes.js.map +1 -0
- package/dist/modules/tenants/tenant.model.d.ts +86 -0
- package/dist/modules/tenants/tenant.model.js +127 -0
- package/dist/modules/tenants/tenant.model.js.map +1 -0
- package/dist/modules/tenants/tenant.routes.d.ts +2 -0
- package/dist/modules/tenants/tenant.routes.js +65 -0
- package/dist/modules/tenants/tenant.routes.js.map +1 -0
- package/dist/modules/users/user.routes.d.ts +2 -0
- package/dist/modules/users/user.routes.js +106 -0
- package/dist/modules/users/user.routes.js.map +1 -0
- package/dist/modules/webhooks/elevenlabs-tool.routes.d.ts +20 -0
- package/dist/modules/webhooks/elevenlabs-tool.routes.js +85 -0
- package/dist/modules/webhooks/elevenlabs-tool.routes.js.map +1 -0
- package/dist/modules/webhooks/elevenlabs-tool.service.d.ts +11 -0
- package/dist/modules/webhooks/elevenlabs-tool.service.js +360 -0
- package/dist/modules/webhooks/elevenlabs-tool.service.js.map +1 -0
- package/dist/modules/webhooks/elevenlabs.routes.d.ts +2 -0
- package/dist/modules/webhooks/elevenlabs.routes.js +34 -0
- package/dist/modules/webhooks/elevenlabs.routes.js.map +1 -0
- package/dist/modules/webhooks/elevenlabs.service.d.ts +6 -0
- package/dist/modules/webhooks/elevenlabs.service.js +512 -0
- package/dist/modules/webhooks/elevenlabs.service.js.map +1 -0
- package/dist/modules/webhooks/unipile.routes.d.ts +2 -0
- package/dist/modules/webhooks/unipile.routes.js +780 -0
- package/dist/modules/webhooks/unipile.routes.js.map +1 -0
- package/dist/modules/whatsapp/appointment.model.d.ts +27 -0
- package/dist/modules/whatsapp/appointment.model.js +58 -0
- package/dist/modules/whatsapp/appointment.model.js.map +1 -0
- package/dist/modules/whatsapp/operator-request.model.d.ts +29 -0
- package/dist/modules/whatsapp/operator-request.model.js +65 -0
- package/dist/modules/whatsapp/operator-request.model.js.map +1 -0
- package/dist/modules/whatsapp/stt-usage.model.d.ts +16 -0
- package/dist/modules/whatsapp/stt-usage.model.js +53 -0
- package/dist/modules/whatsapp/stt-usage.model.js.map +1 -0
- package/dist/modules/whatsapp/whatsapp-chat.model.d.ts +23 -0
- package/dist/modules/whatsapp/whatsapp-chat.model.js +55 -0
- package/dist/modules/whatsapp/whatsapp-chat.model.js.map +1 -0
- package/dist/modules/whatsapp/whatsapp-contact-profile.model.d.ts +23 -0
- package/dist/modules/whatsapp/whatsapp-contact-profile.model.js +54 -0
- package/dist/modules/whatsapp/whatsapp-contact-profile.model.js.map +1 -0
- package/dist/modules/whatsapp/whatsapp-message.model.d.ts +30 -0
- package/dist/modules/whatsapp/whatsapp-message.model.js +52 -0
- package/dist/modules/whatsapp/whatsapp-message.model.js.map +1 -0
- package/dist/modules/whatsapp/whatsapp-session.model.d.ts +33 -0
- package/dist/modules/whatsapp/whatsapp-session.model.js +65 -0
- package/dist/modules/whatsapp/whatsapp-session.model.js.map +1 -0
- package/dist/modules/whatsapp/whatsapp.routes.d.ts +2 -0
- package/dist/modules/whatsapp/whatsapp.routes.js +1237 -0
- package/dist/modules/whatsapp/whatsapp.routes.js.map +1 -0
- package/dist/plugins/cors.d.ts +3 -0
- package/dist/plugins/cors.js +11 -0
- package/dist/plugins/cors.js.map +1 -0
- package/dist/plugins/jwt.d.ts +3 -0
- package/dist/plugins/jwt.js +22 -0
- package/dist/plugins/jwt.js.map +1 -0
- package/dist/plugins/rawBody.d.ts +3 -0
- package/dist/plugins/rawBody.js +16 -0
- package/dist/plugins/rawBody.js.map +1 -0
- package/dist/plugins/rbac.d.ts +5 -0
- package/dist/plugins/rbac.js +29 -0
- package/dist/plugins/rbac.js.map +1 -0
- package/dist/routes/admin.routes.d.ts +2 -0
- package/dist/routes/admin.routes.js +169 -0
- package/dist/routes/admin.routes.js.map +1 -0
- package/dist/routes/health.routes.d.ts +2 -0
- package/dist/routes/health.routes.js +16 -0
- package/dist/routes/health.routes.js.map +1 -0
- package/dist/routes/webhook.routes.d.ts +2 -0
- package/dist/routes/webhook.routes.js +17 -0
- package/dist/routes/webhook.routes.js.map +1 -0
- package/dist/services/ai/base.ai.d.ts +19 -0
- package/dist/services/ai/base.ai.js +120 -0
- package/dist/services/ai/base.ai.js.map +1 -0
- package/dist/services/ai/gemini.service.d.ts +11 -0
- package/dist/services/ai/gemini.service.js +43 -0
- package/dist/services/ai/gemini.service.js.map +1 -0
- package/dist/services/ai/index.d.ts +2 -0
- package/dist/services/ai/index.js +26 -0
- package/dist/services/ai/index.js.map +1 -0
- package/dist/services/ai/openai.service.d.ts +11 -0
- package/dist/services/ai/openai.service.js +50 -0
- package/dist/services/ai/openai.service.js.map +1 -0
- package/dist/services/elevenlabs.service.d.ts +52 -0
- package/dist/services/elevenlabs.service.js +447 -0
- package/dist/services/elevenlabs.service.js.map +1 -0
- package/dist/services/google-calendar.service.d.ts +60 -0
- package/dist/services/google-calendar.service.js +494 -0
- package/dist/services/google-calendar.service.js.map +1 -0
- package/dist/services/inbound-call-schedule.service.d.ts +11 -0
- package/dist/services/inbound-call-schedule.service.js +162 -0
- package/dist/services/inbound-call-schedule.service.js.map +1 -0
- package/dist/services/netgsm.service.d.ts +41 -0
- package/dist/services/netgsm.service.js +89 -0
- package/dist/services/netgsm.service.js.map +1 -0
- package/dist/services/unipile.service.d.ts +41 -0
- package/dist/services/unipile.service.js +149 -0
- package/dist/services/unipile.service.js.map +1 -0
- package/dist/services/whatsapp-agent.service.d.ts +139 -0
- package/dist/services/whatsapp-agent.service.js +2055 -0
- package/dist/services/whatsapp-agent.service.js.map +1 -0
- package/dist/services/whatsapp.service.d.ts +26 -0
- package/dist/services/whatsapp.service.js +206 -0
- package/dist/services/whatsapp.service.js.map +1 -0
- package/dist/templates/index.d.ts +39 -0
- package/dist/templates/index.js +35 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/receptionist.d.ts +2 -0
- package/dist/templates/receptionist.js +39 -0
- package/dist/templates/receptionist.js.map +1 -0
- package/dist/templates/survey.d.ts +2 -0
- package/dist/templates/survey.js +41 -0
- package/dist/templates/survey.js.map +1 -0
- package/dist/types/index.d.ts +173 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.js +105 -0
- package/dist/utils/logger.js.map +1 -0
- package/docker-compose.nestjs.yml +89 -0
- package/docker-compose.yml +78 -0
- package/docs/AI_AGENT_ENHANCEMENT_PLAN.md +164 -0
- package/docs/API.md +1193 -0
- package/docs/API_ENDPOINTS.md +344 -0
- package/docs/ARCHITECTURE.md +305 -0
- package/docs/AUTH_API.md +252 -0
- package/docs/BILLING_SMS_ALERTS.md +94 -0
- package/docs/CHAT_ASSIGNMENT_SYSTEM.md +118 -0
- package/docs/CLIENT_TOOLS_AND_FEATURES.md +337 -0
- package/docs/ELEVENLABS_WEBHOOK_TOOLS.md +644 -0
- package/docs/FRONTEND_CHECKLIST.md +227 -0
- package/docs/IMPLEMENTATION_STATUS.md +470 -0
- package/docs/MIGRATION_GUIDE.md +96 -0
- package/docs/MISSINGS_REPORT.md +507 -0
- package/docs/NESTJS_MIGRATION_REFERENCE.md +5136 -0
- package/docs/PROJECT_DESCRIPTION.md +1038 -0
- package/docs/SCALING.md +148 -0
- package/docs/SESSION_SUMMARY_2026_03_17.md +135 -0
- package/docs/WHATSAPP_AGENT.md +1086 -0
- package/docs/architecture/00-SYSTEM-OVERVIEW.md +318 -0
- package/docs/architecture/01-DATABASE-SCHEMA.md +2564 -0
- package/docs/architecture/02-AUTHENTICATION.md +1040 -0
- package/docs/architecture/03-MULTI-CLINIC.md +742 -0
- package/docs/architecture/04-WHATSAPP-AGENT.md +608 -0
- package/docs/architecture/05-OPERATOR-WORKFLOW.md +444 -0
- package/docs/architecture/06-BAILEYS-MICROSERVICE.md +616 -0
- package/docs/architecture/07-APPOINTMENTS.md +849 -0
- package/docs/architecture/08-VOICE-CALLS.md +470 -0
- package/docs/architecture/09-OUTBOUND-CAMPAIGNS.md +542 -0
- package/docs/architecture/10-CLIENT-TOOLS.md +665 -0
- package/docs/architecture/11-BILLING.md +458 -0
- package/docs/architecture/12-SECURITY.md +216 -0
- package/docs/architecture/13-LOGGING-AUDIT.md +549 -0
- package/docs/architecture/14-META-BUSINESS-API.md +454 -0
- package/docs/architecture/15-AI-MODULE.md +479 -0
- package/docs/architecture/16-BACKGROUND-JOBS.md +469 -0
- package/docs/architecture/17-REALTIME-LIVECHAT.md +447 -0
- package/docs/architecture/18-FILE-STORAGE.md +410 -0
- package/docs/architecture/19-PATIENTS.md +1034 -0
- package/docs/architecture/20-TREATMENTS-AND-PLANS.md +774 -0
- package/docs/architecture/21-BEFORE-AFTER-PHOTOS.md +519 -0
- package/docs/database.md +456 -0
- package/docs/ornek-randevu-onay.csv +3 -0
- package/ecosystem.config.js +16 -0
- package/elevenlabs-convai-api-reference.md +1171 -0
- package/frontend/.dockerignore +2 -0
- package/frontend/Dockerfile +24 -0
- package/frontend/README.md +75 -0
- package/frontend/components.json +25 -0
- package/frontend/eslint.config.js +23 -0
- package/frontend/index.html +13 -0
- package/frontend/nginx.conf +37 -0
- package/frontend/package-lock.json +8709 -0
- package/frontend/package.json +71 -0
- package/frontend/public/favicon.svg +1 -0
- package/frontend/public/icons.svg +24 -0
- package/frontend/src/App.tsx +125 -0
- package/frontend/src/components/error-boundary.tsx +50 -0
- package/frontend/src/components/shared/activity-timeline.tsx +66 -0
- package/frontend/src/components/shared/appointment-calendar.css +80 -0
- package/frontend/src/components/shared/appointment-calendar.tsx +245 -0
- package/frontend/src/components/shared/chat-bubble.tsx +72 -0
- package/frontend/src/components/shared/combobox.tsx +119 -0
- package/frontend/src/components/shared/confirm-dialog.tsx +57 -0
- package/frontend/src/components/shared/data-table-pagination.tsx +97 -0
- package/frontend/src/components/shared/data-table-toolbar.tsx +39 -0
- package/frontend/src/components/shared/empty-state.tsx +27 -0
- package/frontend/src/components/shared/file-upload.tsx +140 -0
- package/frontend/src/components/shared/index.ts +20 -0
- package/frontend/src/components/shared/language-switcher.tsx +29 -0
- package/frontend/src/components/shared/notification-dropdown.tsx +115 -0
- package/frontend/src/components/shared/page-header.tsx +23 -0
- package/frontend/src/components/shared/stat-card.tsx +37 -0
- package/frontend/src/components/shared/status-badge.tsx +70 -0
- package/frontend/src/components/shared/status-dot.tsx +43 -0
- package/frontend/src/components/ui/alert-dialog.tsx +187 -0
- package/frontend/src/components/ui/alert.tsx +76 -0
- package/frontend/src/components/ui/avatar.tsx +109 -0
- package/frontend/src/components/ui/badge.tsx +52 -0
- package/frontend/src/components/ui/breadcrumb.tsx +125 -0
- package/frontend/src/components/ui/button.tsx +60 -0
- package/frontend/src/components/ui/calendar.tsx +219 -0
- package/frontend/src/components/ui/card.tsx +103 -0
- package/frontend/src/components/ui/chart.tsx +371 -0
- package/frontend/src/components/ui/checkbox.tsx +29 -0
- package/frontend/src/components/ui/collapsible.tsx +19 -0
- package/frontend/src/components/ui/command.tsx +194 -0
- package/frontend/src/components/ui/dialog.tsx +158 -0
- package/frontend/src/components/ui/dropdown-menu.tsx +268 -0
- package/frontend/src/components/ui/input-group.tsx +156 -0
- package/frontend/src/components/ui/input.tsx +20 -0
- package/frontend/src/components/ui/label.tsx +20 -0
- package/frontend/src/components/ui/pagination.tsx +130 -0
- package/frontend/src/components/ui/popover.tsx +90 -0
- package/frontend/src/components/ui/progress.tsx +83 -0
- package/frontend/src/components/ui/radio-group.tsx +36 -0
- package/frontend/src/components/ui/scroll-area.tsx +54 -0
- package/frontend/src/components/ui/select.tsx +199 -0
- package/frontend/src/components/ui/separator.tsx +23 -0
- package/frontend/src/components/ui/sheet.tsx +138 -0
- package/frontend/src/components/ui/sidebar.tsx +723 -0
- package/frontend/src/components/ui/skeleton.tsx +13 -0
- package/frontend/src/components/ui/sonner.tsx +47 -0
- package/frontend/src/components/ui/switch.tsx +30 -0
- package/frontend/src/components/ui/table.tsx +114 -0
- package/frontend/src/components/ui/tabs.tsx +82 -0
- package/frontend/src/components/ui/textarea.tsx +18 -0
- package/frontend/src/components/ui/toggle-group.tsx +89 -0
- package/frontend/src/components/ui/toggle.tsx +43 -0
- package/frontend/src/components/ui/tooltip.tsx +64 -0
- package/frontend/src/hooks/use-mobile.ts +19 -0
- package/frontend/src/i18n/index.ts +20 -0
- package/frontend/src/i18n/locales/en.json +786 -0
- package/frontend/src/i18n/locales/tr.json +786 -0
- package/frontend/src/index.css +134 -0
- package/frontend/src/layouts/admin-layout.tsx +111 -0
- package/frontend/src/layouts/app-header.tsx +130 -0
- package/frontend/src/layouts/app-layout.tsx +19 -0
- package/frontend/src/layouts/app-sidebar.tsx +212 -0
- package/frontend/src/layouts/auth-guard.tsx +31 -0
- package/frontend/src/layouts/mobile-sidebar.tsx +120 -0
- package/frontend/src/lib/api.ts +68 -0
- package/frontend/src/lib/hooks/use-appointments.ts +224 -0
- package/frontend/src/lib/hooks/use-availability-blocks.ts +83 -0
- package/frontend/src/lib/hooks/use-chats.ts +236 -0
- package/frontend/src/lib/hooks/use-clinic-detail.ts +171 -0
- package/frontend/src/lib/hooks/use-clinics.ts +37 -0
- package/frontend/src/lib/hooks/use-doctor-calendar.ts +80 -0
- package/frontend/src/lib/hooks/use-examinations.ts +89 -0
- package/frontend/src/lib/hooks/use-medical-history.ts +52 -0
- package/frontend/src/lib/hooks/use-patients.ts +296 -0
- package/frontend/src/lib/hooks/use-photo-sets.ts +118 -0
- package/frontend/src/lib/hooks/use-treatment-plans.ts +152 -0
- package/frontend/src/lib/hooks/use-treatments.ts +125 -0
- package/frontend/src/lib/hooks/use-users.ts +172 -0
- package/frontend/src/lib/utils.ts +6 -0
- package/frontend/src/main.tsx +17 -0
- package/frontend/src/pages/admin/agents/detail.tsx +774 -0
- package/frontend/src/pages/admin/agents/import.tsx +280 -0
- package/frontend/src/pages/admin/agents/index.tsx +245 -0
- package/frontend/src/pages/admin/ai-playground.tsx +543 -0
- package/frontend/src/pages/appointments/create-appointment-dialog.tsx +390 -0
- package/frontend/src/pages/appointments/index.tsx +860 -0
- package/frontend/src/pages/audit/index.tsx +24 -0
- package/frontend/src/pages/auth/login.tsx +194 -0
- package/frontend/src/pages/billing/index.tsx +24 -0
- package/frontend/src/pages/calendar/index.tsx +704 -0
- package/frontend/src/pages/calendar-connections/index.tsx +295 -0
- package/frontend/src/pages/calls/index.tsx +24 -0
- package/frontend/src/pages/campaigns/index.tsx +24 -0
- package/frontend/src/pages/chats/index.tsx +981 -0
- package/frontend/src/pages/clinics/index.tsx +224 -0
- package/frontend/src/pages/clinics/settings.tsx +412 -0
- package/frontend/src/pages/components-showcase.tsx +773 -0
- package/frontend/src/pages/connections/index.tsx +328 -0
- package/frontend/src/pages/dashboard.tsx +50 -0
- package/frontend/src/pages/leads/index.tsx +24 -0
- package/frontend/src/pages/my-schedule/index.tsx +496 -0
- package/frontend/src/pages/patients/create-patient-dialog.tsx +358 -0
- package/frontend/src/pages/patients/detail.tsx +1195 -0
- package/frontend/src/pages/patients/edit-patient-dialog.tsx +387 -0
- package/frontend/src/pages/patients/examinations-tab.tsx +460 -0
- package/frontend/src/pages/patients/index.tsx +381 -0
- package/frontend/src/pages/patients/medical-history-dialog.tsx +207 -0
- package/frontend/src/pages/patients/photo-sets-tab.tsx +616 -0
- package/frontend/src/pages/patients/timeline-tab.tsx +164 -0
- package/frontend/src/pages/patients/treatment-plans-tab.tsx +598 -0
- package/frontend/src/pages/phone-numbers/detail.tsx +427 -0
- package/frontend/src/pages/phone-numbers/index.tsx +455 -0
- package/frontend/src/pages/platform/index.tsx +454 -0
- package/frontend/src/pages/settings/index.tsx +126 -0
- package/frontend/src/pages/treatments/index.tsx +487 -0
- package/frontend/src/pages/users/doctor-profile.tsx +672 -0
- package/frontend/src/pages/users/edit.tsx +329 -0
- package/frontend/src/pages/users/index.tsx +407 -0
- package/frontend/src/pages/validation/index.tsx +24 -0
- package/frontend/src/stores/auth.store.ts +108 -0
- package/frontend/src/stores/ui.store.ts +41 -0
- package/frontend/tsconfig.app.json +32 -0
- package/frontend/tsconfig.json +13 -0
- package/frontend/tsconfig.node.json +26 -0
- package/frontend/vite.config.ts +29 -0
- package/nestjs/.dockerignore +5 -0
- package/nestjs/.env.docker +64 -0
- package/nestjs/.prettierrc +4 -0
- package/nestjs/Dockerfile +36 -0
- package/nestjs/README.md +98 -0
- package/nestjs/eslint.config.mjs +35 -0
- package/nestjs/nest-cli.json +8 -0
- package/nestjs/package-lock.json +13390 -0
- package/nestjs/package.json +114 -0
- package/nestjs/prisma/migrations/20260409161536_add_message_metadata_fields/migration.sql +1746 -0
- package/nestjs/prisma/migrations/20260410140436_add_agent_ai_fields/migration.sql +36 -0
- package/nestjs/prisma/migrations/20260410175519_add_agent_clinic_assignments/migration.sql +21 -0
- package/nestjs/prisma/migrations/20260412094344_make_agent_tenant_optional/migration.sql +2 -0
- package/nestjs/prisma/migrations/20260412110008_add_admin_chat_sessions/migration.sql +47 -0
- package/nestjs/prisma/migrations/migration_lock.toml +3 -0
- package/nestjs/prisma/schema.prisma +1843 -0
- package/nestjs/prisma/seed.ts +375 -0
- package/nestjs/prisma.config.ts +14 -0
- package/nestjs/src/admin/admin.controller.ts +27 -0
- package/nestjs/src/admin/admin.module.ts +16 -0
- package/nestjs/src/admin/admin.service.ts +91 -0
- package/nestjs/src/admin/ai-chat-session.service.ts +454 -0
- package/nestjs/src/admin/ai-test.controller.ts +191 -0
- package/nestjs/src/admin/superadmin.controller.ts +106 -0
- package/nestjs/src/agents/agents.controller.ts +262 -0
- package/nestjs/src/agents/agents.module.ts +13 -0
- package/nestjs/src/agents/agents.service.ts +733 -0
- package/nestjs/src/agents/dto/create-agent.dto.ts +99 -0
- package/nestjs/src/agents/dto/index.ts +2 -0
- package/nestjs/src/agents/dto/update-agent.dto.ts +148 -0
- package/nestjs/src/app.module.ts +115 -0
- package/nestjs/src/appointment-validation/appointment-validation.controller.ts +194 -0
- package/nestjs/src/appointment-validation/appointment-validation.module.ts +16 -0
- package/nestjs/src/appointment-validation/appointment-validation.service.ts +450 -0
- package/nestjs/src/appointment-validation/dto/create-batch.dto.ts +105 -0
- package/nestjs/src/appointment-validation/dto/index.ts +1 -0
- package/nestjs/src/appointment-validation/processors/validation-dispatch.processor.ts +26 -0
- package/nestjs/src/appointment-validation/processors/validation-sync.processor.ts +23 -0
- package/nestjs/src/appointments/appointments.controller.ts +268 -0
- package/nestjs/src/appointments/appointments.module.ts +13 -0
- package/nestjs/src/appointments/appointments.service.ts +773 -0
- package/nestjs/src/appointments/dto/create-appointment.dto.ts +72 -0
- package/nestjs/src/appointments/dto/index.ts +4 -0
- package/nestjs/src/appointments/dto/query-appointments.dto.ts +60 -0
- package/nestjs/src/appointments/dto/update-appointment.dto.ts +43 -0
- package/nestjs/src/appointments/dto/update-status.dto.ts +18 -0
- package/nestjs/src/appointments/processors/reminder.processor.ts +243 -0
- package/nestjs/src/audit/audit.controller.ts +84 -0
- package/nestjs/src/audit/audit.decorator.ts +20 -0
- package/nestjs/src/audit/audit.interceptor.ts +67 -0
- package/nestjs/src/audit/audit.interfaces.ts +15 -0
- package/nestjs/src/audit/audit.module.ts +12 -0
- package/nestjs/src/audit/audit.service.ts +177 -0
- package/nestjs/src/auth/auth.controller.ts +116 -0
- package/nestjs/src/auth/auth.module.ts +25 -0
- package/nestjs/src/auth/auth.service.ts +612 -0
- package/nestjs/src/auth/dto/change-password.dto.ts +13 -0
- package/nestjs/src/auth/dto/forgot-password.dto.ts +8 -0
- package/nestjs/src/auth/dto/index.ts +6 -0
- package/nestjs/src/auth/dto/login.dto.ts +13 -0
- package/nestjs/src/auth/dto/refresh.dto.ts +8 -0
- package/nestjs/src/auth/dto/register.dto.ts +28 -0
- package/nestjs/src/auth/dto/reset-password.dto.ts +13 -0
- package/nestjs/src/auth/permissions.config.ts +85 -0
- package/nestjs/src/availability-blocks/availability-blocks.controller.ts +83 -0
- package/nestjs/src/availability-blocks/availability-blocks.module.ts +10 -0
- package/nestjs/src/availability-blocks/availability-blocks.service.ts +202 -0
- package/nestjs/src/billing/billing.controller.ts +104 -0
- package/nestjs/src/billing/billing.module.ts +12 -0
- package/nestjs/src/billing/billing.service.ts +398 -0
- package/nestjs/src/billing/dto/index.ts +2 -0
- package/nestjs/src/billing/dto/query-billing.dto.ts +29 -0
- package/nestjs/src/billing/dto/record-payment.dto.ts +60 -0
- package/nestjs/src/billing/processors/alerts.processor.ts +216 -0
- package/nestjs/src/billing/processors/snapshot.processor.ts +181 -0
- package/nestjs/src/calls/calls.controller.ts +92 -0
- package/nestjs/src/calls/calls.module.ts +10 -0
- package/nestjs/src/calls/calls.service.ts +359 -0
- package/nestjs/src/calls/dto/index.ts +1 -0
- package/nestjs/src/calls/dto/query-calls.dto.ts +46 -0
- package/nestjs/src/clinics/clinics.controller.ts +226 -0
- package/nestjs/src/clinics/clinics.module.ts +11 -0
- package/nestjs/src/clinics/clinics.service.ts +203 -0
- package/nestjs/src/clinics/dto/create-clinic.dto.ts +40 -0
- package/nestjs/src/clinics/dto/create-meta-connection.dto.ts +44 -0
- package/nestjs/src/clinics/dto/index.ts +4 -0
- package/nestjs/src/clinics/dto/update-clinic.dto.ts +133 -0
- package/nestjs/src/clinics/dto/update-meta-connection.dto.ts +22 -0
- package/nestjs/src/clinics/meta-connections.service.ts +210 -0
- package/nestjs/src/common/decorators/accessible-clinics.decorator.ts +9 -0
- package/nestjs/src/common/decorators/current-user.decorator.ts +10 -0
- package/nestjs/src/common/decorators/features.decorator.ts +7 -0
- package/nestjs/src/common/decorators/index.ts +4 -0
- package/nestjs/src/common/decorators/permissions.decorator.ts +13 -0
- package/nestjs/src/common/gateways/events.gateway.ts +157 -0
- package/nestjs/src/common/guards/clinic-access.guard.ts +40 -0
- package/nestjs/src/common/guards/features.guard.ts +38 -0
- package/nestjs/src/common/guards/index.ts +5 -0
- package/nestjs/src/common/guards/jwt-auth.guard.ts +54 -0
- package/nestjs/src/common/guards/permissions.guard.ts +50 -0
- package/nestjs/src/common/guards/superadmin.guard.ts +35 -0
- package/nestjs/src/common/interceptors/request-context.interceptor.ts +32 -0
- package/nestjs/src/common/interceptors/superadmin-tenant.interceptor.ts +42 -0
- package/nestjs/src/common/interfaces/jwt-payload.interface.ts +11 -0
- package/nestjs/src/config/config.module.ts +13 -0
- package/nestjs/src/database/database.module.ts +9 -0
- package/nestjs/src/database/prisma.service.ts +20 -0
- package/nestjs/src/database/tenant-context.ts +27 -0
- package/nestjs/src/google-calendar/google-calendar.controller.ts +259 -0
- package/nestjs/src/google-calendar/google-calendar.module.ts +10 -0
- package/nestjs/src/google-calendar/google-calendar.service.ts +811 -0
- package/nestjs/src/integrations/ai/ai.interface.ts +74 -0
- package/nestjs/src/integrations/ai/ai.module.ts +11 -0
- package/nestjs/src/integrations/ai/ai.service.ts +148 -0
- package/nestjs/src/integrations/ai/providers/anthropic.provider.ts +146 -0
- package/nestjs/src/integrations/ai/providers/openai.provider.ts +158 -0
- package/nestjs/src/integrations/elevenlabs/elevenlabs.module.ts +8 -0
- package/nestjs/src/integrations/elevenlabs/elevenlabs.service.ts +226 -0
- package/nestjs/src/integrations/encryption/encryption.module.ts +9 -0
- package/nestjs/src/integrations/encryption/encryption.service.ts +31 -0
- package/nestjs/src/integrations/image/image.module.ts +9 -0
- package/nestjs/src/integrations/image/image.service.ts +61 -0
- package/nestjs/src/integrations/meta-business/meta-business.module.ts +10 -0
- package/nestjs/src/integrations/meta-business/meta-instagram.service.ts +94 -0
- package/nestjs/src/integrations/meta-business/meta-webhook.service.ts +52 -0
- package/nestjs/src/integrations/meta-business/meta-whatsapp.service.ts +254 -0
- package/nestjs/src/integrations/minio/minio.module.ts +9 -0
- package/nestjs/src/integrations/minio/minio.service.ts +88 -0
- package/nestjs/src/integrations/netgsm/netgsm.module.ts +8 -0
- package/nestjs/src/integrations/netgsm/netgsm.service.ts +17 -0
- package/nestjs/src/integrations/tektippay/tektippay.module.ts +8 -0
- package/nestjs/src/integrations/tektippay/tektippay.service.ts +23 -0
- package/nestjs/src/leads/dto/index.ts +2 -0
- package/nestjs/src/leads/dto/query-leads.dto.ts +50 -0
- package/nestjs/src/leads/dto/update-lead.dto.ts +26 -0
- package/nestjs/src/leads/leads.controller.ts +184 -0
- package/nestjs/src/leads/leads.module.ts +10 -0
- package/nestjs/src/leads/leads.service.ts +375 -0
- package/nestjs/src/logging/logging.controller.ts +82 -0
- package/nestjs/src/logging/logging.module.ts +11 -0
- package/nestjs/src/logging/logging.service.ts +180 -0
- package/nestjs/src/main.ts +86 -0
- package/nestjs/src/outbound-campaigns/dto/create-campaign.dto.ts +47 -0
- package/nestjs/src/outbound-campaigns/dto/index.ts +3 -0
- package/nestjs/src/outbound-campaigns/dto/update-campaign.dto.ts +31 -0
- package/nestjs/src/outbound-campaigns/dto/upload-entries.dto.ts +35 -0
- package/nestjs/src/outbound-campaigns/outbound-campaigns.controller.ts +307 -0
- package/nestjs/src/outbound-campaigns/outbound-campaigns.module.ts +13 -0
- package/nestjs/src/outbound-campaigns/outbound-campaigns.service.ts +471 -0
- package/nestjs/src/outbound-campaigns/processors/campaign-dispatch.processor.ts +366 -0
- package/nestjs/src/patients/documents.service.ts +231 -0
- package/nestjs/src/patients/dto/create-examination.dto.ts +34 -0
- package/nestjs/src/patients/dto/create-note.dto.ts +14 -0
- package/nestjs/src/patients/dto/create-patient.dto.ts +86 -0
- package/nestjs/src/patients/dto/create-photo-set.dto.ts +32 -0
- package/nestjs/src/patients/dto/index.ts +10 -0
- package/nestjs/src/patients/dto/update-examination.dto.ts +29 -0
- package/nestjs/src/patients/dto/update-medical-history.dto.ts +47 -0
- package/nestjs/src/patients/dto/update-patient.dto.ts +87 -0
- package/nestjs/src/patients/dto/update-photo-set.dto.ts +28 -0
- package/nestjs/src/patients/dto/upload-document.dto.ts +31 -0
- package/nestjs/src/patients/dto/upload-photo.dto.ts +27 -0
- package/nestjs/src/patients/examinations.service.ts +271 -0
- package/nestjs/src/patients/medical-history.service.ts +149 -0
- package/nestjs/src/patients/notes.service.ts +172 -0
- package/nestjs/src/patients/patients.controller.ts +485 -0
- package/nestjs/src/patients/patients.module.ts +22 -0
- package/nestjs/src/patients/patients.service.ts +412 -0
- package/nestjs/src/patients/photo-sets.service.ts +389 -0
- package/nestjs/src/phone-numbers/dto/create-phone-number.dto.ts +57 -0
- package/nestjs/src/phone-numbers/dto/index.ts +3 -0
- package/nestjs/src/phone-numbers/dto/update-phone-number.dto.ts +38 -0
- package/nestjs/src/phone-numbers/dto/update-schedule.dto.ts +39 -0
- package/nestjs/src/phone-numbers/phone-numbers.controller.ts +125 -0
- package/nestjs/src/phone-numbers/phone-numbers.module.ts +10 -0
- package/nestjs/src/phone-numbers/phone-numbers.service.ts +209 -0
- package/nestjs/src/plans/dto/create-plan.dto.ts +70 -0
- package/nestjs/src/plans/dto/index.ts +2 -0
- package/nestjs/src/plans/dto/update-plan.dto.ts +80 -0
- package/nestjs/src/plans/plans.controller.ts +50 -0
- package/nestjs/src/plans/plans.module.ts +10 -0
- package/nestjs/src/plans/plans.service.ts +115 -0
- package/nestjs/src/platform/dto/create-tenant.dto.ts +36 -0
- package/nestjs/src/platform/dto/index.ts +2 -0
- package/nestjs/src/platform/dto/update-tenant-platform.dto.ts +44 -0
- package/nestjs/src/platform/platform.controller.ts +79 -0
- package/nestjs/src/platform/platform.module.ts +10 -0
- package/nestjs/src/platform/platform.service.ts +301 -0
- package/nestjs/src/queue/queue.module.ts +56 -0
- package/nestjs/src/redis/redis.module.ts +20 -0
- package/nestjs/src/tenants/dto/index.ts +1 -0
- package/nestjs/src/tenants/dto/update-tenant.dto.ts +15 -0
- package/nestjs/src/tenants/tenants.controller.ts +45 -0
- package/nestjs/src/tenants/tenants.module.ts +10 -0
- package/nestjs/src/tenants/tenants.service.ts +41 -0
- package/nestjs/src/tools/adapters/elevenlabs-http.adapter.ts +51 -0
- package/nestjs/src/tools/adapters/elevenlabs-ws.adapter.ts +59 -0
- package/nestjs/src/tools/handlers/calendar.tools.ts +441 -0
- package/nestjs/src/tools/handlers/notification.tools.ts +34 -0
- package/nestjs/src/tools/handlers/operator.tools.ts +303 -0
- package/nestjs/src/tools/handlers/patient.tools.ts +242 -0
- package/nestjs/src/tools/handlers/payment.tools.ts +43 -0
- package/nestjs/src/tools/handlers/validation.tools.ts +152 -0
- package/nestjs/src/tools/tool-registry.service.ts +221 -0
- package/nestjs/src/tools/tool.decorator.ts +16 -0
- package/nestjs/src/tools/tool.interfaces.ts +26 -0
- package/nestjs/src/tools/tools.module.ts +50 -0
- package/nestjs/src/treatments/dto/create-plan-item.dto.ts +27 -0
- package/nestjs/src/treatments/dto/create-treatment-plan.dto.ts +69 -0
- package/nestjs/src/treatments/dto/create-treatment.dto.ts +59 -0
- package/nestjs/src/treatments/dto/index.ts +6 -0
- package/nestjs/src/treatments/dto/update-plan-item.dto.ts +23 -0
- package/nestjs/src/treatments/dto/update-treatment-plan.dto.ts +22 -0
- package/nestjs/src/treatments/dto/update-treatment.dto.ts +70 -0
- package/nestjs/src/treatments/treatment-plans.service.ts +362 -0
- package/nestjs/src/treatments/treatments.controller.ts +265 -0
- package/nestjs/src/treatments/treatments.module.ts +14 -0
- package/nestjs/src/treatments/treatments.service.ts +165 -0
- package/nestjs/src/users/doctor-profiles.service.ts +202 -0
- package/nestjs/src/users/dto/index.ts +4 -0
- package/nestjs/src/users/dto/invite-user.dto.ts +52 -0
- package/nestjs/src/users/dto/update-clinic-assignments.dto.ts +9 -0
- package/nestjs/src/users/dto/update-doctor-profile.dto.ts +49 -0
- package/nestjs/src/users/dto/update-user.dto.ts +41 -0
- package/nestjs/src/users/users.controller.ts +142 -0
- package/nestjs/src/users/users.module.ts +11 -0
- package/nestjs/src/users/users.service.ts +250 -0
- package/nestjs/src/webhooks/elevenlabs-tool.controller.ts +66 -0
- package/nestjs/src/webhooks/elevenlabs-webhook.controller.ts +60 -0
- package/nestjs/src/webhooks/meta-webhook.controller.ts +178 -0
- package/nestjs/src/webhooks/processors/elevenlabs-webhook.processor.ts +28 -0
- package/nestjs/src/webhooks/webhooks.module.ts +17 -0
- package/nestjs/src/whatsapp/chat-context.service.ts +281 -0
- package/nestjs/src/whatsapp/dto/add-blacklist.dto.ts +13 -0
- package/nestjs/src/whatsapp/dto/index.ts +2 -0
- package/nestjs/src/whatsapp/dto/send-message.dto.ts +14 -0
- package/nestjs/src/whatsapp/listeners/meta-message.listener.ts +579 -0
- package/nestjs/src/whatsapp/meta-auth.controller.ts +268 -0
- package/nestjs/src/whatsapp/meta-instagram-auth.controller.ts +244 -0
- package/nestjs/src/whatsapp/operator.service.ts +692 -0
- package/nestjs/src/whatsapp/processors/cost-sweep.processor.ts +130 -0
- package/nestjs/src/whatsapp/processors/grace.processor.ts +191 -0
- package/nestjs/src/whatsapp/processors/message-buffer.processor.ts +138 -0
- package/nestjs/src/whatsapp/processors/message-cleanup.processor.ts +148 -0
- package/nestjs/src/whatsapp/processors/meta-token-refresh.processor.ts +114 -0
- package/nestjs/src/whatsapp/processors/operator-expiry.processor.ts +105 -0
- package/nestjs/src/whatsapp/processors/profile-update.processor.ts +234 -0
- package/nestjs/src/whatsapp/processors/session-cleanup.processor.ts +178 -0
- package/nestjs/src/whatsapp/processors/session-labels.processor.ts +248 -0
- package/nestjs/src/whatsapp/whatsapp-agent.service.ts +2506 -0
- package/nestjs/src/whatsapp/whatsapp-recovery.service.ts +117 -0
- package/nestjs/src/whatsapp/whatsapp.controller.ts +398 -0
- package/nestjs/src/whatsapp/whatsapp.module.ts +51 -0
- package/nestjs/src/whatsapp/whatsapp.service.ts +592 -0
- package/nestjs/test/app.e2e-spec.ts +25 -0
- package/nestjs/test/jest-e2e.json +9 -0
- package/nestjs/tsconfig.build.json +4 -0
- package/nestjs/tsconfig.json +25 -0
- package/nginx.example.conf +18 -0
- package/package.json +47 -0
- package/scripts/addRecipient.ts +48 -0
- package/scripts/listRecipients.ts +31 -0
- package/scripts/migrate-agent-ref.ts +86 -0
- package/scripts/migrate-sessions.ts +183 -0
- package/scripts/promote.ts +27 -0
- package/scripts/retrigger.ts +84 -0
- package/scripts/seed.ts +435 -0
- package/scripts/testSend.ts +63 -0
- package/src/app.ts +85 -0
- package/src/config/agentPrompts.json +19 -0
- package/src/config/database.ts +21 -0
- package/src/config/env.ts +94 -0
- package/src/config/index.ts +86 -0
- package/src/controllers/webhook.controller.ts +150 -0
- package/src/errors/index.ts +9 -0
- package/src/hooks/webhookValidator.ts +55 -0
- package/src/index.ts +68 -0
- package/src/migrations/001_session-architecture.ts +138 -0
- package/src/migrations/002_agent-ref.ts +65 -0
- package/src/migrations/003_shift-schedule.ts +55 -0
- package/src/migrations/004_invert-shift-to-clinic-hours.ts +30 -0
- package/src/migrations/005_composite-baileys-chat-ids.ts +60 -0
- package/src/migrations/migration.model.ts +27 -0
- package/src/migrations/migration.routes.ts +40 -0
- package/src/migrations/migration.runner.ts +112 -0
- package/src/models/ConversationClaim.ts +17 -0
- package/src/models/ConversationEvaluation.ts +91 -0
- package/src/models/Summary.ts +77 -0
- package/src/models/Transcription.ts +68 -0
- package/src/models/WhatsAppRecipient.ts +37 -0
- package/src/modules/admin/admin.routes.ts +2385 -0
- package/src/modules/admin/elevenlabs-test-chat.routes.ts +193 -0
- package/src/modules/admin/whatsapp-test-chat.routes.ts +244 -0
- package/src/modules/agents/agent.model.ts +93 -0
- package/src/modules/agents/agent.routes.ts +65 -0
- package/src/modules/appointment-validation/appointment-validation.model.ts +163 -0
- package/src/modules/appointment-validation/appointment-validation.routes.ts +275 -0
- package/src/modules/appointment-validation/appointment-validation.service.ts +1028 -0
- package/src/modules/auth/auth.model.ts +42 -0
- package/src/modules/auth/auth.routes.ts +199 -0
- package/src/modules/auth/auth.service.ts +210 -0
- package/src/modules/auth/refresh-token.model.ts +26 -0
- package/src/modules/billing/billing-alert.model.ts +28 -0
- package/src/modules/billing/billing-period-snapshot.model.ts +68 -0
- package/src/modules/billing/billing.model.ts +42 -0
- package/src/modules/billing/billing.routes.ts +67 -0
- package/src/modules/billing/billing.service.ts +562 -0
- package/src/modules/billing/payment.model.ts +42 -0
- package/src/modules/calls/call.model.ts +102 -0
- package/src/modules/calls/call.routes.ts +118 -0
- package/src/modules/campaigns/campaign.model.ts +111 -0
- package/src/modules/campaigns/campaign.routes.ts +402 -0
- package/src/modules/campaigns/campaign.service.ts +99 -0
- package/src/modules/google-calendar/google-calendar.routes.ts +31 -0
- package/src/modules/inbound-call/inbound-call-config.model.ts +49 -0
- package/src/modules/inbound-call/inbound-call.routes.ts +289 -0
- package/src/modules/leads/lead.model.ts +40 -0
- package/src/modules/leads/lead.routes.ts +246 -0
- package/src/modules/logs/log.model.ts +27 -0
- package/src/modules/logs/log.routes.ts +102 -0
- package/src/modules/plans/plan.model.ts +45 -0
- package/src/modules/surveys/survey.model.ts +70 -0
- package/src/modules/surveys/survey.routes.ts +187 -0
- package/src/modules/tenants/tenant.model.ts +181 -0
- package/src/modules/tenants/tenant.routes.ts +78 -0
- package/src/modules/users/user.routes.ts +126 -0
- package/src/modules/webhooks/elevenlabs-tool.routes.ts +94 -0
- package/src/modules/webhooks/elevenlabs-tool.service.ts +491 -0
- package/src/modules/webhooks/elevenlabs.routes.ts +34 -0
- package/src/modules/webhooks/elevenlabs.service.ts +565 -0
- package/src/modules/webhooks/unipile.routes.ts +917 -0
- package/src/modules/whatsapp/appointment.model.ts +47 -0
- package/src/modules/whatsapp/operator-request.model.ts +58 -0
- package/src/modules/whatsapp/stt-usage.model.ts +30 -0
- package/src/modules/whatsapp/whatsapp-chat.model.ts +39 -0
- package/src/modules/whatsapp/whatsapp-contact-profile.model.ts +41 -0
- package/src/modules/whatsapp/whatsapp-message.model.ts +41 -0
- package/src/modules/whatsapp/whatsapp-session.model.ts +60 -0
- package/src/modules/whatsapp/whatsapp.routes.ts +1435 -0
- package/src/plugins/cors.ts +7 -0
- package/src/plugins/jwt.ts +18 -0
- package/src/plugins/rawBody.ts +12 -0
- package/src/plugins/rbac.ts +24 -0
- package/src/routes/admin.routes.ts +208 -0
- package/src/routes/health.routes.ts +12 -0
- package/src/routes/webhook.routes.ts +12 -0
- package/src/services/ai/base.ai.ts +132 -0
- package/src/services/ai/gemini.service.ts +41 -0
- package/src/services/ai/index.ts +24 -0
- package/src/services/ai/openai.service.ts +48 -0
- package/src/services/elevenlabs.service.ts +532 -0
- package/src/services/google-calendar.service.ts +656 -0
- package/src/services/inbound-call-schedule.service.ts +174 -0
- package/src/services/netgsm.service.ts +128 -0
- package/src/services/unipile.service.ts +200 -0
- package/src/services/whatsapp-agent.service.ts +2479 -0
- package/src/services/whatsapp.service.ts +245 -0
- package/src/templates/index.ts +71 -0
- package/src/templates/receptionist.ts +44 -0
- package/src/templates/survey.ts +44 -0
- package/src/types/index.ts +218 -0
- package/src/utils/logger.ts +83 -0
- package/tsconfig.json +19 -0
- package/web/.dockerignore +4 -0
- package/web/Dockerfile +18 -0
- package/web/README.md +73 -0
- package/web/components.json +23 -0
- package/web/eslint.config.js +23 -0
- package/web/index.html +14 -0
- package/web/nginx.conf +18 -0
- package/web/package-lock.json +10292 -0
- package/web/package.json +48 -0
- package/web/public/favicon.ico +0 -0
- package/web/public/vite.svg +1 -0
- package/web/src/App.tsx +191 -0
- package/web/src/assets/react.svg +1 -0
- package/web/src/components/Layout.tsx +261 -0
- package/web/src/components/LeadConversation.tsx +251 -0
- package/web/src/components/ProtectedRoute.tsx +20 -0
- package/web/src/components/conversation-review/CardAudioPlayer.tsx +200 -0
- package/web/src/components/conversation-review/CardEvaluation.tsx +351 -0
- package/web/src/components/conversation-review/CardMetadata.tsx +44 -0
- package/web/src/components/conversation-review/ConversationCard.tsx +95 -0
- package/web/src/components/conversation-review/ReviewContainer.tsx +120 -0
- package/web/src/components/conversation-review/ReviewFilters.tsx +88 -0
- package/web/src/components/empty-state.tsx +15 -0
- package/web/src/components/page-header.tsx +19 -0
- package/web/src/components/page-loader.tsx +32 -0
- package/web/src/components/pagination.tsx +38 -0
- package/web/src/components/stat-card.tsx +27 -0
- package/web/src/components/status-badge.tsx +125 -0
- package/web/src/components/ui/alert.tsx +66 -0
- package/web/src/components/ui/badge.tsx +48 -0
- package/web/src/components/ui/button.tsx +64 -0
- package/web/src/components/ui/card.tsx +92 -0
- package/web/src/components/ui/checkbox.tsx +32 -0
- package/web/src/components/ui/dialog.tsx +158 -0
- package/web/src/components/ui/dropdown-menu.tsx +255 -0
- package/web/src/components/ui/input.tsx +21 -0
- package/web/src/components/ui/label.tsx +22 -0
- package/web/src/components/ui/progress.tsx +29 -0
- package/web/src/components/ui/select.tsx +188 -0
- package/web/src/components/ui/separator.tsx +28 -0
- package/web/src/components/ui/sheet.tsx +123 -0
- package/web/src/components/ui/skeleton.tsx +13 -0
- package/web/src/components/ui/sonner.tsx +35 -0
- package/web/src/components/ui/table.tsx +116 -0
- package/web/src/components/ui/tabs.tsx +89 -0
- package/web/src/components/ui/textarea.tsx +18 -0
- package/web/src/components/ui/tooltip.tsx +57 -0
- package/web/src/components/whatsapp/ChatDetail.tsx +417 -0
- package/web/src/components/whatsapp/ChatHeader.tsx +78 -0
- package/web/src/components/whatsapp/ChatList.tsx +107 -0
- package/web/src/components/whatsapp/ChatListItem.tsx +60 -0
- package/web/src/components/whatsapp/MessageBubble.tsx +46 -0
- package/web/src/components/whatsapp/MessageInput.tsx +63 -0
- package/web/src/components/whatsapp/MessageStream.tsx +135 -0
- package/web/src/components/whatsapp/SessionDivider.tsx +65 -0
- package/web/src/components/whatsapp/SessionHistory.tsx +119 -0
- package/web/src/components/whatsapp/settings/AiSettingsTab.tsx +268 -0
- package/web/src/components/whatsapp/settings/CalendarTab.tsx +339 -0
- package/web/src/components/whatsapp/settings/ConnectionTab.tsx +236 -0
- package/web/src/components/whatsapp/settings/NotificationsTab.tsx +109 -0
- package/web/src/components/whatsapp/settings/OperatorTab.tsx +303 -0
- package/web/src/contexts/AuthContext.tsx +103 -0
- package/web/src/index.css +130 -0
- package/web/src/lib/api.ts +92 -0
- package/web/src/lib/utils.ts +6 -0
- package/web/src/main.tsx +10 -0
- package/web/src/pages/AppointmentDetail.tsx +206 -0
- package/web/src/pages/AppointmentValidation.tsx +157 -0
- package/web/src/pages/AppointmentValidationDetail.tsx +617 -0
- package/web/src/pages/AppointmentValidationNew.tsx +1005 -0
- package/web/src/pages/Appointments.tsx +283 -0
- package/web/src/pages/Billing.tsx +126 -0
- package/web/src/pages/CallDetail.tsx +293 -0
- package/web/src/pages/CallSettings.tsx +313 -0
- package/web/src/pages/Calls.tsx +188 -0
- package/web/src/pages/CampaignDetail.tsx +216 -0
- package/web/src/pages/CampaignNew.tsx +277 -0
- package/web/src/pages/CampaignResults.tsx +185 -0
- package/web/src/pages/Campaigns.tsx +171 -0
- package/web/src/pages/Dashboard.tsx +336 -0
- package/web/src/pages/InboundSchedule.tsx +246 -0
- package/web/src/pages/LeadDetail.tsx +183 -0
- package/web/src/pages/Leads.tsx +258 -0
- package/web/src/pages/Login.tsx +99 -0
- package/web/src/pages/Register.tsx +129 -0
- package/web/src/pages/Settings.tsx +133 -0
- package/web/src/pages/SurveyDetail.tsx +232 -0
- package/web/src/pages/SurveyPreview.tsx +179 -0
- package/web/src/pages/Surveys.tsx +207 -0
- package/web/src/pages/Users.tsx +199 -0
- package/web/src/pages/WhatsApp.tsx +147 -0
- package/web/src/pages/WhatsAppSettings.tsx +215 -0
- package/web/src/pages/admin/AdminBaileysMessageLog.tsx +331 -0
- package/web/src/pages/admin/AdminBaileysRawMessages.tsx +318 -0
- package/web/src/pages/admin/AdminConversationReview.tsx +116 -0
- package/web/src/pages/admin/AdminCredits.tsx +467 -0
- package/web/src/pages/admin/AdminElevenLabsAgentDetail.tsx +332 -0
- package/web/src/pages/admin/AdminElevenLabsAgents.tsx +164 -0
- package/web/src/pages/admin/AdminElevenLabsBatchCallDetail.tsx +214 -0
- package/web/src/pages/admin/AdminElevenLabsBatchCalls.tsx +293 -0
- package/web/src/pages/admin/AdminElevenLabsConversationDetail.tsx +230 -0
- package/web/src/pages/admin/AdminElevenLabsConversations.tsx +228 -0
- package/web/src/pages/admin/AdminElevenLabsInboundCalls.tsx +293 -0
- package/web/src/pages/admin/AdminElevenLabsPhoneNumbers.tsx +506 -0
- package/web/src/pages/admin/AdminElevenLabsTestChat.tsx +258 -0
- package/web/src/pages/admin/AdminElevenLabsWebhooks.tsx +289 -0
- package/web/src/pages/admin/AdminEvaluationDashboard.tsx +520 -0
- package/web/src/pages/admin/AdminLeads.tsx +339 -0
- package/web/src/pages/admin/AdminLogs.tsx +283 -0
- package/web/src/pages/admin/AdminMigrations.tsx +247 -0
- package/web/src/pages/admin/AdminPlans.tsx +313 -0
- package/web/src/pages/admin/AdminSystem.tsx +391 -0
- package/web/src/pages/admin/AdminTenantBillableItems.tsx +464 -0
- package/web/src/pages/admin/AdminTenantDetail.tsx +1317 -0
- package/web/src/pages/admin/AdminTenants.tsx +274 -0
- package/web/src/pages/admin/AdminWhatsApp.tsx +618 -0
- package/web/src/pages/admin/AdminWhatsAppTestChat.tsx +328 -0
- package/web/src/types/index.ts +242 -0
- package/web/tsconfig.app.json +32 -0
- package/web/tsconfig.json +13 -0
- package/web/tsconfig.node.json +26 -0
- package/web/vite.config.ts +23 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useSearchParams, useNavigate } from 'react-router-dom';
|
|
3
|
+
import api from '../../lib/api';
|
|
4
|
+
import type { Lead } from '../../types';
|
|
5
|
+
import { PageHeader } from '@/components/page-header';
|
|
6
|
+
import { StatCard } from '@/components/stat-card';
|
|
7
|
+
import { Pagination } from '@/components/pagination';
|
|
8
|
+
import { ChannelBadge, LeadStatusBadge, CategoryBadge, LEAD_STATUS_OPTIONS } from '@/components/status-badge';
|
|
9
|
+
import { EmptyState } from '@/components/empty-state';
|
|
10
|
+
import { TableLoader } from '@/components/page-loader';
|
|
11
|
+
import { Card, CardContent } from '@/components/ui/card';
|
|
12
|
+
import { Badge } from '@/components/ui/badge';
|
|
13
|
+
import { Button } from '@/components/ui/button';
|
|
14
|
+
import {
|
|
15
|
+
Table,
|
|
16
|
+
TableBody,
|
|
17
|
+
TableCell,
|
|
18
|
+
TableHead,
|
|
19
|
+
TableHeader,
|
|
20
|
+
TableRow,
|
|
21
|
+
} from '@/components/ui/table';
|
|
22
|
+
import {
|
|
23
|
+
Select,
|
|
24
|
+
SelectContent,
|
|
25
|
+
SelectItem,
|
|
26
|
+
SelectTrigger,
|
|
27
|
+
SelectValue,
|
|
28
|
+
} from '@/components/ui/select';
|
|
29
|
+
import {
|
|
30
|
+
ContactIcon,
|
|
31
|
+
CalendarIcon,
|
|
32
|
+
PhoneIcon,
|
|
33
|
+
MessageSquareIcon,
|
|
34
|
+
CheckCircleIcon,
|
|
35
|
+
XIcon,
|
|
36
|
+
DownloadIcon,
|
|
37
|
+
} from 'lucide-react';
|
|
38
|
+
import { toast } from 'sonner';
|
|
39
|
+
|
|
40
|
+
interface AdminLead extends Lead {
|
|
41
|
+
tenant_name: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface LeadStats {
|
|
45
|
+
total: number;
|
|
46
|
+
new: number;
|
|
47
|
+
contacted: number;
|
|
48
|
+
appointment_scheduled: number;
|
|
49
|
+
completed: number;
|
|
50
|
+
lost: number;
|
|
51
|
+
phone: number;
|
|
52
|
+
whatsapp: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default function AdminLeads() {
|
|
56
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
57
|
+
const navigate = useNavigate();
|
|
58
|
+
const [leads, setLeads] = useState<AdminLead[]>([]);
|
|
59
|
+
const [total, setTotal] = useState(0);
|
|
60
|
+
const [totalPages, setTotalPages] = useState(0);
|
|
61
|
+
const [loading, setLoading] = useState(true);
|
|
62
|
+
const [stats, setStats] = useState<LeadStats | null>(null);
|
|
63
|
+
const [tenants, setTenants] = useState<{ _id: string; name: string }[]>([]);
|
|
64
|
+
|
|
65
|
+
const page = parseInt(searchParams.get('page') || '1');
|
|
66
|
+
const leadStatus = searchParams.get('lead_status') || '';
|
|
67
|
+
const channel = searchParams.get('channel') || '';
|
|
68
|
+
const category = searchParams.get('category') || '';
|
|
69
|
+
const tenantId = searchParams.get('tenant_id') || '';
|
|
70
|
+
const dateFrom = searchParams.get('date_from') || '';
|
|
71
|
+
const dateTo = searchParams.get('date_to') || '';
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
api.get('/admin/leads/stats').then(({ data }) => setStats(data.stats)).catch(() => {});
|
|
75
|
+
api.get('/admin/tenants?limit=100').then(({ data }) => setTenants(data.tenants)).catch(() => {});
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
setLoading(true);
|
|
80
|
+
const params = new URLSearchParams();
|
|
81
|
+
params.set('page', String(page));
|
|
82
|
+
params.set('limit', '30');
|
|
83
|
+
if (leadStatus) params.set('lead_status', leadStatus);
|
|
84
|
+
if (channel) params.set('channel', channel);
|
|
85
|
+
if (category) params.set('category', category);
|
|
86
|
+
if (tenantId) params.set('tenant_id', tenantId);
|
|
87
|
+
if (dateFrom) params.set('date_from', dateFrom);
|
|
88
|
+
if (dateTo) params.set('date_to', dateTo);
|
|
89
|
+
|
|
90
|
+
api.get(`/admin/leads?${params}`)
|
|
91
|
+
.then(({ data }) => {
|
|
92
|
+
setLeads(data.leads);
|
|
93
|
+
setTotal(data.total);
|
|
94
|
+
setTotalPages(data.totalPages);
|
|
95
|
+
})
|
|
96
|
+
.finally(() => setLoading(false));
|
|
97
|
+
}, [page, leadStatus, channel, category, tenantId, dateFrom, dateTo]);
|
|
98
|
+
|
|
99
|
+
function setFilter(key: string, value: string) {
|
|
100
|
+
const params = new URLSearchParams(searchParams);
|
|
101
|
+
if (value && value !== 'all') {
|
|
102
|
+
params.set(key, value);
|
|
103
|
+
} else {
|
|
104
|
+
params.delete(key);
|
|
105
|
+
}
|
|
106
|
+
if (key !== 'page') params.set('page', '1');
|
|
107
|
+
setSearchParams(params);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function exportCsv() {
|
|
111
|
+
try {
|
|
112
|
+
const params = new URLSearchParams();
|
|
113
|
+
if (leadStatus) params.set('lead_status', leadStatus);
|
|
114
|
+
if (channel) params.set('channel', channel);
|
|
115
|
+
if (category) params.set('category', category);
|
|
116
|
+
if (tenantId) params.set('tenant_id', tenantId);
|
|
117
|
+
if (dateFrom) params.set('date_from', dateFrom);
|
|
118
|
+
if (dateTo) params.set('date_to', dateTo);
|
|
119
|
+
|
|
120
|
+
// Fetch all leads (up to 5000) for CSV
|
|
121
|
+
params.set('limit', '5000');
|
|
122
|
+
const { data } = await api.get(`/admin/leads?${params}`);
|
|
123
|
+
const allLeads: AdminLead[] = data.leads;
|
|
124
|
+
|
|
125
|
+
const STATUS_LABELS: Record<string, string> = {
|
|
126
|
+
new: 'Yeni', contacted: 'Iletisime Gecildi', appointment_scheduled: 'Randevu Alindi',
|
|
127
|
+
completed: 'Tamamlandi', lost: 'Kayip', expired: 'Suresi Doldu'
|
|
128
|
+
};
|
|
129
|
+
const CATEGORY_LABELS: Record<string, string> = {
|
|
130
|
+
callback_required: 'Geri Arama', appointment_inquiry: 'Randevu', other: 'Diger'
|
|
131
|
+
};
|
|
132
|
+
const CHANNEL_LABELS: Record<string, string> = { phone: 'Telefon', whatsapp: 'WhatsApp' };
|
|
133
|
+
|
|
134
|
+
function csvEscape(val: string | null | undefined): string {
|
|
135
|
+
if (!val) return '';
|
|
136
|
+
if (val.includes('"') || val.includes(',') || val.includes('\n')) {
|
|
137
|
+
return `"${val.replace(/"/g, '""')}"`;
|
|
138
|
+
}
|
|
139
|
+
return val;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const header = 'Tenant,Ad,Telefon,Hizmet,Kanal,Durum,Kategori,Ozet,Tarih';
|
|
143
|
+
const rows = allLeads.map(l => [
|
|
144
|
+
csvEscape(l.tenant_name),
|
|
145
|
+
csvEscape(l.name),
|
|
146
|
+
csvEscape(l.phone),
|
|
147
|
+
csvEscape(l.service_of_interest),
|
|
148
|
+
CHANNEL_LABELS[l.channel] || l.channel,
|
|
149
|
+
STATUS_LABELS[l.lead_status] || l.lead_status,
|
|
150
|
+
(l.categories || []).map(c => CATEGORY_LABELS[c] || c).join('; '),
|
|
151
|
+
csvEscape(l.summary),
|
|
152
|
+
new Date(l.createdAt).toLocaleString('tr-TR')
|
|
153
|
+
].join(','));
|
|
154
|
+
|
|
155
|
+
const csv = '\uFEFF' + header + '\n' + rows.join('\n');
|
|
156
|
+
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
|
|
157
|
+
const url = URL.createObjectURL(blob);
|
|
158
|
+
const a = document.createElement('a');
|
|
159
|
+
a.href = url;
|
|
160
|
+
a.download = `tum-leadler-${new Date().toISOString().slice(0, 10)}.csv`;
|
|
161
|
+
a.click();
|
|
162
|
+
URL.revokeObjectURL(url);
|
|
163
|
+
} catch {
|
|
164
|
+
toast.error('CSV indirilemedi');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<div>
|
|
170
|
+
<PageHeader title="Tum Leadler (Admin)">
|
|
171
|
+
<div className="flex items-center gap-2">
|
|
172
|
+
<Badge variant="outline" className="text-xs">{total} lead</Badge>
|
|
173
|
+
<Button variant="outline" size="sm" onClick={exportCsv}>
|
|
174
|
+
<DownloadIcon className="size-4 mr-1.5" />
|
|
175
|
+
CSV
|
|
176
|
+
</Button>
|
|
177
|
+
</div>
|
|
178
|
+
</PageHeader>
|
|
179
|
+
|
|
180
|
+
{/* Stats */}
|
|
181
|
+
{stats && (
|
|
182
|
+
<div className="grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6">
|
|
183
|
+
<StatCard label="Toplam" value={stats.total} icon={<ContactIcon className="size-5" />} />
|
|
184
|
+
<StatCard label="Yeni" value={stats.new} icon={<ContactIcon className="size-5 text-sky-500" />} />
|
|
185
|
+
<StatCard label="Randevu" value={stats.appointment_scheduled} icon={<CheckCircleIcon className="size-5 text-emerald-500" />} />
|
|
186
|
+
<StatCard label="Kayip" value={stats.lost} icon={<XIcon className="size-5 text-destructive" />} />
|
|
187
|
+
<StatCard label="Telefon" value={stats.phone} icon={<PhoneIcon className="size-5 text-violet-500" />} />
|
|
188
|
+
<StatCard label="WhatsApp" value={stats.whatsapp} icon={<MessageSquareIcon className="size-5 text-emerald-500" />} />
|
|
189
|
+
</div>
|
|
190
|
+
)}
|
|
191
|
+
|
|
192
|
+
{/* Filters */}
|
|
193
|
+
<div className="flex flex-wrap gap-3 mb-4">
|
|
194
|
+
<Select value={tenantId || 'all'} onValueChange={v => setFilter('tenant_id', v)}>
|
|
195
|
+
<SelectTrigger className="w-48">
|
|
196
|
+
<SelectValue placeholder="Tum Tenantlar" />
|
|
197
|
+
</SelectTrigger>
|
|
198
|
+
<SelectContent>
|
|
199
|
+
<SelectItem value="all">Tum Tenantlar</SelectItem>
|
|
200
|
+
{tenants.map(t => (
|
|
201
|
+
<SelectItem key={t._id} value={t._id}>{t.name}</SelectItem>
|
|
202
|
+
))}
|
|
203
|
+
</SelectContent>
|
|
204
|
+
</Select>
|
|
205
|
+
|
|
206
|
+
<Select value={leadStatus || 'all'} onValueChange={v => setFilter('lead_status', v)}>
|
|
207
|
+
<SelectTrigger className="w-44">
|
|
208
|
+
<SelectValue placeholder="Tum Durumlar" />
|
|
209
|
+
</SelectTrigger>
|
|
210
|
+
<SelectContent>
|
|
211
|
+
<SelectItem value="all">Tum Durumlar</SelectItem>
|
|
212
|
+
{LEAD_STATUS_OPTIONS.map(o => (
|
|
213
|
+
<SelectItem key={o.value} value={o.value}>{o.label}</SelectItem>
|
|
214
|
+
))}
|
|
215
|
+
</SelectContent>
|
|
216
|
+
</Select>
|
|
217
|
+
|
|
218
|
+
<Select value={channel || 'all'} onValueChange={v => setFilter('channel', v)}>
|
|
219
|
+
<SelectTrigger className="w-36">
|
|
220
|
+
<SelectValue placeholder="Kanal" />
|
|
221
|
+
</SelectTrigger>
|
|
222
|
+
<SelectContent>
|
|
223
|
+
<SelectItem value="all">Tum Kanallar</SelectItem>
|
|
224
|
+
<SelectItem value="phone">Telefon</SelectItem>
|
|
225
|
+
<SelectItem value="whatsapp">WhatsApp</SelectItem>
|
|
226
|
+
</SelectContent>
|
|
227
|
+
</Select>
|
|
228
|
+
|
|
229
|
+
<Select value={category || 'all'} onValueChange={v => setFilter('category', v)}>
|
|
230
|
+
<SelectTrigger className="w-40">
|
|
231
|
+
<SelectValue placeholder="Kategori" />
|
|
232
|
+
</SelectTrigger>
|
|
233
|
+
<SelectContent>
|
|
234
|
+
<SelectItem value="all">Tum Kategoriler</SelectItem>
|
|
235
|
+
<SelectItem value="callback_required">Geri Arama</SelectItem>
|
|
236
|
+
<SelectItem value="appointment_inquiry">Randevu</SelectItem>
|
|
237
|
+
<SelectItem value="other">Diger</SelectItem>
|
|
238
|
+
</SelectContent>
|
|
239
|
+
</Select>
|
|
240
|
+
|
|
241
|
+
<div className="flex items-center gap-2">
|
|
242
|
+
<CalendarIcon className="size-4 text-muted-foreground" />
|
|
243
|
+
<input
|
|
244
|
+
type="date"
|
|
245
|
+
value={dateFrom}
|
|
246
|
+
onChange={e => setFilter('date_from', e.target.value)}
|
|
247
|
+
className="h-9 rounded-md border border-input bg-background px-3 text-sm"
|
|
248
|
+
/>
|
|
249
|
+
<span className="text-muted-foreground text-sm">-</span>
|
|
250
|
+
<input
|
|
251
|
+
type="date"
|
|
252
|
+
value={dateTo}
|
|
253
|
+
onChange={e => setFilter('date_to', e.target.value)}
|
|
254
|
+
className="h-9 rounded-md border border-input bg-background px-3 text-sm"
|
|
255
|
+
/>
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
</div>
|
|
260
|
+
|
|
261
|
+
{/* Table */}
|
|
262
|
+
<Card>
|
|
263
|
+
<CardContent className="px-0 py-0">
|
|
264
|
+
{loading ? (
|
|
265
|
+
<TableLoader rows={10} cols={9} />
|
|
266
|
+
) : (
|
|
267
|
+
<Table>
|
|
268
|
+
<TableHeader>
|
|
269
|
+
<TableRow>
|
|
270
|
+
<TableHead className="pl-6">Tenant</TableHead>
|
|
271
|
+
<TableHead>Ad</TableHead>
|
|
272
|
+
<TableHead>Telefon</TableHead>
|
|
273
|
+
<TableHead>Hizmet</TableHead>
|
|
274
|
+
<TableHead>Kanal</TableHead>
|
|
275
|
+
<TableHead>Durum</TableHead>
|
|
276
|
+
<TableHead>Kategori</TableHead>
|
|
277
|
+
<TableHead>Ozet</TableHead>
|
|
278
|
+
<TableHead className="pr-6">Tarih</TableHead>
|
|
279
|
+
</TableRow>
|
|
280
|
+
</TableHeader>
|
|
281
|
+
<TableBody>
|
|
282
|
+
{leads.map(lead => (
|
|
283
|
+
<TableRow
|
|
284
|
+
key={lead._id}
|
|
285
|
+
className="cursor-pointer hover:bg-muted/50"
|
|
286
|
+
onClick={() => navigate(`/leads/${lead._id}`)}
|
|
287
|
+
>
|
|
288
|
+
<TableCell className="pl-6">
|
|
289
|
+
<Badge
|
|
290
|
+
variant="outline"
|
|
291
|
+
className="text-[10px] cursor-pointer hover:bg-accent"
|
|
292
|
+
onClick={e => {
|
|
293
|
+
e.stopPropagation();
|
|
294
|
+
setFilter('tenant_id', String(lead.tenant_id));
|
|
295
|
+
}}
|
|
296
|
+
>
|
|
297
|
+
{lead.tenant_name}
|
|
298
|
+
</Badge>
|
|
299
|
+
</TableCell>
|
|
300
|
+
<TableCell className="font-medium">{lead.name || '-'}</TableCell>
|
|
301
|
+
<TableCell className="text-muted-foreground">{lead.phone}</TableCell>
|
|
302
|
+
<TableCell className="text-muted-foreground max-w-[150px] truncate">
|
|
303
|
+
{lead.service_of_interest || '-'}
|
|
304
|
+
</TableCell>
|
|
305
|
+
<TableCell><ChannelBadge channel={lead.channel} /></TableCell>
|
|
306
|
+
<TableCell><LeadStatusBadge status={lead.lead_status} /></TableCell>
|
|
307
|
+
<TableCell>
|
|
308
|
+
<div className="flex gap-1 flex-wrap">
|
|
309
|
+
{lead.categories?.map(cat => (
|
|
310
|
+
<CategoryBadge key={cat} category={cat} />
|
|
311
|
+
))}
|
|
312
|
+
{(!lead.categories || lead.categories.length === 0) && <span className="text-muted-foreground">-</span>}
|
|
313
|
+
</div>
|
|
314
|
+
</TableCell>
|
|
315
|
+
<TableCell className="text-muted-foreground max-w-xs truncate">
|
|
316
|
+
{lead.summary || '-'}
|
|
317
|
+
</TableCell>
|
|
318
|
+
<TableCell className="text-muted-foreground whitespace-nowrap pr-6">
|
|
319
|
+
{new Date(lead.createdAt).toLocaleString('tr-TR')}
|
|
320
|
+
</TableCell>
|
|
321
|
+
</TableRow>
|
|
322
|
+
))}
|
|
323
|
+
{leads.length === 0 && (
|
|
324
|
+
<TableRow>
|
|
325
|
+
<TableCell colSpan={9}>
|
|
326
|
+
<EmptyState message="Lead bulunamadi" />
|
|
327
|
+
</TableCell>
|
|
328
|
+
</TableRow>
|
|
329
|
+
)}
|
|
330
|
+
</TableBody>
|
|
331
|
+
</Table>
|
|
332
|
+
)}
|
|
333
|
+
</CardContent>
|
|
334
|
+
</Card>
|
|
335
|
+
|
|
336
|
+
<Pagination page={page} totalPages={totalPages} onPageChange={p => setFilter('page', String(p))} />
|
|
337
|
+
</div>
|
|
338
|
+
);
|
|
339
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { useEffect, useState, useCallback } from 'react';
|
|
2
|
+
import api from '@/lib/api';
|
|
3
|
+
import { PageHeader } from '@/components/page-header';
|
|
4
|
+
import { Card, CardContent } from '@/components/ui/card';
|
|
5
|
+
import { Button } from '@/components/ui/button';
|
|
6
|
+
import { Input } from '@/components/ui/input';
|
|
7
|
+
import { Badge } from '@/components/ui/badge';
|
|
8
|
+
import {
|
|
9
|
+
Select,
|
|
10
|
+
SelectContent,
|
|
11
|
+
SelectItem,
|
|
12
|
+
SelectTrigger,
|
|
13
|
+
SelectValue,
|
|
14
|
+
} from '@/components/ui/select';
|
|
15
|
+
import { toast } from 'sonner';
|
|
16
|
+
import {
|
|
17
|
+
Loader2Icon,
|
|
18
|
+
RefreshCwIcon,
|
|
19
|
+
SearchIcon,
|
|
20
|
+
ChevronLeftIcon,
|
|
21
|
+
ChevronRightIcon,
|
|
22
|
+
AlertTriangleIcon,
|
|
23
|
+
XCircleIcon,
|
|
24
|
+
InfoIcon,
|
|
25
|
+
} from 'lucide-react';
|
|
26
|
+
|
|
27
|
+
interface LogEntry {
|
|
28
|
+
_id: string;
|
|
29
|
+
level: string;
|
|
30
|
+
message: string;
|
|
31
|
+
meta: Record<string, unknown>;
|
|
32
|
+
service: string;
|
|
33
|
+
timestamp: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface Pagination {
|
|
37
|
+
page: number;
|
|
38
|
+
limit: number;
|
|
39
|
+
total: number;
|
|
40
|
+
pages: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface Stats {
|
|
44
|
+
info: number;
|
|
45
|
+
warn: number;
|
|
46
|
+
error: number;
|
|
47
|
+
total: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const LEVEL_CONFIG: Record<string, { color: string; icon: typeof InfoIcon; badge: string }> = {
|
|
51
|
+
info: { color: 'text-blue-600', icon: InfoIcon, badge: 'default' },
|
|
52
|
+
warn: { color: 'text-yellow-600', icon: AlertTriangleIcon, badge: 'warning' },
|
|
53
|
+
error: { color: 'text-red-600', icon: XCircleIcon, badge: 'destructive' },
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function formatTime(iso: string): string {
|
|
57
|
+
const d = new Date(iso);
|
|
58
|
+
return d.toLocaleTimeString('tr-TR', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function formatDate(iso: string): string {
|
|
62
|
+
const d = new Date(iso);
|
|
63
|
+
return d.toLocaleDateString('tr-TR', { day: '2-digit', month: '2-digit' });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function MetaValue({ value }: { value: unknown }) {
|
|
67
|
+
if (value === null || value === undefined) return null;
|
|
68
|
+
if (typeof value === 'object') {
|
|
69
|
+
return <span className="text-muted-foreground">{JSON.stringify(value)}</span>;
|
|
70
|
+
}
|
|
71
|
+
return <span>{String(value)}</span>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default function AdminLogs() {
|
|
75
|
+
const [logs, setLogs] = useState<LogEntry[]>([]);
|
|
76
|
+
const [pagination, setPagination] = useState<Pagination>({ page: 1, limit: 100, total: 0, pages: 0 });
|
|
77
|
+
const [stats, setStats] = useState<Stats>({ info: 0, warn: 0, error: 0, total: 0 });
|
|
78
|
+
const [loading, setLoading] = useState(true);
|
|
79
|
+
const [level, setLevel] = useState('all');
|
|
80
|
+
const [search, setSearch] = useState('');
|
|
81
|
+
const [searchInput, setSearchInput] = useState('');
|
|
82
|
+
const [expandedId, setExpandedId] = useState<string | null>(null);
|
|
83
|
+
const [autoRefresh, setAutoRefresh] = useState(false);
|
|
84
|
+
|
|
85
|
+
const loadLogs = useCallback(async (page = 1) => {
|
|
86
|
+
try {
|
|
87
|
+
const params = new URLSearchParams({ page: String(page), limit: '100' });
|
|
88
|
+
if (level !== 'all') params.set('level', level);
|
|
89
|
+
if (search) params.set('search', search);
|
|
90
|
+
|
|
91
|
+
const [logsRes, statsRes] = await Promise.all([
|
|
92
|
+
api.get(`/admin/logs?${params}`),
|
|
93
|
+
api.get('/admin/logs/stats'),
|
|
94
|
+
]);
|
|
95
|
+
|
|
96
|
+
setLogs(logsRes.data.logs);
|
|
97
|
+
setPagination(logsRes.data.pagination);
|
|
98
|
+
setStats(statsRes.data);
|
|
99
|
+
} catch {
|
|
100
|
+
toast.error('Loglar yuklenemedi');
|
|
101
|
+
} finally {
|
|
102
|
+
setLoading(false);
|
|
103
|
+
}
|
|
104
|
+
}, [level, search]);
|
|
105
|
+
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
setLoading(true);
|
|
108
|
+
loadLogs(1);
|
|
109
|
+
}, [loadLogs]);
|
|
110
|
+
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (!autoRefresh) return;
|
|
113
|
+
const interval = setInterval(() => loadLogs(pagination.page), 5000);
|
|
114
|
+
return () => clearInterval(interval);
|
|
115
|
+
}, [autoRefresh, pagination.page, loadLogs]);
|
|
116
|
+
|
|
117
|
+
function handleSearch(e: React.FormEvent) {
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
setSearch(searchInput);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<div className="space-y-4">
|
|
124
|
+
<PageHeader title="Sistem Loglari" description="Son 30 gun (otomatik temizlenir)" />
|
|
125
|
+
|
|
126
|
+
{/* Stats */}
|
|
127
|
+
<div className="grid grid-cols-4 gap-3">
|
|
128
|
+
<Card className="cursor-pointer" onClick={() => setLevel('all')}>
|
|
129
|
+
<CardContent className="p-3 text-center">
|
|
130
|
+
<div className="text-2xl font-bold">{stats.total}</div>
|
|
131
|
+
<div className="text-[11px] text-muted-foreground">Son 24 Saat</div>
|
|
132
|
+
</CardContent>
|
|
133
|
+
</Card>
|
|
134
|
+
<Card className="cursor-pointer" onClick={() => setLevel('info')}>
|
|
135
|
+
<CardContent className="p-3 text-center">
|
|
136
|
+
<div className="text-2xl font-bold text-blue-600">{stats.info}</div>
|
|
137
|
+
<div className="text-[11px] text-muted-foreground">Info</div>
|
|
138
|
+
</CardContent>
|
|
139
|
+
</Card>
|
|
140
|
+
<Card className="cursor-pointer" onClick={() => setLevel('warn')}>
|
|
141
|
+
<CardContent className="p-3 text-center">
|
|
142
|
+
<div className="text-2xl font-bold text-yellow-600">{stats.warn}</div>
|
|
143
|
+
<div className="text-[11px] text-muted-foreground">Warning</div>
|
|
144
|
+
</CardContent>
|
|
145
|
+
</Card>
|
|
146
|
+
<Card className="cursor-pointer" onClick={() => setLevel('error')}>
|
|
147
|
+
<CardContent className="p-3 text-center">
|
|
148
|
+
<div className="text-2xl font-bold text-red-600">{stats.error}</div>
|
|
149
|
+
<div className="text-[11px] text-muted-foreground">Error</div>
|
|
150
|
+
</CardContent>
|
|
151
|
+
</Card>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
{/* Filters */}
|
|
155
|
+
<div className="flex items-center gap-2 flex-wrap">
|
|
156
|
+
<form onSubmit={handleSearch} className="flex items-center gap-2 flex-1 min-w-[200px]">
|
|
157
|
+
<div className="relative flex-1">
|
|
158
|
+
<SearchIcon className="absolute left-2.5 top-2.5 size-4 text-muted-foreground" />
|
|
159
|
+
<Input
|
|
160
|
+
className="pl-8"
|
|
161
|
+
placeholder="Mesaj, conversation_id, telefon..."
|
|
162
|
+
value={searchInput}
|
|
163
|
+
onChange={e => setSearchInput(e.target.value)}
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
<Button type="submit" size="sm" variant="outline">Ara</Button>
|
|
167
|
+
</form>
|
|
168
|
+
<Select value={level} onValueChange={setLevel}>
|
|
169
|
+
<SelectTrigger className="w-[120px]">
|
|
170
|
+
<SelectValue />
|
|
171
|
+
</SelectTrigger>
|
|
172
|
+
<SelectContent>
|
|
173
|
+
<SelectItem value="all">Tumu</SelectItem>
|
|
174
|
+
<SelectItem value="info">Info</SelectItem>
|
|
175
|
+
<SelectItem value="warn">Warning</SelectItem>
|
|
176
|
+
<SelectItem value="error">Error</SelectItem>
|
|
177
|
+
</SelectContent>
|
|
178
|
+
</Select>
|
|
179
|
+
<Button
|
|
180
|
+
size="sm"
|
|
181
|
+
variant={autoRefresh ? 'default' : 'outline'}
|
|
182
|
+
onClick={() => setAutoRefresh(!autoRefresh)}
|
|
183
|
+
>
|
|
184
|
+
{autoRefresh ? 'Canli' : 'Canli Izle'}
|
|
185
|
+
</Button>
|
|
186
|
+
<Button size="sm" variant="outline" onClick={() => loadLogs(pagination.page)} disabled={loading}>
|
|
187
|
+
<RefreshCwIcon className="size-4" />
|
|
188
|
+
</Button>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
{/* Log entries */}
|
|
192
|
+
<Card>
|
|
193
|
+
<CardContent className="p-0">
|
|
194
|
+
{loading ? (
|
|
195
|
+
<div className="flex items-center justify-center py-12">
|
|
196
|
+
<Loader2Icon className="size-6 animate-spin text-muted-foreground" />
|
|
197
|
+
</div>
|
|
198
|
+
) : logs.length === 0 ? (
|
|
199
|
+
<div className="text-center py-12 text-muted-foreground text-sm">Log bulunamadi</div>
|
|
200
|
+
) : (
|
|
201
|
+
<div className="divide-y text-xs font-mono">
|
|
202
|
+
{logs.map(log => {
|
|
203
|
+
const cfg = LEVEL_CONFIG[log.level] || LEVEL_CONFIG.info;
|
|
204
|
+
const Icon = cfg.icon;
|
|
205
|
+
const isExpanded = expandedId === log._id;
|
|
206
|
+
|
|
207
|
+
// Extract key meta fields for inline display
|
|
208
|
+
const { stack, ...displayMeta } = log.meta || {};
|
|
209
|
+
const inlineKeys = Object.keys(displayMeta).filter(
|
|
210
|
+
k => k !== 'service' && k !== 'timestamp' && typeof displayMeta[k] !== 'object',
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<div
|
|
215
|
+
key={log._id}
|
|
216
|
+
className="px-3 py-1.5 hover:bg-muted/50 cursor-pointer"
|
|
217
|
+
onClick={() => setExpandedId(isExpanded ? null : log._id)}
|
|
218
|
+
>
|
|
219
|
+
<div className="flex items-start gap-2">
|
|
220
|
+
<Icon className={`size-3.5 mt-0.5 shrink-0 ${cfg.color}`} />
|
|
221
|
+
<span className="text-muted-foreground shrink-0 w-[70px]">
|
|
222
|
+
{formatDate(log.timestamp)} {formatTime(log.timestamp)}
|
|
223
|
+
</span>
|
|
224
|
+
<span className="font-medium truncate flex-1">{log.message}</span>
|
|
225
|
+
{inlineKeys.length > 0 && !isExpanded && (
|
|
226
|
+
<span className="text-muted-foreground truncate max-w-[300px]">
|
|
227
|
+
{inlineKeys.slice(0, 3).map(k => `${k}=${String(displayMeta[k])}`).join(' ')}
|
|
228
|
+
{inlineKeys.length > 3 && ' ...'}
|
|
229
|
+
</span>
|
|
230
|
+
)}
|
|
231
|
+
</div>
|
|
232
|
+
{isExpanded && (
|
|
233
|
+
<div className="mt-2 ml-5 space-y-1 pb-1">
|
|
234
|
+
{Object.entries(displayMeta).map(([key, value]) => (
|
|
235
|
+
<div key={key} className="flex gap-2">
|
|
236
|
+
<span className="text-muted-foreground shrink-0 w-[140px]">{key}:</span>
|
|
237
|
+
<MetaValue value={value} />
|
|
238
|
+
</div>
|
|
239
|
+
))}
|
|
240
|
+
{stack && (
|
|
241
|
+
<pre className="mt-2 text-red-500 whitespace-pre-wrap text-[10px] bg-red-50 dark:bg-red-950/20 rounded p-2">
|
|
242
|
+
{String(stack)}
|
|
243
|
+
</pre>
|
|
244
|
+
)}
|
|
245
|
+
</div>
|
|
246
|
+
)}
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
})}
|
|
250
|
+
</div>
|
|
251
|
+
)}
|
|
252
|
+
|
|
253
|
+
{/* Pagination */}
|
|
254
|
+
{pagination.pages > 1 && (
|
|
255
|
+
<div className="flex items-center justify-between px-3 py-2 border-t text-xs text-muted-foreground">
|
|
256
|
+
<span>
|
|
257
|
+
{pagination.total} log, sayfa {pagination.page}/{pagination.pages}
|
|
258
|
+
</span>
|
|
259
|
+
<div className="flex gap-1">
|
|
260
|
+
<Button
|
|
261
|
+
size="sm"
|
|
262
|
+
variant="ghost"
|
|
263
|
+
disabled={pagination.page <= 1}
|
|
264
|
+
onClick={() => loadLogs(pagination.page - 1)}
|
|
265
|
+
>
|
|
266
|
+
<ChevronLeftIcon className="size-4" />
|
|
267
|
+
</Button>
|
|
268
|
+
<Button
|
|
269
|
+
size="sm"
|
|
270
|
+
variant="ghost"
|
|
271
|
+
disabled={pagination.page >= pagination.pages}
|
|
272
|
+
onClick={() => loadLogs(pagination.page + 1)}
|
|
273
|
+
>
|
|
274
|
+
<ChevronRightIcon className="size-4" />
|
|
275
|
+
</Button>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
)}
|
|
279
|
+
</CardContent>
|
|
280
|
+
</Card>
|
|
281
|
+
</div>
|
|
282
|
+
);
|
|
283
|
+
}
|