npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hof-behaviour-feedback

v2.0.2

Published

A hof plugin allow customisation of the linked feedback form and feedback form submission

Downloads

8

Readme

hof-behaviour-feedback

HOF behaviour allowing a custom feedback page to be deployed as part of the hof form, which will then be linked to as part of the banner.

When configured correctly the user will be taken to the custom feedback form, and redirected back to the page they came from when the form has been submitted.

It is possible to use a single feedback instance for multiple hof forms - e.g. by including it in a 'common' app with no base url and setting a custom feedback url of '/feedback'.

Installation

npm install [--save] hof-behaviour-feedback;

Usage

hof app initialisation (top level index.js)

const app = hof({
  ...
  behaviours: [
    require('hof-behaviour-feedback').SetFeedbackReturnUrl
  ],
  ...
});

Customising the feedback form step path (Optional, defaults to ${app.baseUrl}/feedback):

Note that if setting a custom url for the feedback form the app.baseUrl will not be applied automatically.

app.use((req, res, next) => {
  // Set custom feedback path
  res.locals.feedbackUrl='/my-feedback-url';
  next();
});

app/myapp/index.js

const UploadFeedback = require('hof-behaviour-feedback').SubmitFeedback

module.exports = {
  ...
  steps: {
    ...
    '/feedback': {
      fields: [...],
      behaviours: [UploadFeedback],
      feedbackConfig: {
        ...
      }
    } 
  }
}

Configure the fields for the feedback step as normal.

Submission types

While currently only GovUK email is supported this library is designed to be easily extensible to support other types of feedback submission.

Email via GovUK Notify

Requires notifications-node-client if notify is configured.

feedbackConfig: {
  notify: {
    apiKey: config.govukNotify.notifyApiKey,
    email: {
      templateId: config.govukNotify.templateFormFeedback, 
      emailAddress: config.govukNotify.feedbackEmail,
      fieldMappings: { 
          'feedbackText': 'feedback',
          'feedbackName' : 'name',
          'feedbackEmail' : ' email'
      },
      includeBaseUrlAs : "process",
      includeSourcePathAs : "path"
    }
  }
}
  • apiKey - the notify api key.
  • templateId - id of the GovUk notify email template.
  • emailAddress - address the feedback email should be sent to.
  • fieldMappings - associative array of input names to the corresponding variable name in the notify email template. Any inputs which are not explicitly mapped here will not be sent to notify.
  • includeBaseUrlAs (Optional) - if included the application base url will be sent to notify with the given variable name.
  • includeSourcePathAs (Optional) - if included the originating page path (i.e. the page the user was on before they clicked the feedback link) will be sent to notify with the given variable name.