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

clinic-connect-widget

v1.1.6

Published

Healthcare booking widget

Readme

Clinic Connect Widget

Clinic Connect is a lightweight, embeddable medical booking and tele-consultation widget designed for clinics and hospitals. It allows patients to book appointments, view doctor availability, and initiate video consultations directly from the clinic's existing website.

Features

  • Zero Dependencies: Built with Vanilla JavaScript, ensuring fast load times and no conflicts with existing frameworks (React, Vue, jQuery, etc.).
  • Shadow DOM Isolation: Styles and logic are encapsulated, preventing your site's CSS from breaking the widget and vice versa.
  • Inline Triggers: Can be embedded as a floating button or integrated into specific page elements (e.g., "Book Now" sections).
  • Comprehensive Flow:
    • Inline Doctor Availability Status with "Consult Now" CTA.
    • Patient Information & Booking Form.
    • Simulated Video Consultation Interface.
    • Post-consultation Summary.
  • Responsive Design: Optimized for both Desktop and Mobile experiences.

Installation

To add the Clinic Connect widget to your website, simply include the compiled script file near the end of your <body> tag.

Basic Embed

<script 
    src="https://your-cdn.com/clinic-widget.umd.js"
    data-widget-id="YOUR_CLINIC_ID"
    data-locale="vi">
</script>

Advanced Embed (With Dynamic Doctor/Product)

You can pre-select a doctor or product context by passing additional attributes.

<script 
    src="https://your-cdn.com/clinic-widget.umd.js"
    data-widget-id="YOUR_CLINIC_ID"
    data-store-id="YOUR_STORE_ID"

    data-org-id="YOUR_ORG_ID"
    
    data-doctor-id="YOUR_DOCTOR_ID"
    data-product-id="YOUR_PRODUCT_ID"
    data-url-video="YOUR_VIDEO_URL"
    data-locale="vi">
</script>

Configuration Parameters

The widget is highly configurable via data- attributes on the script tag.

| Attribute | Description | Required | Default | | :--- | :--- | :---: | :---: | | src | Path to the widget JavaScript file. | Yes | - | | data-widget-id | Unique ID for your clinic's implementation. | Yes | - | | data-trigger-element-id| The generic DOM ID of the element where you want to render the inline trigger card (instead of floating). | No | null | | data-locale | Language code (e.g., 'vi', 'en'). | No | vi | | data-store-id | The Store ID associated with the booking system. | No | null | | data-org-id | The Organization ID. | No | null | | data-doctor-id | Pre-select a specific doctor context. | No | null | | data-product-id | Pre-select a specific product or service package. | No | null | | data-url-video | URL for the introductory video used in the permission flow. | No | null |

Client Hooks (API)

The widget exposes a global window.Clinic object that allows your website to listen for widget events and interact with the instance.

window.Clinic = {
    /**
     * Called when the widget is fully loaded and ready.
     */
    onReady: () => {
        console.log('Widget loaded and ready');
    },

    /**
     * Called when the user successfully starts a consultation session.
     * Useful for tracking analytics conversions.
     */
    onConsultationStarted: () => {
        console.log('User started a consultation');
    },

    /**
     * Called when the consultation flow is finished.
     */
    onCompleted: () => {
        console.log('Consultation finished');
    },

    // The active widget instance
    instance: { ... } 
};

Development Guide

Prerequisites

  • Node.js (v18+)
  • npm

Setup

  1. Clone the repository.
  2. Install dependencies:
    npm install

Running Locally

To start the development server with Hot Module Replacement (HMR):

npm run dev

Open the URL provided (usually http://localhost:5173) and navigate to test_widget.html to see the widget in action.

Building for Production

To generate the optimized, minified script for distribution:

npm run build

The output files will be in the dist/ folder:

  • clinic-widget.umd.js: For direct browser usage (Standard).
  • clinic-widget.es.js: For ES Module imports.

Testing Production Build

To verify the final build behaves as expected:

  1. Run the build command:
    npm run build
  2. Open test_build.html in your browser. This file is pre-configured to load the built script from dist/clinic-widget.umd.js to ensure the production artifact works correctly.

Project Structure

  • src/api/: Handles API simulation and fetching widget configuration.
  • src/core/: Main widget logic (ClinicWidget class), lifecycle management, and event binding.
  • src/state/: Centralized state management (Store pattern).
  • src/ui/: Contains HTML Templates (templates.js) and CSS Styles (styles.js).
  • src/index.js: Entry point that parses configuration and initializes the widget.

License

ISC