diff --git a/.gitignore b/.gitignore index ed11dbe2..baf38ee9 100644 --- a/.gitignore +++ b/.gitignore @@ -71,7 +71,7 @@ dist/ /ios/Pods/ /vendor/bundle/ -sdk/README.MD +sdk/README.md sdk/LICENSE .local diff --git a/sdk/README.md b/sdk/README.md deleted file mode 100644 index ec6ec932..00000000 --- a/sdk/README.md +++ /dev/null @@ -1,403 +0,0 @@ -

- - - - - Fingerprint logo - - -

-

- - coverage - - - Current NPM version - - - Monthly downloads from NPM - - - - - - Discord server - - - Discord server - -

- -# Fingerprint Pro React Native - -[Fingerprint](https://fingerprint.com/) is a device intelligence platform offering industry-leading accuracy. -Fingerprint Pro React Native SDK is an easy way to integrate Fingerprint Pro into your React Native -application to call the native Fingerprint Pro libraries (Android and iOS) and identify devices. - -## Table of contents - -- [Fingerprint Pro React Native](#fingerprint-pro-react-native) - - [Table of contents](#table-of-contents) - - [Requirements and limitations](#requirements-and-limitations) - - [Dependencies](#dependencies) - - [How to install](#how-to-install) - - [Expo setup](#expo-setup) - - [1. Add config plugin](#1-add-config-plugin) - - [2. Rebuild the native code](#2-rebuild-the-native-code) - - [3. Rebuild the app](#3-rebuild-the-app) - - [Bare react-native](#bare-react-native-setup) - - [1. Configure iOS dependencies (if developing on iOS)](#1-configure-ios-dependencies-if-developing-on-ios) - - [2. Configure Android dependencies (if developing on Android)](#2-configure-android-dependencies-if-developing-on-android) - - [Usage](#usage) - - [Hooks approach](#hooks-approach) - - [API Client approach](#api-client-approach) - - [Response format](#response-format) - - [Error handling](#error-handling) - - [Linking and tagging information](#linking-and-tagging-information) - - [API Reference](#api-reference) - - [Additional Resources](#additional-resources) - - [Support and feedback](#support-and-feedback) - - [License](#license) - -## Requirements and limitations - -- React Native 0.80 or higher is supported (New Architecture only) -- Expo 54.0.0 or higher is supported -- Android 7.0 (API level 24+) or higher -- iOS 15.1+/tvOS 15.1+, Swift 5.9 or higher (stable releases) - -- Fingerprint Pro [request filtering](https://dev.fingerprint.com/docs/request-filtering) is not supported right now. Allowed and forbidden origins cannot be used. - -## Dependencies - -- [Fingerprint Pro iOS](https://github.com/fingerprintjs/fingerprintjs-pro-ios) -- [Fingerprint Pro Android](https://github.com/fingerprintjs/fingerprintjs-pro-android) - -## How to install - -Install the package using your favorite package manager: - -- [NPM](https://npmjs.org): - - ```shell - npm install @fingerprint/react-native --save - ``` - -- [Yarn](https://yarnpkg.com): - - ```shell - yarn add @fingerprint/react-native - ``` - -- [PNPM](https://pnpm.js.org): - ```shell - pnpm add @fingerprint/react-native - ``` - -## Expo setup - -> ℹ️ Our SDK cannot be used in [Expo Go](https://expo.dev/go) because it requires custom native code. - -
-Web support -To use the SDK on the web, install the peer dependency with your preferred package manager: - -- [NPM](https://npmjs.org): - - ```shell - npm install @fingerprint/agent --save - ``` - -- [Yarn](https://yarnpkg.com): - - ```shell - yarn add @fingerprint/agent - ``` - -- [PNPM](https://pnpm.js.org): - ```shell - pnpm add @fingerprint/agent - ``` - -Then, use the SDK as you would with the native version. -
- -### 1. Add config plugin -```json -{ - "expo": { - "plugins": [ - "@fingerprint/react-native" - ] - } -} -``` - -### 2. Rebuild the native code -```bash -npx expo prebuild --clean -``` - -### 3. Rebuild the app -For Android: -```bash -npx expo run:android -``` - -For iOS: -```bash -npx expo run:ios -``` - -## Bare react-native setup - -### 1. Configure iOS dependencies (if developing on iOS) - -```shell -cd ios && pod install -``` - -### 2. Configure Android dependencies (if developing on Android) - -Add the repositories to your Gradle configuration file. The location for these additions depends on your project's structure and the Gradle version you're using: - -You likely manage repositories in the `dependencyResolutionManagement` block in `{rootDir}/android/settings.gradle`. Add the Maven repositories in this block: - -```groovy -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) - repositories { - google() - mavenCentral() - maven { - url("https://maven.fpregistry.io/releases") // Add this - } - } -} -``` - -## Usage - -To identify visitors, you need a Fingerprint Pro account (you can [sign up for free](https://dashboard.fingerprint.com/signup/)). - -- Go to [the Fingerprint Pro dashboard](https://dashboard.fingerprint.com/). -- Open **App Settings** > **API Keys** to find your Public API key. - -### Hooks approach - -Configure the SDK by wrapping your application in `FingerprintProvider`. - -> ⚠️ **Important**: Applications should create only one client across the entire app, either through `FingerprintProvider` or through the API client (`start()`). If you create another client, it will overwrite the underlying native client of the first one. - -```javascript -// src/index.js -import React from 'react'; -import { AppRegistry } from 'react-native'; -import { FingerprintProvider } from '@fingerprint/react-native'; -import App from './App'; -import { name as appName } from './app.json'; - -const WrappedApp = () => ( - - - -) - -AppRegistry.registerComponent(appName, () => WrappedApp); -``` - -Use the `useVisitorData` hook in your components to perform visitor identification and get the data. - -```javascript -// src/App.js -import React from 'react' -import {Button, SafeAreaView, Text, View} from 'react-native' -import {useVisitorData} from '@fingerprint/react-native' - -export default function App() { - const {isLoading, isFetched, error, data, getData} = useVisitorData() - - return ( - - -