diff --git a/src/modules/market/components/CreateStoreDialog.vue b/src/modules/market/components/CreateStoreDialog.vue index 78ef1b3..613c005 100644 --- a/src/modules/market/components/CreateStoreDialog.vue +++ b/src/modules/market/components/CreateStoreDialog.vue @@ -47,14 +47,10 @@ Currency * - - + @@ -279,7 +275,6 @@ const toast = useToast() // Local state const isCreating = ref(false) const createError = ref(null) -const isLoadingCurrencies = ref(false) const availableCurrencies = ref(['sat']) const availableZones = ref([]) const showNewZoneForm = ref(false) @@ -336,27 +331,11 @@ const onSubmit = form.handleSubmit(async (values) => { // Methods const loadAvailableCurrencies = async () => { - isLoadingCurrencies.value = true try { const currencies = await nostrmarketAPI.getCurrencies() - if (currencies.length > 0) { - // Ensure 'sat' is always first in the list - const satIndex = currencies.indexOf('sat') - if (satIndex === -1) { - // Add 'sat' at the beginning if not present - availableCurrencies.value = ['sat', ...currencies] - } else if (satIndex > 0) { - // Move 'sat' to the beginning if present but not first - const withoutSat = currencies.filter(c => c !== 'sat') - availableCurrencies.value = ['sat', ...withoutSat] - } else { - availableCurrencies.value = currencies - } - } + availableCurrencies.value = currencies } catch (error) { console.error('Failed to load currencies:', error) - } finally { - isLoadingCurrencies.value = false } } diff --git a/src/modules/market/components/DashboardOverview.vue b/src/modules/market/components/DashboardOverview.vue index 804d77c..103c07a 100644 --- a/src/modules/market/components/DashboardOverview.vue +++ b/src/modules/market/components/DashboardOverview.vue @@ -77,6 +77,77 @@ + +
+ +
+

+ + Customer Actions +

+
+ + + +
+
+ + +
+

+ + Merchant Actions +

+
+ + + +
+
+
+

Recent Activity

@@ -145,12 +216,15 @@ + diff --git a/src/modules/market/components/MerchantStore.vue b/src/modules/market/components/MerchantStore.vue index 381fcae..50da407 100644 --- a/src/modules/market/components/MerchantStore.vue +++ b/src/modules/market/components/MerchantStore.vue @@ -49,47 +49,84 @@
- -
-
-
- - -
-
- + +
+
+
+

My Stores

+

+ Manage your stores and products +

-

Create Your Store

-

- Set up your store to start selling products on the Nostr marketplace. -

-
+
- -
+ +
+
+
+ + +
+ + + + +
+ +
+
+ + +
+ +
+ +
+ {{ activeStall.currency }} +
+
-
-

{{ activeStall.name }}

- {{ activeStall.currency }} -
-

{{ activeStall.config?.description || 'Manage incoming orders and your products' }}

+

{{ activeStall.name }}

+

{{ activeStall.config?.description || 'Manage incoming orders and your products' }}

+
+
+ +
-
@@ -151,23 +188,20 @@
- -
-
- Coming Soon -
+ +

Satisfaction

-

--%

+

{{ storeStats.satisfaction }}%

