1.1.2 • Published 5 years ago

react-okra v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

React-Okra

This is a react package for implementing Okra enrollment gateway

Dont use yet

There is a cross origin issue with the CDN from Okra. Hopefully it is resolved before you use this package

Installation

$ npm install react-okra
# or
$ yarn add react-okra

Examples

import React from 'react';
import { useOkra, OkraButton } from 'react-okra';

export default function App() {
  const config = {
    env: 'production',
    clientName: 'Chikala',
    callbackUrl: 'www.google.com',
    token: '5d8a35224d8113507c7521ac',
    okraKey: 'c81f3e05-7a5c-5727-8d33-1113a3c7a5e4',
    filter: {
      industry_type: 'all',
      banks: [
        'ecobank-nigeria',
        'fidelity-bank',
        'first-bank-of-nigeria',
        'first-city-monument-bank',
        'guaranty-trust-bank',
        'heritage-bank',
        'polaris-bank',
        'stanbic-ibtc-bank',
        'standard-chartered-bank',
        'sterling-bank',
        'union-bank-of-nigeria',
        'united-bank-for-africa',
        'wema-bank',
        'unity-bank',
        'alat',
        'access-bank',
      ],
    },
    options: {
      fullname: 'USER_FULL_NAME',
      email: 'USER_EMAIL',
      bvn: 'USER_BVN',
    },
    products: ['auth', 'transactions', 'balance', 'income', 'identity'],
  };

  const handleOkraConnection = useOkra(config);

  const okraConfig = {
    ...config,
    text: 'Connect bank with Okra!',
    onSuccess: (response) => {
      console.log(response);
    },
    onClose: () => {},
  };

  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>

      <button
        onClick={() => {
          handleOkraConnection({
            onSuccess: (response) => {
              console.log(response);
            },
            onClose: () => {},
          });
        }}
      >
        Connect bank with Okra
      </button>

      <OkraButton {...okraConfig} />
    </div>
  );
}

OkraOptions

NameTypeRequiredDefault ValueDescription
callback-urlstringtrueundefined
keyStringtrueundefinedYour public key from Okra.
tokenStringtrueundefinedYour token from your Okra Dashboard.
productsArraytrue['Auth']The Okra products you want to use with the widget.
envStringtrueproductionproduction or production-sandbox
client-nameStringfalseThis clientName on the widget
logoString(URL)falseOkra's Logo
colorHEXfalse#3AB795Theme on the widget
limitNumberfalse24Statement length
filterObjectfalseFilter for widget
corporateBoolenfalsefalseCorporate or Individual account
connect-messageStringfalseInstruction to connnect account
guarantorsObjectfalse
widget-successStringfalseWidget Success Message
widget-failedStringfalseWidget Failed Message
currencyStringfalseNGNWallet to bill
expDatefalseWon't expireExpirary date of widget
optionsObjectfalseYou can pass a object custom values eg id
successFunctionfalseAction to perform after widget is successful
closeFunctionfalseAction to perform if widget is closed

Please checkout Okra Documentation for other available options you can add to the tag

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Contributions ✨

  1. Fork it!
  2. Create your feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -am 'Some commit message'
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request

This project follows the all-contributors specification. Contributions of any kind welcome!

Follow on Twitter @somtougeh

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago