@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental 1.107.3 → 1.107.5
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.
- package/README.md +12 -85
- package/dist/.a4drules/features/feature-react-agentforce-conversation-client-embedded-agent-rule.md +30 -6
- package/dist/.a4drules/skills/managing-agentforce-conversation-client/SKILL.md +186 -0
- package/dist/.a4drules/skills/managing-agentforce-conversation-client/references/constraints.md +134 -0
- package/dist/.a4drules/skills/managing-agentforce-conversation-client/references/examples.md +132 -0
- package/dist/.a4drules/skills/managing-agentforce-conversation-client/references/style-tokens.md +101 -0
- package/dist/.a4drules/skills/{integrating-agentforce-conversation-client/docs → managing-agentforce-conversation-client/references}/troubleshooting.md +9 -12
- package/dist/CHANGELOG.md +16 -0
- package/dist/force-app/main/default/webapplications/feature-react-agentforce-conversation-client/package.json +4 -4
- package/dist/package-lock.json +2 -2
- package/dist/package.json +1 -1
- package/package.json +2 -2
- package/rules/embedded-agent-rule.md +30 -6
- package/skills/managing-agentforce-conversation-client/SKILL.md +186 -0
- package/skills/managing-agentforce-conversation-client/references/constraints.md +134 -0
- package/skills/managing-agentforce-conversation-client/references/examples.md +132 -0
- package/skills/managing-agentforce-conversation-client/references/style-tokens.md +101 -0
- package/skills/{integrating-agentforce-conversation-client/docs → managing-agentforce-conversation-client/references}/troubleshooting.md +9 -12
- package/dist/.a4drules/skills/integrating-agentforce-conversation-client/SKILL.md +0 -92
- package/dist/.a4drules/skills/integrating-agentforce-conversation-client/docs/embed-examples.md +0 -116
- package/skills/integrating-agentforce-conversation-client/SKILL.md +0 -92
- package/skills/integrating-agentforce-conversation-client/docs/embed-examples.md +0 -116
package/README.md
CHANGED
|
@@ -106,90 +106,17 @@ Use `headerEnabled` to explicitly show or hide the chat header. It defaults to `
|
|
|
106
106
|
|
|
107
107
|
#### Available Style Tokens
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
##### Agentforce Messages
|
|
122
|
-
|
|
123
|
-
| Token name | UI area themed |
|
|
124
|
-
| -------------------------------- | ---------------------------------- |
|
|
125
|
-
| `messageBlockBodyPaddingBottom` | Message block body bottom padding |
|
|
126
|
-
| `messageBlockTextPadding` | Message block text padding |
|
|
127
|
-
| `messageBlockPaddingContainer` | Message block container padding |
|
|
128
|
-
| `messageBlockContainerMarginTop` | Message block container top margin |
|
|
129
|
-
| `messageBlockPadding` | Message block padding |
|
|
130
|
-
| `messageBlockBorderRadius` | Message block border radius |
|
|
131
|
-
| `messageBlockFontSize` | Message block font size |
|
|
132
|
-
| `messageBlockLineHeight` | Message block line height |
|
|
133
|
-
| `messageBlockBackgroundColor` | Message block background (base) |
|
|
134
|
-
| `messageBlockBodyWidth` | Message block body width |
|
|
135
|
-
|
|
136
|
-
##### Inbound message (customer to agent)
|
|
137
|
-
|
|
138
|
-
| Token name | UI area themed |
|
|
139
|
-
| ----------------------------------------- | -------------------------------- |
|
|
140
|
-
| `messageBlockInboundHoverBackgroundColor` | Inbound message hover background |
|
|
141
|
-
| `messageBlockInboundBackgroundColor` | Inbound message background |
|
|
142
|
-
| `messageBlockInboundTextColor` | Inbound message text color |
|
|
143
|
-
| `messageBlockInboundWidth` | Inbound message width |
|
|
144
|
-
| `messageBlockInboundTextAlign` | Inbound message text alignment |
|
|
145
|
-
|
|
146
|
-
##### Outbound message (agent to customer)
|
|
147
|
-
|
|
148
|
-
| Token name | UI area themed |
|
|
149
|
-
| ------------------------------------- | ------------------------------- |
|
|
150
|
-
| `messageBlockOutboundBackgroundColor` | Outbound message background |
|
|
151
|
-
| `messageBlockOutboundTextColor` | Outbound message text color |
|
|
152
|
-
| `messageBlockOutboundWidth` | Outbound message width |
|
|
153
|
-
| `messageBlockOutboundMarginLeft` | Outbound message left margin |
|
|
154
|
-
| `messageBlockOutboundTextAlign` | Outbound message text alignment |
|
|
155
|
-
|
|
156
|
-
##### Agentforce Input
|
|
157
|
-
|
|
158
|
-
| Token name | UI area themed |
|
|
159
|
-
| ---------------------------------------- | ---------------------------------------------- |
|
|
160
|
-
| `messageInputPadding` | Message input container padding |
|
|
161
|
-
| `messageInputBorderRadius` | Message input border radius |
|
|
162
|
-
| `messageInputFooterBorderColor` | Message input footer border color |
|
|
163
|
-
| `messageInputFooterBorderFocusColor` | Message input footer focus border color |
|
|
164
|
-
| `messageInputBorderTransitionDuration` | Message input border transition duration |
|
|
165
|
-
| `messageInputBorderTransitionEasing` | Message input border transition easing |
|
|
166
|
-
| `messageInputTextColor` | Message input text color |
|
|
167
|
-
| `messageInputTextBackgroundColor` | Message input text background color |
|
|
168
|
-
| `messageInputFooterPlaceholderText` | Message input placeholder text color |
|
|
169
|
-
| `messageInputErrorTextColor` | Message input error text color |
|
|
170
|
-
| `messageInputFontSize` | Message input font size |
|
|
171
|
-
| `messageInputFontWeight` | Message input font weight |
|
|
172
|
-
| `messageInputPlaceholderFontWeight` | Placeholder font weight |
|
|
173
|
-
| `messageInputLineHeight` | Message input line height |
|
|
174
|
-
| `messageInputMaxHeight` | Message input max height |
|
|
175
|
-
| `messageInputTextPadding` | Message input text padding |
|
|
176
|
-
| `messageInputActionsWidth` | Message input actions width |
|
|
177
|
-
| `messageInputActionsPaddingRight` | Message input actions right padding |
|
|
178
|
-
| `messageInputActionsGap` | Message input actions gap |
|
|
179
|
-
| `messageInputActionsPadding` | Message input actions padding |
|
|
180
|
-
| `messageInputOverflowY` | Message input overflow Y |
|
|
181
|
-
| `messageInputScrollbarWidth` | Message input scrollbar width |
|
|
182
|
-
| `messageInputScrollbarColor` | Message input scrollbar color |
|
|
183
|
-
| `messageInputTextareaMaxHeight` | Message input textarea max height |
|
|
184
|
-
| `messageInputTextareaWithImageMaxHeight` | Message input textarea max height (with image) |
|
|
185
|
-
| `messageInputFilePreviewPadding` | Message input file preview padding |
|
|
186
|
-
| `messageInputActionButtonSize` | Message input action button size |
|
|
187
|
-
| `messageInputActionButtonRadius` | Message input action button radius |
|
|
188
|
-
| `messageInputActionButtonFocusBorder` | Message input action button focus border |
|
|
189
|
-
| `messageInputActionButtonHoverShadow` | Message input action button hover shadow |
|
|
190
|
-
| `messageInputFooterSendButton` | Message input send button color |
|
|
191
|
-
| `messageInputFooterSendButtonHoverColor` | Message input send button hover color |
|
|
192
|
-
| `messageInputSendButtonDisabledColor` | Message input send button disabled color |
|
|
109
|
+
For the complete and always up-to-date list of all 60+ style tokens, see the underlying SDK documentation:
|
|
110
|
+
|
|
111
|
+
**[@salesforce/agentforce-conversation-client README](https://www.npmjs.com/package/@salesforce/agentforce-conversation-client)** or `node_modules/@salesforce/agentforce-conversation-client/README.md` (lines 94-177)
|
|
112
|
+
|
|
113
|
+
Style tokens are organized by UI area:
|
|
114
|
+
|
|
115
|
+
- **Header** (7 tokens): background, text color, hover, active, focus, border, font family
|
|
116
|
+
- **Messages** (10 tokens): colors, padding, margins, border radius, fonts, body width
|
|
117
|
+
- **Inbound messages** (5 tokens): background, text color, width, alignment, hover
|
|
118
|
+
- **Outbound messages** (5 tokens): background, text color, width, alignment, margin
|
|
119
|
+
- **Input** (33 tokens): colors, borders, fonts, padding, buttons, scrollbar, textarea, actions
|
|
193
120
|
|
|
194
121
|
### Prerequisites
|
|
195
122
|
|
|
@@ -209,7 +136,7 @@ This component wraps `@salesforce/agentforce-conversation-client`. For lower-lev
|
|
|
209
136
|
This package includes coding-agent rules and skills for automated workflows:
|
|
210
137
|
|
|
211
138
|
- **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).
|
|
212
|
-
- **Skill** (`skills/
|
|
139
|
+
- **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).
|
|
213
140
|
|
|
214
141
|
---
|
|
215
142
|
|
package/dist/.a4drules/features/feature-react-agentforce-conversation-client-embedded-agent-rule.md
CHANGED
|
@@ -8,11 +8,35 @@ paths:
|
|
|
8
8
|
|
|
9
9
|
## DO NOT build a chat UI from scratch
|
|
10
10
|
|
|
11
|
-
When the user asks for a chat UI, chat widget, chatbot, agent, or conversational interface — **always use the existing `AgentforceConversationClient` component
|
|
11
|
+
When the user asks for a chat UI, chat widget, chatbot, agent, or conversational interface — **always use the existing `AgentforceConversationClient` component**. Never generate custom chat implementations, third-party chat libraries, WebSocket/REST chat, or direct calls to `embedAgentforceClient`.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## NEVER edit implementation files
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
**CRITICAL: Only edit files where AgentforceConversationClient is USED, never the component implementation itself.**
|
|
16
|
+
|
|
17
|
+
❌ **DO NOT edit**: `AgentforceConversationClient.tsx`, `index.tsx`, or any files in:
|
|
18
|
+
|
|
19
|
+
- `node_modules/@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental/`
|
|
20
|
+
- `packages/template/feature/feature-react-agentforce-conversation-client/src/`
|
|
21
|
+
- `src/components/AgentforceConversationClient.tsx` (patched templates)
|
|
22
|
+
|
|
23
|
+
If you're reading a file named `AgentforceConversationClient.tsx`, stop and search for the USAGE instead.
|
|
24
|
+
|
|
25
|
+
## Invalid Props
|
|
26
|
+
|
|
27
|
+
AgentforceConversationClient does NOT accept:
|
|
28
|
+
|
|
29
|
+
- ❌ `containerStyle` - Use `width`/`height` props directly instead
|
|
30
|
+
- ❌ `style` - Use `styleTokens` prop for theming
|
|
31
|
+
- ❌ `className` - Not supported
|
|
32
|
+
|
|
33
|
+
## Styling
|
|
34
|
+
|
|
35
|
+
**For ANY styling, theming, branding, or color changes - ONLY use `styleTokens` prop.**
|
|
36
|
+
|
|
37
|
+
NEVER use: CSS files, `<style>` tags, `className`, inline styles, CSS modules, or CSS-in-JS libraries.
|
|
38
|
+
|
|
39
|
+
## Hard Constraints
|
|
40
|
+
|
|
41
|
+
- **`agentId` is required** - Always ask the user for their agent ID before proceeding
|
|
42
|
+
- **Use the React wrapper only** - Never call `embedAgentforceClient` directly
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: managing-agentforce-conversation-client
|
|
3
|
+
description: Adds or modifies AgentforceConversationClient in React apps (.tsx or .jsx files). Use when user says "add chat widget", "embed agentforce", "add agent", "add chatbot", "integrate conversational AI", or asks to change colors, dimensions, styling, or configure agentId, width, height, inline mode, or styleTokens for travel agent, HR agent, employee agent, or any Salesforce agent chat.
|
|
4
|
+
metadata:
|
|
5
|
+
author: ACC Components
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
package: "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental"
|
|
8
|
+
sdk-package: "@salesforce/agentforce-conversation-client"
|
|
9
|
+
last-updated: 2025-03-18
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Managing Agentforce Conversation Client
|
|
13
|
+
|
|
14
|
+
## Instructions
|
|
15
|
+
|
|
16
|
+
### Step 1: Check if component already exists
|
|
17
|
+
|
|
18
|
+
Search for existing usage across all app files (not implementation files):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
grep -r "AgentforceConversationClient" --include="*.tsx" --include="*.jsx" --exclude-dir=node_modules
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Important:** Look for React files that import and USE the component (for example, shared shells, route components, or feature pages). Do NOT open files named `AgentforceConversationClient.tsx` or `AgentforceConversationClient.jsx` - those are the component implementation.
|
|
25
|
+
|
|
26
|
+
**If found:** Read the file and check the current `agentId` value.
|
|
27
|
+
|
|
28
|
+
**Agent ID validation rule (deterministic):**
|
|
29
|
+
|
|
30
|
+
- Valid only if it matches: `^0Xx[a-zA-Z0-9]{15}$`
|
|
31
|
+
- Meaning: starts with `0Xx` and total length is 18 characters
|
|
32
|
+
|
|
33
|
+
**Decision:**
|
|
34
|
+
|
|
35
|
+
- If `agentId` matches `^0Xx[a-zA-Z0-9]{15}$` and user wants to update other props → Go to Step 4 (update props)
|
|
36
|
+
- If `agentId` is missing, empty, or does NOT match `^0Xx[a-zA-Z0-9]{15}$` → Continue to Step 2 (need real ID)
|
|
37
|
+
- If not found → Continue to Step 2 (add new)
|
|
38
|
+
|
|
39
|
+
### Step 2: Get agent ID
|
|
40
|
+
|
|
41
|
+
If component doesn't exist or has an invalid placeholder value, ask user for their Salesforce agent ID.
|
|
42
|
+
|
|
43
|
+
Treat these as placeholder/invalid values:
|
|
44
|
+
|
|
45
|
+
- `"0Xx..."`
|
|
46
|
+
- `"Placeholder"`
|
|
47
|
+
- `"YOUR_AGENT_ID"`
|
|
48
|
+
- `"<USER_AGENT_ID_18_CHAR_0Xx...>"`
|
|
49
|
+
- Any value that does not match `^0Xx[a-zA-Z0-9]{15}$`
|
|
50
|
+
|
|
51
|
+
Skip this step if:
|
|
52
|
+
|
|
53
|
+
- Component exists with a real agent ID
|
|
54
|
+
- User only wants to update styling or dimensions
|
|
55
|
+
|
|
56
|
+
### Step 3: Canonical import strategy
|
|
57
|
+
|
|
58
|
+
Use this import path by default in app code:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { AgentforceConversationClient } from "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental";
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If the package is not installed, install it:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install @salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Only use a local relative import (for example, `./components/AgentforceConversationClient`) when the user explicitly asks to use a patched/local component in that app.
|
|
71
|
+
|
|
72
|
+
Do not infer import path from file discovery alone. Prefer one consistent package import across the codebase.
|
|
73
|
+
|
|
74
|
+
### Step 4: Add or update component
|
|
75
|
+
|
|
76
|
+
**For new installations:**
|
|
77
|
+
|
|
78
|
+
Add to the target React component file using the canonical package import:
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { Outlet } from "react-router";
|
|
82
|
+
import { AgentforceConversationClient } from "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental";
|
|
83
|
+
|
|
84
|
+
export default function AgentChatHost() {
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<Outlet />
|
|
88
|
+
<AgentforceConversationClient agentId="0Xx..." />
|
|
89
|
+
</>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Fallback note:** Use a local relative import only when the user explicitly requests patched/local component usage in that app.
|
|
95
|
+
|
|
96
|
+
**For updates:**
|
|
97
|
+
|
|
98
|
+
Read the file where component is used and modify only the props that need to change. Preserve all other props. Never delete and recreate.
|
|
99
|
+
|
|
100
|
+
**Replacing placeholder values:**
|
|
101
|
+
|
|
102
|
+
If the component has a placeholder agentId (e.g., `agentId="Placeholder"` or `agentId="0Xx..."`), replace it with the real agent ID:
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
// Before (template with placeholder)
|
|
106
|
+
<AgentforceConversationClient agentId="Placeholder" />
|
|
107
|
+
|
|
108
|
+
// After (with real agent ID)
|
|
109
|
+
<AgentforceConversationClient agentId="0Xx8X00000001AbCDE" />
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Step 5: Configure props
|
|
113
|
+
|
|
114
|
+
**Available props (use directly on component):**
|
|
115
|
+
|
|
116
|
+
- `agentId` (string, required) - Salesforce agent ID
|
|
117
|
+
- `inline` (boolean) - `true` for inline mode, omit for floating
|
|
118
|
+
- `width` (number | string) - e.g., `420` or `"100%"`
|
|
119
|
+
- `height` (number | string) - e.g., `600` or `"80vh"`
|
|
120
|
+
- `headerEnabled` (boolean) - Show/hide header
|
|
121
|
+
- `styleTokens` (object) - For all styling (colors, fonts, spacing)
|
|
122
|
+
- `salesforceOrigin` (string) - Auto-resolved
|
|
123
|
+
- `frontdoorUrl` (string) - Auto-resolved
|
|
124
|
+
|
|
125
|
+
**Examples:**
|
|
126
|
+
|
|
127
|
+
Floating mode (default):
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
<AgentforceConversationClient agentId="0Xx..." />
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Inline mode with dimensions:
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
<AgentforceConversationClient agentId="0Xx..." inline width="420px" height="600px" />
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Styling with styleTokens:
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
<AgentforceConversationClient
|
|
143
|
+
agentId="0Xx..."
|
|
144
|
+
styleTokens={{
|
|
145
|
+
headerBlockBackground: "#0176d3",
|
|
146
|
+
headerBlockTextColor: "#ffffff",
|
|
147
|
+
messageBlockInboundBackgroundColor: "#4CAF50",
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**For complex patterns,** consult `references/examples.md` for:
|
|
153
|
+
|
|
154
|
+
- Sidebar containers and responsive sizing
|
|
155
|
+
- Dark theme and advanced theming combinations
|
|
156
|
+
- Inline without header, calculated dimensions
|
|
157
|
+
- Complete host component examples
|
|
158
|
+
|
|
159
|
+
**For styling:** For ANY color, font, or spacing changes, use `styleTokens` prop only. See `references/style-tokens.md` for complete token list and examples.
|
|
160
|
+
|
|
161
|
+
**Common mistakes to avoid:** Consult `references/constraints.md` for:
|
|
162
|
+
|
|
163
|
+
- Invalid props (containerStyle, style, className)
|
|
164
|
+
- Invalid styling approaches (CSS files, style tags)
|
|
165
|
+
- What files NOT to edit (implementation files)
|
|
166
|
+
|
|
167
|
+
## Common Issues
|
|
168
|
+
|
|
169
|
+
If component doesn't appear or authentication fails, see `references/troubleshooting.md` for:
|
|
170
|
+
|
|
171
|
+
- Agent activation and deployment
|
|
172
|
+
- Localhost trusted domains
|
|
173
|
+
- Cookie restriction settings
|
|
174
|
+
|
|
175
|
+
## Prerequisites
|
|
176
|
+
|
|
177
|
+
Before the component will work, the following Salesforce settings must be configured by the user:
|
|
178
|
+
|
|
179
|
+
**Cookie settings:**
|
|
180
|
+
|
|
181
|
+
- Setup → My Domain → Disable "Require first party use of Salesforce cookies"
|
|
182
|
+
|
|
183
|
+
**Trusted domains (required only for local development):**
|
|
184
|
+
|
|
185
|
+
- Setup → Session Settings → Trusted Domains for Inline Frames → Add your domain
|
|
186
|
+
- Local development: `localhost:<PORT>` (e.g., `localhost:3000`)
|
package/dist/.a4drules/skills/managing-agentforce-conversation-client/references/constraints.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Constraints and Anti-Patterns
|
|
2
|
+
|
|
3
|
+
This document lists all invalid approaches and patterns to avoid when working with AgentforceConversationClient.
|
|
4
|
+
|
|
5
|
+
## Never Edit Implementation Files
|
|
6
|
+
|
|
7
|
+
**CRITICAL: Only edit files where the component is USED, never the component implementation itself.**
|
|
8
|
+
|
|
9
|
+
- ✅ **DO edit**: Any React files that import and use `<AgentforceConversationClient />` (for example, shared shells, route components, or feature pages)
|
|
10
|
+
- ❌ **DO NOT edit**: AgentforceConversationClient.tsx, AgentforceConversationClient.jsx, index.tsx, index.jsx, or any files inside:
|
|
11
|
+
- `node_modules/@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental/src/`
|
|
12
|
+
- `packages/template/feature/feature-react-agentforce-conversation-client/src/`
|
|
13
|
+
- `src/components/AgentforceConversationClient.tsx` (patched templates)
|
|
14
|
+
- Any path containing `/components/AgentforceConversationClient.`
|
|
15
|
+
|
|
16
|
+
**If you're reading a file named `AgentforceConversationClient.tsx`, you're in the wrong place. Stop and search for the USAGE instead.**
|
|
17
|
+
|
|
18
|
+
## Invalid Props
|
|
19
|
+
|
|
20
|
+
AgentforceConversationClient uses a flat prop API and does NOT accept these props:
|
|
21
|
+
|
|
22
|
+
- ❌ `containerStyle` - Use `width` and `height` props directly instead
|
|
23
|
+
- ❌ `style` - Use `styleTokens` for theming
|
|
24
|
+
- ❌ `className` - Not supported
|
|
25
|
+
- ❌ Any standard React div props - This wraps an embedded iframe, not a div
|
|
26
|
+
|
|
27
|
+
**Why:** The component is a wrapper around an embedded iframe using Lightning Out 2.0. Standard React styling props don't apply.
|
|
28
|
+
|
|
29
|
+
## Invalid Styling Approaches
|
|
30
|
+
|
|
31
|
+
**CRITICAL: For ALL styling, theming, branding, or color changes - ONLY use `styleTokens` prop.**
|
|
32
|
+
|
|
33
|
+
Never use these approaches:
|
|
34
|
+
|
|
35
|
+
- ❌ Creating CSS files (e.g., `agent-styles.css`, `theme.css`)
|
|
36
|
+
- ❌ Creating `<style>` tags or internal stylesheets
|
|
37
|
+
- ❌ Using `style` attribute on the component
|
|
38
|
+
- ❌ Using `className` prop
|
|
39
|
+
- ❌ Inline styles
|
|
40
|
+
- ❌ CSS modules
|
|
41
|
+
- ❌ Styled-components or any CSS-in-JS libraries
|
|
42
|
+
|
|
43
|
+
**Why:** The component controls its own internal styling through the `styleTokens` API. External CSS cannot reach into the embedded iframe.
|
|
44
|
+
|
|
45
|
+
## Invalid Implementation Approaches
|
|
46
|
+
|
|
47
|
+
Never do these:
|
|
48
|
+
|
|
49
|
+
- ❌ Create custom chat UIs from scratch
|
|
50
|
+
- ❌ Use third-party chat libraries (socket.io, WebSocket libraries, etc.)
|
|
51
|
+
- ❌ Call `embedAgentforceClient` directly from `@salesforce/agentforce-conversation-client`
|
|
52
|
+
- ❌ Build custom WebSocket or REST API chat implementations
|
|
53
|
+
|
|
54
|
+
**Why:** The AgentforceConversationClient component is the official wrapper that handles authentication, Lightning Out 2.0 initialization, and all communication with Salesforce agents. Custom implementations will not work.
|
|
55
|
+
|
|
56
|
+
## Invalid Update Patterns
|
|
57
|
+
|
|
58
|
+
When updating an existing component:
|
|
59
|
+
|
|
60
|
+
- ❌ Delete and recreate the component
|
|
61
|
+
- ❌ Remove all props and start over
|
|
62
|
+
- ❌ Copy the entire component to a new file
|
|
63
|
+
|
|
64
|
+
**Why:** This loses configuration, introduces errors, and creates unnecessary diffs. Always update props in place.
|
|
65
|
+
|
|
66
|
+
## Examples
|
|
67
|
+
|
|
68
|
+
### ❌ Wrong - Using containerStyle
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<AgentforceConversationClient agentId="0Xx..." containerStyle={{ width: 420, height: 600 }} />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### ✅ Correct - Using width/height directly
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<AgentforceConversationClient agentId="0Xx..." width="420px" height="600px" />
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### ❌ Wrong - Creating CSS file
|
|
81
|
+
|
|
82
|
+
```css
|
|
83
|
+
/* agent-styles.css */
|
|
84
|
+
.agentforce-chat {
|
|
85
|
+
background: red;
|
|
86
|
+
color: white;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import "./agent-styles.css";
|
|
92
|
+
|
|
93
|
+
<AgentforceConversationClient className="agentforce-chat" />;
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### ✅ Correct - Using styleTokens
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<AgentforceConversationClient
|
|
100
|
+
agentId="0Xx..."
|
|
101
|
+
styleTokens={{
|
|
102
|
+
headerBlockBackground: "red",
|
|
103
|
+
headerBlockTextColor: "white",
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### ❌ Wrong - Creating style tag
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
<>
|
|
112
|
+
<style>{`.agent-chat { background: blue; }`}</style>
|
|
113
|
+
<AgentforceConversationClient agentId="0Xx..." />
|
|
114
|
+
</>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### ✅ Correct - Using styleTokens
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<AgentforceConversationClient
|
|
121
|
+
agentId="0Xx..."
|
|
122
|
+
styleTokens={{
|
|
123
|
+
headerBlockBackground: "blue",
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### ❌ Wrong - Editing implementation file
|
|
129
|
+
|
|
130
|
+
Reading or editing: `node_modules/@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental/src/AgentforceConversationClient.tsx`
|
|
131
|
+
|
|
132
|
+
### ✅ Correct - Editing usage file
|
|
133
|
+
|
|
134
|
+
Reading and editing: usage files where the component is imported and used (for example, `src/app.tsx`, a route component, or a feature page)
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Additional Examples
|
|
2
|
+
|
|
3
|
+
Essential examples for common patterns and combinations. All use flat props API.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Layout Patterns
|
|
8
|
+
|
|
9
|
+
### Sidebar Chat
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
export default function DashboardWithChat() {
|
|
13
|
+
return (
|
|
14
|
+
<div style={{ display: "flex", height: "100vh" }}>
|
|
15
|
+
<main style={{ flex: 1 }}>{/* Main content */}</main>
|
|
16
|
+
<aside style={{ width: 400 }}>
|
|
17
|
+
<AgentforceConversationClient agentId="0Xx..." inline width="100%" height="100%" />
|
|
18
|
+
</aside>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Full Page Chat
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
export default function SupportPage() {
|
|
28
|
+
return (
|
|
29
|
+
<div>
|
|
30
|
+
<h1>Customer Support</h1>
|
|
31
|
+
<AgentforceConversationClient agentId="0Xx..." inline width="100%" height="600px" />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Size Variations
|
|
40
|
+
|
|
41
|
+
### Responsive sizing
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<AgentforceConversationClient agentId="0Xx..." inline width="100%" height="80vh" />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Calculated dimensions
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<AgentforceConversationClient agentId="0Xx..." inline width="500px" height="calc(100vh - 100px)" />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Theming Combinations
|
|
56
|
+
|
|
57
|
+
### Brand theme with custom sizing
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<AgentforceConversationClient
|
|
61
|
+
agentId="0Xx..."
|
|
62
|
+
inline
|
|
63
|
+
width="500px"
|
|
64
|
+
height="700px"
|
|
65
|
+
styleTokens={{
|
|
66
|
+
headerBlockBackground: "#0176d3",
|
|
67
|
+
headerBlockTextColor: "#ffffff",
|
|
68
|
+
messageBlockInboundBackgroundColor: "#0176d3",
|
|
69
|
+
messageBlockInboundTextColor: "#ffffff",
|
|
70
|
+
messageInputFooterSendButton: "#0176d3",
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Dark theme
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
<AgentforceConversationClient
|
|
79
|
+
agentId="0Xx..."
|
|
80
|
+
styleTokens={{
|
|
81
|
+
headerBlockBackground: "#1a1a1a",
|
|
82
|
+
headerBlockTextColor: "#ffffff",
|
|
83
|
+
messageBlockInboundBackgroundColor: "#2d2d2d",
|
|
84
|
+
messageBlockInboundTextColor: "#ffffff",
|
|
85
|
+
messageBlockOutboundBackgroundColor: "#3a3a3a",
|
|
86
|
+
messageBlockOutboundTextColor: "#f0f0f0",
|
|
87
|
+
}}
|
|
88
|
+
/>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Inline without header
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<AgentforceConversationClient
|
|
95
|
+
agentId="0Xx..."
|
|
96
|
+
inline
|
|
97
|
+
width="100%"
|
|
98
|
+
height="600px"
|
|
99
|
+
headerEnabled={false}
|
|
100
|
+
styleTokens={{
|
|
101
|
+
messageBlockBorderRadius: "12px",
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Complete Host Component Example
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { Outlet } from "react-router";
|
|
112
|
+
import { AgentforceConversationClient } from "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental";
|
|
113
|
+
|
|
114
|
+
export default function AgentChatHost() {
|
|
115
|
+
return (
|
|
116
|
+
<>
|
|
117
|
+
<Outlet />
|
|
118
|
+
<AgentforceConversationClient
|
|
119
|
+
agentId="0Xx..."
|
|
120
|
+
styleTokens={{
|
|
121
|
+
headerBlockBackground: "#0176d3",
|
|
122
|
+
headerBlockTextColor: "#ffffff",
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
</>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
For complete style token reference, see `references/style-tokens.md` or `node_modules/@salesforce/agentforce-conversation-client/README.md`.
|