Add NostrmarketAPI integration and enhance MerchantStore component

- Introduce NostrmarketAPI service for improved merchant profile management.
- Update MerchantStore component to handle loading and error states during merchant profile checks.
- Implement logic to check for merchant profiles using the new API, enhancing user experience.
- Refactor computed properties and lifecycle methods to accommodate the new API integration.

These changes streamline the process of checking and managing merchant profiles, providing users with real-time feedback and improving overall functionality.
This commit is contained in:
padreug 2025-09-08 13:42:27 +02:00
parent 8cf62076fd
commit b25e502c17
5 changed files with 319 additions and 28 deletions

View file

@ -20,6 +20,7 @@ import { useMarketPreloader } from './composables/useMarketPreloader'
// Import services
import { NostrmarketService } from './services/nostrmarketService'
import { PaymentMonitorService } from './services/paymentMonitor'
import { NostrmarketAPI } from './services/nostrmarketAPI'
export interface MarketModuleConfig {
defaultCurrency: string
@ -49,6 +50,9 @@ export const marketModule: ModulePlugin = {
const nostrmarketService = new NostrmarketService()
container.provide(SERVICE_TOKENS.NOSTRMARKET_SERVICE, nostrmarketService)
const nostrmarketAPI = new NostrmarketAPI()
container.provide(SERVICE_TOKENS.NOSTRMARKET_API, nostrmarketAPI)
const paymentMonitorService = new PaymentMonitorService()
container.provide(SERVICE_TOKENS.PAYMENT_MONITOR, paymentMonitorService)
@ -61,6 +65,14 @@ export const marketModule: ModulePlugin = {
// Service will auto-initialize when dependencies are available
})
await nostrmarketAPI.initialize({
waitForDependencies: true,
maxRetries: 3
}).catch(error => {
console.warn('🛒 NostrmarketAPI initialization deferred:', error)
// Service will auto-initialize when dependencies are available
})
await paymentMonitorService.initialize({
waitForDependencies: true,
maxRetries: 3
@ -87,6 +99,7 @@ export const marketModule: ModulePlugin = {
// Clean up services
container.remove(SERVICE_TOKENS.NOSTRMARKET_SERVICE)
container.remove(SERVICE_TOKENS.NOSTRMARKET_API)
container.remove(SERVICE_TOKENS.PAYMENT_MONITOR)
console.log('✅ Market module uninstalled')