2.6.2 • Published 2 days ago

flourish-sdk-react-native v2.6.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

Flourish React Native SDK

This React Native library will allow the communication between the visual implementation of Flourish functionality.

Table of contents

Getting Started


Adding Flourish to your project

In your project's package.json file, add the last version of Flourish Flutter SDK to your dependencies.

"dependencies": {
  "flourish-sdk-react-native": "*.*.*"
}

or install directly from terminal using npm or yarn

npm install flourish-sdk-react-native
yarn add flourish-sdk-react-native

SDK internal requirements

To use this SDK, you will need these elements:

  • partnerId: a unique identifier that will be provided by Flourish
  • secret: a string that represents a key, also provided by Flourish
  • language: a string that will represents witch language will be used (en, es, pt)

This plugin can be run in two different environments:

  • staging: In this environment, you can test the functionality without impacting any real data
  • production: this environment is for running the app with the real data

About the SDK

The integration with us works as follows, the client authenticates himself in our backend and we return an access token that allows him to load our webview, given that, the sdk serves to encapsulate and help in loading this webview.

Using the SDK


First foremost, it is necessary to initialize the SDK providing the variables: partnerId, secret, env, language and customer_code.

You can also pass a category this one isn't required.

  import { initialize } from 'flourish-sdk-react-native';

  const partnerId = process.env.PARTNER_ID;
  const partnerSecret = process.env.PARTNER_SECRET;
  const language = process.env.LANGUAGE;
  const environment = process.env.ENVIRONMENT;
  const customerCode = 'YOUR-CUSTOMER-CODE';
  const category = 'CATEGORY-VALUE';

  initialize(partnerId, partnerSecret, language, environment, customerCode, category);

Finally after initialization, you will be able to import and adding our Flourish component inside your screen, but remember that all our functionalities are displayed through a webview.

  import Flourish from 'flourish-sdk-react-native';

  return (
    <Flourish/>
  );

EVENTS


You can register for some events to know when something happens within our platform.

Listen all our events

To listen all our events, you will pass a generic callback function to our Flourish component when you add it to your screen.

import Flourish from 'flourish-sdk-react-native';

const genericEventCallback = (data: string): void => {
  console.log('Event Client side', data);
};

const RewardsScreen = () => {
  return <Flourish genericEventCallback={genericEventCallback} />;
};

Listen only to a specific event

To listen to only a specific event you will pass a function to an attribute referring to the event you want to listen to.

For example, if you want to be notified when a Trivia game ends, you can pass a callback function in the attribute called: "triviaGameFinishedEventCallback"

import Flourish from 'flourish-sdk-react-native';

const triviaGameFinishedEventCallback = (data: string): void => {
  console.log('Event Client side', data);
};

const RewardsScreen = () => {
  return (
    <Flourish
      triviaGameFinishedEventCallback={triviaGameFinishedEventCallback}
    />
  );
};

Events to listen

here you have all events we will return

Event nameDescription
BACK_BUTTON_PRESSEDWhen you need to know when the user clicks on the back menu button on our platform.
HOME_BACK_BUTTON_PRESSEDWhen you need to know when the user clicks on the back menu button when on the home screen of our platform.
MISSION_ACTIONWhen you need to know when the user clicks on a mission card
TRIVIA_GAME_FINISHEDWhen you need to know when the user finishes a Trivia game on our platform.
TRIVIA_CLOSEDWhen you need to know when the user closed the Trivia game on our platform.
GIFT_CARD_COPYWhen you need to know when the user copy the Gift code to the clipboard area.
REFERRAL_COPYWhen you need to know when the user copy the referral code to the clipboard area.
HOME_BANNER_ACTIONWhen you need to know when the user clicks on the home banner.
ERRORWhen you need to know when a error happened.

Examples


Inside this repository, you have an example app to show how to integrate with us:

https://github.com/Flourish-savings/flourish-sdk-react-native/tree/main/example

2.6.2

2 days ago

2.6.2-candidate

6 days ago

2.6.1

2 months ago

2.6.0

2 months ago

2.5.0

3 months ago

2.4.1

3 months ago

2.4.0

3 months ago

2.3.2

5 months ago

2.3.1

6 months ago

2.3.0

7 months ago

2.2.1

8 months ago

2.2.0

8 months ago

2.2.2

7 months ago

2.1.1

9 months ago

2.0.0-17

10 months ago

2.0.3

9 months ago

2.0.2

9 months ago

2.1.0

9 months ago

2.0.1-17

10 months ago

1.3.7

11 months ago

1.2.8

12 months ago

1.2.7

12 months ago

1.3.5

11 months ago

1.2.6

12 months ago

1.4.3

11 months ago

1.3.4

11 months ago

1.2.5

12 months ago

1.4.2

11 months ago

1.3.3

11 months ago

1.2.4

12 months ago

1.5.0

11 months ago

1.4.1

11 months ago

1.3.2

11 months ago

1.2.3

12 months ago

1.4.0

11 months ago

1.3.1

11 months ago

1.2.2

12 months ago

1.3.0

12 months ago

1.2.9

12 months ago

1.2.10

12 months ago

1.2.11

12 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago

1.2.1

1 year ago

0.1.0

1 year ago