From f466559b515119331f6ff2f01d4397a13f8905ae Mon Sep 17 00:00:00 2001 From: Ben Weeks Date: Wed, 24 Dec 2025 13:18:51 +0000 Subject: [PATCH] feat: add Switch dropdown options for profile management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add "Import Existing Key" option with vpn_key icon - Add "Generate New Key" option to create fresh nsec - Add "Remove " option to delete merchant from DB - Wire up generate-key event to existing generateKeys function 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- static/components/merchant-tab.js | 30 ++++++++++++++++++- .../nostrmarket/components/merchant-tab.html | 30 +++++++++++++++++-- templates/nostrmarket/index.html | 1 + 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/static/components/merchant-tab.js b/static/components/merchant-tab.js index cd2e2b2..1194420 100644 --- a/static/components/merchant-tab.js +++ b/static/components/merchant-tab.js @@ -19,7 +19,9 @@ window.app.component('merchant-tab', { 'merchant-deleted', 'toggle-merchant-state', 'restart-nostr-connection', - 'profile-updated' + 'profile-updated', + 'import-key', + 'generate-key' ], data: function () { return { @@ -57,6 +59,32 @@ window.app.component('merchant-tab', { handleMerchantDeleted: function () { this.$emit('merchant-deleted') }, + removeMerchant: function () { + const name = + this.merchantConfig?.display_name || + this.merchantConfig?.name || + 'this merchant' + LNbits.utils + .confirmDialog( + `Are you sure you want to remove "${name}"? This will delete all associated data (stalls, products, orders, messages).` + ) + .onOk(async () => { + try { + await LNbits.api.request( + 'DELETE', + `/nostrmarket/api/v1/merchant/${this.merchantId}`, + this.adminkey + ) + this.$emit('merchant-deleted') + this.$q.notify({ + type: 'positive', + message: 'Merchant removed' + }) + } catch (error) { + LNbits.utils.notifyApiError(error) + } + }) + }, toggleMerchantState: function () { this.$emit('toggle-merchant-state') }, diff --git a/templates/nostrmarket/components/merchant-tab.html b/templates/nostrmarket/components/merchant-tab.html index d4f8e34..5725de3 100644 --- a/templates/nostrmarket/components/merchant-tab.html +++ b/templates/nostrmarket/components/merchant-tab.html @@ -70,12 +70,38 @@ + + + + + Import Existing Key + Use an existing nsec + + + - Add New Profile - Import a different nsec + Generate New Key + Create a fresh nsec + + + + + + + + + Remove + + Remove this nPub from the DB diff --git a/templates/nostrmarket/index.html b/templates/nostrmarket/index.html index 69e7e2e..7fe4e2c 100644 --- a/templates/nostrmarket/index.html +++ b/templates/nostrmarket/index.html @@ -159,6 +159,7 @@ @toggle-merchant-state="toggleMerchantState" @restart-nostr-connection="restartNostrConnection" @import-key="showImportKeysDialog" + @generate-key="generateKeys" @profile-updated="getMerchant" >