1.0.8 • Published 1 year ago

@blissapi/react-connect v1.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

BlissAPI Connect For React

Allow your users to quickly integrate with several services with BlissAPI. The @blissapi/react-connect introduces an easy-to-use React hook for integrating with your web app.

Install

# NPM
npm install --save @blissapi/react-connect

# Yarn
yarn add @blissapi/react-connect

Usage

Use React hook to start the Connect flow. Listen to the callbacks to know when an account has been linked or whether the flow has been cancelled. The callback will give you the information about the account added/updated - you may also retrieve this information by using webhooks or the API.

import { useBlissConnect } from '@blissapi/react-component';

const LinkAccountButton = () => {
  const { startConnect } = useBlissConnect();

  const startFlow = useCallback(async () => {
    const sessionToken = await retrieveConnectSessionToken();
    startConnect({ sessionToken });
  }, [startConnect]);

  return (
    <button onClick={startFlow}>Connect Account</button>
  );
};

Connect Options

When starting the flow, you may pass a few options:

const { startConnect } = useBlissConnect();

startConnect(options)
NameTypeRequiredDescription
sessionTokenstringYesConnect session token created in the backend. The session token allows users to manage their accounts in the frontend. You may limit a connect session token to selected categories or to a given service
apiUrlstringNoWhich API instance should it connect to. It will automatically infer it from your connect session.
onSuccess(account)functionNoCalled when an account is successfully linked. The account param gives you information about the linked account.
onCancel()functionNoCalled when the connect flow is closed without an account being linked.
onClose()functionNoCalled every time the connect flow is closed regardless of whether an account has been linked or not.
1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago