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

@webex/webex-widget-base

v0.222.0

Published

Webex React Widget Base

Readme

Webex Base Widget (@webex/webex-widget-base)

This base React component does the initial React, Webex authentication, and Redux setup for all Webex widgets.

Usage

There are a number of ways to use our webex-widget-base repo to begin developing your own widget on the Webex platform.

IMPORTANT NOTE: In order to authenticate to Webex, the resulting components require an accessToken or guestToken prop that you must provide when instantiating your widget. Please see the Authentication Section

Quick Start

To automatically setup Webex connections, and register your widget into the global browser store, you can use the webexWidgetBase enhancer like so:

import webexWidgetBase from '@webex/webex-widget-base';

function MyWidget(props) {
  return <div>My Widget</div>;
}


export default webexWidgetBase('myWidget', MyWidget);

Widgets using Redux

If you are also using redux for state management and want to provide your own reducers, import and use the constructWebexEnhancer higher order component instead:

import React, {Component} from 'react';
import {constructWebexEnhancer} from '@webex/webex-widget-base';

import reducers from './reducer';

class MyWidget extends Component {
  render() {
    return <div>My Widget's name is {this.props.displayName}</div>
  }
}

export default constructWebexEnhancer({
  name: 'myWidget',
  reducers
})(MyWidget);

By constructing your component like this, the constructor will combine your reducers with internal webex reducers and update your store with a react-redux <Provider />. This will allow you to connect() any child components and gain access to the store.

Authentication

In order to authenticate to Webex, you must provide the resulting React Components with an accessToken prop. This can be done programatically like so:

import MyWidget from './MyWidget';

class MyApp extends Component {
  render() {
    return <MyWidget accessToken={this.getState().accessToken} />;
  }
}

The widgets also support guest tokens in the form of JWT. To provide a guest token to authenticate, use the guestToken prop.

SDK Instance

In addition to accessToken or guestToken, the widgets can accept the property sdkInstance. This is a Webex SDK instance that has already been created and authenticated. The SDK requires certain plugins to be loaded in order for the widgets to function properly:

  • authorization
  • logger
  • meetings
  • people
  • rooms
  • internal.conversation
  • internal.feature
  • internal.flag
  • internal.mercury
  • internal.presence
  • internal.search
  • internal.team

Advance Usage

When your widget instantiates, it will get receive props from our main store. Some of the data and functions you will have access to:

  • sparkState: an object that will provide you with device registration and authentication states
  • sparkInstance: the webex object that is provided by the Webex JS SDK. You can use this object to interact with Webex APIs as the authenticated user.

Additional Enhancers

This package also provides some additional enhancers to make your widget setup a bit easier:

  • withInitialState (default): Establishes widget initial states with Redux and injects the React-Redux store Provider component
  • withBrowserGlobals (default): Enables widgets to be instantiated globally using window.webex.widget(el).widgetName (usage example)
  • withDataAPI (default): Enables widgets to be instantiated using a data API (usage example)
  • withIntl: A helper for enabling react-intl in your widget. You can pass a config object that will make intl available to you: {locale: 'en', messages}

To use any of these enhancers you can apply them directly to a Component: withIntl(MyComponent). Or you can compose them using a libary like recompose:

import {compose} from 'recompose';
import {
  withIntl
} from '@webex/webex-widget-base';
import {MyWidget} from './MyWidget';

const MyWrappedWidget = compose(
  withIntl()
)(MyWidget);