0.3.12 ā€¢ Published 4 months ago

@onereach/webform v0.3.12

Weekly downloads
12
License
UNLICENSED
Repository
-
Last release
4 months ago

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

2) 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] .

0.3.12

4 months ago

0.0.38-alpha.27

2 years ago

0.3.11

2 years ago

0.3.10

2 years ago

0.0.38-alpha.26

3 years ago

0.0.38-alpha.41

3 years ago

0.0.38-alpha.40

3 years ago

0.3.9

3 years ago

0.3.8

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.0.38-alpha.24

3 years ago

0.0.38-alpha.25

3 years ago

0.0.38-alpha.23

3 years ago

0.3.2

3 years ago

0.0.38-alpha.22

3 years ago

0.0.38-alpha.21

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.0.38-alpha.20

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.0.38-alpha.16

3 years ago

0.1.3

3 years ago

0.1.5

3 years ago

0.0.38-alpha.15

3 years ago

0.0.38-alpha.14

3 years ago

0.1.2

3 years ago

0.0.38-alpha.13

3 years ago

0.1.1

3 years ago

0.0.38-alpha.12

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.41

3 years ago

0.0.38-alpha.11

3 years ago

0.0.40

3 years ago

0.0.39

3 years ago

0.0.39-beta.1

3 years ago

0.0.38-beta.2

3 years ago

0.0.38-alpha.2

3 years ago

0.0.38-alpha.3

3 years ago

0.0.38-alpha.8

3 years ago

0.0.38-alpha.9

3 years ago

0.0.38-alpha.6

3 years ago

0.0.38-alpha.7

3 years ago

0.0.38-alpha.4

3 years ago

0.0.38-alpha.5

3 years ago

0.0.38-alpha.10

3 years ago

0.0.38

3 years ago

0.0.38-alpha.1

3 years ago

0.0.38-delta

3 years ago

0.0.38-beta.0

3 years ago

0.0.37

3 years ago

0.0.35

3 years ago

0.0.36

3 years ago

0.0.34

3 years ago

0.0.33

3 years ago

0.0.30

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.24

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.18-beta.0

3 years ago

0.0.18-beta1.0

3 years ago

0.0.18-beta2.0

3 years ago

0.0.18-beta3.0

3 years ago

0.0.18-beta4.0

3 years ago

0.0.18-beta5.0

3 years ago

0.0.19-beta-6.0

3 years ago

0.0.19-beta-7.0

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.11

3 years ago

0.0.11-alpha.0

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago