0.20.4 • Published 9 months ago

@flipgive/react-native-rewards v0.20.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

@flipgive/react-native-rewards

A React Native module for rewards partners, providing seamless integration of reward systems into your mobile app.

npm license downloads

Architecture Diagram

Arch

Tokens

Only EXPO_PUBLIC_US_DEFAULT_REWARDS_TOKEN is needed for single country configuration.

🚀 Installation

npm install @flipgive/react-native-rewards

or

yarn add @flipgive/react-native-rewards

or

pnpm add @flipgive/react-native-rewards

Requirements

To use this package, ensure you have the following components installed in your project:

Peer Dependencies

These dependencies need to be manually installed in your project:

  • expo-secure-store
  • react-native-webview

Usage

Here's a quick example to get you started:

import { SafeAreaView, StyleSheet } from 'react-native';
import { ShopRewards } from '@flipgive/react-native-rewards';

export default function App() {
  return (
    <SafeAreaView style={styles.container}>
      <ShopRewards
        keys={{
          REWARDS_PROPS_US_DEFAULT_REWARDS_TOKEN: process.env.EXPO_PUBLIC_US_DEFAULT_REWARDS_TOKEN || '',
          REWARDS_PROPS_CA_DEFAULT_REWARDS_TOKEN: process.env.EXPO_PUBLIC_CA_DEFAULT_REWARDS_TOKEN || '',
          REWARDS_PROPS_BASE_URL: process.env.EXPO_PUBLIC_BASE_URL || '',
          REWARDS_PROPS_GOOGLE_API_KEY: process.env.EXPO_PUBLIC_GOOGLE_API_KEY || '',
          REWARDS_PROPS_API_URL: process.env.EXPO_PUBLIC_API_URL || '',
          REWARDS_PROPS_X_REWARDS_PARTNER_ID: process.env.EXPO_PUBLIC_X_REWARDS_PARTNER_ID || '',
        }}
      />
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
});

for more information go to the examples folder.

For now it is necessary to use this entry point for all imports until the split imports task is completed.

import { ShopRewards..... } from '@flipgive/react-native-rewards'

This package is compatible with expo go - expo snacks

Shop rewards - RewardsTypes

Keys

PropertyTypeRequired
REWARDS_PROPS_US_DEFAULT_REWARDS_TOKENstringNo
REWARDS_PROPS_CA_DEFAULT_REWARDS_TOKENstringNo
REWARDS_PROPS_BASE_URLstringYes
REWARDS_PROPS_GOOGLE_API_KEYstringNo
REWARDS_PROPS_API_URLstringYes
REWARDS_PROPS_X_REWARDS_PARTNER_IDstringYes

Theme

PropertyTypeRequired
colorsPartialNo

Custom Components

ComponentTypeRequired
CustomCountryPickerComponentTypeNo
CustomSignUpScreenComponentTypeNo
CustomSignInScreenComponentTypeNo
CustomCreateTeamScreenComponentTypeNo
CustomLogoutScreenComponentTypeNo
CustomWebViewShopComponentType<{ baseURL: string }>No
CustomModalLoaderComponentTypeNo
CustomInitialScreenComponentTypeNo
CustomForgotPasswordScreenComponentTypeNo

Options

PropertyTypeRequiredDescription
shouldResetKeychainbooleanNo
showWebDebugOptionsbooleanNoEnables debug buttons for webview messages: login/logout/optIn

Custom Methods

customMethods

PropertyTypeRequired
onNavigationStateChange(navState: WebViewNavigation) => void;No
onDeleteUserAccount(error?: unknown; response?: DeleteUserResponse or null;) => void;No

📚 API Reference

Components

ComponentDescription
ShopRewardsMain component to display rewards.
ShopRewardsProviderHighly Customizable Store Provider
FadeWrapperfade animation wrapper for views

Hooks

HookDescription
useSignUpFormHook for managing sign-up form.
useSignInFormHook for managing sign-in form.
useCountrySelectHook for selecting countries.
useCreateTeamFormHook for managing team creation form.
useGetCategoriesHook for fetching categories.
useCityAutocompleteHook for city autocomplete feature - google api.
useHostHook for context usage
useLoadKeysToEnvHook for Resetting Environment and Local Storage on New Props
useResetPasswordHook for resetting password
useUpdateDeviceInfoHook for register push token into our cloud solution, updateDeviceInfo({ device: { fcm_token: '1234' } })

Context

ComponetDescription
HostProviderBare provider

Contributing

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

License

This library is distributed under the Apache License, version 2.0

copyright 2023. FlipGive, inc. all rights reserved.

licensed under the apache license, version 2.0 (the "license");
you may not use this file except in compliance with the license.
you may obtain a copy of the license at

    http://www.apache.org/licenses/license-2.0

unless required by applicable law or agreed to in writing, software
distributed under the license is distributed on an "as is" basis,
without warranties or conditions of any kind, either express or implied.
see the license for the specific language governing permissions and
limitations under the license.

TODO

  • Test
  • Split modules (working on example app, but not in npm package import)

Made with ❤️ by create-react-native-library.

0.20.4

9 months ago

0.20.3

9 months ago

0.20.1

9 months ago

0.20.0

9 months ago

0.19.0

9 months ago

0.19.1

9 months ago

0.16.0

9 months ago

0.17.0

9 months ago

0.16.1

9 months ago

0.18.0

9 months ago

0.17.1

9 months ago

0.20.2

9 months ago

0.15.2

9 months ago

0.15.3

9 months ago

0.15.1

10 months ago

0.15.0

10 months ago

0.14.2

10 months ago

0.14.3

10 months ago

0.14.1

11 months ago

0.14.0

11 months ago

0.13.0

11 months ago

0.12.1

11 months ago

0.12.0

11 months ago

0.11.0

11 months ago

0.10.1

11 months ago

0.10.0

11 months ago

0.9.5

11 months ago

0.9.4

11 months ago

0.9.3

11 months ago

0.9.2

11 months ago

0.9.1

11 months ago

0.9.0

11 months ago

0.8.2

11 months ago

0.8.1

11 months ago

0.8.0

11 months ago

0.7.0

11 months ago

0.6.1

12 months ago

0.6.0

12 months ago

0.5.0

12 months ago

0.4.2

12 months ago

0.4.1

12 months ago

0.4.0

12 months ago

0.3.0

12 months ago

0.2.1

12 months ago

0.2.0

12 months ago

0.1.0

12 months ago