Phase 3 scaffold: chat engine (WebSocket, FCM, pricing, timer, extension, history)

- Backend: WebSocket plugin, chat/pricing/timer/extension/closure/notification services
- Client app: ChatBloc, pricing dialog, chat screen with message status, extension/goodbye flow, history
- Mitra app: MitraChatBloc, ExtensionBloc, chat screen, extension accept/reject, history
- Control center: free trial, extension timeout, early end config toggles
- DB migration: chat_messages, session_closures, session_extensions, customer_transactions tables

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 23:58:11 +08:00
parent 844d7234e6
commit b4efcf14c2
47 changed files with 4361 additions and 44 deletions

View File

@@ -6,6 +6,9 @@ import 'features/auth/screens/login_screen.dart';
import 'features/auth/screens/otp_screen.dart';
import 'features/home/home_screen.dart';
import 'features/chat/screens/active_sessions_screen.dart';
import 'features/chat/screens/mitra_chat_screen.dart';
import 'features/chat/screens/chat_history_screen.dart';
import 'features/chat/screens/chat_transcript_screen.dart';
class _BlocRefreshNotifier extends ChangeNotifier {
late final StreamSubscription _subscription;
@@ -40,6 +43,17 @@ GoRouter buildRouter(AuthBloc authBloc) {
GoRoute(path: '/otp', builder: (context, state) => OtpScreen(phone: state.extra as String)),
GoRoute(path: '/home', builder: (_, __) => const HomeScreen()),
GoRoute(path: '/sessions', builder: (_, __) => const ActiveSessionsScreen()),
GoRoute(path: '/chat/session/:sessionId', builder: (context, state) {
final extra = state.extra as Map<String, dynamic>?;
return MitraChatScreen(
sessionId: state.pathParameters['sessionId']!,
customerName: extra?['customerName'] as String? ?? 'Customer',
);
}),
GoRoute(path: '/chat/history', builder: (_, __) => const MitraChatHistoryScreen()),
GoRoute(path: '/chat/history/:sessionId', builder: (context, state) {
return MitraChatTranscriptScreen(sessionId: state.pathParameters['sessionId']!);
}),
],
);
}