@schandlergarcia/sf-web-components 1.0.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.
Files changed (195) hide show
  1. package/.a4drules/skills/building-data-visualization/SKILL.md +72 -0
  2. package/.a4drules/skills/building-data-visualization/implementation/bar-line-chart.md +316 -0
  3. package/.a4drules/skills/building-data-visualization/implementation/dashboard-layout.md +189 -0
  4. package/.a4drules/skills/building-data-visualization/implementation/donut-chart.md +181 -0
  5. package/.a4drules/skills/building-data-visualization/implementation/stat-card.md +150 -0
  6. package/.a4drules/skills/building-react-components/SKILL.md +96 -0
  7. package/.a4drules/skills/building-react-components/implementation/component.md +78 -0
  8. package/.a4drules/skills/building-react-components/implementation/header-footer.md +132 -0
  9. package/.a4drules/skills/building-react-components/implementation/page.md +93 -0
  10. package/.a4drules/skills/configuring-csp-trusted-sites/SKILL.md +90 -0
  11. package/.a4drules/skills/configuring-csp-trusted-sites/implementation/metadata-format.md +281 -0
  12. package/.a4drules/skills/configuring-webapp-metadata/SKILL.md +158 -0
  13. package/.a4drules/skills/creating-webapp/SKILL.md +140 -0
  14. package/.a4drules/skills/deploying-to-salesforce/SKILL.md +226 -0
  15. package/.a4drules/skills/implementing-file-upload/SKILL.md +396 -0
  16. package/.a4drules/skills/installing-webapp-features/SKILL.md +210 -0
  17. package/.a4drules/skills/managing-agentforce-conversation-client/SKILL.md +186 -0
  18. package/.a4drules/skills/managing-agentforce-conversation-client/references/constraints.md +134 -0
  19. package/.a4drules/skills/managing-agentforce-conversation-client/references/examples.md +132 -0
  20. package/.a4drules/skills/managing-agentforce-conversation-client/references/style-tokens.md +101 -0
  21. package/.a4drules/skills/managing-agentforce-conversation-client/references/troubleshooting.md +57 -0
  22. package/.a4drules/skills/using-salesforce-data/SKILL.md +363 -0
  23. package/.a4drules/skills/using-salesforce-data/graphql-search.sh +139 -0
  24. package/.a4drules/webapp-data.md +353 -0
  25. package/.a4drules/webapp-ui.md +16 -0
  26. package/README.md +124 -0
  27. package/dist/components/library/cards/ActionList.js +27 -0
  28. package/dist/components/library/cards/ActionList.js.map +1 -0
  29. package/dist/components/library/cards/ActivityCard.js +40 -0
  30. package/dist/components/library/cards/ActivityCard.js.map +1 -0
  31. package/dist/components/library/cards/BaseCard.js +89 -0
  32. package/dist/components/library/cards/BaseCard.js.map +1 -0
  33. package/dist/components/library/cards/CalloutCard.js +28 -0
  34. package/dist/components/library/cards/CalloutCard.js.map +1 -0
  35. package/dist/components/library/cards/ChartCard.js +79 -0
  36. package/dist/components/library/cards/ChartCard.js.map +1 -0
  37. package/dist/components/library/cards/FeedPanel.js +38 -0
  38. package/dist/components/library/cards/FeedPanel.js.map +1 -0
  39. package/dist/components/library/cards/ListCard.js +112 -0
  40. package/dist/components/library/cards/ListCard.js.map +1 -0
  41. package/dist/components/library/cards/MetricCard.js +86 -0
  42. package/dist/components/library/cards/MetricCard.js.map +1 -0
  43. package/dist/components/library/cards/MetricsStrip.js +60 -0
  44. package/dist/components/library/cards/MetricsStrip.js.map +1 -0
  45. package/dist/components/library/cards/SectionCard.js +59 -0
  46. package/dist/components/library/cards/SectionCard.js.map +1 -0
  47. package/dist/components/library/cards/StatusCard.js +137 -0
  48. package/dist/components/library/cards/StatusCard.js.map +1 -0
  49. package/dist/components/library/cards/TableCard.js +244 -0
  50. package/dist/components/library/cards/TableCard.js.map +1 -0
  51. package/dist/components/library/cards/WidgetCard.js +60 -0
  52. package/dist/components/library/cards/WidgetCard.js.map +1 -0
  53. package/dist/components/library/charts/D3Chart.js +74 -0
  54. package/dist/components/library/charts/D3Chart.js.map +1 -0
  55. package/dist/components/library/charts/D3ChartTemplates.js +44 -0
  56. package/dist/components/library/charts/D3ChartTemplates.js.map +1 -0
  57. package/dist/components/library/charts/GeoMap.js +229 -0
  58. package/dist/components/library/charts/GeoMap.js.map +1 -0
  59. package/dist/components/library/chat/ChatBar.js +194 -0
  60. package/dist/components/library/chat/ChatBar.js.map +1 -0
  61. package/dist/components/library/chat/ChatInput.js +67 -0
  62. package/dist/components/library/chat/ChatInput.js.map +1 -0
  63. package/dist/components/library/chat/ChatMessage.js +112 -0
  64. package/dist/components/library/chat/ChatMessage.js.map +1 -0
  65. package/dist/components/library/chat/ChatMessageList.js +50 -0
  66. package/dist/components/library/chat/ChatMessageList.js.map +1 -0
  67. package/dist/components/library/chat/ChatPanel.js +77 -0
  68. package/dist/components/library/chat/ChatPanel.js.map +1 -0
  69. package/dist/components/library/chat/ChatSuggestions.js +22 -0
  70. package/dist/components/library/chat/ChatSuggestions.js.map +1 -0
  71. package/dist/components/library/chat/ChatToolCall.js +87 -0
  72. package/dist/components/library/chat/ChatToolCall.js.map +1 -0
  73. package/dist/components/library/chat/ChatTypingIndicator.js +20 -0
  74. package/dist/components/library/chat/ChatTypingIndicator.js.map +1 -0
  75. package/dist/components/library/chat/ChatWelcome.js +24 -0
  76. package/dist/components/library/chat/ChatWelcome.js.map +1 -0
  77. package/dist/components/library/chat/useChatState.js +77 -0
  78. package/dist/components/library/chat/useChatState.js.map +1 -0
  79. package/dist/components/library/data/DataModeProvider.js +47 -0
  80. package/dist/components/library/data/DataModeProvider.js.map +1 -0
  81. package/dist/components/library/data/DataModeToggle.js +28 -0
  82. package/dist/components/library/data/DataModeToggle.js.map +1 -0
  83. package/dist/components/library/data/filterUtils.js +71 -0
  84. package/dist/components/library/data/filterUtils.js.map +1 -0
  85. package/dist/components/library/data/useDataSource.js +13 -0
  86. package/dist/components/library/data/useDataSource.js.map +1 -0
  87. package/dist/components/library/data/usePageFilters.js +46 -0
  88. package/dist/components/library/data/usePageFilters.js.map +1 -0
  89. package/dist/components/library/filters/FilterBar.js +89 -0
  90. package/dist/components/library/filters/FilterBar.js.map +1 -0
  91. package/dist/components/library/filters/SearchFilter.js +44 -0
  92. package/dist/components/library/filters/SearchFilter.js.map +1 -0
  93. package/dist/components/library/filters/SelectFilter.js +44 -0
  94. package/dist/components/library/filters/SelectFilter.js.map +1 -0
  95. package/dist/components/library/filters/ToggleFilter.js +48 -0
  96. package/dist/components/library/filters/ToggleFilter.js.map +1 -0
  97. package/dist/components/library/forms/FormField.js +256 -0
  98. package/dist/components/library/forms/FormField.js.map +1 -0
  99. package/dist/components/library/forms/FormModal.js +161 -0
  100. package/dist/components/library/forms/FormModal.js.map +1 -0
  101. package/dist/components/library/forms/FormRenderer.js +32 -0
  102. package/dist/components/library/forms/FormRenderer.js.map +1 -0
  103. package/dist/components/library/forms/FormSection.js +49 -0
  104. package/dist/components/library/forms/FormSection.js.map +1 -0
  105. package/dist/components/library/forms/useFormState.js +85 -0
  106. package/dist/components/library/forms/useFormState.js.map +1 -0
  107. package/dist/components/library/heroui/Accordion.js +12 -0
  108. package/dist/components/library/heroui/Accordion.js.map +1 -0
  109. package/dist/components/library/heroui/Alert.js +12 -0
  110. package/dist/components/library/heroui/Alert.js.map +1 -0
  111. package/dist/components/library/heroui/Badge.js +12 -0
  112. package/dist/components/library/heroui/Badge.js.map +1 -0
  113. package/dist/components/library/heroui/Breadcrumbs.js +12 -0
  114. package/dist/components/library/heroui/Breadcrumbs.js.map +1 -0
  115. package/dist/components/library/heroui/Button.js +18 -0
  116. package/dist/components/library/heroui/Button.js.map +1 -0
  117. package/dist/components/library/heroui/Card.js +12 -0
  118. package/dist/components/library/heroui/Card.js.map +1 -0
  119. package/dist/components/library/heroui/Drawer.js +12 -0
  120. package/dist/components/library/heroui/Drawer.js.map +1 -0
  121. package/dist/components/library/heroui/Dropdown.js +12 -0
  122. package/dist/components/library/heroui/Dropdown.js.map +1 -0
  123. package/dist/components/library/heroui/Input.js +10 -0
  124. package/dist/components/library/heroui/Input.js.map +1 -0
  125. package/dist/components/library/heroui/Kbd.js +12 -0
  126. package/dist/components/library/heroui/Kbd.js.map +1 -0
  127. package/dist/components/library/heroui/Meter.js +12 -0
  128. package/dist/components/library/heroui/Meter.js.map +1 -0
  129. package/dist/components/library/heroui/Modal.js +12 -0
  130. package/dist/components/library/heroui/Modal.js.map +1 -0
  131. package/dist/components/library/heroui/Pagination.js +12 -0
  132. package/dist/components/library/heroui/Pagination.js.map +1 -0
  133. package/dist/components/library/heroui/ProgressBar.js +12 -0
  134. package/dist/components/library/heroui/ProgressBar.js.map +1 -0
  135. package/dist/components/library/heroui/ProgressCircle.js +12 -0
  136. package/dist/components/library/heroui/ProgressCircle.js.map +1 -0
  137. package/dist/components/library/heroui/ScrollShadow.js +12 -0
  138. package/dist/components/library/heroui/ScrollShadow.js.map +1 -0
  139. package/dist/components/library/heroui/Select.js +12 -0
  140. package/dist/components/library/heroui/Select.js.map +1 -0
  141. package/dist/components/library/heroui/Separator.js +12 -0
  142. package/dist/components/library/heroui/Separator.js.map +1 -0
  143. package/dist/components/library/heroui/Skeleton.js +12 -0
  144. package/dist/components/library/heroui/Skeleton.js.map +1 -0
  145. package/dist/components/library/heroui/Tabs.js +12 -0
  146. package/dist/components/library/heroui/Tabs.js.map +1 -0
  147. package/dist/components/library/heroui/Toast.js +13 -0
  148. package/dist/components/library/heroui/Toast.js.map +1 -0
  149. package/dist/components/library/heroui/Toggle.js +12 -0
  150. package/dist/components/library/heroui/Toggle.js.map +1 -0
  151. package/dist/components/library/heroui/Tooltip.js +12 -0
  152. package/dist/components/library/heroui/Tooltip.js.map +1 -0
  153. package/dist/components/library/layout/PageContainer.js +9 -0
  154. package/dist/components/library/layout/PageContainer.js.map +1 -0
  155. package/dist/components/library/skeletons/CardSkeleton.js +29 -0
  156. package/dist/components/library/skeletons/CardSkeleton.js.map +1 -0
  157. package/dist/components/library/theme/AppThemeProvider.js +55 -0
  158. package/dist/components/library/theme/AppThemeProvider.js.map +1 -0
  159. package/dist/components/library/theme/tokens.js +55 -0
  160. package/dist/components/library/theme/tokens.js.map +1 -0
  161. package/dist/components/library/ui/Avatar.js +33 -0
  162. package/dist/components/library/ui/Avatar.js.map +1 -0
  163. package/dist/components/library/ui/Button.js +50 -0
  164. package/dist/components/library/ui/Button.js.map +1 -0
  165. package/dist/components/library/ui/Card.js +21 -0
  166. package/dist/components/library/ui/Card.js.map +1 -0
  167. package/dist/components/library/ui/Chip.js +31 -0
  168. package/dist/components/library/ui/Chip.js.map +1 -0
  169. package/dist/components/library/ui/Container.js +42 -0
  170. package/dist/components/library/ui/Container.js.map +1 -0
  171. package/dist/components/library/ui/EmptyState.js +27 -0
  172. package/dist/components/library/ui/EmptyState.js.map +1 -0
  173. package/dist/components/library/ui/Input.js +22 -0
  174. package/dist/components/library/ui/Input.js.map +1 -0
  175. package/dist/components/library/ui/Spinner.js +64 -0
  176. package/dist/components/library/ui/Spinner.js.map +1 -0
  177. package/dist/components/library/ui/Text.js +43 -0
  178. package/dist/components/library/ui/Text.js.map +1 -0
  179. package/dist/components/library/ui/Toggle.js +47 -0
  180. package/dist/components/library/ui/Toggle.js.map +1 -0
  181. package/dist/components/workspace/ComponentRegistry.js +231 -0
  182. package/dist/components/workspace/ComponentRegistry.js.map +1 -0
  183. package/dist/index.js +185 -0
  184. package/dist/index.js.map +1 -0
  185. package/dist/lib/utils.js +9 -0
  186. package/dist/lib/utils.js.map +1 -0
  187. package/dist/node_modules/clsx/dist/clsx.js +17 -0
  188. package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
  189. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2925 -0
  190. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  191. package/package.json +81 -0
  192. package/scripts/get-graphql-schema.mjs +68 -0
  193. package/scripts/reset-command-center.sh +358 -0
  194. package/scripts/rewrite-e2e-assets.mjs +23 -0
  195. package/scripts/validate-dashboard.sh +290 -0
@@ -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`)
@@ -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`.
@@ -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
@@ -0,0 +1,57 @@
1
+ # Troubleshooting
2
+
3
+ Common issues when using the Agentforce Conversation Client.
4
+
5
+ ---
6
+
7
+ ### Component throws "requires agentId"
8
+
9
+ **Cause:** `agentId` was not passed.
10
+
11
+ **Solution:** Pass `agentId` directly as a flat prop:
12
+
13
+ ```tsx
14
+ <AgentforceConversationClient agentId="0Xx000000000000AAA" />
15
+ ```
16
+
17
+ ---
18
+
19
+ ### Chat widget does not appear
20
+
21
+ **Cause:** Invalid `agentId` or inactive agent.
22
+
23
+ **Solution:**
24
+
25
+ 1. Confirm the id is correct (18-char Salesforce id, starts with `0Xx`).
26
+ 2. Ensure the agent is Active in **Setup → Agentforce Agents**.
27
+ 3. Verify the agent is deployed to the target channel.
28
+
29
+ ---
30
+
31
+ ### Authentication error on localhost
32
+
33
+ **Cause:** `localhost:<PORT>` is not trusted for inline frames.
34
+
35
+ **Solution:**
36
+
37
+ 1. Go to **Setup → Session Settings → Trusted Domains for Inline Frames**.
38
+ 2. Add `localhost:<PORT>` (example: `localhost:3000`).
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.
45
+
46
+ ---
47
+
48
+ ### Blank iframe / auth session issues
49
+
50
+ **Possible cause:** First-party Salesforce cookie restriction may block embedded auth flow in some environments.
51
+
52
+ **Solution:**
53
+
54
+ 1. Go to **Setup → Session Settings**.
55
+ 2. Find **Require first party use of Salesforce cookies**.
56
+ 3. Disable it **only if needed and approved by your security/admin team**.
57
+ 4. Save and reload.