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

@statflo/textkit-widget-events

v1.3.3

Published

TextKit Events for Widgets

Downloads

18

Readme

TextKit by Statflo

TextKit Widget Events

This package defines all the available events within the TextKit platform this package extends the Widget SDK package. We export all the functionality from that package along with our implementation of it.

We also include the necessary iframeResizer.contentWindow.min.js file needed for external widgets. This will always be included therefore it's not necessary to include or import.

Installation

yarn add @statflo/textkit-widget-events

More Documentation

For more information on widget communication or container intialization you can refer to our Widget SDK Readme

Container Initialization

This function will create the initial Widget State.

Usage

import { createWidgetState, ContainerClient } from '@statflo/textkit-widget-events'

// Initialize Container
const containerClient = new ContainerClient({ window });

// Set the widgets unique id
const id = 'widgetId';

// Initialize widget inside client with default state
containerClient.createWidget(createWidgetState(id));

Widget Initialization

import { WidgetClient } from "@statflo/widget-sdk";

export const client = new WidgetClient({ 
  id: "my widget",
  window,
  createWidgetState: (id) => ({ id }),
});

Events

Usage

import { EventNames } from '@statflo/textkit-widget-events'

Widget Properties

EventNames.widget.postForwardExample: This event will forward the event data to other widgets this is for cross widget communication.

EventNames.widget.actionCreationFailed: This event will alert of error when actions are created.

EventNames.widget.appendTextToMessage: This event will append text to the message box.

EventNames.widget.replaceTextMessage: This event will replace the contents of the message box.

Container Events

EventNames.container.activeConversationChanged: This event will include context data when a conversation changes within TextKit so you can know with whom you are speaking to.

EventNames.container.appContextChanged: This event will include context data about the app session.

Widget Types

Usage

import { WidgetTypes } from '@statflo/textkit-widget-events'

Enum values

  • Standard
  • Action
  • Timeline
  • Sendable

Widget Scopes

Usage

import { WidgetScope } from '@statflo/textkit-widget-events'

Enum values

  • User
  • Conversation

Widget Tabs

Usage

import { WidgetTabs } from '@statflo/textkit-widget-events';

Enum values

  • Widget
  • Timeline

Widget State

Usage

import { WidgetState } from '@statflo/textkit-widget-events'

Enum values

  • containerDomain
  • footer
  • header
  • id
  • isOpen
  • isReady
  • isShown
  • label
  • maxHeight
  • size
  • type
  • url
  • widgetDomain

Widget View Sizes

Usage

import { WidgetViewSize } from '@statflo/textkit-widget-events'

Enum values

  • Large
  • Medium
  • Small

Debug Log

Usage

import { DebugLogLevel } from '@statflo/textkit-widget-events'

Enm values

  • None
  • Debug

Example

import { DebugLogLevel, ContainerClient } from '@statflo/textkit-widget-events';

export const widgetContainerClient = new ContainerClient({
  logs: DebugLogLevel.None,
  window,
});