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

mg-forms

v0.1.0

Published

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

Downloads

1

Readme

This project was bootstrapped with Create React App.

MG-Forms

Application web et plugin Javascript permettant la création de pop-ups de devis / qualification / leadgen sur mesure.

Les données de structure des formulaires et méta-données sont persistées sur l'API de Contentful : https://app.contentful.com/spaces/n3fqi1ufw4d2

L'application Web utilise l'API contentful-management qui permet de manipuler les ressources : https://contentful.github.io/contentful-management.js/contentful-management/5.11.0/

Le script JS, quant à lui, utilise le SDK contentful content delivery : https://contentful.github.io/contentful.js/contentful/7.10.0/

Pré-requis

  • Node.JS
  • Yarn

Dépendances majeures

  • React (Create-React-App)
  • Bootstrap (Reactstrap)
  • PropTypes

Available Scripts

yarn start

Lance l'admin en mode développement (auto-reload, non-minifié, etc.). Par défaut, utilise le port 3000. Par défaut lancé en HTTPS (requis pour le SSO Contentful).

yarn build

L'action build va lancer en parallèle les actions build:app et build:sdk. Les deux vont écrire dans le répertoire /build.

Testing

Une page /tester.html permet de tester le fonctionnement du SDK.

SDK API

Le SDK déclare une classe MGFormLoader sur l'objet window. Cette classe est instanciée avec les paramètres suivant :

const loader = new MGFormLoader({
  contentfulParams: {
    space: "n3fqi1ufw4d2",
    accessToken: "byDuC5n8v18DCyMknlbwDS6nDuRO3Hrl-LF1lsySwos"
  },
  userId: "ft1xqb2345",
  onReady: function() {}
});

Attention pour Contenful, l'accessToken correspond à une API key pour l'API content-delivery (Settings / API Keys)

Cette classe est responsable de la récupération des configurations de formulaires sur Contentful et détermine, en fonction de la pondération des différents formulaires, quel formulaire afficher.

Une fois le FormLoader instancié, celui-ci expose une méthode createForm qui prend les paramètres suivants :

loader.createForm({
  type: 'express',
  onStepEvent: function(event) {
    console.info("Step Event", event);
  },
  onComplete: function(value) {
    console.info("Form Complete", value);
  },
  onChange: function(value) {
    console.info("Form value Change", value);
  },
  onMount: function() {
    console.info("Form mounted");
  },
  value: {
    product_id: 1234
  },
  container: document.getElementById("mount")
});