React Native SDK (https://www.npmjs.com/package/@simula/ads-react-native) for integrating contextual advertising and mini-game components into AI character apps.

image.png


Quick Start

1. Provider Setup

Wrap your application with SimulaProvider to initialize the SDK:

function App() {
  return (
    <SimulaProvider 
      apiKey="SIMULA_xxx"
      primaryUserID="xxxxx" // Optional: Hashed publisher provided user ID, highly recommended for better ad targeting
      hasPrivacyConsent={true} // Optional: Privacy consent flag. When false, suppresses collection of PII
      devMode={false} // Optional: Determines whether session is in dev mode or not
    >
      {/* Your application components */}
    </SimulaProvider>
  );
}

2. Component Integration

Add components where you want ads or games to appear.


MiniGameMenu

Modal component for displaying and launching sponsored mini-games. Clicking on a sponsored mini game opens an iframe that allows for a playable game.

image.png

Basic Usage

function ChatInterface() {
  const [menuOpen, setMenuOpen] = useState(false);

  return (
    <>
      <button onClick={() => setMenuOpen(true)}>
        Play Games
      </button>

      <MiniGameMenu
        isOpen={menuOpen}
        onClose={() => setMenuOpen(false)}
        charName="Luna"
        charID="luna-123"
        charImage="<https://cdn.example.com/avatars/luna.png>"
      />
    </>
  );
}

Props

Prop Type Required Default Description
isOpen boolean Yes - Controls modal visibility
onClose () => void Yes - Close event handler
charName string Yes - Character name displayed in header
charID string Yes - Character identifier
charImage string Yes - Character avatar URL
messages Message[] No [] Conversation history for context
charDesc string No - Character description
maxGamesToShow 3 6 9 No
theme MiniGameTheme No {} Theme configuration
delegateChar boolean No true Whether Simula displays AI character messages inside the iframe
consentRequiredMessage string No - Custom message when privacy consent is not granted

Note: Minigames require privacy consent. If hasPrivacyConsent is false in SimulaProvider, the menu displays a consent required message instead of games.

Theme Configuration

interface MiniGameTheme {
  backgroundColor?: string;
  headerColor?: string;
  borderColor?: string;
  titleFont?: string;
  secondaryFont?: string;
  titleFontColor?: string;
  secondaryFontColor?: string;
  iconCornerRadius?: number;
  accentColor?: string;
  playableHeight?: number | string;
  playableBorderColor?: string;
}