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

@hemantkadam/contentpulse-chat-sdk

v1.0.0

Published

Advanced React SDK for integrating ContentPulse AI Chat Agent with customizable themes and configurations

Readme

🚀 ContentPulse Chat SDK

An advanced React SDK for integrating ContentPulse AI Chat Agent with extensive customization options, beautiful themes, and seamless Contentstack CMS integration.

✨ Features

  • 🎨 Advanced Theming - Highly customizable visual configurations
  • 🤖 Multi-LLM Support - OpenAI, Anthropic, Perplexity integration
  • 📱 Responsive Design - Mobile-friendly chat interface
  • 🔗 Contentstack Integration - CMS content retrieval via MCP
  • 🛡️ TypeScript - Full type safety and IntelliSense
  • 🎭 Animations - Smooth Framer Motion animations

📦 Installation

npm install @contentpulse/chat-sdk

🚀 Quick Start

import { ContentPulseProvider, ChatAgent } from '@contentpulse/chat-sdk';

function App() {
  return (
    <ContentPulseProvider
      agentId="your-agent-id"
      apiBaseUrl="https://your-contentpulse-api.com/api"
      apiKey="your-api-key"
      // LLM Configuration (optional - can be managed in backend)
      llmProvider="openai"
      llmModel="gpt-4"
      llmApiKey="your-openai-key"
      // Contentstack Configuration  
      contentstackApiKey="your-cs-api-key"
      contentstackDeliveryToken="your-cs-delivery-token"
      contentType="articles"
    >
      <ChatAgent 
        title="ContentPulse AI" 
        subtitle="How can I help you today?"
      />
    </ContentPulseProvider>
  );
}

🎨 Advanced Theme Customization

The SDK offers extensive theming capabilities that go far beyond basic color changes:

<ContentPulseProvider
  agentId="your-agent-id"
  // ... other props
  visualConfig={{
    // Layout & Positioning
    layout: {
      position: 'bottom-right',
      spacing: { bottom: '24px', right: '24px' },
      zIndex: 9999,
    },
    
    // Trigger Button Styling
    trigger: {
      size: 'large',
      shape: 'circle',
      backgroundColor: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
      hoverEffect: 'glow',
      icon: '🤖',
    },
    
    // Chat Window Styling
    window: {
      width: '450px',
      height: '650px',
      borderRadius: '24px',
      backgroundColor: '#ffffff',
      backdropBlur: '10px',
      boxShadow: '0 20px 60px rgba(0, 0, 0, 0.15)',
      animation: 'scale',
    },
    
    // Header Styling
    header: {
      backgroundColor: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
      textColor: '#ffffff',
    },
    
    // Message Styling
    userMessage: {
      backgroundColor: '#ffffff',
      textColor: '#2d3748',
      borderRadius: '18px 18px 6px 18px',
      boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
    },
    
    assistantMessage: {
      backgroundColor: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
      textColor: '#ffffff',
      borderRadius: '18px 18px 18px 6px',
    },
    
    // Avatar Styling
    avatars: {
      size: '40px',
      user: {
        backgroundColor: 'linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%)',
        icon: '👤',
      },
      assistant: {
        backgroundColor: 'linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)',
        icon: '🤖',
      },
    },
    
    // Typography
    typography: {
      fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
      fontSize: { medium: '14px' },
      lineHeight: '1.5',
    },
    
    // Custom CSS
    customCSS: `
      .cp-trigger-button:hover {
        transform: rotate(10deg) scale(1.1);
      }
    `,
  }}
>
  <ChatAgent />
</ContentPulseProvider>

⚙️ Configuration Options

ContentPulseProvider Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | agentId | string | ✅ | Unique identifier for your chat agent | | apiBaseUrl | string | ❌ | ContentPulse API base URL (defaults to localhost:3000 in dev) | | apiKey | string | ❌ | API key for ContentPulse backend authentication | | llmProvider | 'openai' | 'anthropic' | 'perplexity' | ❌ | LLM provider (can override backend settings) | | llmModel | string | ❌ | Model name (e.g., 'gpt-4', 'claude-3-sonnet') | | llmApiKey | string | ❌ | LLM provider API key | | contentstackApiKey | string | ❌ | Contentstack CMS API key | | contentstackDeliveryToken | string | ❌ | Contentstack delivery token | | contentstackEnvironment | string | ❌ | Environment (default: 'development') | | contentstackRegion | 'US' | 'EU' | 'AZURE_NA' | 'AZURE_EU' | 'GCP_NA' | ❌ | Contentstack region | | contentType | string | ❌ | Contentstack content type for queries | | enableStreaming | boolean | ❌ | Enable real-time response streaming (default: true) | | enableToolCalls | boolean | ❌ | Enable MCP tool calls (default: true) | | maxTokens | number | ❌ | Maximum tokens for responses | | temperature | number | ❌ | LLM temperature (0-1) | | sessionId | string | ❌ | Session identifier for conversation tracking | | enableAuthentication | boolean | ❌ | Enable user authentication | | visualConfig | AdvancedThemeConfig | ❌ | Advanced theme configuration |

ChatAgent Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | title | string | ❌ | Chat window title (default: "ContentPulse AI") | | subtitle | string | ❌ | Subtitle/status text | | placeholder | string | ❌ | Input placeholder text | | welcomeMessage | string | ❌ | Initial welcome message | | autoOpen | boolean | ❌ | Auto-open chat on load | | enableMinimize | boolean | ❌ | Show minimize button (default: true) | | enableClose | boolean | ❌ | Show close button (default: true) | | enableClearHistory | boolean | ❌ | Enable clear chat history (default: true) | | enableExport | boolean | ❌ | Enable chat export functionality | | onMessageSent | (message: string) => void | ❌ | Callback when user sends message | | onMessageReceived | (message: ChatMessage) => void | ❌ | Callback when assistant responds | | onError | (error: Error) => void | ❌ | Error handling callback | | onOpen | () => void | ❌ | Chat window opened callback | | onClose | () => void | ❌ | Chat window closed callback |

🎭 Theme Presets

Modern Gradient Theme

const modernTheme = {
  trigger: {
    backgroundColor: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
    hoverEffect: 'glow',
  },
  window: {
    backgroundColor: '#ffffff',
    borderRadius: '24px',
    boxShadow: '0 20px 60px rgba(0, 0, 0, 0.15)',
  },
  assistantMessage: {
    backgroundColor: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
    textColor: '#ffffff',
  },
};

Dark Theme

const darkTheme = {
  window: {
    backgroundColor: '#1a202c',
    borderRadius: '16px',
  },
  header: {
    backgroundColor: '#2d3748',
    textColor: '#ffffff',
  },
  messages: {
    backgroundColor: '#2d3748',
  },
  userMessage: {
    backgroundColor: '#4a5568',
    textColor: '#ffffff',
  },
  assistantMessage: {
    backgroundColor: '#3182ce',
    textColor: '#ffffff',
  },
};

Minimal Theme

const minimalTheme = {
  trigger: {
    backgroundColor: '#f7fafc',
    borderColor: '#e2e8f0',
    shape: 'rounded',
    icon: '💬',
  },
  window: {
    backgroundColor: '#ffffff',
    borderRadius: '12px',
    border: '1px solid #e2e8f0',
  },
  userMessage: {
    backgroundColor: '#f7fafc',
    textColor: '#2d3748',
    borderRadius: '12px',
  },
  assistantMessage: {
    backgroundColor: '#edf2f7',
    textColor: '#2d3748',
    borderRadius: '12px',
  },
};

🔧 Advanced Usage

Using the Hook Directly

import { useChatAgent, useContentPulse } from '@contentpulse/chat-sdk';

function CustomChatInterface() {
  const { config, theme, isConnected } = useContentPulse();
  const { 
    messages, 
    sendMessage, 
    isLoading, 
    clearMessages,
    exportChat 
  } = useChatAgent();

  return (
    <div>
      {messages.map(message => (
        <div key={message.id}>
          <strong>{message.role}:</strong> {message.content}
        </div>
      ))}
      
      <input 
        onKeyDown={e => e.key === 'Enter' && sendMessage(e.target.value)}
        disabled={!isConnected || isLoading}
      />
    </div>
  );
}

The SDK is fully responsive and includes mobile-optimized defaults:

visualConfig={{
  window: {
    width: '420px',
    maxWidth: '95vw',
    height: '600px',
    maxHeight: '80vh',
  },
  layout: {
    position: 'bottom-right',
    spacing: { bottom: '24px', right: '16px' },
  },
}}

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

MIT License - see LICENSE file for details.

🆘 Support


Made with ❤️ by the Hemant Kadam