npm.io
1.1.1 • Published 2 years ago

@getrollee/connect-react-native-sdk

Licence
MIT
Version
1.1.1
Deps
0
Size
47 kB
Vulns
0
Weekly
0

RolleeLogo

Rollee Connect React Native SDK

Rollee Connect SDK is a plugin for integrating Rollee Connect process into WEB or mobile applications.

Change Log

v1.1.1

  • adding performance layer for Android
v1.1.0

==Breaking changes - Important!==

  • adding customizationId parameter to configuration
  • removing setup parameter from configuration
  • removing token parameter from configuration
v1.0.6
  • update configuration fixes
v1.0.5
  • onLoginSuccess callback added
v1.0.4
  • supporting multiple session customization
v1.0.3
  • bug fixing
v1.0.2
  • update documentation
v1.0.0

==Breaking changes - Important!==

  • you should use token instead of apiKey, parnterUUID and parnterName
  • updated to typescript
  • exported types
v0.1.3
  • bug fixes
v0.1.2
  • bug fixes
v0.1.1
  • added param for skipping datasources page
  • added param for removing "Close button" at header
  • improved "onCompleted" callback
  • other bug fixes
v0.1.0
  • bug fixes
v0.0.9
  • updated React Native version to 0.68.2
v0.0.8
  • Added "datasource" param for pre-selecting data source and skip "Search" screen
v0.0.7
  • Fixed form view on software keyboard opened
v0.0.6
  • Added new callback "onClose" when user confirm closing the Rollee Connect process.
v0.0.5
  • Added support for providing sessionToken to match one session
  • added sessionToken in "completed" callback
  • other fixes

Installation

Create a sample Expo project with typescript

$ expo init YourReactNativeProject -t expo-template-blank-typescript

Add Rollee Connect SDK

$ npm install --save @getrollee/connect-react-native-sdk

Usage

The RolleeConnect component is a view that you can integrate into your app's flow. The CONFIG and optional callback handlers are passed in as props.

import RolleeConnect from "@getrollee/connect-react-native-sdk";
.
.
.
<RolleeConnect config={CONFIG} onCompleted={onCompleted} onClose={onClose} />

Callbacks

When you want to exit from Rollee Connect back to your application or to get information when user completed flow, you should use onClose and onCompleted callbacks

const onClose = () => {
    console.log('onClose');
};

const onCompleted = (data) => {
    console.log('onCompleted', data);
};

Configuration

To define a User Session on Rollee Connect, you must provide the mandatory parameter sessionToken.

The production and customizationId parameters are optional.

If production parameter is not defined, it will be fallback to false and the SDK will use the sandbox environment.

The minimal configuration for setting up RolleeConnect component:

const CONFIG = {
  sessionToken: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
};

The optional configuration for setting up RolleeConnect component:

const CONFIG = {
  sessionToken: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
  production: false,
  customizationId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
};

Setup paramteres description

Param Description
sessionToken String - defining user session on Rollee Connect application
production Boolean - parameter for switching between sandbox and production env
customizationId String - parameter for adding customization defined in Rollee Dashboard

Keywords