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

@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client

v9.12.1

Published

Embedded Agentforce conversation client feature for UI Bundles

Readme

Agentforce Conversation Client React

React component for embedding the Agentforce Conversation Client — the Salesforce agent chat UI for employee agents — into a UI Bundle. This is a wrapper around @salesforce/agentforce-conversation-client that handles authentication automatically and provides a declarative <AgentforceConversationClient /> component.

Use this when a user expects to add an employee agent, Agentforce chat, conversation client, or chat widget for employee agents to their React app. This package only supports Salesforce employee agents — service agents and other agent types are not supported.

How it works

The component embeds the Agentforce chat experience using Lightning Out 2.0. Authentication is resolved automatically:

  • Dev (localhost): fetches a frontdoorUrl from /__lo/frontdoor
  • Prod (hosted in org): uses globalThis.SFDC_ENV?.orgUrl as salesforceOrigin when available

Step 1: Install

npm install @salesforce/ui-bundle-template-feature-react-agentforce-conversation-client

This automatically installs @salesforce/agentforce-conversation-client (the underlying SDK) as a dependency.

Step 2: Embed in the app layout

import { AgentforceConversationClient } from "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client";

export default function AppLayout() {
  return (
    <>
      <Outlet />
      <AgentforceConversationClient agentId="0Xx000000000000AAA" />
    </>
  );
}

Step 3: Configure (flat props)

Props

| Prop | Type | Required | Description | | ------------------ | ------------------------ | -------- | ------------------------------------------------------------------------------------------------- | | agentId | string | Yes | Agent id to load (18-char Salesforce id, starts with 0Xx). | | agentLabel | string | No | Optional display name shown in the chat header. | | inline | boolean | No | If true renders inline; otherwise floating. | | headerEnabled | boolean | No | Header visibility toggle (primarily for inline mode). Floating mode displays a header by default. | | showHeaderIcon | boolean | No | Show/hide the icon in the header. | | width | number \| string | No | Inline width (px number or CSS string). | | height | number \| string | No | Inline height (px number or CSS string). | | styleTokens | Record<string, string> | No | Theme tokens for chat UI styling. Passed through to the underlying SDK. | | salesforceOrigin | string | No | Salesforce org origin URL. Resolved automatically if not provided. | | frontdoorUrl | string | No | Frontdoor URL for authentication. Resolved automatically in dev if not provided. | | onReady | AgentforceReadyHandler | No | Callback invoked when Lightning Out is ready. Receives the event detail. | | onError | AgentforceErrorHandler | No | Callback invoked on Lightning Out errors. Receives { type, detail }. |

Rendering Modes

Floating (default)

A persistent chat widget overlay pinned to the bottom-right corner. No extra config needed.

<AgentforceConversationClient agentId="0Xx000000000000AAA" />

Inline

The chat renders within the page layout at a specific size.

<AgentforceConversationClient agentId="0Xx000000000000AAA" inline width={420} height={600} />

Agent Selection

Pass agentId to load a specific agent (e.g. travel agent, HR agent). agentId is required.

<AgentforceConversationClient agentId="0Xx000000000000AAA" />

Theming with styleTokens

Use styleTokens to theme the Agentforce Conversation Client. Only override the tokens you need.

<AgentforceConversationClient
  agentId="0Xx000000000000AAA"
  styleTokens={{
    headerBlockBackground: "#0176d3",
    headerBlockTextColor: "#ffffff",
    messageBlockInboundBackgroundColor: "#0176d3",
  }}
/>

Header visibility

Use headerEnabled to explicitly show or hide the chat header. In this wrapper, floating mode shows a header by default; this prop is most useful for inline mode.

<AgentforceConversationClient
  agentId="0Xx000000000000AAA"
  inline
  width={420}
  height={600}
  headerEnabled
/>

Header icon visibility

Use showHeaderIcon to explicitly show or hide the icon in the header.

<AgentforceConversationClient agentId="0Xx000000000000AAA" showHeaderIcon={false} />

Error and ready callbacks

Use onReady and onError to react programmatically to Lightning Out lifecycle events — for example, to show a loading spinner until the agent is ready, or to report errors to an observability service.

<AgentforceConversationClient
  agentId="0Xx000000000000AAA"
  onReady={(detail) => {
    console.log("Agent chat is ready", detail);
  }}
  onError={(error) => {
    // error.type: "lo.application.error" | "lo.iframe.error"
    // error.detail: the raw error payload from Lightning Out
    reportError(error);
  }}
/>

Both callbacks are optional. When omitted, the SDK still logs errors and readiness to the console.

Wrapper defaults and initialization behavior

This React wrapper applies a few defaults around the underlying SDK:

  • showAvatar is set to false.
  • channel is set to "Vibes".
  • The embed is initialized once per browser window (singleton). If multiple instances mount, only the first successful initialization performs the embed.

Available Style Tokens

For the complete and always up-to-date list of all 60+ style tokens, see the underlying SDK documentation:

@salesforce/agentforce-conversation-client README or node_modules/@salesforce/agentforce-conversation-client/README.md (lines 94-177)

Style tokens are organized by UI area:

  • Header (7 tokens): background, text color, hover, active, focus, border, font family
  • Messages (10 tokens): colors, padding, margins, border radius, fonts, body width
  • Inbound messages (5 tokens): background, text color, width, alignment, hover
  • Outbound messages (5 tokens): background, text color, width, alignment, margin
  • Input (33 tokens): colors, borders, fonts, padding, buttons, scrollbar, textarea, actions

Prerequisites

  • The SDK requires one of salesforceOrigin or frontdoorUrl.
  • The wrapper auto-resolves auth in common cases:
    • localhost: fetches frontdoorUrl from /__lo/frontdoor
    • org-hosted UI Bundle: reads salesforceOrigin from globalThis.SFDC_ENV?.orgUrl
  • If your runtime does not provide either source, pass salesforceOrigin or frontdoorUrl explicitly.
  • The org must allow localhost:<PORT> in Trusted Domains for Inline Frames (session settings) for local development.

If used outside a Salesforce web app (React app)

When this package is used in an external React app (not running inside a Salesforce-hosted UI Bundle), you should pass frontdoorUrl explicitly so Lightning Out can start with an authenticated Salesforce session.

<AgentforceConversationClient
  agentId="0Xx000000000000AAA"
  frontdoorUrl="https://your-org.my.salesforce.com/secur/frontdoor.jsp?otp=<OTP>"
/>

Underlying SDK

This component wraps @salesforce/agentforce-conversation-client. For lower-level usage (vanilla JS, non-React frameworks), see the Agentforce Conversation Client SDK.


Rules and Skills

This package includes coding-agent rules and skills for automated workflows:

  • Rule (rules/embedded-agent-rule.md): Conventions for which component to use, authentication, rendering modes, and placement. Copy into .cursor/rules/ (Cursor) or .clinerules/ (Cline).
  • Skill (skills/managing-agentforce-conversation-client/): Step-by-step workflow for adding, updating, and configuring the agent — install (or detect existing via patches), add component, update existing instances, configure inline/theming/agent. Copy into .cursor/skills/ (Cursor) or .cline/skills/ (Cline).

Development

npm run build   # apply patches -> dist
npm run dev     # run from dist
npm run watch   # watch and re-apply