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

@careshiphealth/sdk

v2.1.4

Published

A lightweight SDK to dynamically embed the SuperCare widget into any web page

Readme

SuperCare Embed SDK

A lightweight, zero-dependency SDK to dynamically embed the SuperCare widget into any web page.

Installation

npm install @careshiphealth/sdk

Usage

Method 1: JavaScript/TypeScript Module

import SuperCareEmbed from '@careshiphealth/sdk';

// Embed the widget
await SuperCareEmbed.embed({
  orgId: 'your-org-id-here',
  apiKey: 'your-api-key-here',
  widgetUrl: '/widget/supercare-widget.iife.js', // optional
  cssUrl: '/widget/widget.css', // optional
  containerId: 'supercare-widget-container' // optional
});

// Check if widget is embedded
if (SuperCareEmbed.isEmbedded()) {
  console.log('Widget is embedded');
}

// Remove the widget
SuperCareEmbed.remove();

Method 2: Direct Script Tag with Data Attributes

<!DOCTYPE html>
<html>
<head>
  <title>Your App</title>
</head>
<body>
  <!-- Your content -->
  
  <!-- Load the embed SDK script with data attributes -->
  <script 
    src="path/to/supercare-embed-sdk.js"
    data-supercare-org-id="545a71ce-dab2-4ce3-b33b-83326eff6a36"
    data-supercare-api-key="9991a016cb88421e8da4048b19f9a576"
    data-supercare-widget-url="/widget/supercare-widget.iife.js"
    data-supercare-css-url="/widget/widget.css"
    data-supercare-container-id="my-widget-container">
  </script>
</body>
</html>

Method 3: Global Window Object

<script src="path/to/supercare-embed-sdk.js"></script>
<script>
  // SDK is available as window.SuperCareEmbed
  window.SuperCareEmbed.embed({
    orgId: '545a71ce-dab2-4ce3-b33b-83326eff6a36',
    apiKey: '9991a016cb88421e8da4048b19f9a576',
  }).then(() => {
    console.log('Widget embedded successfully');
  }).catch((error) => {
    console.error('Failed to embed widget:', error);
  });
</script>

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | orgId | string | Required | Your organization ID | | widgetUrl | string | /widget/supercare-widget.iife.js | URL to the widget JavaScript file | | cssUrl | string | /widget/widget.css | URL to the widget CSS file | | containerId | string | supercare-09u2ekhbpo-body | ID of the container element for the widget | | autoInit | boolean | true | Whether to automatically initialize the widget |

API Reference

SuperCareEmbed.embed(config: SuperCareEmbedConfig): Promise<void>

Embeds the SuperCare widget with the provided configuration.

Parameters:

  • config: Configuration object containing orgId and optional settings

Returns: Promise that resolves when the widget is embedded

Example:

await SuperCareEmbed.embed({
  orgId: 'your-org-id',
  widgetUrl: 'https://cdn.example.com/widget.js'
});

SuperCareEmbed.remove(): void

Removes the widget and cleans up all injected elements.

Example:

SuperCareEmbed.remove();

SuperCareEmbed.isEmbedded(): boolean

Returns whether the widget is currently embedded.

Returns: true if embedded, false otherwise

Example:

if (SuperCareEmbed.isEmbedded()) {
  console.log('Widget is active');
}

What the SDK Does

The embed SDK automatically:

  1. Injects CSS: Adds the widget stylesheet to the document head
  2. Creates Container: Adds the required container div to the document body
  3. Loads Script: Injects the widget JavaScript with the proper org ID parameter
  4. Handles Cleanup: Provides methods to cleanly remove all injected elements

Generated HTML Structure

When embedded, the SDK creates the following structure:

<head>
  <!-- Injected CSS -->
  <link rel="stylesheet" href="/widget/widget.css" />
</head>
<body>
  <!-- Your existing content -->
  
  <!-- Injected container -->
  <div id="supercare-09u2ekhbpo-body"></div>
  
  <!-- Injected script -->
  <script 
    id="supercare-09u2ekhbpo-script" 
    type="module"
    src="/widget/supercare-widget.iife.js?ORG_ID=your-org-id">
  </script>
</body>

Error Handling

The embed SDK includes comprehensive error handling:

try {
  await SuperCareEmbed.embed({
    orgId: 'invalid-org-id',
    widgetUrl: 'https://nonexistent.com/widget.js'
  });
} catch (error) {
  console.error('Widget embedding failed:', error.message);
  // Handle the error appropriately
}

TypeScript Support

The package includes full TypeScript definitions:

import SuperCareEmbed, { SuperCareEmbedConfig } from '@careshiphealth/sdk';

const config: SuperCareEmbedConfig = {
  orgId: 'your-org-id',
  widgetUrl: '/custom/path/widget.js'
};

await SuperCareEmbed.embed(config);

Browser Compatibility

  • Modern browsers with ES2015+ support
  • Internet Explorer 11+ (with polyfills)
  • All major mobile browsers

License

MIT