feat: add merchant profile edit, keys dialog, and publish to Nostr
- Add PATCH endpoint for updating merchant profile config - Add website field to MerchantProfile model - Fix to_nostr_event to include all profile fields (display_name, banner, website, nip05, lud16) - Always publish merchant profile (kind 0) when publishing to Nostr - Extract edit-profile-dialog and nostr-keys-dialog into separate components - Fix profile avatar alignment to match original design - Simplify keys dialog to show only npub QR code (no nsec QR) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c3dea9f01d
commit
a21b5289c1
12 changed files with 635 additions and 109 deletions
85
static/components/edit-profile-dialog.js
Normal file
85
static/components/edit-profile-dialog.js
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
window.app.component('edit-profile-dialog', {
|
||||
name: 'edit-profile-dialog',
|
||||
template: '#edit-profile-dialog',
|
||||
delimiters: ['${', '}'],
|
||||
props: ['model-value', 'merchant-id', 'merchant-config', 'adminkey'],
|
||||
emits: ['update:model-value', 'profile-updated'],
|
||||
data: function () {
|
||||
return {
|
||||
saving: false,
|
||||
formData: {
|
||||
name: '',
|
||||
display_name: '',
|
||||
about: '',
|
||||
picture: '',
|
||||
banner: '',
|
||||
website: '',
|
||||
nip05: '',
|
||||
lud16: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
show: {
|
||||
get() {
|
||||
return this.modelValue
|
||||
},
|
||||
set(value) {
|
||||
this.$emit('update:model-value', value)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
saveProfile: async function () {
|
||||
this.saving = true
|
||||
try {
|
||||
const config = {
|
||||
...this.merchantConfig,
|
||||
name: this.formData.name || null,
|
||||
display_name: this.formData.display_name || null,
|
||||
about: this.formData.about || null,
|
||||
picture: this.formData.picture || null,
|
||||
banner: this.formData.banner || null,
|
||||
website: this.formData.website || null,
|
||||
nip05: this.formData.nip05 || null,
|
||||
lud16: this.formData.lud16 || null
|
||||
}
|
||||
await LNbits.api.request(
|
||||
'PATCH',
|
||||
`/nostrmarket/api/v1/merchant/${this.merchantId}`,
|
||||
this.adminkey,
|
||||
config
|
||||
)
|
||||
this.show = false
|
||||
this.$q.notify({
|
||||
type: 'positive',
|
||||
message: 'Profile updated!'
|
||||
})
|
||||
this.$emit('profile-updated')
|
||||
} catch (error) {
|
||||
LNbits.utils.notifyApiError(error)
|
||||
} finally {
|
||||
this.saving = false
|
||||
}
|
||||
},
|
||||
loadFormData: function () {
|
||||
if (this.merchantConfig) {
|
||||
this.formData.name = this.merchantConfig.name || ''
|
||||
this.formData.display_name = this.merchantConfig.display_name || ''
|
||||
this.formData.about = this.merchantConfig.about || ''
|
||||
this.formData.picture = this.merchantConfig.picture || ''
|
||||
this.formData.banner = this.merchantConfig.banner || ''
|
||||
this.formData.website = this.merchantConfig.website || ''
|
||||
this.formData.nip05 = this.merchantConfig.nip05 || ''
|
||||
this.formData.lud16 = this.merchantConfig.lud16 || ''
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
modelValue(newVal) {
|
||||
if (newVal) {
|
||||
this.loadFormData()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue