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

react-native-tink-sdk

v0.0.38-beta

Published

NPM package for wrapping Tink SDKs

Downloads

2,635

Readme

react-native-tink-sdk

This project contains the RN NPM package for Open Banking with Tink Link SDK and Tink's Money Manager SDK.

Current version of Tink Link SDK used: 2.5.0(Android), 2.3.0(iOS)

Current version of Tink Money Manager SDK used: 1.1.4(Android), 1.3.0(iOS)

Tink Link SDK will be used to connect to bank accounts for continous access - Tink Transactions

Find the official method documentation here:

Android

iOS

Installation

npm install react-native-tink-sdk

Usage of Tink Link SDK

Step 1 and 2 are important for the deeplink configuration for the Tink Link SDK to redirect correctly to your application after finishing the account aggregation flow in external browser or bank app.

Step 1 - Add ConnectAccountActivity in app's AndroidManifest.xml file.

Add ConnectAccountActivity to your application's AndroidManifest file like this:

<activity
    android:name="com.reactnativetink.activity.ConnectAccountActivity"
    android:exported="true"
    android:launchMode="singleInstance">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data
            android:host="wallet"
            android:scheme="pxsplus" />
    </intent-filter>
</activity>

Step 2 - Add deeplink for iOS in your App's plist file.

Make sure to add this deeplink pxsplus://wallet in your application's plist file like this:

<array>
	<dict>
		<key>CFBundleTypeRole</key>
		<string>Editor</string>
		<key>CFBundleURLName</key>
		<string>pxsplus</string>
		<key>CFBundleURLSchemes</key>
		<array>
			<string>pxsplus</string>
		</array>
	</dict>
</array>

Step 2 - Call the function

import { connectAccount } from 'react-native-tink-sdk';

const result = await connectAccount(clientId, redirectUri, authorizationCode, market, locale);
 

where,

  • clientId - client ID retrieved from Tink Console.
  • redirectUri - configured in Tink Console - the page to which the end-user is redirected, along with the response parameters, when completing the flow.
  • authorizationCode - the authorization code generated using API's.
  • market - The market code for which providers should be listed.
  • locale - Locale to be used for end-user facing text.

connectAccount will return the credentialsId in case of success and will return an object of type TinkLinkError from react-native-tink-sdk in case of error scenario. See TinkLinkError

Usage of Money manager SDK

Step 1 - Initialize the SDK(Only for Android)

import { initTink } from 'react-native-tink-sdk';

const result = await initTink(clientId);
 

where,

  • clientId - client ID retrieved from Tink Console.

Note:

initTink should be called only once. If Tink has already been initialized, it throws an IllegalStateException.

Step 2 - Add the MoneyManagerFinanceOverview view

Currently this is available for Android and iOS. Due to certain issues found in Android, we recommended to use this only for iOS and for Android please use Step 3.

import { MoneyManagerFinanceOverview } from 'react-native-tink-sdk';

 <MoneyManagerFinanceOverview
    style={{
        height: windowHeightOS,
        width: windowWidthOS,
    }}
    clientId={clientId}
    accessToken={accessToken}
    userPressedBack={() => {
        Alert.alert('React-Native event popup', 'Event triggered: userPressedBack');
    }} 
    />

where,

  • style - width and height for the component needs to be passed. This will be taken effect in Andriod only. In iOS, the entire length and width will be taken.
  • clientId - client ID retrieved from Tink Console.
  • accessToken - Access token created with the help of authorization-grant, from the endpoint oauth/token.
  • userPressedBack - This callback method will be invoked when user press the back button. Only for iOS.

Events

To access event data, you will need to use e.nativeEvent. For example, onPress={e => console.log(e.nativeEvent)} will log the entire event object to your console.

| Event Name | Returns | Notes |---|---|---| | userPressedBack | | Callback that is called when user click on back (arrow) button.

Step 3 - Open the finance overview in Money manager

import { showMoneyManager } from 'react-native-tink-sdk';

showMoneyManager(clientId, accessToken).then((message) => {
        console.log(message)
        Alert.alert('Promise resolved', 'userPressedBack');
    }).catch((error) => {
        console.log(error)
    })
 

where,

  • clientId - client ID retrieved from Tink Console.
  • accessToken - Access token created with the help of authorization-grant, from the endpoint oauth/token.

The promise will be resolved when user press on back button on Financial overview.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

ChangeLog

See the ChangeLog here

Running tests

yarn run test

Make sure the code coverage is 90+% before committing the code!

Running code quality check

yarn run tsc
yarn run lint
yarn run check_code:native

Make sure there are no flow errors before committing!

Running the build

npm run build

Publishing

npm publish

Make sure to run the build before publishing (the published code is in the lib folder)!

Example App

To run the app see instructions here

How to update translations for Budget manager SDK

The translations inside budget manager can be customized. If need to change any translations, you can find them in the below files:

- Android

EN: android/src/main/res/values/strings.xml

FR: android/src/main/res/values-fr/strings.xml

NL: android/src/main/res/values-nl/strings.xml

DE: android/src/main/res/values-de/strings.xml

- iOS

EN: ios/Resources/en.lproj/TinkMoneyManagerUI.strings

FR: ios/Resources/fr.lproj/TinkMoneyManagerUI.strings

DE: ios/Resources/de.lproj/TinkMoneyManagerUI.strings

NL: ios/Resources/nl.lproj/TinkMoneyManagerUI.strings

- Tink reference doc for adding translations:

Android : https://github.com/tink-ab/tink-money-manager-android/blob/master/string-customization-guide.md

iOS : https://github.com/tink-ab/tink-money-manager-ios/blob/master/LOCALIZABLE_STRINGS.md