@xapp/stentor-chat-widget 1.85.1 → 1.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  /*! Copyright (c) 2021, XAPPmedia */
2
+ import { Cta } from "./WidgetEnv";
2
3
  /**
3
4
  * Types of buttons available in the Action Bar
4
5
  */
@@ -252,6 +253,12 @@ export interface ActionBarConfig {
252
253
  * @default 768
253
254
  */
254
255
  readonly mobileBreakpoint?: number;
256
+ /**
257
+ * Call-to-action configuration for the chat button.
258
+ * When configured, displays a banner above the action bar prompting
259
+ * users to engage with chat. Only shown when chat is not open.
260
+ */
261
+ readonly cta?: Cta;
255
262
  }
256
263
  /**
257
264
  * Type guard for ActionBarChatButton
package/lib/ActionBar.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /*! Copyright (c) 2021, XAPPmedia */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.isActionBarChatButton = isActionBarChatButton;
5
4
  exports.isActionBarFormButton = isActionBarFormButton;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBar.js","sourceRoot":"","sources":["../src/ActionBar.ts"],"names":[],"mappings":";AAAA,oCAAoC;;AAwSpC,sDAEC;AAKD,sDAEC;AAKD,8DAEC;AAKD,wDAEC;AAKD,oDAEC;AAKD,wDAEC;AAKD,sDAEC;AAKD,4DAEC;AAtDD;;GAEG;AACH,SAAgB,qBAAqB,CAAC,MAAuB;IACzD,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,MAAuB;IACzD,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,MAAuB;IAC7D,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,SAAgB,sBA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;AACH,SAAgB,sBAAsB,CAAC,MAAuB;IAC1D,OAAO,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,MAAuB;IACzD,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,wBAAwB,CAAC,MAAuB;IAC5D,OAAO,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;AACrC,CAAC"}
package/lib/UserInfo.d.ts CHANGED
@@ -27,4 +27,9 @@ export interface UserInfo {
27
27
  * Display name
28
28
  */
29
29
  readonly displayName?: string;
30
+ /**
31
+ * Whether this user is an AI agent.
32
+ * Used to display an "AI" badge on the avatar when configured.
33
+ */
34
+ readonly isAI?: boolean;
30
35
  }
@@ -49,7 +49,7 @@ export interface Cta extends CtaConfig {
49
49
  */
50
50
  mobile?: MobileCtaConfig;
51
51
  }
52
- export type ServerType = "direct" | "websocket" | "local" | "websocketraw";
52
+ export type ServerType = "direct" | "websocket" | "local" | "websocketraw" | "mcp";
53
53
  /**
54
54
  * @deprecated Use connection property
55
55
  */
@@ -105,6 +105,70 @@ export interface ServerConfig {
105
105
  * @default 60000
106
106
  */
107
107
  readonly backgroundSleepDelay?: number;
108
+ /**
109
+ * MCP-specific configuration
110
+ * Only applies to "mcp" connection type
111
+ */
112
+ readonly mcp?: MCPServerConfig;
113
+ }
114
+ /**
115
+ * Page context override for testing/development.
116
+ * When provided, overrides the automatically detected page context.
117
+ */
118
+ export interface PageContextOverride {
119
+ /** Full URL to simulate (e.g., "https://example.com/pricing?ref=nav") */
120
+ readonly url?: string;
121
+ /** Path to simulate (e.g., "/pricing") */
122
+ readonly path?: string;
123
+ /** Document title to simulate (e.g., "Pricing - Example Co") */
124
+ readonly title?: string;
125
+ /** Referrer to simulate (e.g., "https://google.com") */
126
+ readonly referrer?: string;
127
+ }
128
+ export interface MCPServerConfig {
129
+ /**
130
+ * Mode determines endpoint path and authentication requirements:
131
+ * - homeowner: /chat/stream (unauthenticated, appId should be in serverUrl)
132
+ * - business_owner: /api/chat/stream (authenticated, requires authToken)
133
+ *
134
+ * For homeowner mode, the serverUrl should include the appId:
135
+ * e.g., "https://agent.xapp.ai/abc123"
136
+ *
137
+ * @default "homeowner"
138
+ */
139
+ readonly mode?: "homeowner" | "business_owner";
140
+ /**
141
+ * Auth token required for business_owner mode.
142
+ * Must be set when mode is "business_owner", will throw error if missing.
143
+ *
144
+ * SECURITY: This token grants access to the business account.
145
+ * Always use HTTPS in production to protect the token.
146
+ */
147
+ readonly authToken?: string;
148
+ /**
149
+ * Optional session ID for conversation continuity.
150
+ * If not provided, a new session will be created automatically.
151
+ * Session IDs are managed by the server and may be updated during conversation.
152
+ */
153
+ readonly sessionId?: string;
154
+ /**
155
+ * Enable debug mode to show tool calls in the chat.
156
+ * When enabled, expandable sections will appear showing tool inputs and outputs.
157
+ * Useful for debugging and understanding how the assistant processes requests.
158
+ */
159
+ readonly debugMode?: boolean;
160
+ /**
161
+ * Override the automatically detected page context.
162
+ * Useful for testing/development in Storybook or other environments
163
+ * where you want to simulate being on a specific page.
164
+ */
165
+ readonly pageContextOverride?: PageContextOverride;
166
+ /**
167
+ * Show an "AI" badge on the avatar for AI-generated messages.
168
+ * Helps distinguish AI responses from human agent messages.
169
+ * @default false
170
+ */
171
+ readonly showAiBadge?: boolean;
108
172
  }
109
173
  /**
110
174
  * Environment settings for the Widget
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "1.85.1",
7
+ "version": "1.87.0",
8
8
  "description": "Chat Widget channel for stentor",
9
9
  "types": "lib/index",
10
10
  "main": "lib/index",
@@ -19,18 +19,18 @@
19
19
  "@types/react": "^19.0.0",
20
20
  "@types/sinon": "10.0.20",
21
21
  "@types/sinon-chai": "3.2.12",
22
- "@xapp/config": "0.2.3",
22
+ "@xapp/config": "0.3.0",
23
23
  "chai": "4.5.0",
24
24
  "mocha": "9.2.2",
25
25
  "sinon": "13.0.2",
26
26
  "sinon-chai": "3.7.0",
27
- "stentor-models": "1.68.6",
27
+ "stentor-models": "1.69.9",
28
28
  "ts-node": "10.9.2",
29
29
  "typescript": "5.9.3"
30
30
  },
31
31
  "dependencies": {
32
- "stentor-constants": "1.68.6",
33
- "stentor-guards": "1.68.6"
32
+ "stentor-constants": "1.69.9",
33
+ "stentor-guards": "1.69.9"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^18.0.0 || ^19.0.0",
@@ -40,5 +40,5 @@
40
40
  "build": "tsc -d true -p .",
41
41
  "clean": "rm -rf ./lib/*"
42
42
  },
43
- "gitHead": "5c99ab44e56acebb675aede84a8cc5a42a37f051"
43
+ "gitHead": "e4e9a6ff1e817ce27c3df845376892b980d9adcc"
44
44
  }