1.4.2 • Published 2 years ago

christotle-connect v1.4.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Zeeh Connect-js

Zeeh Connect is a drop-in framework that handles connecting a financial institution to your app (e.g credential validation, multi-factor authentication, error handling, etc). It works with all major javascript frameworks. Zeeh Connect-js is simply a quick and secure way to link bank accounts to Zeeh from within your app.

If you are longing to acessss customer accounts (Identity, Transactions, etc) and wants to interact with Zeeh's API , please read the documentation on how to use the server-side Zeeh API.

Documentation

For a complete information about Zeeh Connect-js, click here to read our comprehensive documentation to that regards.

Requirements

Node 10 or higher.

Getting Started

  1. Register/Sign-up on the Zeeh website and get your *public and secret keys. (This publicKey is required in setting up the Zeeh Connect-js Widget)

  2. Create an App with the *company name of your choice that your want your customers to be linking to. (This companyName is also required in setting up the Zeeh Connect-js Widget). Please read more here creating an App.

Installation

To install the package you can use NPM or Yarn;

npm install zeeh-connect-js

or

yarn add zeeh-connect-js

Then import it into your project;

import ZeehConnect from 'zeeh-connect-js'

Usage

Click the links below for detailed examples on how to use zeeh-connect-js with your favourite framework;

Reactjs Example:

import React from 'react';
import './App.css';
import ZeehConnect from 'zeeh-connect-js';

export default function App() {
  const zeehConnect = React.useMemo(() => {
    const zeehInstance = new ZeehConnect({
      onLoad: () => console.log('Widget loaded successfully'),
      onClose: () => console.log('Widget closed'),
      companyName: "fastmoney", //name associated with publicKey used in registering the app at Zeeh Dashboard
      key: "pk_jYaWseQlVJ9FNN5849700SPcU" //publicKey gotten from app at Zeeh Dashboard
    })

    zeehInstance.setup()
    
    return zeehInstance;
  }, [])

  return (
    <div className='App'>
      <h1>React.js SDK Testing Ground</h1>
      <button onClick={() => zeehConnect.open()}>
        Link account with Fast Money
      </button>
    </div>
  )
}

NOTE
The list above is not exhaustive, you can also use this package in other frontend javascript frameworks.

Parameters

key

Required
This is your Zeeh public API key from the Zeeh dashboard gotten from the App you intend to use in onboarding your customers.

new ZeehConnect({ key: 'zeeh_public_key' });

companyName

Required
This is otherwise the appName accociated with the App you intend to use in onboarding your customers. (you might have more than one app for different purpose - e.g Connect, KYC etc - hense, you need both the companyName & publicKey to set-up the Zeeh Connect-js Widget.

new ZeehConnect({ companyName: 'app_name' });

onLoad

This function is invoked when the widget has been mounted unto the DOM. You can handle toggling your trigger button within this callback.

new ZeehConnect({
  key: 'zeeh_public_key',
  companyName: 'app_name',
  onLoad: () => console.log("widget loaded successfully")
});

onClose

The optional closure is called when a user has specifically exited the Zeeh Connect-js flow (i.e. the widget is not visible to the user). It does not take any arguments.

new ZeehConnect({
  key: 'zeeh_public_key',
  companyName: 'app_name',
  onClose: () => console.log("widget has been closed")
});

onEvent

This optional function is called when certain events in the Zeeh Connect-js flow have occurred, for example, when the user selected an institution. This enables your application to gain further insight into the Zeeh Connect onboarding flow.

See the data object below for details.

new ZeehConnect({
  key: 'zeeh_public_key',
  companyName: 'app_name',
  onEvent: (eventName, data) => {
    console.log(eventName);
    console.log(data);
  }
});

API Reference

setup(config: object)

This method is used to load the widget onto the DOM, the widget remains hidden after invoking this function until the open() method is called.

const connect = new ZeehConnect({
  key: 'zeeh_public_key',
  companyName: 'app_name',
  onLoad: () => console.log("widget loaded successfully"),
  onClose: () => console.log("widget has been closed"),
  onEvent: (eventName, data) => {
    console.log(eventName);
    console.log(data);
  },
  reference: "random_string"
});

connect.setup(config);

open()

This method makes the widget visible to the user.

const connect = new ZeehConnect({
  key: 'zeeh_public_key',
  companyName: 'app_name',
  onLoad: () => console.log("widget loaded successfully"),
});

connect.setup();
connect.open();

close()

This method programatically hides the widget after it's been opened.

const connect = new ZeehConnect({
  key: 'zeeh_public_key',
  companyName: 'app_name',
  onClose: () => console.log("widget has been closed"),
});

connect.setup();
connect.open();

// this closes the widget 5seconds after it has been opened
setTimeout(() => connect.close(), 5000)

onEvent Callback

The onEvent callback returns two paramters, eventName a string containing the event name and data an object that contains event metadata.

const connect = new ZeehConnect({
  key: 'zeeh_public_key',
  companyName: 'app_name',
  onEvent: (eventName, data) => {
    if(eventName == "OPENED"){
      console.log("Widget opened");
    }else if(eventName == "INSTITUTION_SELECTED"){
      console.log("Selected institution: "+data.institution.name);
    }
    console.log(eventName)
    console.log(data)
  }
});

eventName

Event names corespond to the type key returned by the raw event data. Possible options are in the table below.

Event NameDescription
OPENEDTriggered when the user opens the Connect Widget.
EXITTriggered when the user closes the Connect Widget.
INSTITUTION_SELECTEDTriggered when the user selects an institution.
ACCOUNT_LINKEDTriggered when the user successfully links their account.
ERRORTriggered when the widget reports an error.

Support

If you're having general trouble with Zeeh Connect-js or your Zeeh integration, please reach out to us at support@zeeh.africa or come chat with us on Slack. We're proud of our level of service, and we're more than happy to help you out with your integration to Zeeh.

Contributing

If you find any issue using this package please let us know by filing an issue right here.

If you would like to contribute to the Zeeh Connect-js, please make sure to read our contributor guidelines.

License

MIT for more information.

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.3.7

2 years ago

1.2.8

2 years ago

1.1.9

2 years ago

1.3.6

2 years ago

1.2.7

2 years ago

1.1.8

2 years ago

1.3.5

2 years ago

1.2.6

2 years ago

1.1.7

2 years ago

1.3.4

2 years ago

1.2.5

2 years ago

1.1.6

2 years ago

1.4.2

2 years ago

1.3.3

2 years ago

1.2.4

2 years ago

1.1.5

2 years ago

1.4.1

2 years ago

1.3.2

2 years ago

1.2.3

2 years ago

1.1.4

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.2.2

2 years ago

1.1.3

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.3.9

2 years ago

1.3.8

2 years ago

1.2.9

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago