Setup

Installation

npm install @didomi/vega-sdk

Peer Dependencies

This SDK requires 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-kepler (^2.0.0)

  • @amazon-devices/webview

Note: For WebView support, update your app’s manifest.toml file to include the required Vega services. Please refer to https://developer.amazon.com/docs/vega/0.21/set-up-webview.html

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 app content */}
      <YourApp />
    </DidomiSDK>
  );
};

Programmatic Usage

All SDK functionality is exposed through the component ref:


API Reference

Component 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/

onReady

() => void

Fired when the SDK is initialized and ready.

onConsentChanged

(consent: any) => void

Fired whenever the user’s consent status changes.

Other events are available as props, please refer to Events for more details.

Last updated