react-native-conscent

React native sdk for conscent

Usage no npm install needed!

<script type="module">
  import reactNativeConscent from 'https://cdn.skypack.dev/react-native-conscent';
</script>

README

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

Prop Definition
clientId You get your client id from the dashboard
storyId Your storyid for a story you have registered
successCallback Function which will receive the success payload. See the success payload structure in the complete documentation.
subscriptionUrl You may either set the subscriptionUrl or the subscriptionCallback. subscriptionUrl will open the given url in the browser when the subscribe button is clicked
subscriptionCallback function which receives no arguments. This function is called when the user clicks the subscribe button
mode either '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