@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental 1.107.3 → 1.107.4
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 +8 -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
|
@@ -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`.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Style Tokens Reference
|
|
2
|
+
|
|
3
|
+
This document explains how to use `styleTokens` for theming and styling the AgentforceConversationClient.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The `styleTokens` prop is the **ONLY** way to customize the appearance of the Agentforce conversation client. It accepts an object with style token keys and CSS values.
|
|
8
|
+
|
|
9
|
+
## Source of Truth
|
|
10
|
+
|
|
11
|
+
For the complete and always up-to-date list of all 60+ style tokens, see:
|
|
12
|
+
|
|
13
|
+
**[@salesforce/agentforce-conversation-client on npm](https://www.npmjs.com/package/@salesforce/agentforce-conversation-client)**
|
|
14
|
+
|
|
15
|
+
The npm package README contains the definitive documentation with all available style tokens.
|
|
16
|
+
|
|
17
|
+
## Token Categories
|
|
18
|
+
|
|
19
|
+
Style tokens are organized by UI area:
|
|
20
|
+
|
|
21
|
+
- **Header** (7 tokens): background, text color, hover, active, focus, border, font family
|
|
22
|
+
- **Messages** (10 tokens): colors, padding, margins, border radius, fonts, body width
|
|
23
|
+
- **Inbound messages** (5 tokens): background, text color, width, alignment, hover
|
|
24
|
+
- **Outbound messages** (5 tokens): background, text color, width, alignment, margin
|
|
25
|
+
- **Input** (33 tokens): colors, borders, fonts, padding, buttons, scrollbar, textarea, actions
|
|
26
|
+
|
|
27
|
+
## Common Use Cases
|
|
28
|
+
|
|
29
|
+
### Change header color
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
<AgentforceConversationClient
|
|
33
|
+
agentId="0Xx..."
|
|
34
|
+
styleTokens={{
|
|
35
|
+
headerBlockBackground: "#0176d3",
|
|
36
|
+
headerBlockTextColor: "#ffffff",
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Change message colors
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<AgentforceConversationClient
|
|
45
|
+
agentId="0Xx..."
|
|
46
|
+
styleTokens={{
|
|
47
|
+
messageBlockInboundBackgroundColor: "#4CAF50",
|
|
48
|
+
messageBlockInboundTextColor: "#ffffff",
|
|
49
|
+
messageBlockOutboundBackgroundColor: "#f5f5f5",
|
|
50
|
+
messageBlockOutboundTextColor: "#333333",
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Apply brand colors
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<AgentforceConversationClient
|
|
59
|
+
agentId="0Xx..."
|
|
60
|
+
styleTokens={{
|
|
61
|
+
headerBlockBackground: "#1a73e8",
|
|
62
|
+
headerBlockTextColor: "#ffffff",
|
|
63
|
+
messageBlockInboundBackgroundColor: "#1a73e8",
|
|
64
|
+
messageBlockInboundTextColor: "#ffffff",
|
|
65
|
+
messageInputFooterSendButton: "#1a73e8",
|
|
66
|
+
messageInputFooterSendButtonHoverColor: "#1557b0",
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Adjust spacing and fonts
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
<AgentforceConversationClient
|
|
75
|
+
agentId="0Xx..."
|
|
76
|
+
styleTokens={{
|
|
77
|
+
messageInputFontSize: "16px",
|
|
78
|
+
messageBlockBorderRadius: "12px",
|
|
79
|
+
messageBlockPadding: "16px",
|
|
80
|
+
messageInputPadding: "12px",
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## How to Find Token Names
|
|
86
|
+
|
|
87
|
+
1. Check the [@salesforce/agentforce-conversation-client npm package](https://www.npmjs.com/package/@salesforce/agentforce-conversation-client) for the complete list of all tokens
|
|
88
|
+
|
|
89
|
+
2. Token names follow a pattern:
|
|
90
|
+
- `headerBlock*` - Header area
|
|
91
|
+
- `messageBlock*` - Message bubbles
|
|
92
|
+
- `messageBlockInbound*` - Messages from customer to agent
|
|
93
|
+
- `messageBlockOutbound*` - Messages from agent to customer
|
|
94
|
+
- `messageInput*` - Input field and send button
|
|
95
|
+
|
|
96
|
+
## Important Notes
|
|
97
|
+
|
|
98
|
+
- You do NOT need to provide all tokens - only override the ones you want to change
|
|
99
|
+
- Token values are CSS strings (e.g., `"#FF0000"`, `"16px"`, `"bold"`)
|
|
100
|
+
- Invalid token names are silently ignored
|
|
101
|
+
- The component uses default values for any tokens you don't specify
|
|
@@ -23,7 +23,7 @@ Common issues when using the Agentforce Conversation Client.
|
|
|
23
23
|
**Solution:**
|
|
24
24
|
|
|
25
25
|
1. Confirm the id is correct (18-char Salesforce id, starts with `0Xx`).
|
|
26
|
-
2. Ensure the agent is Active in **Setup → Agents**.
|
|
26
|
+
2. Ensure the agent is Active in **Setup → Agentforce Agents**.
|
|
27
27
|
3. Verify the agent is deployed to the target channel.
|
|
28
28
|
|
|
29
29
|
---
|
|
@@ -36,25 +36,22 @@ Common issues when using the Agentforce Conversation Client.
|
|
|
36
36
|
|
|
37
37
|
1. Go to **Setup → Session Settings → Trusted Domains for Inline Frames**.
|
|
38
38
|
2. Add `localhost:<PORT>` (example: `localhost:3000`).
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
**Important:**
|
|
41
|
+
|
|
42
|
+
- This setting should be **temporary for local development only**.
|
|
43
|
+
- **Remove `localhost:<PORT>` from trusted domains after development**.
|
|
44
|
+
- **Recommended:** Test the Agentforce conversation client in a deployed app instead of relying on localhost trusted domains for extended periods.
|
|
40
45
|
|
|
41
46
|
---
|
|
42
47
|
|
|
43
48
|
### Blank iframe / auth session issues
|
|
44
49
|
|
|
45
|
-
**
|
|
50
|
+
**Possible cause:** First-party Salesforce cookie restriction may block embedded auth flow in some environments.
|
|
46
51
|
|
|
47
52
|
**Solution:**
|
|
48
53
|
|
|
49
54
|
1. Go to **Setup → Session Settings**.
|
|
50
55
|
2. Find **Require first party use of Salesforce cookies**.
|
|
51
|
-
3. Disable it
|
|
56
|
+
3. Disable it **only if needed and approved by your security/admin team**.
|
|
52
57
|
4. Save and reload.
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
### Multiple chat widgets appear
|
|
57
|
-
|
|
58
|
-
**Cause:** Component rendered more than once.
|
|
59
|
-
|
|
60
|
-
**Solution:** Render one instance in app layout only.
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: integrating-agentforce-conversation-client
|
|
3
|
-
description: Embed an Agentforce conversation client (chat UI) into a React web application using the AgentforceConversationClient component. Use when the user wants to add or integrate a chat widget, chatbot, conversation client, agent chat, or conversational interface in a React app, or when they mention Agentforce chat, Agentforce widget, employee agent, travel agent, HR agent, or embedding a Salesforce agent. ALWAYS use this skill instead of building a chat UI from scratch. NEVER generate custom chat components, use third-party chat libraries, or implement chat with WebSockets or REST APIs. Do NOT use for Lightning Web Components (LWC), non-React frameworks.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Embedded Agentforce chat (flat-prop API)
|
|
7
|
-
|
|
8
|
-
Use this workflow whenever the user wants add or update Agentforce chat in React.
|
|
9
|
-
|
|
10
|
-
## 1) Get agent id first
|
|
11
|
-
|
|
12
|
-
Ask for the Salesforce agent id (18-char id starting with `0Xx`). Do not proceed without it.
|
|
13
|
-
|
|
14
|
-
Placeholder convention for all examples in this file:
|
|
15
|
-
|
|
16
|
-
`<AgentforceConversationClient agentId="<USER_AGENT_ID_18_CHAR_0Xx...>" />`
|
|
17
|
-
|
|
18
|
-
## 2) Install package
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install @salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## 3) Use component in app layout
|
|
25
|
-
|
|
26
|
-
Render a single instance in the shared layout (alongside `<Outlet />`).
|
|
27
|
-
|
|
28
|
-
```tsx
|
|
29
|
-
import { Outlet } from "react-router";
|
|
30
|
-
import { AgentforceConversationClient } from "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental";
|
|
31
|
-
|
|
32
|
-
export default function AppLayout() {
|
|
33
|
-
return (
|
|
34
|
-
<>
|
|
35
|
-
<Outlet />
|
|
36
|
-
<AgentforceConversationClient agentId="<USER_AGENT_ID_18_CHAR_0Xx...>" />
|
|
37
|
-
</>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## 4) Flat props only
|
|
43
|
-
|
|
44
|
-
This package uses a flat prop API. Use these props directly on the component:
|
|
45
|
-
|
|
46
|
-
- `agentId` (required in practice)
|
|
47
|
-
- `inline` (`true` = inline, omitted/false = floating)
|
|
48
|
-
- `headerEnabled` (defaults to true for floating; actual use case for inline mode)
|
|
49
|
-
- `width`, `height` (actual work is when inline mode is true)
|
|
50
|
-
- `styleTokens`
|
|
51
|
-
- `salesforceOrigin`, `frontdoorUrl`
|
|
52
|
-
|
|
53
|
-
## 5) Inline mode example
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
<AgentforceConversationClient
|
|
57
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
58
|
-
inline
|
|
59
|
-
width={420}
|
|
60
|
-
height={600}
|
|
61
|
-
/>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## 6) Theming example
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
<AgentforceConversationClient
|
|
68
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
69
|
-
styleTokens={{
|
|
70
|
-
headerBlockBackground: "#0176d3",
|
|
71
|
-
headerBlockTextColor: "#ffffff",
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## 7) Do not do this
|
|
77
|
-
|
|
78
|
-
- Do not create custom chat UIs.
|
|
79
|
-
- Do not use third-party chat libraries.
|
|
80
|
-
- Do not call `embedAgentforceClient` directly from @salesforce/agentforce-conversation-client.
|
|
81
|
-
|
|
82
|
-
## 8) Prerequisites
|
|
83
|
-
|
|
84
|
-
Ensure org setup is valid:
|
|
85
|
-
|
|
86
|
-
1. Agent is active and deployed to the correct channel.
|
|
87
|
-
2. `localhost:<PORT>` is trusted for inline frames in local dev.
|
|
88
|
-
3. First-party Salesforce cookie restriction is disabled when required for embedding.
|
|
89
|
-
|
|
90
|
-
## Troubleshooting
|
|
91
|
-
|
|
92
|
-
If the chat widget does not appear, fails to authenticate, or behaves unexpectedly, see [troubleshooting.md](docs/troubleshooting.md).
|
package/dist/.a4drules/skills/integrating-agentforce-conversation-client/docs/embed-examples.md
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
# Embed examples (flat-prop API)
|
|
2
|
-
|
|
3
|
-
All examples use `AgentforceConversationClient` with flat props.
|
|
4
|
-
|
|
5
|
-
> `agentId` is required in practice. Use this placeholder pattern in examples: `"<USER_AGENT_ID_18_CHAR_0Xx...>"`.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Floating mode (default)
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
<AgentforceConversationClient agentId="<USER_AGENT_ID_18_CHAR_0Xx...>" />
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Explicit floating
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
<AgentforceConversationClient agentId="<USER_AGENT_ID_18_CHAR_0Xx...>" />
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Inline mode
|
|
24
|
-
|
|
25
|
-
### Fixed pixels
|
|
26
|
-
|
|
27
|
-
```tsx
|
|
28
|
-
<AgentforceConversationClient
|
|
29
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
30
|
-
inline
|
|
31
|
-
width={420}
|
|
32
|
-
height={600}
|
|
33
|
-
/>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### CSS string size
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
<AgentforceConversationClient
|
|
40
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
41
|
-
inline
|
|
42
|
-
width="100%"
|
|
43
|
-
height="80vh"
|
|
44
|
-
/>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Inline sidebar
|
|
48
|
-
|
|
49
|
-
```tsx
|
|
50
|
-
<div style={{ display: "flex", height: "100vh" }}>
|
|
51
|
-
<main style={{ flex: 1 }}>{/* App content */}</main>
|
|
52
|
-
<aside style={{ width: 400 }}>
|
|
53
|
-
<AgentforceConversationClient
|
|
54
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
55
|
-
inline
|
|
56
|
-
width="100%"
|
|
57
|
-
height="100%"
|
|
58
|
-
/>
|
|
59
|
-
</aside>
|
|
60
|
-
</div>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Theming
|
|
66
|
-
|
|
67
|
-
```tsx
|
|
68
|
-
<AgentforceConversationClient
|
|
69
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
70
|
-
styleTokens={{
|
|
71
|
-
headerBlockBackground: "#0176d3",
|
|
72
|
-
headerBlockTextColor: "#ffffff",
|
|
73
|
-
messageBlockInboundColor: "#0176d3",
|
|
74
|
-
}}
|
|
75
|
-
/>
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## Inline with header enabled
|
|
81
|
-
|
|
82
|
-
```tsx
|
|
83
|
-
<AgentforceConversationClient
|
|
84
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
85
|
-
inline
|
|
86
|
-
width={420}
|
|
87
|
-
height={600}
|
|
88
|
-
headerEnabled
|
|
89
|
-
/>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
`headerEnabled` defaults to `true` for floating mode, and you can use it in inline mode to add/remove the header.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Full layout example
|
|
97
|
-
|
|
98
|
-
```tsx
|
|
99
|
-
import { Outlet } from "react-router";
|
|
100
|
-
import { AgentforceConversationClient } from "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental";
|
|
101
|
-
|
|
102
|
-
export default function AppLayout() {
|
|
103
|
-
return (
|
|
104
|
-
<>
|
|
105
|
-
<Outlet />
|
|
106
|
-
<AgentforceConversationClient
|
|
107
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
108
|
-
styleTokens={{
|
|
109
|
-
headerBlockBackground: "#0176d3",
|
|
110
|
-
headerBlockTextColor: "#ffffff",
|
|
111
|
-
}}
|
|
112
|
-
/>
|
|
113
|
-
</>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
```
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: integrating-agentforce-conversation-client
|
|
3
|
-
description: Embed an Agentforce conversation client (chat UI) into a React web application using the AgentforceConversationClient component. Use when the user wants to add or integrate a chat widget, chatbot, conversation client, agent chat, or conversational interface in a React app, or when they mention Agentforce chat, Agentforce widget, employee agent, travel agent, HR agent, or embedding a Salesforce agent. ALWAYS use this skill instead of building a chat UI from scratch. NEVER generate custom chat components, use third-party chat libraries, or implement chat with WebSockets or REST APIs. Do NOT use for Lightning Web Components (LWC), non-React frameworks.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Embedded Agentforce chat (flat-prop API)
|
|
7
|
-
|
|
8
|
-
Use this workflow whenever the user wants add or update Agentforce chat in React.
|
|
9
|
-
|
|
10
|
-
## 1) Get agent id first
|
|
11
|
-
|
|
12
|
-
Ask for the Salesforce agent id (18-char id starting with `0Xx`). Do not proceed without it.
|
|
13
|
-
|
|
14
|
-
Placeholder convention for all examples in this file:
|
|
15
|
-
|
|
16
|
-
`<AgentforceConversationClient agentId="<USER_AGENT_ID_18_CHAR_0Xx...>" />`
|
|
17
|
-
|
|
18
|
-
## 2) Install package
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install @salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## 3) Use component in app layout
|
|
25
|
-
|
|
26
|
-
Render a single instance in the shared layout (alongside `<Outlet />`).
|
|
27
|
-
|
|
28
|
-
```tsx
|
|
29
|
-
import { Outlet } from "react-router";
|
|
30
|
-
import { AgentforceConversationClient } from "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental";
|
|
31
|
-
|
|
32
|
-
export default function AppLayout() {
|
|
33
|
-
return (
|
|
34
|
-
<>
|
|
35
|
-
<Outlet />
|
|
36
|
-
<AgentforceConversationClient agentId="<USER_AGENT_ID_18_CHAR_0Xx...>" />
|
|
37
|
-
</>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## 4) Flat props only
|
|
43
|
-
|
|
44
|
-
This package uses a flat prop API. Use these props directly on the component:
|
|
45
|
-
|
|
46
|
-
- `agentId` (required in practice)
|
|
47
|
-
- `inline` (`true` = inline, omitted/false = floating)
|
|
48
|
-
- `headerEnabled` (defaults to true for floating; actual use case for inline mode)
|
|
49
|
-
- `width`, `height` (actual work is when inline mode is true)
|
|
50
|
-
- `styleTokens`
|
|
51
|
-
- `salesforceOrigin`, `frontdoorUrl`
|
|
52
|
-
|
|
53
|
-
## 5) Inline mode example
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
<AgentforceConversationClient
|
|
57
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
58
|
-
inline
|
|
59
|
-
width={420}
|
|
60
|
-
height={600}
|
|
61
|
-
/>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## 6) Theming example
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
<AgentforceConversationClient
|
|
68
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
69
|
-
styleTokens={{
|
|
70
|
-
headerBlockBackground: "#0176d3",
|
|
71
|
-
headerBlockTextColor: "#ffffff",
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## 7) Do not do this
|
|
77
|
-
|
|
78
|
-
- Do not create custom chat UIs.
|
|
79
|
-
- Do not use third-party chat libraries.
|
|
80
|
-
- Do not call `embedAgentforceClient` directly from @salesforce/agentforce-conversation-client.
|
|
81
|
-
|
|
82
|
-
## 8) Prerequisites
|
|
83
|
-
|
|
84
|
-
Ensure org setup is valid:
|
|
85
|
-
|
|
86
|
-
1. Agent is active and deployed to the correct channel.
|
|
87
|
-
2. `localhost:<PORT>` is trusted for inline frames in local dev.
|
|
88
|
-
3. First-party Salesforce cookie restriction is disabled when required for embedding.
|
|
89
|
-
|
|
90
|
-
## Troubleshooting
|
|
91
|
-
|
|
92
|
-
If the chat widget does not appear, fails to authenticate, or behaves unexpectedly, see [troubleshooting.md](docs/troubleshooting.md).
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
# Embed examples (flat-prop API)
|
|
2
|
-
|
|
3
|
-
All examples use `AgentforceConversationClient` with flat props.
|
|
4
|
-
|
|
5
|
-
> `agentId` is required in practice. Use this placeholder pattern in examples: `"<USER_AGENT_ID_18_CHAR_0Xx...>"`.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Floating mode (default)
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
<AgentforceConversationClient agentId="<USER_AGENT_ID_18_CHAR_0Xx...>" />
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Explicit floating
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
<AgentforceConversationClient agentId="<USER_AGENT_ID_18_CHAR_0Xx...>" />
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Inline mode
|
|
24
|
-
|
|
25
|
-
### Fixed pixels
|
|
26
|
-
|
|
27
|
-
```tsx
|
|
28
|
-
<AgentforceConversationClient
|
|
29
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
30
|
-
inline
|
|
31
|
-
width={420}
|
|
32
|
-
height={600}
|
|
33
|
-
/>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### CSS string size
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
<AgentforceConversationClient
|
|
40
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
41
|
-
inline
|
|
42
|
-
width="100%"
|
|
43
|
-
height="80vh"
|
|
44
|
-
/>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Inline sidebar
|
|
48
|
-
|
|
49
|
-
```tsx
|
|
50
|
-
<div style={{ display: "flex", height: "100vh" }}>
|
|
51
|
-
<main style={{ flex: 1 }}>{/* App content */}</main>
|
|
52
|
-
<aside style={{ width: 400 }}>
|
|
53
|
-
<AgentforceConversationClient
|
|
54
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
55
|
-
inline
|
|
56
|
-
width="100%"
|
|
57
|
-
height="100%"
|
|
58
|
-
/>
|
|
59
|
-
</aside>
|
|
60
|
-
</div>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Theming
|
|
66
|
-
|
|
67
|
-
```tsx
|
|
68
|
-
<AgentforceConversationClient
|
|
69
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
70
|
-
styleTokens={{
|
|
71
|
-
headerBlockBackground: "#0176d3",
|
|
72
|
-
headerBlockTextColor: "#ffffff",
|
|
73
|
-
messageBlockInboundColor: "#0176d3",
|
|
74
|
-
}}
|
|
75
|
-
/>
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## Inline with header enabled
|
|
81
|
-
|
|
82
|
-
```tsx
|
|
83
|
-
<AgentforceConversationClient
|
|
84
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
85
|
-
inline
|
|
86
|
-
width={420}
|
|
87
|
-
height={600}
|
|
88
|
-
headerEnabled
|
|
89
|
-
/>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
`headerEnabled` defaults to `true` for floating mode, and you can use it in inline mode to add/remove the header.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Full layout example
|
|
97
|
-
|
|
98
|
-
```tsx
|
|
99
|
-
import { Outlet } from "react-router";
|
|
100
|
-
import { AgentforceConversationClient } from "@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental";
|
|
101
|
-
|
|
102
|
-
export default function AppLayout() {
|
|
103
|
-
return (
|
|
104
|
-
<>
|
|
105
|
-
<Outlet />
|
|
106
|
-
<AgentforceConversationClient
|
|
107
|
-
agentId="<USER_AGENT_ID_18_CHAR_0Xx...>"
|
|
108
|
-
styleTokens={{
|
|
109
|
-
headerBlockBackground: "#0176d3",
|
|
110
|
-
headerBlockTextColor: "#ffffff",
|
|
111
|
-
}}
|
|
112
|
-
/>
|
|
113
|
-
</>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
```
|