0.3.0 • Published 3 years ago

react-native-conscent v0.3.0

Weekly downloads
10
License
MIT
Repository
github
Last release
3 years ago

react-native-conscent

This is a package written in react-native with no native code, it is a pure javascript implementation and can be used in both iOS and Android version with no extra configuration.

React-native plugin usage is covered here, complete conscent documentation is available here.

Installation

npm install react-native-conscent

Usage

import Conscent from 'react-native-conscent';

export default function App() {
  return (
    // When you want to render conscent's paywall, simply use the Conscent component
    <View style={{ flex: 1 }}>
      <Conscent
        clientId="your-client-id"
        storyId="your-story-id"
        successCallback={successCallback}
        subscriptionUrl="https://www.google.com"
        subscriptionCallback={subscriptioncallback}
        mode="sandbox"
      />
    </View>
  );
}

Props

PropDefinition
clientIdYou get your client id from the dashboard
storyIdYour storyid for a story you have registered
successCallbackFunction which will receive the success payload. See the success payload structure in the complete documentation.
subscriptionUrlYou may either set the subscriptionUrl or the subscriptionCallback. subscriptionUrl will open the given url in the browser when the subscribe button is clicked
subscriptionCallbackfunction which receives no arguments. This function is called when the user clicks the subscribe button
modeeither 'sandbox' or 'production' based on your credentials

Contributing

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

License

MIT