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

@onereach/webform

v0.3.12

Published

Content Builder includes several views for: - Content builder view itself; - Web Form view; - Slack block-kit builder;

Downloads

198

Readme

Content Builder App

Content Builder includes several views for:

  • Content builder view itself;
  • Web Form view;
  • Slack block-kit builder;

Structure of project source:

  • ./src/assets - scss, fonts, images files (static stuff)

  • ./src/components - for each view / channel create specific folder. You could use components from common folder in any view or component
    📦 components
    ┣ 📂 common
    ┣ 📂 content-builder
    ┣ 📂 slack
    ┗ 📂 webform

  • ./src/constants - labels and texts constants.
    // TODO - all labels and text have to be brought to constants

  • ./src/data - Static data. Channels components structure.

alt text

{
  "web": [
    {
      "type": "input", // name of auto imported component field.
      "props": {
        "icon": "input", // (1) name of icon from https://material.io/
        "label": "Input", // (2) just a visible lable for user
        "helpText": "Input element", // (3) help text (visible on hover)
        "codeMode": true // (4) ability to use codemode for one field
      }
    },
    ...
  ],
  "slack": [
    ...
  ],
  ...
}
  • ./src/helpers - just js helpers.

  • ./src/mixins - just vue helpers mixins.

  • ./src/router - just Vue router (https://router.vuejs.org/). If you want to create a new view, don't forget to add the path to the router and restart dev server.

  • ./src/store - app vuex.

  • ./src/utils - just js helpers. // TODO merge this folder with helpers.

  • ./src/views - this app is created for several projects which connected to content builder.

  • ./src/lib.js - this file create wrapper around webform view and published as npm package for usage as library in html scripts or in vue / reac component.

// Sample of usage of webform
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <!-- Google icons css file -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body> 
  <!-- Container for rendering app -->
  <div id="form"></div>

  <!-- Sample of submit button -->
  <div>
    <button id="submitButton">
      Submit
    </button>
  </div>
 
  <!-- Webform script -->
  <script src="https://unpkg.com/@onereach/webform@latest"></script>

  <script>
    // You can use this app in simple html file or any js component
    const options = {
      selector: '#form',
      formUrl: 'https://cbuilder.staging.onereach.ai/webform/3da948b0-15cc-459e-8dae-a6673d0b2b40/ZGIwMTc3MTctN2UwYy00ZmJlLWI0NjYtZDQwMTc1ZDM3MTNm',
      hideSubmitButton: false // show or hide submit button in webform App
    }

    // Create new instance and pass options
    const form = new oneReachWebForm.default(options);

    // Callbacks for events
    const loaded = () => {
      console.log('Loaded');
    }

    const onSubmit = () => {
      console.log('onSubmit');
    }

    const onSubmitSuccess = ({ result, formData }) => {
      console.log('onSubmitSuccess', { result, formData });
    }

    const onSubmitError = (error) => {
      console.log('onSubmitError', error);
    }

    // Subscrine on events
    form.on('on-webform-loaded', loaded);
    form.on('on-webform-submit', onSubmit);
    form.on('on-webform-submit-success', onSubmitSuccess);
    form.on('on-webform-submit-error', onSubmitError);

    // Emit event
    const submitButton = document.querySelector('#submitButton');
    submitButton.addEventListener('click', () => {
      form.emit('emit-webform-submit')
    })
  </script>
</body>
</html>
  • ./src/main.ts - app start point. We try to integrate ts. // TODO: intergate ts to components.

Dev process

  1. npm install
  2. npm run dev (served dev and dev:lib)

or

  1. or run [env] .

Build process

  1. npm run build - build lib and app files
  2. If you want to update lib version, in package.json increment version and run command: npm publish

Deploy

  1. or deploy [env] .