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

flourish-sdk-react-native

v2.11.0

Published

Flourish React Native SDK

Downloads

67

Readme

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);

WebView options

You can customize the webview component if you prefer, just initialize one of our configuration objects (WebViewOptions) and pass it in the initialization as the last parameter::

  import type { WebViewOptions } from 'src/components/
  CustomWebView';

  const webViewOptions: WebViewOptions = {
    androidLayerType: 'software',
    scalesPageToFit: true,
    domStorageEnabled: true,
    scrollEnabled: true,
    setBuiltInZoomControls: true,
    bounces: true,
    style: 'marginTop: 20',
  };

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

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 name | Description | |--------------------------------|-------------------------------------------------------------------------------------------------------------------| | BACK_BUTTON_PRESSED | When you need to know when the user clicks on the back menu button on our platform. | | ERROR_BACK_BUTTON_PRESSED | When you need to know when the user clicks on the back menu button on our error page. | | HOME_BACK_BUTTON_PRESSED | When you need to know when the user clicks on the back menu button when on the home screen of our platform. | | ONBOARDING_BACK_BUTTON_PRESSED | When you need to know when the user clicks on the back menu button when on the onboarding screen of our platform. | | TERMS_ACCEPTED | When you need to know when the user clicks to accept the terms. | | TRIVIA_GAME_FINISHED | When you need to know when the user finishes a Trivia game on our platform. | | TRIVIA_CLOSED | When you need to know when the user closed the Trivia game on our platform. | | REFERRAL_COPY | When you need to know when the user copy the referral code to the clipboard area. | | REFERRAL_FINISHED | When you need to know when the referral finished. | | REFERRAL_REWARD_REDEEMED | When you need to know when the user redeem the referral rewards. | | REFERRAL_REWARD_SKIPPED | When you need to know when the user slipped the referral rewards. | | GIFT_CARD_COPY | When you need to know when the user copy the Gift code to the clipboard area. | | HOME_BANNER_ACTION | When you need to know when the user clicks on the home banner. | | MISSION_ACTION | When you need to know when the user clicks on a mission card | | AUTHENTICATION_FAILURE | When you need to know when the Authentication failed | | ERROR | When you need to know when a not mapped 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