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

zengenti-forms-package

v2.2.10

Published

This is a package to allow you to render Contensis forms in your react/redux app. There are a number of prerequisites in order to get this to work, they are as follows:

Downloads

831

Readme

Contensis forms renderer

This is a package to allow you to render Contensis forms in your react/redux app. There are a number of prerequisites in order to get this to work, they are as follows:

Using this in your project

Install the package

npm i --save zengenti-forms-package

Import the sagas and reducers

Import the sagas and add them to your rootSaga function: e.g.

import { sagas as formSagas } from 'zengenti-forms-package';

Import the reducer: e.g.

import { reducer as FormsReducer } from 'zengenti-forms-package';

and add it to your combineReducer function, ensure your reducer key is called form: e.g.

const reducers = { form: FormsReducer, ...otherReducers };

Server-side reverse proxy

Import the server-side api proxy

import { formsApiProxy } from 'zengenti-forms-package/server';

Create the required api endpoints (where you would normally configure server-side features) by calling the imported function supplying the server-side express app instance e.g. formsApiProxy(app);

** this step is not required if you are overriding the rootUrl variable with FORMS_API_CONFIG

Render the Form in your React components

  • Import the <Form> component and use it in JSX where it is needed: e.g.
import { Form } from 'zengenti-forms-package';

and supply it with a valid formId prop: e.g.

  <MyComponent>
    <Form formId={1234} />
  </MyComponent>

Suggested usage with Content Types and Entries

  • Content type called form containing these fields[]:
"fields": [
  {
    "id": "formName",
    "name": {
      "en-GB": "Form Name"
    },
    "dataType": "string",
    "dataFormat": "",
    "description": {
      "en-GB": null
    },
    "default": null,
    "validations": {}
  },
  {
    "id": "formId",
    "name": {
      "en-GB": "Form - Content ID"
    },
    "dataType": "string",
    "dataFormat": "",
    "description": {
      "en-GB": null
    },
    "default": null,
    "validations": {}
  }
],
  • Then in your content type or composer content add an entry picker linking back to form content type, this will give the editor the ability to select a particular form entry from the form content type:

  • Essentially we are just trying to feed a prop called formId to the <Form ... /> component invocation.

Localisation

You can pass in a localisedPhrases prop to the Form component. e.g. <Form formId={1234} localisedPhrases={...} />

This is an object type where keys relate to specific phrases in the form.

The value will be rendered wherever that phrase is used.

Currently available keys: |key|type| |-|-| |required|string| |optional|string| |step|string| |previousPage|string| |nextPage|string| |errorTitle|string|

Note: the form component does not handle any language switching itself. All the localisedPhrases prop does is display the value of what you are passing to the key.

<Form formId={1234} localisedPhrases={{
  required: 'gofynnol',
  optional: 'dewisol',
  step: 'cam',
  previousPage: 'blaenorol',
  nextPage: 'nesaf',
  errorTitle: 'Wps!',
}} />

Overriding config variables

Ensure a global variable is available called FORM_API_CONFIG containing any of the following values you wish to override:

const FORM_API_CONFIG = {
  rootUrl: 'https://cms-mycms.cloud.contensis.com/',
  getFormUrl: '/REST/Contensis/content/GetFormSettings',
  uploadFileUrl: '/REST/UI/FormsModule/UploadFile',
};

This is normally available in a webpack file and added to the build via some define plugin.

** The server-side forms proxy will not be used if you are overriding rootUrl with the FORM_API_CONFIG global, instead this url will be called directly from the client

Recaptcha

Recaptcha v2 support has been added. For those curious here is the implementation used: https://developers.google.com/recaptcha/docs/display#auto_render

Requirements

Need a content type named formSettings With a field named recaptchaSiteKey

The form component will check your project for that site key.

How to test

Run npm run start and check your network tab for results from 'gstatic.com' you should return a recaptcha__en.js file. You will likely then get a message stating "Localhost is not in the list of supported domains". More detail can be found here: https://developers.google.com/recaptcha/docs/faq#im-getting-an-error-localhost-is-not-in-the-list-of-supported-domains.-what-should-i-do

Dependencies

  • React
  • React Helmet
  • Redux
  • Styled Components
  • Webpack

Installation

npm install

Run Development environment

npm start