1.2.1 • Published 1 month ago

@icomedias/hybridforms-js v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Isomorphic TS/JS Lib (@icomedias/hybridforms-js)

Build status NPM Version standard-readme compliant

A Typescript/Javascript isomorphic library, for use in HybridForms forms and Node.js.

Typedoc: https://icodeveloper.github.io/hybridforms-js/

Table of Contents

Install

  • Node.js 18+ is recommended.

NPM

To install via NPM:

npm install @icomedias/hybridforms-js

Development

To install locally (for development):

git clone https://github.com/IcoDeveloper/hybridforms-js.git
cd hybridforms-js
npm install

Usage

First of all, you need to install the library:

npm install @icomedias/hybridforms-js

Then you're able to import the library and establish the connection with the database:

import { createClient } from '@icomedias/hybridforms-js'

// Create a single HybridForms client for interacting with the API
const hybridforms = createClient({
    baseUrl: 'example.hybridforms.com',
    clientId: '1',
    user: 'test@test.com',
    password: '123456'
})

UMD

You can now use plain <script>s to import hybridforms-js, like:

<script src="hybridforms.min.js"></script>

Then you can use it from a global HybridFormsJS variable:

<script>
    const { createClient } = HybridFormsJS
    const hybridforms = createClient({
        baseUrl: 'example.hybridforms.com',
        clientId: '1',
        user: 'test@test.com',
        password: '123456'
    })

    console.log('HybridForms Instance: ', hybridforms)
  // ...
</script>

Custom xhr implementation

hybridforms-js uses the node-fetch library to make HTTP requests, but an alternative xhr implementation can be provided as an option. This is necessary in HybridForms forms where an authentication is already available:

<script data-hf-src="hybridforms.min.js"></script>
const { createClient } = HybridFormsJS
// Provide a custom `xhr` implementation as an option
const hybridforms = createClient({
    baseUrl: 'example.hybridforms.com',
    clientId: '1',
    xhr: HybridForms.API.XHR.request
})

Contribute

PRs accepted.

If editing the Readme, please conform to the standard-readme specification.

License

MIT License © 2023 icomedias GmbH.

1.2.0

1 month ago

1.2.1

1 month ago

1.1.0

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago