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

besper-frontend-toolkit-prod-main

v1.1.5-main.bf02e6e

Published

Professional B-esper Frontend Toolkit - Modular bot integration for WordPress plugins and web applications

Readme

Besper Frontend Toolkit - Production

Production-ready version of the Besper Frontend Toolkit, optimized for performance with minified builds.

Installation

npm install besper-frontend-toolkit-prod-main

Package Information

  • Package Name: besper-frontend-toolkit-prod-main
  • Environment: Production
  • API Endpoint: https://apimprodmainpublic.azure-api.net
  • Version: 1.1.5-0

Quick Start

import { init_b_esper_bot } from 'besper-frontend-toolkit-prod-main';

// Initialize chat bot with UI-based data policy
const bot = await init_b_esper_bot('your-bot-id', {
  environment: '',
  containerId: 'my-chat-container',
  width: '100%',
  height: '600px',
});

Core API Functions

init_b_esper_bot(botId, options)

Main API function - Initialize B-esper bot with session token generation and UI-based data policy.

Parameters:

  • botId (string, required) - The unique identifier for your Azure Bot
  • options (Object, optional) - Configuration options

Options:

  • environment (string) - Environment segment for the API URL (defaults to production for this package)
  • containerId (string) - Container element ID for embedded chat
  • width (string) - Chat container width (default: '100%')
  • height (string) - Chat container height (default: '500px')

Returns: Promise<Object> - Bot instance with type ('widget' | 'embedded') and sessionData

Example:

import { init_b_esper_bot } from 'besper-frontend-toolkit-prod-main';

// Embedded chat implementation
const bot = await init_b_esper_bot('your-bot-id', {
  environment: '',
  containerId: 'chat-container',
  width: '100%',
  height: '600px',
});

console.log('Bot type:', bot.type); // 'widget' or 'embedded'
console.log('Session data:', bot.sessionData);

init_b_esper_portal(purchaseId, purchaseSecret, options)

Main API function - Initialize B-esper portal with purchase authentication for administrative tasks.

Parameters:

  • purchaseId (string, required) - The purchase ID for authentication
  • purchaseSecret (string, required) - The purchase secret for authentication
  • options (Object, optional) - Configuration options

Returns: Promise<Object> - Portal instance

Example:

import { init_b_esper_portal } from 'besper-frontend-toolkit-prod-main';

try {
  const portal = await init_b_esper_portal(
    'your-purchase-id',
    'your-purchase-secret',
    {}
  );

  console.log('Portal initialized:', portal);
  console.log('Authentication verified:', portal.authenticationVerified);
} catch (error) {
  console.error('Portal initialization failed:', error);
}

Advanced Chat Class

BesperChat

Advanced chat interface with full conversation management, streaming support, and GDPR compliance.

Static Methods:

import { BesperChat } from 'besper-frontend-toolkit-prod-main';

// Initialize with configuration
const config = {
  botId: 'your-bot-id',
  api_endpoint: 'https://apimprodmainpublic.azure-api.net',
  environment: '',
  // Additional configuration options
};

const chat = await BesperChat.init(config);

Instance Methods:

  • sendMessage(message) - Send message to bot
  • downloadConversation(format) - Download conversation history
  • deleteConversation() - Delete conversation (GDPR compliance)
  • restartConversation() - Restart conversation with new session

Example:

// Complete conversation lifecycle
const chat = await BesperChat.init({
  botId: 'your-bot-id',
  api_endpoint: 'https://apimprodmainpublic.azure-api.net',
});

// Send messages
await chat.sendMessage('Hello, how can you help me?');

// Download conversation
await chat.downloadConversation('json'); // or 'txt'

// Restart conversation
await chat.restartConversation();

// Delete conversation (GDPR)
await chat.deleteConversation();

Embedded Chat Component

BesperEmbeddedChat

A complete embedded chat interface with modern UI and full feature support.

Features:

  • Real-time messaging with WebSocket and streaming support
  • Conversation download (JSON/TXT formats)
  • GDPR-compliant conversation deletion
  • Multi-language support with i18n
  • Customizable styling via APIM
  • Data policy integration
  • Accessibility features

Constructor:

import { BesperEmbeddedChat } from 'besper-frontend-toolkit-prod-main';

const chat = new BesperEmbeddedChat({
  botId: 'your-bot-id',
  environment: '',
  containerId: 'chat-container',
  width: '100%',
  height: '500px',
  bot_name: 'Assistant',
  welcomeMessage: 'Hello! How can I help you today?',
  dataPolicyUrl: 'https://example.com/privacy',
});

await chat.init();

Methods:

  • init() - Initialize the chat interface
  • sendMessage(message) - Send a message with streaming support
  • destroy() - Clean up and destroy the chat instance
  • downloadConversation() - Download conversation with format selection
  • deleteConversation() - GDPR-compliant conversation deletion

Utility Functions

Style Management

get_standard_styles(styleType, options)

Get standard CSS styles for widget and portal implementations from APIM.

Parameters:

  • styleType (string, required) - Type of styles ('widget', 'portal', 'chat')
  • options (Object, optional) - Configuration options
    • environment (string) - Environment for API endpoint (defaults to production for this package)
    • version (string) - Style version to retrieve (default: 'latest')

Returns: Promise<Object> - JSON object containing style configurations

Example:

import { get_standard_styles } from 'besper-frontend-toolkit-prod-main';

// Get widget styles
const widgetStyles = await get_standard_styles('widget');

// Get chat styles
const chatStyles = await get_standard_styles('chat');

// Get portal styles with specific version
const portalStyles = await get_standard_styles('portal', {
  version: 'v2.0',
});

Logging Utilities

BesperJS provides comprehensive logging for debugging and monitoring:

import {
  enableBesperLogging,
  downloadBesperLogs,
  getBesperLogs,
  clearBesperLogs,
  getBesperLogsSummary,
  exportBesperLogsAsText,
} from 'besper-frontend-toolkit-prod-main';

// Enable centralized logging
enableBesperLogging(true);

// Get all captured logs
const logs = getBesperLogs();

// Get error summary
const summary = getBesperLogsSummary();

// Download logs as JSON file
downloadBesperLogs('debug-logs.json');

// Export logs as formatted text
const textLogs = exportBesperLogsAsText();

// Clear all logs
clearBesperLogs();

Widget Implementation

BesperWidget

Advanced widget functionality with customizable UI and behavior.

import { BesperWidget } from 'besper-frontend-toolkit-prod-main';

const widget = new BesperWidget({
  botId: 'your-bot-id',
  environment: '',
  // Additional widget configuration
});

await widget.init();

Utility Classes

Logger

Centralized logging utility for debugging and monitoring.

import { Logger } from 'besper-frontend-toolkit-prod-main';

Logger.info('Information message');
Logger.warn('Warning message');
Logger.error('Error message');
Logger.debug('Debug message');

ApiClient

HTTP client for API interactions with streaming support.

import { ApiClient } from 'besper-frontend-toolkit-prod-main';

// Stream bot responses
const stream = await ApiClient.streamBotResponse(
  sessionToken,
  message,
  options
);

// Generate session tokens
const sessionData = await ApiClient.generateSessionToken(botId, environment);

// Download conversations
const result = await ApiClient.downloadConversation(
  sessionToken,
  format,
  environment
);

// Delete conversations
const deleteResult = await ApiClient.deleteConversation(
  sessionToken,
  environment
);

Validator

Input validation utilities for secure data handling.

import { Validator } from 'besper-frontend-toolkit-prod-main';

// Validate API endpoints
const isValidEndpoint = Validator.validateApiEndpoint(endpoint);

// Validate purchase credentials
const isValidPurchaseId = Validator.isValidPurchaseId(purchaseId);
const isValidSecret = Validator.isValidSecret(secret);

I18n

Internationalization support for multi-language interfaces.

import { I18n } from 'besper-frontend-toolkit-prod-main';

const i18n = new I18n.I18n();

// Get localized text
const text = i18n.t('button_label');

// Get localized data policy URL
const localizedUrl = i18n.getLocalizedDataPolicyUrl(baseUrl);

EventEmitter

Event management for custom event handling.

import { EventEmitter } from 'besper-frontend-toolkit-prod-main';

const emitter = new EventEmitter();
emitter.on('custom-event', data => {
  console.log('Event received:', data);
});
emitter.emit('custom-event', { message: 'Hello' });

Environment-Specific Features

This is the production version of the package. It contains optimized, minified builds without source maps for best performance and security. Use this version for production deployments.

API Endpoints

This package is configured to use the following API endpoints:

  • Base URL: https://apimprodmainpublic.azure-api.net
  • Session Management: https://apimprodmainpublic.azure-api.net/bot-operations
  • Style Management: https://apimprodmainpublic.azure-api.net/styles
  • WebSocket: wss://apimprodmainpublic.azure-api.net

Streaming Support

The Production environment supports real-time streaming responses:

const chat = new BesperEmbeddedChat({
  botId: 'your-bot-id',
  environment: '',
  // Streaming is automatically enabled
});

await chat.init();
await chat.sendMessage('Tell me about your capabilities');
// Response will stream in real-time

GDPR Compliance

Full conversation management with GDPR-compliant data deletion:

// Download before deletion (optional)
await chat.downloadConversation('json');

// GDPR-compliant deletion
await chat.deleteConversation();

Complete Integration Examples

Embedded Chat with Full Features

<!DOCTYPE html>
<html>
  <head>
    <title>Besper Bot Integration</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
  </head>
  <body>
    <div id="chat-container"></div>

    <script type="module">
      import { init_b_esper_bot } from 'besper-frontend-toolkit-prod-main';

      // Initialize with full feature set
      const bot = await init_b_esper_bot('your-bot-id', {
        containerId: 'chat-container',
        width: '100%',
        height: '600px',
        welcomeMessage: 'Hello! How can I assist you today?',
        dataPolicyUrl: 'https://example.com/privacy',
      });

      // Handle events
      document.addEventListener('embedded-chat:initialized', event => {
        console.log('Chat initialized:', event.detail);
      });

      document.addEventListener('session:deleted', event => {
        console.log('Conversation deleted:', event.detail);
      });

      console.log('Bot initialized:', bot);
    </script>
  </body>
</html>

Advanced Configuration

import {
  init_b_esper_bot,
  enableBesperLogging,
  get_standard_styles,
} from 'besper-frontend-toolkit-prod-main';

// Enable logging for debugging
enableBesperLogging(true);

// Get custom styles
const customStyles = await get_standard_styles('chat', {
  environment: '',
  version: 'latest',
});

// Initialize with advanced configuration
const bot = await init_b_esper_bot('your-bot-id', {
  environment: '',
  containerId: 'advanced-chat',
  width: '400px',
  height: '700px',
  chatStyles: customStyles.classes,
  welcomeMessage: 'Welcome to our advanced support chat!',
  dataPolicyUrl: 'https://example.com/privacy-policy',
  // Additional custom options
  enableStreaming: true,
  enableDownloads: true,
  enableDeletion: true,
});

Development and Testing

Environment Configuration

For development and testing, use the appropriate environment:

// Development environment
const devBot = await init_b_esper_bot('dev-bot-id', {
  environment: 'dev', // Uses development API endpoints
});

// Integration testing
const testBot = await init_b_esper_bot('test-bot-id', {
  environment: 'int', // Uses integration API endpoints
});

// Production deployment
const prodBot = await init_b_esper_bot('prod-bot-id', {
  environment: 'prod', // Uses production API endpoints
});

Debugging Support

import {
  enableBesperLogging,
  getBesperLogsSummary,
  downloadBesperLogs,
} from 'besper-frontend-toolkit-prod-main';

// Enable detailed logging
enableBesperLogging(true);

// Your application code...

// Get debugging information
const summary = getBesperLogsSummary();
console.log('Errors found:', summary.errorCount);
console.log('Warnings found:', summary.warningCount);

// Download logs for analysis
downloadBesperLogs('application-debug.json');

Browser Compatibility

  • Modern Browsers: Chrome 88+, Firefox 85+, Safari 14+, Edge 88+
  • Features: ES2020, WebSocket, Fetch API, CSS Grid
  • Polyfills: Not required for supported browsers

Performance Considerations

  • Bundle Size: Optimized for production-optimized builds without source maps
  • Streaming: Real-time response processing
  • Caching: Automatic style and configuration caching
  • Memory: Efficient conversation history management

Support

For support and documentation, please refer to the main repository at https://github.com/wsperger/BAF.

Additional Resources

  • API Documentation: Available in the repository docs folder
  • Integration Examples: See the examples directory
  • Testing Suite: Comprehensive test coverage included
  • Developer Guide: Detailed development instructions

This package was built for the Production environment and includes production-optimized builds without source maps.

Latest Features:

  • Real-time streaming responses
  • GDPR-compliant conversation management
  • Multi-language support (i18n)
  • Comprehensive logging and debugging
  • Advanced styling via APIM integration
  • WebSocket and HTTP fallback support
  • Accessibility features and keyboard navigation
  • Mobile-responsive design