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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@twilio/flex-plugin

v7.0.7

Published

Runtime for Flex plugins

Downloads

28,116

Readme

Version Downloads License

Flex Plugin

Library to help building Twilio Flex Plugins.

Installation

npm install flex-plugin

Usage

import { loadPlugin, FlexPlugin } from '@twilio/flex-plugin';

class MyPlugin extends FlexPlugin {
  pluginName = 'MyPlugin';

  init(flex, manager) {
    // set up your flex
    flex.TaskCanvas.Content.add(<p>Hello</p>);
  }
}

loadPlugin(MyPlugin);

Visit Twilio Docs for a tutorial on creating your first plugin.

Libraries

Loading External JS/CSS Files

To load external JS/CSS files into your plugin, we provide two helper methods: loadJS and loadCSS. Use them by calling these methods at the start of plugin initialization.

import { FlexPlugin, loadJS, loadCSS } from '@twilio/flex-plugin';

class MyPlugin extends FlexPlugin {
  pluginName = 'MyPlugin';

  init(flex, manager) {
    loadJS('http://mysite.com/files/flex.js');
    loadCSS(
      'http://mysite.com/files/flex.css',
      'http://mysite.com/files/flex-2.css',
    );

    // set up everything else
  }
}

The CSS/JS files must be accessible by Twilio's proxy servers. Local files on your desktop are likely inaccessible via these methods, but your stylesheet may be uploaded to Twilio Assets for use here.

External Dependencies

The following NPM packages are defined as external dependencies:

react
react-dom
redux
react-redux

When you build your plugin, these dependencies will not be included in your bundle. Instead, Flex UI will provide them as global for your plugin to use.

To ensure you are using the same version that Flex UI is exposing, leave the version of the React that is specified in your package.json. See React Versions to see the currently supported version.

React Versions

We currently support the following versions:

react          16.5.2
react-dom      16.5.2
redux          3.7.2
react-redux    5.1.0

Contributing

Make sure to follow the instructions in the main repository to set up the project.

# Install dependencies and link local packages with each other
cd packages/flex-plugin-scripts
npx lerna bootstrap

# Run tests
npm test

# To use your local package in a different project
npm link
# then in a different project
npm link flex-plugin-scripts

Contributors

Thank you to all the lovely contributors to this project. Please check the main repository to see all contributors.

License

MIT