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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@websolutespa/ask-dececco

v1.0.7

Published

Ask De Cecco plugin

Readme

@websolutespa/ask-dececco

npm version

status alpha

Ask De Cecco plugin module of the Ask Repository by websolute.

Docs

This guide shows how to embed Ask Dececco into a web page using the browser bundle.

The integration has five steps:

  1. Include the browser JavaScript bundle.
  2. Prepare the plugin options.
  3. Initialize the plugin instance.
  4. Create the web component element.
  5. Append the element to the page.

Basic Integration

<!DOCTYPE html>
<html lang="it">
  <head>
    <meta charset="utf-8" />
    <script type="module" src="https://cdn.jsdelivr.net/npm/@websolutespa/ask-dececco/dist/browser.js"></script>
  </head>
  <body>
    <div class="ask-dececco"></div>

    <script type="module">
      const mount = () => {
        const target = document.querySelector('.ask-dececco');
        if (!target || !window.askDececco) {
          return;
        }

        const searchParams = new URLSearchParams(window.location.search);
        const options = {
          appKey: 'ask-dececco',
          apiKey: 'YOUR_API_KEY',
          endpoint: 'https://ask.websolute.ai',
          styles: 'https://cdn.jsdelivr.net/npm/@websolutespa/ask-dececco/dist/styles.css',
          threadId: searchParams.get('threadId') || undefined,
        };

        const instance = window.askDececco(options);
        if (!instance) {
          return;
        }

        const element = document.createElement('ask-dececco');
        element.style.display = 'contents';
        target.appendChild(element);
      };

      if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', mount, { once: true });
      } else {
        mount();
      }
    </script>
  </body>
</html>

Step By Step

1. Include the Browser JS

Load the browser entrypoint with a module script:

<script type="module" src="https://cdn.jsdelivr.net/npm/@websolutespa/ask-dececco/dist/browser.js"></script>

This bundle exposes the askDececco(...) initializer on window.

2. Configure the Options

Create an options object before initializing the plugin.

Common example:

const options = {
  appKey: 'ask-dececco',
  apiKey: 'YOUR_API_KEY',
  endpoint: 'https://ask.websolute.ai',
  styles: 'https://cdn.jsdelivr.net/npm/@websolutespa/ask-dececco/dist/styles.css',
  threadId: new URLSearchParams(window.location.search).get('threadId') || undefined,
};

3. Initialize the Instance

Call the browser initializer with the options object:

const instance = window.askDececco(options);

The initializer returns a plugin instance when creation succeeds.

Available instance methods:

  • opened() returns the current open state.
  • setOpened(boolean) explicitly opens or closes the widget.
  • toggle() toggles the widget state.
  • send(message) sends a message programmatically.
  • clear() clears the current conversation state.
  • create(target?) creates or mounts the plugin programmatically.

4. Create the Web Component Element

Create the custom element used by the UI:

const element = document.createElement('ask-dececco');
element.style.display = 'contents';

Using display: contents keeps the wrapper element visually neutral when the page layout should be controlled by the component content.

5. Append the Component to the Page

Append the element to a target container already present in the DOM:

const target = document.querySelector('.ask-dececco');
target.appendChild(element);

Supported Options

The published type declarations expose the following plugin options.

| Option | Type | Description | | --- | --- | --- | | apiKey | string | API key used by the plugin requests. | | appKey | string | Application identifier for the embedded experience. | | contexts | ChatUserContext[] | User context entries passed to the chat. | | draft | boolean | Enables draft mode when supported by the backend. | | embedded | boolean | Marks the plugin as embedded in an existing page. | | endpoint | string | Base API endpoint used by the widget. | | initialSpec | Spec \| null | Initial UI spec payload, if you want to preload a generated UI state. | | instance | PluginInstance | Existing instance reference, when reusing plugin state manually. | | mock | boolean \| object | Mock mode for local or controlled test data. | | preview | boolean | Enables preview behavior when supported. | | styles | string | URL of the stylesheet to load for the widget UI. | | threadId | string | Conversation thread identifier to resume an existing thread. | | userId | string | User identifier for session association or personalization. |

contexts

contexts accepts an array of objects with this shape:

const contexts = [
  {
    title: 'Customer',
    context: {
      id: '12345',
      market: 'it',
    },
  },
];

mock

mock can be a boolean or an object used for mocked data flows.

Supported mock payload fields from the published types:

  • contents
  • history
  • messages
  • stream

Clean Integration Pattern

For better readability and fewer global checks, keep the embed logic in a small initializer function:

<script type="module">
  const mount = () => {
    const target = document.querySelector('.ask-dececco');
    if (!target || !window.askDececco) {
      return;
    }

    const searchParams = new URLSearchParams(window.location.search);
    const options = {
      appKey: 'ask-dececco',
      apiKey: 'YOUR_API_KEY',
      endpoint: 'https://ask.websolute.ai',
      styles: 'https://cdn.jsdelivr.net/npm/@websolutespa/ask-dececco/dist/styles.css',
      threadId: searchParams.get('threadId') || undefined,
    };

    const instance = window.askDececco(options);
    if (!instance) {
      return;
    }

    const element = document.createElement('ask-dececco');
    element.style.display = 'contents';
    target.appendChild(element);
  };

  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', mount, { once: true });
  } else {
    mount();
  }
</script>

Performance And Readability Notes

To keep the embed clean and efficient:

  • Load the browser bundle once with type="module".
  • Reuse a single mount container.
  • Resolve threadId only once during initialization.
  • Guard against missing target nodes or missing bundle globals.
  • Use DOMContentLoaded only when needed; if the document is already ready, initialize immediately.
  • Keep the stylesheet URL inside the options object so the component can manage its own styles consistently.

Hints

Replace YOUR_API_KEY with the correct key for the target environment before publishing.

Replace Dececco with the actual exported name of the Ask Plugin.


this library is for internal usage and not production ready