Customer Agent

ESM entry

Package exports exposed by @customer-agent/sdk.

The ESM entry is the package-import version of the SDK. It exposes the same browser singleton as the script entry, plus React hooks and message catalog assets.

Package Exports

Export pathExportsPurpose
@customer-agent/sdkdefault, CustomerAgent, named SDK methods, types, CUSTOMER_AGENT_EVENTSBrowser SDK control surface.
@customer-agent/sdk/reactuseCustomerAgent, useCustomerAgentState, useCustomerAgentEventReact hook surface.
@customer-agent/sdk/sdk.jsBrowser script assetScript SDK file.
@customer-agent/sdk/runtime.es.jsBrowser runtime assetPublic runtime module artifact.
@customer-agent/sdk/messages/*Message catalog JSON filesBuilt-in locale message catalogs.

Main Export

import CustomerAgent, {
  CUSTOMER_AGENT_EVENTS,
  boot,
  chooseInvitation,
  ensureInvitation,
  getInterviewState,
  getInterviewSession,
  getSession,
  getState,
  getSupportState,
  hide,
  identify,
  openEntry,
  on,
  loadInterviewReward,
  sendInterviewMessage,
  setContext,
  show,
  shutdown,
  startInvitation,
  toggle,
  update
} from "@customer-agent/sdk"

See JavaScript SDK for method signatures.

Type Exports

TypeMeaning
CustomerAgentGlobalCommand function and method namespace.
CustomerAgentOptionsOptions accepted by boot and update.
CustomerAgentWidgetController returned by boot.
CustomerAgentStateState returned by getState.
CustomerAgentSupportStateState returned by getSupportState.
CustomerAgentInterviewStateState returned by getInterviewState.
CustomerAgentTargetTarget accepted by show and toggle.
CustomerAgentEventMapEvent payload map.
CustomerAgentEventNameUnion of event names.
SetContextOptionsOptions accepted by setContext.
CustomerAgentInterviewSessionSession returned by getInterviewSession.
WidgetContextJsonJSON object accepted as user context.

Message Catalog Exports

Built-in message catalogs are available under @customer-agent/sdk/messages/<locale>.json.

Self-hosted Assets

When serving built SDK files yourself, publish the complete dist output instead of copying individual entry files.

LocaleExport path
de@customer-agent/sdk/messages/de.json
en@customer-agent/sdk/messages/en.json
es@customer-agent/sdk/messages/es.json
fr@customer-agent/sdk/messages/fr.json
it@customer-agent/sdk/messages/it.json
ja@customer-agent/sdk/messages/ja.json
ko@customer-agent/sdk/messages/ko.json
pt-BR@customer-agent/sdk/messages/pt-BR.json
zh@customer-agent/sdk/messages/zh.json
zh-TW@customer-agent/sdk/messages/zh-TW.json

On this page