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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@eka-care/medassist-widget-embed

v0.0.3

Published

Embeddable MedAssist widget loader built with Web Components.

Readme

@eka-care/medassist-widget-embed

A lightweight, embeddable widget loader for MedAssist that uses Web Components for easy integration into any website. This package provides

Overview

The widget-embed package provides:

  • Custom Web Component: <eka-medassist-widget> for easy embedding
  • Lazy Loading: Widget assets are loaded only when the user clicks the button
  • Framework Agnostic: Works with any website, no React or build step required
  • Isolated Styling: Shadow DOM prevents style conflicts with host websites
  • Simple Integration: Just add a script tag and custom element

Installation

Install from npm to self-host the assets or reference the package from a CDN such as jsDelivr or UNPKG:

npm install @eka-care/medassist-widget-embed

To load directly from a CDN, point the script tag to the published package (replace the version with the one you intend to use):

<script
  src="https://cdn.jsdelivr.net/npm/@eka-care/[email protected]/index.js"
  async></script>

The script automatically looks for the accompanying src/medassist-widget.* files, so host those assets alongside index.js.

Usage

Add the widget to any HTML page:

<!DOCTYPE html>
<html>
  <head>
    <title>My Website</title>
  </head>
  <body>
    <h1>Welcome to my site!</h1>

    <!-- Add the widget custom element -->
    <eka-medassist-widget agent-id="your-agent-id-here"></eka-medassist-widget>

    <!-- Load the widget loader script -->
    <script src="https://your-cdn.com/widget-embed/index.js" async></script>
  </body>
</html>

That's it! The widget will appear as a floating button in the bottom-right corner.

Configuration

Required Attributes

  • agent-id (required): Your MedAssist agent identifier

Optional Attributes

  • icon-url: Custom icon URL for the widget button (default: ./assets/bot-icon.svg)

Example with Custom Icon

<eka-medassist-widget
  agent-id="your-agent-id-here"
  icon-url="https://example.com/custom-icon.svg"></eka-medassist-widget>

How It Works

  1. Initial Load: The loader script (index.js) registers the custom element <eka-medassist-widget>
  2. Button Display: The custom element renders a floating button in the bottom-right corner
  3. Lazy Loading: When the user clicks the button:
    • The widget CSS is fetched and injected into the shadow DOM
    • The widget JavaScript bundle is loaded
    • The widget is rendered inside the shadow DOM
  4. Isolation: All widget code runs in a Shadow DOM, preventing style and script conflicts

File Structure

widget-embed/
├── index.js              # Web component loader and custom element definition
├── src/                  # Generated widget assets (from widget package build)
│   ├── medassist-widget.js
│   └── medassist-widget.css
├── assets/
│   └── bot-icon.svg      # Default widget button icon
└── test.html             # Example integration page

Customization

Custom Icon

You can customize the widget button icon by setting the icon-url attribute:

<eka-medassist-widget
  agent-id="your-agent-id"
  icon-url="/path/to/your-icon.svg"></eka-medassist-widget>

Dynamic Attribute Updates

You can update widget attributes programmatically:

const widget = document.querySelector("eka-medassist-widget");
widget.setAttribute("icon-url", "https://example.com/new-icon.svg");

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Requires support for:

  • Custom Elements (Web Components)
  • Shadow DOM
  • ES6+ JavaScript

Development

Use any static server or bundler workflow you prefer for local verification. The widget emits helpful console logs (asset loading status, errors) that you can inspect in the browser DevTools.

Integration Examples

React

import { useEffect } from "react";

function App() {
  useEffect(() => {
    // Load the widget script
    const script = document.createElement("script");
    script.src = "https://your-cdn.com/widget-embed/index.js";
    script.async = true;
    document.body.appendChild(script);

    return () => {
      // Cleanup if needed
    };
  }, []);

  return (
    <div>
      <h1>My React App</h1>
      <eka-medassist-widget agent-id="your-agent-id" />
    </div>
  );
}

Vue

<template>
  <div>
    <h1>My Vue App</h1>
    <eka-medassist-widget :agent-id="agentId" />
  </div>
</template>

<script>
export default {
  data() {
    return {
      agentId: "your-agent-id",
    };
  },
  mounted() {
    const script = document.createElement("script");
    script.src = "https://your-cdn.com/widget-embed/index.js";
    script.async = true;
    document.body.appendChild(script);
  },
};
</script>

Vanilla JavaScript

<!DOCTYPE html>
<html>
  <head>
    <title>My Site</title>
  </head>
  <body>
    <eka-medassist-widget agent-id="your-agent-id"></eka-medassist-widget>

    <script>
      // Load widget script
      (function () {
        const script = document.createElement("script");
        script.src = "https://your-cdn.com/widget-embed/index.js";
        script.async = true;
        document.body.appendChild(script);
      })();
    </script>
  </body>
</html>

Troubleshooting

Widget Not Appearing

  1. Check that the agent-id attribute is set correctly
  2. Verify that index.js is loading (check Network tab in DevTools)
  3. Check browser console for errors
  4. Ensure the widget assets (medassist-widget.js and medassist-widget.css) are accessible

Styling Conflicts

The widget uses Shadow DOM to isolate styles, but if you encounter issues:

  • Check that the widget is rendering inside the shadow DOM
  • Verify that host website styles aren't affecting the shadow root

License

MIT