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

ai12z

v1.0.18

Published

ai12z Web Components

Downloads

5,640

Readme

ai12z Web Components

ai12z is a library of web components to integrate ai12z platform to you website / web app.

Setup

To install from npm:

npm install ai12z@latest --save
npm install ai12z-cta --save
npm install ai12z-knowledge-box  --save

Getting Started

HTML

  • Put a script tag similar to this <script type='module' src='https://unpkg.com/ai12z@latest/dist/esm/library.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your html
  • The tag named as ai12z-cta allows us to show the search results along with the follow up chat conversations and customize our search results.
  • This control is having two tag element which is mentioned below.
<<ai12z-cta>
  <privacy slot="custom-privacy"></privacy>
  <cta slot="cta"></cta>
</<ai12z-cta>
  • (Optional) This tag element allows us to add the privacy policy links.
  • (Optional) This tag element allows us to customize our page by adding our own tag elements within this element.

The control contains following properties to customize the page.

  • data-key (Required) api key from your ai12z project settings.
  • data-mode (Required) Allows us to enter the data-mode which will identify the server as local or dev or prod.
  • heading (Optional) allows us to show the header text.
  • button-text (Optional) allows us to customize the button name.
  • help-text (Optional) allows us to customize the helper text.
  • no-results-text (Optional) allows us to customize the no results found text.
  • auto-search (Optional) allows us to configure the search option.
  • placeholder (Optional) allows us to customize the placeholder text.
  • icon-src (Optional) allows us to add the icon to the search button.
  • categorize (Optional) allows us to customize the search results based on the category. By default the search results will be catogorized.
  • clear-memory (Optional) allows us to clear the previously searched data. By defualt, this property is set to true.
  • image-upload (Optional) allows us to perform a image based search.By default, this property is set to true.
  • The second control named as ai12z-knowledge-box allows us to send the query programmmatically through javascript and rendering the query results by clicking on the button.

The control contains following properties to customize the page.

  • data-key (Required) api key from your ai12z project settings.
  • data-mode (Required) Allows us to enter the data-mode which will identify the server as local or dev or prod.
  • question (Optional) allows us to set the question for on-load.
  • relavance-score (Optional) allows us to view the score of clicks, engagement, conversions and negative reviews.
  • feedback (Optional) allows us to add the thumbs up and down option for the question. By default this property set to true.

Usage

We are providing the option named as dataAttributes for assigning the JSON object programmatically and sending those object to the API payload for furthur use.

<script>
  const ele = document.querySelector('ai12z-cta');
  ele.dataAttributes = {
    content: {
      newlist: [
        {
          _uid: "BUY6Drn9e1",
          component: "foo",
          headline: "Foo"
        },
        {
          _uid: "gJZoSLkfZV",
          component: "bar",
          title: "Bar"
        },
        {
          _uid: "X1JAfdsZxy",
          component: "foo",
          headline: "Another headline"
        }
      ]
    }
};
</script>

Events

<script>
  // Reference to your component
  const ele = document.querySelector("ai12z-cta")

  // onErrored
  ele.addEventListener("errored", (event) => {
    console.error("Error:", event.detail)
  })

  // onButtonClicked
  ele.addEventListener("buttonClicked", (event) => {
    console.log("Button clicked:", event.detail)
  })

  // onMessageSent
  ele.addEventListener("messageSent", (event) => {
    console.log("Sent message:", event.detail)
  })

  // onMessageReceived
  ele.addEventListener("messageReceived", (event) => {
    console.log("Received message:", event.detail)
  })

  // onOpen
  ele.addEventListener("open", () => {
    console.log("Component opened")
  })

  // onClose
  ele.addEventListener("close", () => {
    console.log("Component closed")
  })
</script>