Commit graph

22 commits

Author SHA1 Message Date
0da23e9332 Replace complex UnreadMessageData system with elegant path-based wildcard notification tracking inspired by Coracle's pattern. This simplifies the codebase while adding powerful batch "mark as read" capabilities.
Key changes:
  - Add notification store with path-based wildcard support (chat/*, chat/{pubkey}, *)
  - Remove UnreadMessageData interface and processedMessageIds Set tracking
  - Implement timestamp-based "seen at" logic with wildcard matching
  - Add markAllChatsAsRead() for batch operations
  - Integrate ChatNotificationConfig for module configuration
  - Create useNotifications composable for easy notification access

  Benefits:
  - Simpler architecture (removed processedMessageIds complexity)
  - Flexible wildcard-based "mark as read" operations
  - Future-proof for Primal-style backend sync
  - User-scoped storage via StorageService
  - Clean separation of concerns

refactor: enhance chat service with activity tracking and sorting

- Updated the ChatService to track lastSent, lastReceived, and lastChecked timestamps for peers, improving message handling and user experience.
- Implemented sorting of peers by last activity to prioritize recent conversations.
- Adjusted message handling to update peer activity based on message direction.
- Ensured updated peer data is saved to storage after modifications.

These changes streamline chat interactions and enhance the overall functionality of the chat service.

refactor: improve ChatService and notification store initialization

- Updated ChatService to ensure the notification store is initialized only after user authentication, preventing potential errors.
- Introduced a new method to safely access the notification store, enhancing error handling.
- Enhanced peer activity tracking by calculating last activity based on actual message timestamps, improving sorting and user experience.
- Added debounced saving of notification state to storage, optimizing performance and reducing unnecessary writes.
- Improved logging for better debugging and visibility into notification handling processes.

These changes enhance the reliability and efficiency of the chat service and notification management.

refactor: clean up logging in ChatService and notification store

- Removed unnecessary console logs from ChatService to streamline the code and improve performance.
- Simplified the initialization process of the notification store by eliminating redundant logging statements.
- Enhanced readability and maintainability of the code by focusing on essential operations without excessive debug output.

These changes contribute to a cleaner codebase and improved performance in chat service operations.

FIX BUILD ERRORS

refactor: update chat module notification configuration

- Refactored the notification settings in the chat module to use a nested structure, enhancing clarity and organization.
- Introduced `wildcardSupport` to the notification configuration, allowing for more flexible notification handling.
- Maintained existing functionality while improving the overall configuration structure.

These changes contribute to a more maintainable and extensible chat module configuration.

refactor: optimize ChatComponent and ChatService for improved performance

- Removed unnecessary sorting of peers in ChatComponent, leveraging the existing order provided by the chat service.
- Updated the useFuzzySearch composable to directly utilize the sorted peers, enhancing search efficiency.
- Cleaned up logging in ChatService by removing redundant console statements, streamlining the codebase.
- Added critical checks to prevent the current user from being included in peer interactions, improving user experience and functionality.

These changes contribute to a more efficient and maintainable chat module.

refactor: simplify message publishing in ChatService

- Removed unnecessary variable assignment in the message publishing process, directly awaiting the relayHub.publishEvent call.
- This change streamlines the code and enhances readability without altering functionality.

These modifications contribute to a cleaner and more efficient chat service implementation.
2025-10-04 10:29:22 +02:00
4feb5459cc Refactor authentication architecture to eliminate dual auth complexity
This major refactor consolidates the authentication system to use a single
source of truth, eliminating timing issues and architectural complexity
that was causing chat and payment functionality problems.

Key Changes:
• Remove old global useAuth composable and replace with useAuthService wrapper
• Update all 25+ files to use consistent auth pattern via dependency injection
• Eliminate dual auth detection workarounds from services (ChatService, PaymentService, etc.)
• Fix TypeScript errors and add proper Uint8Array conversion for Nostr private keys
• Consolidate auth state management to AuthService as single source of truth

Benefits:
• Resolves chat peer loading and message subscription timing issues
• Fixes wallet detection problems for Lightning payments
• Eliminates race conditions between global and injected auth
• Maintains API compatibility while improving architecture
• Reduces code complexity and improves maintainability

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-07 00:47:02 +02:00
5a899d1501 Enhance ChatService to process market messages in chat
- Updated ChatService to forward market messages to the chat interface, ensuring they are displayed alongside regular chat messages.
- Improved message formatting for payment requests and order status updates, providing clearer user notifications.
- Deprecated the previous order updates subscription method in useMarket, redirecting functionality to the chat service for better integration.

These changes improve the user experience by consolidating message handling and enhancing clarity in communication.
2025-09-07 00:08:38 +02:00
d3ee19f56f Enhance authentication handling and error logging in ChatService and NostrmarketService
- Introduce a flag in ChatService to track initialization status and improve message handling.
- Enhance error handling and logging for API responses in ChatService, including warnings for invalid data formats.
- Update NostrmarketService to utilize global authentication checks, improving user authentication flow.
- Refactor CheckoutPage to streamline pubkey retrieval and enhance error messages related to Nostr identity configuration.

These changes improve the robustness of authentication processes and provide clearer feedback to users during interactions.
2025-09-06 23:46:23 +02:00
4db7645a8f Enhance ChatService initialization and authentication handling
- Introduce periodic authentication checks to ensure full initialization of the ChatService.
- Implement a flag to prevent redundant initialization.
- Update message handling and subscription methods to accommodate both injected and global authentication services.
- Improve error handling and logging for message subscription setup and processing.
- Clear authentication check intervals during service disposal to prevent memory leaks.

This commit improves the reliability and responsiveness of the chat service in handling user authentication and message subscriptions.
2025-09-06 23:26:35 +02:00
7cfeaee21e Refactor Chat and Market Services for enhanced user experience and error handling
Chat Service:
- Improved error handling for message subscription setup and API responses.
- Enhanced logging for better tracking of authentication issues.

Market Service:
- Streamlined authentication checks to improve order placement flow.
- Updated user guidance for missing Nostr keys.

These updates aim to bolster the reliability and usability of the chat and market functionalities.
2025-09-06 22:56:50 +02:00
8a019db34a Enhance Chat and Market Services with improved error handling and logging
Chat Service:
- Added detailed logging for API calls and responses, including warnings for missing authentication tokens and invalid response formats.
- Implemented a retry mechanism for message subscription setup on connection errors.
- Merged peers instead of clearing existing ones when loading from the API.

Market Service:
- Updated authentication checks to prioritize global auth state, improving user experience during order placement.
- Enhanced error messages for missing Nostr keys to guide users in configuring their profiles.

These changes improve the robustness and user-friendliness of the chat and market functionalities.
2025-09-06 20:12:41 +02:00
a811040a34 Fix TypeScript build errors in module pages
- Replace location.reload() with proper window.location.reload() function calls
- Remove unused isReady variable in ChatPage.vue
- Add handleRetry functions in ChatPage.vue and EventsPage.vue
- Ensures successful production builds with vue-tsc type checking

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 17:00:27 +02:00
7145af3f83 Fix blank page issue on module route refresh
- Pre-register all module routes automatically from module definitions in router configuration
- Add useModuleReady composable for clean reactive loading states during module initialization
- Update ChatPage and EventsPage with proper loading/error states and computed service access
- Remove duplicate route registration from plugin manager install phase
- Maintain modular architecture while ensuring routes are available immediately on app startup

Resolves blank pages and Vue Router warnings when refreshing on /chat, /events, /my-tickets routes.
Users now see proper loading indicators instead of blank screens during module initialization.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 16:33:32 +02:00
3cf10b1db4 1.3.4 User-Scoped Storage Pattern: Add StorageService integration across modules for improved data management
- Introduced STORAGE_SERVICE token in the DI container for consistent service registration.
- Updated BaseService to include storageService as a dependency, ensuring proper initialization and error handling.
- Refactored ChatService to utilize storageService for managing unread messages and peers, replacing localStorage usage.
- Enhanced MarketStore to save and load orders using storageService, improving data persistence and user experience.
- Registered storageService in the base module, ensuring it is initialized and disposed of correctly.

This integration streamlines data handling across the application, promoting better maintainability and consistency.
2025-09-06 12:08:39 +02:00
30b9089829 Refactor chat module to utilize standardized service tokens for improved dependency management
- Update chat module to use SERVICE_TOKENS for chat service registration and injection, enhancing consistency across the application.
- Modify useChat composable to reference the standardized service token, ensuring alignment with the new DI container structure.
- Clean up references to the previous CHAT_SERVICE_TOKEN, streamlining the codebase and improving maintainability.
2025-09-05 16:35:03 +02:00
ef7333e68e Enhance VisibilityService integration for WebSocket and chat services
- Add detailed examples for WebSocket connection recovery and chat message synchronization in the VisibilityService documentation.
- Refactor ChatService to register with VisibilityService, enabling automatic handling of app visibility changes and missed message synchronization.
- Implement connection recovery logic in NostrclientHub and ChatService to ensure seamless user experience during app backgrounding.
- Update base module to ensure proper initialization of services with VisibilityService dependencies, enhancing overall connection management.
2025-09-05 15:57:02 +02:00
8d4c389f71 Add BaseService and refactor ChatService for improved dependency management
- Introduce BaseService as a foundational class for services, providing standardized dependency injection and initialization logic.
- Refactor ChatService to extend BaseService, enhancing its initialization process and dependency handling.
- Implement service metadata and structured initialization in ChatService, allowing for better tracking and error handling during service setup.
- Update chat module to initialize ChatService with dependency management, ensuring readiness before use.
2025-09-05 06:19:08 +02:00
7c439361b7 Refactor authentication and async operation handling in useAuth composable
- Introduce useMultiAsyncOperation to manage multiple async operations in useAuth, enhancing error handling and loading state management.
- Replace manual loading and error state management with standardized async operation patterns for initialize, login, register, and logout functions.
- Update related components to utilize the new async operation structure, improving code clarity and maintainability.
- Add useAsyncOperation to other composables (useChat, useTicketPurchase, useMarket) for consistent async handling across the application.
2025-09-05 06:08:08 +02:00
ee8dd37761 Refactor imports and remove legacy composables for improved code clarity
- Simplify imports in app.ts by removing unused SERVICE_TOKENS.
- Eliminate the NavigationItem interface in Navbar.vue as its functionality is now managed by useModularNavigation.
- Introduce new legacy composable stubs for useNostrChat and useRelayHub, indicating a shift towards modular chat and relay services.
- Update MyTicketsPage.vue to correct the import path for useUserTickets, enhancing module organization.
- Refactor ChatService to improve type handling for event tags, ensuring better type safety.

Remove ChatComponent, useNostrChat composable, and ChatPage for a modular chat architecture

- Delete ChatComponent.vue to streamline chat functionality.
- Remove legacy useNostrChat composable, transitioning to a more modular chat service approach.
- Eliminate ChatPage.vue as part of the refactor to enhance code organization and maintainability.
2025-09-05 05:27:45 +02:00
4258ea87c4 Enhance chat and market integration with message forwarding
- Make ChatService globally available for other modules, enabling market-related message handling.
- Introduce a market message handler in ChatService to process market-related direct messages (DMs).
- Update useMarket to register the market message handler with ChatService, streamlining order-related DM processing.
- Refactor message handling logic to differentiate between market messages and regular chat messages, improving message management.
- Enhance order update logging in nostrmarketService for better debugging and verification of order status.
2025-09-05 05:00:46 +02:00
55e99e002d Refactor AuthService and market components for improved functionality and error handling
- Integrate LNbits API for authentication in AuthService, replacing token management with direct API calls for user data.
- Enhance login and registration processes to utilize the new API, improving user experience and error handling.
- Update market components to include detailed logging and fallback mechanisms for offline scenarios, ensuring better resilience during market data loading.
- Refactor market preloader to handle connection timeouts and provide sample data as a fallback, enhancing user experience in offline mode.
2025-09-05 03:07:55 +02:00
daa9656680 Implement LNbits integration in AuthService and enhance ChatComponent for improved user experience
- Refactor AuthService to integrate LNbits authentication, including fetching user data from the API and handling token validation.
- Update ChatComponent to reflect changes in peer management, replacing user_id with pubkey and username with name for better clarity.
- Enhance connection status indicators in ChatComponent for improved user feedback during chat initialization.
2025-09-05 02:48:47 +02:00
17c07c37a0 Refactor chat and market modules for improved integration and maintainability
- Remove deprecated Nostr chat and relay hub components, transitioning to a modular chat service for better encapsulation.
- Update App.vue and Navbar.vue to utilize the new chat module, enhancing user experience with automatic peer management.
- Simplify event handling and connection logic in ChatComponent.vue, ensuring compatibility with the new chat service architecture.
- Adjust market settings and order history components to reflect changes in the chat module, improving overall coherence in the application structure.
- Clean up unused imports and streamline configuration access for better performance and maintainability.
2025-09-05 01:44:15 +02:00
90ef85f4e8 Refactor ChatComponent and ChatPage for improved readability and maintainability
- Update Badge components in ChatComponent.vue to use new variant props for better styling consistency.
- Simplify ChatPage.vue by removing debug information and authentication checks, directly rendering ChatComponent for a cleaner layout.
2025-09-05 00:40:51 +02:00
0ee0bc428c Refactor chat module and navigation components for improved user experience
- Update app configuration to load chat module on startup for route registration.
- Introduce useModularNavigation composable for dynamic navigation based on enabled modules.
- Simplify Navbar.vue by utilizing userMenuItems for dropdown and button rendering, enhancing maintainability.
- Enhance ChatPage.vue with detailed debug information and user authentication checks for better feedback.
2025-09-05 00:31:53 +02:00
e40ac91417 Enhance market module with new chat and events features
- Introduce chat module with components, services, and composables for real-time messaging.
- Implement events module with API service, components, and ticket purchasing functionality.
- Update app configuration to include new modules and their respective settings.
- Refactor existing components to integrate with the new chat and events features.
- Enhance market store and services to support new functionalities and improve order management.
- Update routing to accommodate new views for chat and events, ensuring seamless navigation.
2025-09-05 00:01:40 +02:00