-
- +
+
- No reviews yet + {{ storeStats.totalReviews }} reviews
@@ -396,6 +430,7 @@ import { injectService, SERVICE_TOKENS } from '@/core/di-container' import CreateStoreDialog from './CreateStoreDialog.vue' import CreateProductDialog from './CreateProductDialog.vue' import DeleteConfirmDialog from './DeleteConfirmDialog.vue' +import StoreCard from './StoreCard.vue' import MerchantOrders from './MerchantOrders.vue' const router = useRouter() @@ -617,6 +652,14 @@ const loadStallProducts = async () => { } } +const manageStall = (stallId: string) => { + activeStallId.value = stallId +} + +const viewStallProducts = (stallId: string) => { + activeStallId.value = stallId +} + const navigateToMarket = () => router.push('/market') const checkMerchantProfile = async () => { @@ -654,6 +697,7 @@ const checkMerchantProfile = async () => { // Event handlers const onStoreCreated = async (_stall: Stall) => { await loadStallsList() + toast.success('Store created successfully!') } const onProductCreated = async (_product: Product) => { diff --git a/src/modules/market/components/OrderHistory.vue b/src/modules/market/components/OrderHistory.vue index 54401fa..0807c97 100644 --- a/src/modules/market/components/OrderHistory.vue +++ b/src/modules/market/components/OrderHistory.vue @@ -212,6 +212,19 @@
+ +
+

Debug Information

+
+
Total Orders in Store: {{ Object.keys(marketStore.orders).length }}
+
Filtered Orders: {{ filteredOrders.length }}
+
Order Events Subscribed: {{ orderEvents.isSubscribed ? 'Yes' : 'No' }}
+
Relay Hub Connected: {{ relayHub.isConnected ? 'Yes' : 'No' }}
+
Auth Status: {{ auth.isAuthenticated ? 'Authenticated' : 'Not Authenticated' }}
+
Current User: {{ auth.currentUser?.value?.pubkey ? 'Yes' : 'No' }}
+
+
+
@@ -299,6 +312,8 @@ const pendingOrders = computed(() => allOrders.value.filter(o => o.status === 'p const paidOrders = computed(() => allOrders.value.filter(o => o.status === 'paid').length) const pendingPayments = computed(() => allOrders.value.filter(o => !isOrderPaid(o)).length) +const isDevelopment = computed(() => import.meta.env.DEV) + // Methods const isOrderPaid = (order: any) => { // Prioritize the 'paid' field from Nostr status updates (type 2) @@ -482,9 +497,34 @@ onMounted(() => { paymentService.forceResetPaymentState() } + // Orders are already loaded in the market store + console.log('Order History component loaded with', allOrders.value.length, 'orders') + console.log('Market store orders:', marketStore.orders) + + // Debug: Log order details for orders with payment requests + allOrders.value.forEach(order => { + if (order.paymentRequest) { + console.log('Order with payment request:', { + id: order.id, + paymentRequest: order.paymentRequest.substring(0, 50) + '...', + hasPaymentRequest: !!order.paymentRequest, + status: order.status, + paymentStatus: order.paymentStatus + }) + } + }) + + console.log('Order events status:', orderEvents.isSubscribed.value) + console.log('Relay hub connected:', relayHub.isConnected.value) + console.log('Auth status:', auth.isAuthenticated) + console.log('Current user:', auth.currentUser?.value?.pubkey) + // Start listening for order events if not already listening if (!orderEvents.isSubscribed.value) { + console.log('Starting order events listener...') orderEvents.initialize() + } else { + console.log('Order events already listening') } }) diff --git a/src/modules/market/services/nostrmarketAPI.ts b/src/modules/market/services/nostrmarketAPI.ts index 528336f..4913aa0 100644 --- a/src/modules/market/services/nostrmarketAPI.ts +++ b/src/modules/market/services/nostrmarketAPI.ts @@ -329,34 +329,6 @@ export class NostrmarketAPI extends BaseService { return stall } - /** - * Update an existing stall - */ - async updateStall( - walletAdminkey: string, - stallId: string, - stallData: Partial<{ - name: string - config: { - description?: string - image_url?: string - } - }> - ): Promise { - const stall = await this.request( - `/api/v1/stall/${stallId}`, - walletAdminkey, - { - method: 'PATCH', - body: JSON.stringify(stallData), - } - ) - - this.debug('Updated stall:', { stallId: stall.id, stallName: stall.name }) - - return stall - } - /** * Get available shipping zones */ @@ -399,70 +371,30 @@ export class NostrmarketAPI extends BaseService { } /** - * Update an existing shipping zone - */ - async updateZone( - walletAdminkey: string, - zoneId: string, - zoneData: Zone - ): Promise { - const zone = await this.request( - `/api/v1/zone/${zoneId}`, - walletAdminkey, - { - method: 'PATCH', - body: JSON.stringify(zoneData), - } - ) - - this.debug('Updated zone:', { zoneId: zone.id, zoneName: zone.name }) - - return zone - } - - /** - * Delete a shipping zone - */ - async deleteZone(walletAdminkey: string, zoneId: string): Promise { - await this.request( - `/api/v1/zone/${zoneId}`, - walletAdminkey, - { method: 'DELETE' } - ) - - this.debug('Deleted zone:', { zoneId }) - } - - /** - * Get available currencies from the LNbits core API - * This endpoint returns currencies allowed by the server configuration + * Get available currencies */ async getCurrencies(): Promise { - // Call the LNbits core API directly (not under /nostrmarket) - const url = `${this.baseUrl}/api/v1/currencies` + const baseCurrencies = ['sat'] try { - const response = await fetch(url, { - method: 'GET', - headers: { 'Content-Type': 'application/json' } - }) - - if (!response.ok) { - throw new Error(`Failed to fetch currencies: ${response.status}`) - } - - const apiCurrencies = await response.json() + const apiCurrencies = await this.request( + '/api/v1/currencies', + '', // No authentication needed for currencies endpoint + { method: 'GET' } + ) if (apiCurrencies && Array.isArray(apiCurrencies)) { - this.debug('Retrieved currencies from LNbits core:', { count: apiCurrencies.length, currencies: apiCurrencies }) - return apiCurrencies + // Combine base currencies with API currencies, removing duplicates + const allCurrencies = [...baseCurrencies, ...apiCurrencies.filter(currency => !baseCurrencies.includes(currency))] + this.debug('Retrieved currencies:', { count: allCurrencies.length, currencies: allCurrencies }) + return allCurrencies } - this.debug('No currencies returned from server, using default') - return ['sat'] + this.debug('No API currencies returned, using base currencies only') + return baseCurrencies } catch (error) { - this.debug('Failed to get currencies, using default:', error) - return ['sat'] + this.debug('Failed to get currencies, falling back to base currencies:', error) + return baseCurrencies } } diff --git a/target-ui.md b/target-ui.md deleted file mode 100644 index 7b8e802..0000000 --- a/target-ui.md +++ /dev/null @@ -1,216 +0,0 @@ - - -