npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@front-finance/frontfinance-rn-sdk

v1.3.8

Published

Front Finance React Native SDK.

Downloads

72

Readme

Front Finance React Native SDK

📌 Deprecation Notice

As of Dec 7, 2023 this package is no longer maintained and has been superseded by a new version. For the latest features, improvements, and bug fixes, please use our updated package: mesh-react-native-sdk.

We encourage all users to migrate to the new package for continued support and updates.

Install

With npm:

npm install --save @front-finance/frontfinance-rn-sdk

With yarn:

yarn add @front-finance/frontfinance-rn-sdk

💡 This package requires react-native-webview to be installed in your project. Although it is listed as direct dependency, some times it is not installed automatically (This is a known npm issue). You should install it manually via following command in this case:

npm install --save [email protected]

# or with yarn
yarn add [email protected]

Connect through linkToken

The connection link token should be obtained from the Get link token endpoint. Request must be performed from the server side because it requires the client secret. You will get the response in the following format: You should use content --> linkToken from this response to run the FrontFinance component.

here is an example http request using request API in JS:

const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/*+json',
    'X-Client-Secret': 'XXXX', // replace with your client secret
    'X-Client-Id': 'XXXX' // replace with your client id
  },
  body: '{"userId":"XXXX"}' // replace with your user id (could be user email or phone number)
};

const getLinkToken = async () => {
  const response = await fetch('https://integration-api.getfront.com/api/v1/linktoken', options);
  const json = await response.json();
  return json?.content?.linkToken;
};

You will get a response in the following structure:

{
  "content": {
    "linkToken": "REQUESTED_LINK_TOKEN"
  },
  "status": "ok",
  "message": "",
  "errorType": ""
}

Using the FrontFinance component

import React from 'react';
import {
  FrontFinance,
  FrontPayload,
  TransferFinishedPayload,
  TransferFinishedSuccessPayload,
  TransferFinishedErrorPayload
} from '@front-finance/frontfinance-rn-sdk';

export const App = () => {
  return (
    <FrontFinance
      linkToken={"YOUR_LINKTOKEN"}
      onBrokerConnected={(payload: FrontPayload) => {
        // use broker account data
      }}
      onTransferFinished={(payload: TransferFinishedPayload) => {
        if (payload.status === 'success') {
          const successPayload = payload as TransferFinishedSuccessPayload
          // use transfer finished data
        } else {
          const errorPayload = payload as TransferFinishedErrorPayload
          // handle transfer error
        }
      }}
      onClose={() => {
        // use close event
      }}
      onError={(err: string) => {
        // use error message
      }}
    />
  )
}

export default App;

ℹ️ See full source code examples at examples/.

FrontFinance component arguments

| key | type | Required/Optional | description | |----------------------|-------------------------------------------------|-------------------------------------------|-------------------------------------------------------------------------------| | url | string @deprecated (use linkToken instead) | required (if linkToken is not provided) | Connection catalog link | | linkToken | string | required | link token | | onBrokerConnected | (payload: FrontPayload) => void | optional | Callback called when users connects their accounts | | onTransferFinished | (payload: TransferFinishedPayload) => void | optional | Callback called when a crypto transfer is executed | | onError | (err: string) => void) | optional | Called if connection not happened. Returns an error message | | onClose | () => void | optional | Called at the end of the connection, or when user closed the connection page |

Using tokens

You can use broker tokens to perform requests to get current balance, assets and execute transactions. Full API reference can be found here.

Typescript support

Typescript definitions for @front-finance/frontfinance-rn-sdk are built into the npm package.