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

@vcita/intandem-app-com

v1.3.0

Published

Provide embedded app communication tools

Readme

intandem-app-com

official usage documentation

Getting started

npm i @vcita/intandem-app-com

Initializing your app or widget

In order to initialize the communication with the host simply call the init method on the handler object, await the result and from this point, the widget communication is ready for use. You should receive a unique widget uid when the widget is set up in the host. The value should be identical to the value held by the host, or the initialization will fail. When using this code snippet, replace [YOUR_WIDGET_UID] with the widget uid you received from the host.

import messageHandler from '@vcita/intandem-app-com';

const hostWindow = window.parent;
const widgetWindow = window;
const widgetUid = '[YOUR_WIDGET_UID]';
let initialized = false;

await messageHandler.init(hostWindow, widgetWindow, widgetUid).then(() => {
    // The widget is ready to communicate with the host
    initialized = true;    
}).catch((error) => {
    // In case there is an error during initialization
    console.log(error);
});

Listening to messages sent from the host

There are two ways available to listen to messages sent from the host:

  1. The result is received as a promise
import messageHandler from '@vcita/intandem-app-com';

messageHandler.getJWKSToken((result) => {
  console.log(result);
});
  1. The result is received as a callback, after a listener is added by calling addEventListener.
import messageHandler from '@vcita/intandem-app-com';
import { MessageType, WidgetState } from '@vcita/intandem-app-com';

messageHandler.addEventListener(MessageType.GetJWKSToken, (result, ack) => {
  console.log(result.isAck); // The value here will be true
  console.log(result);
  ack(success, result); // Optional
});

messageHandler.getJWKSToken();

This can used in case there is a need to listen to the result in a different location than where the data is requested.

The ack function is used to send an acknowledgment to the host, in case the widget needs to respond to the host. The ack function should be called with two parameters, the first is a boolean value that indicates if the operation was successful, and the second is the data that should be sent to the host. Both parameters are optional, and if the first parameter is not provided, the default value is true.

To remove the listener, call the removeEventListener method.

Sending messages to the host

There is a set of messages that can be sent to the host, and the host will respond with the requested information. The messages are:

  1. getJWKSToken
  2. getUser
  3. getState
  4. setState
  5. navigate
  6. openModal
  7. openAppMarket This is a shortcut to open the app market modal

Exiting the widget

When the widget wishes to exit, it should call the destroymethod on the handler object.

messageHandler.destroy();

This will release open listeners and other resources.

Troubleshooting

There are a few common issues that can occur when using the widget

  1. Trying to send a message when the widget is not initialized
messageHandler.getState().catch((error) => {
  console.log(error); // The error message will be 'The widget is not initialized'
});
  1. Trying to send a message and the answer is not received before timeout
messageHandler.getState().catch((error) => {
  console.log(error); // The error message will be 'Timeout'
});

This situation should not occur, the host is expected to always respond to the messages sent by the widget. In case no data is requested, the host will send an object with {isAck:true}. If you encounter this situation, it's best to contact the host developers to resolve this issue.