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

@bigbinary/neeto-form-frontend

v3.9.9

Published

Neeto Form Engine Frontend

Downloads

3,497

Readme

neeto-form-nano

The neeto-form-nano allows us to build forms within neeto applications. This nano exports @bigbinary/neeto-form-frontend NPM package and neeto-form-engine Rails engine.

Contents

  1. Development with Host Application
  2. Instructions for Publishing

Development with Host Application

Engine

The engine adds setup for form on backend and allows us to attach forms to any model. It also stores submissions.

Installation

  1. Add this line to your application's Gemfile:

    source "NEETO_GEM_SERVER_URL" do
      # ...existing gems
    
      gem 'neeto-form-engine'
    end
  2. And then execute:

    bundle install
  3. Install the migrations

    bundle exec rails neeto_form_engine:install:migrations
  4. Run the migrations

    bundle exec rails db:migrate
  5. Add this line to your application's config/routes.rb file (replace at to your desired route):

    mount NeetoFormEngine::Engine, at: "/neeto_form_engine"
  6. Create file neeto_form_engine.rb under config/initializers to provide the owner_class information

    NeetoFormEngine.owner_class = "Organization"
  7. Configure models to add below association to the provided owner class

    has_many :forms, class_name: "::NeetoFormEngine::Form", as: :owner
  8. Configure models to add below association to scope submission records (optional)

    has_one :submission, class_name: "::NeetoFormEngine::Submission", as: :record
  9. Configure model to add below association to attach form (optional)

    has_one :form, class_name: "::NeetoFormEngine::Form", as: :attachable

Customizability

NeetoFormEngine::Customizable::Forms::Createable

The engine supports customizing the default behavior of Forms::CreateService by overriding the supported methods in this concern.

Available methods:

  1. create_default_questions!: If you want to use custom logic to create default questions, you can specify them using this method. owner, form and params will be available globally.
  2. additional_form_params: If you want to include additional attributes while creating forms, you can specify them using this method. It takes one argument params which will be the form parameters passed from the front-end.

NeetoFormEngine::Customizable::Questions::Createable

The engine supports customizing the default behavior of Questions::CreateService by overriding the supported methods in this concern.

Available methods:

  1. create_question!: This method receives one argument params that contains the question parameters passed from the front-end.
  2. additional_question_params: If you want to include additional attributes while creating questions, you can specify them using this method. It takes one argument params which will be the question parameters passed from the front-end.

NeetoFormEngine::Customizable::Questions::Updateable

The engine supports customizing the default behavior of Questions::UpdateService by overriding the supported constants in this concern.

Available constants:

  1. EXCLUDED_UPDATE_PARAMS: If you have included extra parameters other than kind for additional use cases that are not valid entity attributes, they need to be specified as EXCLUDED_UPDATE_PARAMS.

NeetoFormEngine::Customizable::QuestionResponses::Createable

The engine supports customizing the default behavior of QuestionResponses::CreateService by overriding the supported methods in this concern.

Available methods:

  1. additional_initialization_logic: If you want to initialize additional variables, you can specify them using this method.
  2. additional_process_actions: If you want to perform any additional actions outside the transaction block, you can override this method.
  3. additional_create_submission_actions: You can use this method to specify any additional logic that needs to be executed after creating submissions.
  4. additional_create_response_actions: If you want to perform some additional actions on each of the responses, you can specify them using this method. This method receives question and response_param passed from the front-end as arguments.

Set up Google reCAPTCHA

  1. Sign up for an API key pair from the official website.

  2. Configure the following environment variables and secrets with suitable values

    • Under .env file:

      FORM_NANO_RECAPTCHA_V2_SITE_KEY=# Value from Google cloud console
      FORM_NANO_RECAPTCHA_V2_SECRET_KEY=# Value from Google cloud console
    • Under secrets.yml file:

      form_nano:
        recaptcha_v2:
          site_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SITE_KEY"] %>
          secret_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SECRET_KEY"] %>
  3. Include the site key in global_props

    module ApplicationHelper
      def get_client_props
        # other variables
        custom_props = {
          # other props
          form_nano_recaptcha_v2_site_key: Rails.application.secrets.form_nano.dig(:recaptcha_v2, :site_key)
        }
      end
    end

Frontend package

The frontend package allows us to create forms across neeto products.

Installation

  1. Install the NPM package

    yarn add @bigbinary/neeto-form-frontend
  2. The frontend package has a few peer dependencies that are required for the proper functioning of the package. Install all the peer dependencies using the below command:

    yarn add @bigbinary/neetoui @bigbinary/neeto-icons ramda@^0.28.0 classnames@^2.3.1 [email protected] @bigbinary/neeto-commons-frontend react-google-recaptcha
  3. Import stylesheet from the following location:

    @import "@bigbinary/neeto-form-frontend/dist/main.css";

Instructions for development

Check the Frontend package development guide for step-by-step instructions to develop the frontend package.

Usage

You can learn more about the usage here:

  1. Components
  2. Hooks

Instructions for Publishing

Consult the building and releasing packages guide for details on how to publish.