@botonic/shared

v2.29.0

Published

Shared types, helpers, and building blocks used by `@botonic/core`, plugins, and related packages in the **current** Botonic line.

Readme

@botonic/shared

Shared types, helpers, and building blocks used by @botonic/core, plugins, and related packages in the current Botonic line.

Source and versions

| Line | npm | Source | | ----------- | ----- | ---------------------------------------------------------------- | | Legacy | 0.x | github.com/hubtype/botonic | | Current | 2.x | Hubtype internal monorepo (not public; packages publish to npm) |

Match the major version of @botonic/shared to @botonic/core and other @botonic/* packages in your project.

Package boundaries (2.x)

  • @botonic/shared — Protocol types, enums, request API types, and shared utilities. Not the home for server/webchat/webview runtime classes.
  • @botonic/core — Server runtime: BotonicContext, plugins, BotServerMessage factories, routing helpers (CoreBot, routes, session helpers — same package entry).
  • @botonic/webchat-core — Webchat message runtime (WebchatMessage, factories, realtime wrappers).
  • @botonic/webviews — Webview session context (BotonicContextWebviews, factory).

Import server runtime (BotonicContext, BotServerMessageFactory, plugins) from @botonic/core, webchat message classes from @botonic/webchat-core, and webview context from @botonic/webviews — not from @botonic/shared.

Installation

pnpm add @botonic/shared
# or
npm install @botonic/shared

Webchat rating submit payload (builtin)

Built-in webchat rating UI (and demos that follow it) send postbacks with the same prefix|JSON pattern as webchat client settings:

  • Prefix: submit-webchat-rating (SUBMIT_WEBCHAT_RATING_PAYLOAD).
  • Helpers: createSubmitWebchatRatingPayload, parseSubmitWebchatRatingPayload, isSubmitWebchatRatingPayload.

Flow Builder CMS rating nodes may still use agent-rating|… and other CMS-defined payloads; those are separate from this builtin contract. Custom payloads arrays on rating custom messages override defaults and are sent as-is.

With @botonic/webchat-react, the UI for BOTONIC_OUTPUT_RATING (botonic-output-rating) is registered automatically in customMessages. Pass your own component under the same key only when you need to replace the default RatingMessage.