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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@didomi/vega-sdk

v0.0.2

Published

Didomi SDK for Vega TV platform

Readme

Didomi Vega SDK

A Vega SDK for integrating Didomi's Consent Management Platform (CMP) with Amazon's Vega platform. This SDK enables applications to manage user consent for data collection and processing in compliance with privacy regulations.

Features

  • Display consent notices and preference dialogs
  • Collect and manage user consent choices
  • Synchronize consent data with Didomi servers
  • Support for various privacy regulations (GDPR, CCPA, etc.)
  • Comprehensive event handling for user interactions

Installation

npm install @didomi/vega-sdk

Peer Dependencies

This SDK has the following peer dependencies:

  • React (>=18.0.0 <=18.2.0)
  • React DOM (>=18.0.0 <=18.2.0)
  • React Native (^0.72.0)
  • @amazon-devices/react-native-vega (^2.0.0)
  • @amazon-devices/webview

For WebView: Update your app's manifest.toml file to include required services

Usage

Basic Integration

import { DidomiSDK, DidomiSDKAPI } from '@didomi/vega-sdk';
import React, { useRef } from 'react';

const MyApp = () => {
  const didomiRef = useRef<DidomiSDKAPI>(null);

  return (
    <DidomiSDK
      noticeId="YOUR_NOTICE_ID"
      didomiPublicApiKey="YOUR_PUBLIC_API_KEY"
      ref={didomiRef}
      onReady={() => console.log('Didomi SDK is ready')}
      onConsentChanged={(consent) => console.log('Consent changed:', consent)}
    >
      {/* Your application content */}
      <YourApp />
    </DidomiSDK>
  );
};

Programmatically Interacting with the SDK

After integrating the SDK, you can programmatically access its functionality through the ref:

// All SDK methods are accessible through the ref
const didomiSDK = didomiRef.current;

// Display UI elements
didomiSDK?.notice.show(); // Show consent notice
didomiSDK?.preferences.show('purposes'); // Show preferences UI

// Query SDK state
const isConsentRequired = await didomiSDK?.isConsentRequired();

// Manage user consent
const userStatus = await didomiSDK?.getCurrentUserStatus();
await didomiSDK?.setUserAgreeToAll();
await didomiSDK?.setCurrentUserStatus({
  purposes: {
    /* purpose status */
  },
  vendors: {
    /* vendor status */
  },
});

API Reference

Component Props

The DidomiSDK accepts the following required props:

| Prop | Type | Description | | -------------------- | -------- | -------------------------------------------------------------------------------- | | noticeId | string | ID of the consent notice to display | | didomiPublicApiKey | string | Your Didomi public API key | | sdkPath | string | (Optional) Path to the Didomi SDK, defaults to 'https://sdk.privacy-center.org/' |

Methods

The SDK exposes methods through a ref:

Consent Management

| Method | Description | Parameters | Returns | | ------------------------ | ------------------------------- | ----------------------------------------------- | ------------------ | | notice.show() | Shows the consent notice | None | void | | notice.isVisible() | Checks if the notice is visible | None | Promise<boolean> | | preferences.show(type) | Shows the preferences UI | type: 'information' | 'purposes' | 'vendor' | void | | reset() | Resets the consent data | None | void |

User Status

| Method | Description | Parameters | Returns | | ------------------------ | --------------------------------- | ---------- | ---------------------------- | | getCurrentUserStatus() | Gets detailed user consent status | None | Promise<CurrentUserStatus> | | getUserStatus() | Gets user consent status | None | Promise<any> | | getPurposes() | Gets available purposes | None | Promise<any> | | getVendors() | Gets available vendors | None | Promise<any> |

User Configuration

| Method | Description | Parameters | Returns | | ------------------------------ | ------------------------------------- | ------------------------------- | ------------------------- | | setUser(config) | Sets user information | config: UserConfiguration | Promise<void> | | clearUser() | Clears user data | None | Promise<void> | | setUserAgreeToAll() | Sets consent to agree to all | None | Promise<void> | | setUserDisagreeToAll() | Sets consent to disagree to all | None | Promise<void> | | setCurrentUserStatus(params) | Updates user consent status | params: SetUserStatusParams | Promise<boolean> | | syncUser() | Synchronizes user consent with server | None | Promise<SyncReadyEvent> |

Consent Checking

| Method | Description | Parameters | Returns | | ------------------------------ | ------------------------------------- | ---------------- | ------------------- | | isConsentRequired() | Checks if consent is required | None | Promise<boolean> | | isUserConsentStatusPartial() | Checks if user consent is partial | None | Promise<boolean> | | shouldConsentBeCollected() | Checks if consent should be collected | None | Promise<boolean> | | isRegulationApplied(name) | Checks if a regulation applies | name: string | Promise<boolean> | | getRequiredPurposeIds() | Gets required purpose IDs | None | Promise<string[]> | | getRequiredVendorIds() | Gets required vendor IDs | None | Promise<string[]> |

Events

The SDK provides callbacks for various events:

Ready Events

| Event | Description | Callback Parameter | | --------- | ---------------------------- | ------------------ | | onReady | Called when the SDK is ready | None |

Consent Events

| Event | Description | Callback Parameter | | ------------------ | -------------------------------- | ---------------------------- | | onConsentChanged | Called when user consent changes | consent: User consent data |

UI Events

| Event | Description | Callback Parameter | | --------------------- | ------------------------------------ | ------------------ | | onNoticeShown | Called when notice is shown | None | | onNoticeHidden | Called when notice is hidden | None | | onPreferencesShown | Called when preferences UI is shown | None | | onPreferencesHidden | Called when preferences UI is hidden | None |

User Interaction Events

| Event | Description | Callback Parameter | | --------------------------------- | ------------------------------------------- | ------------------ | | onNoticeBackdropclick | Called when notice backdrop is clicked | None | | onNoticeClickAgree | Called when user clicks agree on notice | None | | onNoticeClickMoreInfo | Called when user clicks more info on notice | None | | onPreferencesClickAgreeToAll | Called when user clicks agree to all | None | | onPreferencesClickDisagreeToAll | Called when user clicks disagree to all | None | | onPreferencesClickSaveChoices | Called when user saves choices | None |

Implementation Example

Below is a simplified example showing how to implement the SDK and access its functionality:

import { DidomiSDK, DidomiSDKAPI } from '@didomi/vega-sdk';
import React, { useRef, useState } from 'react';
import { View } from 'react-native';

function App() {
  // Create ref to access SDK methods
  const didomiRef = useRef<DidomiSDKAPI>(null);

  // Example of event handling
  const handleReady = () => {
    // SDK is ready, you can now call methods
    console.log('SDK is ready');
  };

  // Example of handling consent changes
  const handleConsentChanged = (consent) => {
    console.log('Consent changed', consent);
    // Update application state or perform actions based on consent
  };

  return (
    <DidomiSDK
      noticeId="YOUR_NOTICE_ID"
      didomiPublicApiKey="YOUR_PUBLIC_API_KEY"
      ref={didomiRef}
      onReady={handleReady}
      onConsentChanged={handleConsentChanged}
    >
      <View>{/* Your application UI */}</View>
    </DidomiSDK>
  );
}

export default App;

License

Copyright © Didomi. All rights reserved.