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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@privasapien/react-native-consent-sdk

v1.0.5

Published

React Native bridge for the Privasapien Consent SDK — delegates all consent UI to native Android and iOS SDKs.

Readme


Why Privasapien Consent SDK?

Most apps handle consent with hardcoded dialogs or fragile WebViews. When regulations change or your legal team updates the privacy policy, you're stuck pushing an app update.

Privasapien Consent SDK solves this with a backend-driven approach — your consent UI, text, and logic are all controlled from the server. No app updates needed.

Features

  • Native Performance — all UI is rendered natively (Jetpack Compose / SwiftUI) rather than the React Native bridge.
  • Backend-driven consent UI — colors, text, layout, and purposes all configured remotely.
  • GDPR & DPDP compliant — built for global privacy regulations.
  • Persistent consent state — dual-layer cache for instant loads.
  • Event listeners — get notified on submit, toggle, language change, close, and errors.

Installation

npm install @privasapien/react-native-consent-sdk

(Optional) If you use yarn:

yarn add @privasapien/react-native-consent-sdk

iOS Requirements

Since the SDK uses native iOS frameworks, you must run pod install:

cd ios && pod install

Note: Because the SDK relies on native modules, it cannot be used with the "Expo Go" app. You must use a custom development client (EAS Build) or a bare React Native workflow.


Quick Start

1. Initialize the SDK

Call initialize() as early as possible in your app lifecycle (e.g., inside App.tsx or index.js).

import React, { useEffect } from 'react';
import { View, Button } from 'react-native';
import ConsentSDK from '@privasapien/react-native-consent-sdk';

export default function App() {
  useEffect(() => {
    // 1. Initialize the SDK
    ConsentSDK.initialize({
      apiUrl: "https://api.your-domain.com/api/v1",
      applicationId: "your-app-id",
      tenantId: "your-tenant-id",
      userIdentifier: "[email protected]",
      modeOfCommunication: "email",
    }).catch(console.error);

    // 2. Setup Listeners
    ConsentSDK.addListener({
      onConsentSubmitted: (acceptedPurposeIds) => {
        console.log('Consent saved:', acceptedPurposeIds);
      },
      onConsentClosed: () => {
        console.log('Consent bottom sheet closed');
      },
    });

    // Cleanup listeners on unmount
    return () => ConsentSDK.removeListeners();
  }, []);

  // 3. Trigger the UI
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Button 
        title="Manage Privacy Settings" 
        onPress={() => ConsentSDK.showBottomSheet()} 
      />
    </View>
  );
}

Configuration

All fields for the initialization config object:

| Parameter | Type | Required | Description | |-----------|------|:--------:|-------------| | apiUrl | string | ✓ | Base URL of your consent API | | applicationId | string | ✓ | Your application UUID | | tenantId | string | ✓ | Your tenant UUID | | userIdentifier | string | ✓ | User's email or phone number | | modeOfCommunication | string | ✓ | "email" or "phone" | | introductionMessage | string? | | Custom message shown above the consent notice | | age | number? | | User's age (enables parental consent flow if < 18) | | parentEmail | string? | | Required when age < 18 | | language | string? | | Default language. Defaults to "english" |


API Reference

ConsentSDK.initialize(config)

Initializes the SDK. Must be called before attempting to show any UI. Returns a Promise.

ConsentSDK.showBottomSheet()

Presents the consent UI as a modal bottom sheet overlay. Returns a Promise that resolves when the UI opens.

ConsentSDK.showFullScreen()

Presents the consent UI as a full-screen modal. Returns a Promise that resolves when the UI opens.

ConsentSDK.addListener(listener)

Registers a single listener for Consent SDK lifecycle events. Calling this replaces any previously registered listener.

ConsentSDK.removeListeners()

Removes all registered event listeners and cancels the native subscriptions. Call this in useEffect cleanup or when the screen unmounts to prevent memory leaks.


Event Listeners

Subscribe to consent lifecycle events via ConsentSDK.addListener(listener):

ConsentSDK.addListener({
  onConsentSubmitted: (acceptedPurposeIds: string[]) => {
    // User saved their preferences
  },
  onConsentClosed: () => {
    // User dismissed without saving
  },
  onConsentError: (error: string) => {
    // Network or API error occurred
  },
  onLanguageChanged: (languageCode: string) => {
    // Language switched in the dropdown
  },
  onPurposeToggled: (purposeId: string, isSelected: boolean) => {
    // Individual purpose toggled
  }
});

All methods are optional — provide only the callbacks you need.


License

Copyright © 2024 Privasapien. All rights reserved.