1.0.1 • Published 5 years ago

@gamiphy/loyalty-station-react-native-sdk v1.0.1

Weekly downloads
7
License
-
Repository
-
Last release
5 years ago

Gamiphy Loyalty Station React Native SDK

Introduction

Gamiphy Loyalty Station, is a gamified loyalty program plugin/widget for eCommerce. You will be able to reward users with points for completing pre defined "challenges" within your store. In addition to that users can compete with each other in compeitions reflected on a leaderboard, receive badges and invite their freinds, among other gamified features.

Installation

To install:

npm install --save @gamiphy/loyalty-station-react-native-sdk  

Requirement

	"react": "^16.x",  
	"react-native": "^0.x",  
	"react-native-webview": "^10.x"

Getting started

Import LoyaltyStation from the library:

import {LoyaltyStation} from "@gamiphy/loyalty-station-react-native-sdk"

Then wrap your code in LoyaltyStationProvider component to make it available to all components.

<LoyaltyStationProvider config={config:Config}>    
    <YourComponent/>  
</LoyaltyStationProvider>  

You can use the hooks based API to access the Loyalty Station functionality:

  
function App() {  
  const {open, close} = useLoyaltyStation()  
 
	 return (
		<View>    
			<Button title="Open Loyalty Station " onPress={() => open()}/>    
			<Button title="Close Loyalty Station" onPress={() => close()}/>    
		</View>  
	 );
}  

Hooks providing the following functionality:

FunctionsignatureDescription
open()=>voidopening the Loyalty Station App
close()=>voidClosing The Loyalty Station App
logout()=>voidLogout
login(user:User)=>voidLogin

props

It will inject the following props to the component:

Prop---TypeOptionalDescription
Config:------no
appstringnoThe app ID
userUseryes
User:
emailstringnoUser's email
hashstringnoThe hash value is generated using the client hmac as a key, sha256 as the algorithm, and the value is constructed as this appIdemail. const hash = hmacSHA512('appIdemail', appKey);
firstNamestringnoUser's first name
lastNamestringnoUser's last name
goToAuth(isSignUp:boolean) => Voidyeslistener on the "Sign in" button
1.0.1

5 years ago

1.0.0

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago