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

test-chat-component-per

v1.1.1

Published

AI Chat Web Component - Universal chat component for web applications

Downloads

302

Readme

DelaChat Web Component

A universal AI chat component for Deltek PPM applications. Built as a standard Web Component, it works seamlessly across all frameworks and platforms.

Features

  • Framework Agnostic - Works with React, Vue, Angular, or vanilla JavaScript
  • Shadow DOM Encapsulation - Styles don't leak or conflict
  • Zero Dependencies - Pure Web Standards (Custom Elements API)
  • TypeScript Support - Includes type definitions
  • Responsive - Works on desktop and mobile
  • Session Management - Integrates with PPM.Auth sessions
  • Event-Driven - Listen to messages, errors, and state changes

Installation

NPM

npm install chat-component

CDN

<script src="https://cdn.company.com/delachat/v1.0.0/delachat-webcomponent.min.js"></script>

Quick Start

Vanilla JavaScript

<!DOCTYPE html>
<html>
<head>
    <script src="node_modules/chat-component/dist/delachat-webcomponent.min.js"></script>
</head>
<body>
    <dela-chat
        api-url="https://api.company.com"
        session-uid="your-session-uid"
        datasource="EPMSCA"
        product-id="200"
        token="your-token">
    </dela-chat>

    <script>
        const chat = document.querySelector('dela-chat');

        chat.addEventListener('message-sent', (e) => {
            console.log('User sent:', e.detail.message);
        });

        chat.addEventListener('message-received', (e) => {
            console.log('AI replied:', e.detail.message);
        });
    </script>
</body>
</html>

React

import 'chat-component';
import { useRef, useEffect } from 'react';

function ChatWidget({ sessionUid, token }) {
    const chatRef = useRef(null);

    useEffect(() => {
        const chat = chatRef.current;

        const handleMessage = (e) => {
            console.log('Message sent:', e.detail.message);
        };

        chat.addEventListener('message-sent', handleMessage);
        return () => chat.removeEventListener('message-sent', handleMessage);
    }, []);

    return (
        <dela-chat
            ref={chatRef}
            api-url="https://api.company.com"
            session-uid={sessionUid}
            datasource="EPMSCA"
            product-id="200"
            token={token}
        />
    );
}

Vue

<template>
    <dela-chat
        :api-url="apiUrl"
        :session-uid="sessionUid"
        :datasource="datasource"
        :product-id="productId"
        :token="token"
        @message-sent="handleMessageSent"
    />
</template>

<script>
import 'chat-component';

export default {
    props: ['sessionUid', 'token'],
    data() {
        return {
            apiUrl: 'https://api.company.com',
            datasource: 'EPMSCA',
            productId: 200
        };
    },
    methods: {
        handleMessageSent(e) {
            console.log('Sent:', e.detail.message);
        }
    }
};
</script>

Angular

import { Component, ViewChild, ElementRef, AfterViewInit, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import 'chat-component';

@Component({
    selector: 'app-chat',
    template: `
        <dela-chat #chat
            [attr.api-url]="apiUrl"
            [attr.session-uid]="sessionUid"
            [attr.datasource]="datasource"
            [attr.product-id]="productId"
            [attr.token]="token">
        </dela-chat>
    `,
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ChatComponent implements AfterViewInit {
    @ViewChild('chat') chatElement: ElementRef;

    apiUrl = 'https://api.company.com';
    sessionUid = 'session-123';
    datasource = 'EPMSCA';
    productId = 200;
    token = 'token-456';

    ngAfterViewInit() {
        const chat = this.chatElement.nativeElement;
        chat.addEventListener('message-sent', (e: any) => {
            console.log('Sent:', e.detail.message);
        });
    }
}

API Reference

Attributes

| Attribute | Type | Required | Description | |-----------|------|----------|-------------| | api-url | string | Yes | API base URL | | session-uid | string | Yes | PPM.Auth session UID | | datasource | string | Yes | Datasource name | | product-id | number | Yes | Product ID (e.g., 200) | | token | string | Yes | Verification token | | theme | 'light' | 'dark' | No | Color theme (default: 'light') | | height | string | No | Component height (default: '600px') | | width | string | No | Component width (default: '100%') |

Methods

const chat = document.querySelector('dela-chat');

// Send a message programmatically
await chat.sendMessage('Hello AI!');

// Open chat
chat.open();

// Close chat
chat.close();

// Clear history
chat.clearHistory();

// Reload history from server
await chat.loadHistory();

Events

const chat = document.querySelector('dela-chat');

// Component is ready
chat.addEventListener('ready', () => {
    console.log('Chat ready');
});

// User sent a message
chat.addEventListener('message-sent', (e) => {
    console.log('User sent:', e.detail.message);
});

// AI sent a response
chat.addEventListener('message-received', (e) => {
    console.log('AI replied:', e.detail.message);
});

// An error occurred
chat.addEventListener('error', (e) => {
    console.error('Error:', e.detail.error);
});

// Chat was closed
chat.addEventListener('close', () => {
    console.log('Chat closed');
});

WinForms / WPF Integration

using Microsoft.Web.WebView2.WinForms;

public class ChatForm : Form
{
    private WebView2 webView;

    private async void LoadChat()
    {
        webView = new WebView2 { Dock = DockStyle.Fill };
        this.Controls.Add(webView);

        await webView.EnsureCoreWebView2Async();

        // Load HTML with component
        string html = @"
            <!DOCTYPE html>
            <html>
            <head>
                <script src='https://cdn.company.com/delachat/v1.0.0/delachat-webcomponent.min.js'></script>
            </head>
            <body style='margin: 0'>
                <dela-chat id='chat'
                    api-url='https://api.company.com'
                    datasource='EPMSCA'
                    product-id='200'
                    height='100vh'>
                </dela-chat>
            </body>
            </html>";

        webView.NavigateToString(html);

        // Set session after load
        webView.NavigationCompleted += async (s, e) =>
        {
            await webView.ExecuteScriptAsync($@"
                const chat = document.getElementById('chat');
                chat.setAttribute('session-uid', '{sessionUid}');
                chat.setAttribute('token', '{token}');
            ");
        };
    }
}

Browser Support

  • Chrome/Edge 79+
  • Firefox 63+
  • Safari 12.1+
  • Opera 66+

All modern browsers that support Custom Elements v1 and Shadow DOM.

License

PROPRIETARY - Copyright © Deltek, Inc.

Support

For issues and questions, contact Deltek support or file an issue in the repository.