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

@cue/embedded

v0.3.0

Published

JavaScript/TypeScript library for the Cue embeddable widget and related tools

Readme

Cue Embedded

Cue Platform Reference

Installation

Option 1: NPM

npm install @cue/embedded --save

and then import the library as an ES6 module to use in your application's code:

import * as Cue from '@cue/embedded'; // OR import { init, embed, EmbeddedWidget, WidgetEvent } from '@cue/embedded';

TypeScript definitions are automatically included when installing from npm.

Option 2: CDN

Insert the following script right before your app's closing </body> tag, replacing LATEST_VERSION_NUM with the library's latest stable version number from npm:

<script src="https://unpkg.com/@cue/embedded@[LATEST_VERSION_NUM]/bundles/cue.umd.js"></script>

Displaying the Widget

On any page or component where you'd like to display the widget:

<!-- Insert your own container element -->
<div id="cue-widget-container" style="height:100%; width:600px; max-width:100%;"></div>
// Create a new widget instance and attach to the DOM element
const cueWidget = Cue.embed('#cue-widget-container');

The widget will automatically expand to fill the space of its container.

Receiving Data

You can listen for events or changes to data from the widget anytime after the instance variable has been instantiated.

Angular

export class ExampleComponent implements OnInit {
    cueWidget: EmbeddedWidget;
    
    constructor() {}

    ngOnInit(): void {
        this.cueWidget = Cue.embed('#cue-widget-container');

        /* Widget iframe has finished loading */
        this.cueWidget.on(WidgetEvent.Ready, () => {
            console.log('Widget is awaiting instructions');
        });

        /* Cue user has logged into the widget */
        this.cueWidget.on(WidgetEvent.Login, (user) => {
            console.log(user);
        });

        /* Cue user has logged out of the widget  */
        this.cueWidget.on(WidgetEvent.Logout, (oldUser) => {
            console.log(oldUser);
        });

        /* Authenticated Cue user has changed (i.e. login, logout, or credentials loaded from localStorage on page load) */
        this.cueWidget.on(WidgetEvent.AuthChange, (newUser) => {
            if (!!newUser && !!newUser.id) {
                console.log(newUser.fullName);
            }
        });

        /* A new script session has started */
        this.cueWidget.on(WidgetEvent.SessionReady, ({ session }) => {
            console.log(session.id, session.smartScriptId, session.campaignId, session.direction, session.contactIdInitial);
            // "1", "5", "10", "Outbound", "20"
        });

        /* A displayed field's value was loaded within Cue or from a third-party integration's data */
        this.cueWidget.on(WidgetEvent.FieldInit, ({ field, value }) => {
           console.log(field.mergeText, value);
           // "CONTACT.EMAIL", "[email protected]"
        });
        
        /* A displayed field was edited while in an agent's script session */
        this.cueWidget.on(WidgetEvent.FieldEdit, ({ field, value }) => {
           console.log(field.mergeText, value);
           // "CONTACT.EMAIL", "[email protected]"
        });
    }
}

Starting a New Script Session (requires user login to widget)

/*
 * Set the call session parameters programmatically and control navigation flow
 * Make sure to replace CAMPAIGN_ID below with a campaignId from your Cue organization
 */
cueWidget.startSession(CAMPAIGN_ID, 'Outbound');

Updating Script Fields (requires user login to widget)

While inside a scripted call session, you might want to update a field's value in the script to keep it in sync with the parent page's data:

Angular

<input name="firstName" [(ngModel)]="firstName" (ngModelChange)="cueWidget.setField('CONTACT.FIRSTNAME', $event)" />

jQuery

$(function() {
    $("input#first-name").blur(function() {
        // Follows the method signature (mergeText: string, value: any)
        cueWidget.setField('CONTACT.FIRSTNAME', $(this).val());
    })
});

To Remove the Widget + Unsubscribe from Events

cueWidget.destroy();

More Examples

Additional examples can be found in the package's /examples folder.