Skip to content
UI components for user profile / consent
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
demos
dist
src
templates
test
.gitignore
.pa11yci.js
.snyk
Makefile
README.md
bower.json
ft.yml
main.scss
package.json
renovate.json
secret-squirrel.js
tsconfig.commonjs.json
tsconfig.esm.json
tslint.json

README.md

n-profile-ui

UI handlebars templates for GDPR consent

If you want to integrate a consent form into your Next app, please see this wiki guide.

Your app should render the

element and required hidden fields detailed in the guide.

Then include the consent.html template from n-profile-ui

If you want to render a 'changes saved' message, a partial is available to include in your app page

Helper functions

buildConsentRecord

Accepts some user consent data (eg submitted from a form), a form of words ID and a consent source (the system code of the application sending the data eg 'next-signup'), and returns a consent record suitable for saving to the single consent store.

populateConsentModel

This works in the opposite direction to 'buildConsentRecord' - given a user's consent record (from the single consent store), plus form of words, this function will construct a view-model suitable for rendering out the consent template detailed above.

extractMetaFromString

Given a string like 'lbi-categoryName-channelName' used as the name attribute of a consent form control, this will return an object keyed by the parts of that string.

getFormOfWords

Accepts a form of words ID (and optionally, a scope eg FTPINK), and returns the form of words for it from the Form of Words API. Note - this helper requires that the FOW_API_HOST environment variable is set.

Client-side helpers

If your consent form should 'auto-save' each Yes/No consent option as soon as it's changed:

LiveUpdateConsent - a class to provide 'auto-save' functionality for a consent form. See Privacy settings for a working example, and the GDPR wiki for notes on how to implement.

alternatively, if the consent form will save when its submit button is clicked, use:

UpdateOnSave - helpers to validate and extract consent values to be merged into a form payload.

ConsentMessage - a simple helper class to show / hide a message on a consent form.

Demo

make demo

pageshot of update-on-save 2018-04-03-1220 20

You can’t perform that action at this time.