0.1.5 • Published 4 months ago

nostr-feedback-button v0.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

Nostr Feedback button

Let your users screen into the ether about bugs and broken features

Options

The createFeedbackButton takes some options

createFeedbackButton({
  developer: "<your nostr pubkey>",
  namespace: "<name of your application>",
  relays: [
    // a list of relays to publish the feedback events to
    "wss://relay.example.com",
  ],

  // Optional methods

  // Create an additional block of metadata that will be included at the bottom of the feedback
  getMetadataBlock: () => {
    return [`location: ${location.href}`].join("/n");
  },

  // Allows the user the option to sign the event with their current pubkey
  signEvent: (draft) => window.nostr.signEvent(draft),

  // override event publishing
  publishEvent: async (event, relays) => {
    // implement custom relay publishing logic
    await relayPool.send(event, relays);
  },

  // callback method called when feedback event is published
  onFeedback: () => {
    // recommended to show confetti
    confetti({
      particleCount: 100,
      spread: 70,
    });
  },
});

Adding to html

<head>
  <link rel="stylesheet" href="//unpkg.com/nostr-feedback-button/styles.css" />
  <script src="//unpkg.com/nostr-feedback-button/feedback.browser.js"></script>
</head>
<body>
  <script>
    window.nostr_feedback.createFeedbackButton({
      developer: "<your nostr pubkey>",
      namespace: "<name of your application>",
      relays: [
        // a list of relays to publish the feedback events to
        "wss://relay.example.com",
      ],

      // additional options
    });
  </script>
</body>

Using in a javascript app

import { createFeedbackButton } from "nostr-feedback-button";
import "nostr-feedback-button/styles.css";

// creates and adds the feedback button to the page
createFeedbackButton({
  developer: "<your nostr pubkey>",
  namespace: "<name of your application>",
  relays: [
    // a list of relays to publish the feedback events to
    "wss://relay.example.com",
  ],

  // additional options
});
0.1.5

4 months ago

0.1.4

5 months ago

0.1.3

5 months ago

0.1.2

5 months ago

0.1.1

5 months ago

0.1.0

5 months ago