afv-library/skills/implementing-ui-bundle-agentforce-conversation-client/references/constraints.md

135 lines
4.3 KiB
Markdown
Raw Normal View History

feat: syncing webapp skills sync to afv @W-21338965@ (#57) * feat: removing old webapp skills * feat: adding sync of skills from webapps to afv * feat: adding the first iteration of skills * feat: pin template deps to latest npm versions and flatten skill folders - Add pin-template-deps.js to resolve "*" deps to exact npm versions - Integrate pinning into sync-template-skills npm script - Remove check-template-skills-versions.js (no longer needed) - Simplify workflow to single sync step - Flatten skill output: one folder per skill with cleaned names Made-with: Cursor * fix: resolve skill validation errors - Move .template-versions.json from skills/ to root - Shorten skill names to meet 64-char limit: - salesforce-webapp-feature-micro-frontend-generating-micro-frontend-lwc → salesforce-webapp-micro-frontend-lwc - salesforce-webapp-feature-react-agentforce-conversation-client-integrating-agentforce-conversation-client → salesforce-webapp-agentforce-conversation-client - salesforce-webapp-feature-react-file-upload-implementing-file-upload → salesforce-webapp-react-file-upload - Expand descriptions to meet 20-word minimum with trigger context * Add webapp skills from template, sync script updates - Rename skill folders from salesforce-webapp-* to *-webapp-* convention - Update sync-template-skills.js: set SKILL.md front matter name to dest folder - Remove sync-template-skills workflow and pin-template-deps script - Add .synced-template-skills.json manifest, deploying-webapp-to-salesforce skill - Replace salesforce-webapp-designing-webapp-ui-ux with designing-webapp-ui-ux Made-with: Cursor * Align SKILL.md front matter name with folder for all webapp skills Made-with: Cursor * Fix skill validation: description length and trigger context for configuring-webapp-metadata, creating-webapp Made-with: Cursor * Rename sync script to sync-webapp-skills, drop manifest file - Rename sync-template-skills.js to sync-webapp-skills.js - Update package.json script to sync-webapp-skills - Remove .synced-template-skills.json creation and add to .gitignore Made-with: Cursor * Revert sync-react-b2e-sample and sync-react-b2x-sample to upstream version Made-with: Cursor * Sync script: pin b2e and b2x to latest, sync skills from template - Pin both template packages to latest in sync-webapp-skills.js - Update package.json / package-lock.json (b2x 1.109.0) - Sync skills: managing-webapp-agentforce-conversation-client, bar-line-chart, remove building-webapp-analytics-charts and integrating-webapp-agentforce-conversation-client - Minor skill content updates Made-with: Cursor * Remove interactive map, weather widget, and Unsplash skills (no longer in template) Made-with: Cursor --------- Co-authored-by: Hemant Singh Bisht <hsinghbisht@salesforce.com>
2026-03-20 01:16:27 +08:00
# Constraints and Anti-Patterns
This document lists all invalid approaches and patterns to avoid when working with AgentforceConversationClient.
## Never Edit Implementation Files
**CRITICAL: Only edit files where the component is USED, never the component implementation itself.**
-**DO edit**: Any React files that import and use `<AgentforceConversationClient />` (for example, shared shells, route components, or feature pages)
-**DO NOT edit**: AgentforceConversationClient.tsx, AgentforceConversationClient.jsx, index.tsx, index.jsx, or any files inside:
- `node_modules/@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client/src/`
feat: syncing webapp skills sync to afv @W-21338965@ (#57) * feat: removing old webapp skills * feat: adding sync of skills from webapps to afv * feat: adding the first iteration of skills * feat: pin template deps to latest npm versions and flatten skill folders - Add pin-template-deps.js to resolve "*" deps to exact npm versions - Integrate pinning into sync-template-skills npm script - Remove check-template-skills-versions.js (no longer needed) - Simplify workflow to single sync step - Flatten skill output: one folder per skill with cleaned names Made-with: Cursor * fix: resolve skill validation errors - Move .template-versions.json from skills/ to root - Shorten skill names to meet 64-char limit: - salesforce-webapp-feature-micro-frontend-generating-micro-frontend-lwc → salesforce-webapp-micro-frontend-lwc - salesforce-webapp-feature-react-agentforce-conversation-client-integrating-agentforce-conversation-client → salesforce-webapp-agentforce-conversation-client - salesforce-webapp-feature-react-file-upload-implementing-file-upload → salesforce-webapp-react-file-upload - Expand descriptions to meet 20-word minimum with trigger context * Add webapp skills from template, sync script updates - Rename skill folders from salesforce-webapp-* to *-webapp-* convention - Update sync-template-skills.js: set SKILL.md front matter name to dest folder - Remove sync-template-skills workflow and pin-template-deps script - Add .synced-template-skills.json manifest, deploying-webapp-to-salesforce skill - Replace salesforce-webapp-designing-webapp-ui-ux with designing-webapp-ui-ux Made-with: Cursor * Align SKILL.md front matter name with folder for all webapp skills Made-with: Cursor * Fix skill validation: description length and trigger context for configuring-webapp-metadata, creating-webapp Made-with: Cursor * Rename sync script to sync-webapp-skills, drop manifest file - Rename sync-template-skills.js to sync-webapp-skills.js - Update package.json script to sync-webapp-skills - Remove .synced-template-skills.json creation and add to .gitignore Made-with: Cursor * Revert sync-react-b2e-sample and sync-react-b2x-sample to upstream version Made-with: Cursor * Sync script: pin b2e and b2x to latest, sync skills from template - Pin both template packages to latest in sync-webapp-skills.js - Update package.json / package-lock.json (b2x 1.109.0) - Sync skills: managing-webapp-agentforce-conversation-client, bar-line-chart, remove building-webapp-analytics-charts and integrating-webapp-agentforce-conversation-client - Minor skill content updates Made-with: Cursor * Remove interactive map, weather widget, and Unsplash skills (no longer in template) Made-with: Cursor --------- Co-authored-by: Hemant Singh Bisht <hsinghbisht@salesforce.com>
2026-03-20 01:16:27 +08:00
- `packages/template/feature/feature-react-agentforce-conversation-client/src/`
- `src/components/AgentforceConversationClient.tsx` (patched templates)
- Any path containing `/components/AgentforceConversationClient.`
**If you're reading a file named `AgentforceConversationClient.tsx`, you're in the wrong place. Stop and search for the USAGE instead.**
## Invalid Props
AgentforceConversationClient uses a flat prop API and does NOT accept these props:
-`containerStyle` - Use `width` and `height` props directly instead
-`style` - Use `styleTokens` for theming
-`className` - Not supported
- ❌ Any standard React div props - This wraps an embedded iframe, not a div
**Why:** The component is a wrapper around an embedded iframe using Lightning Out 2.0. Standard React styling props don't apply.
## Invalid Styling Approaches
**CRITICAL: For ALL styling, theming, branding, or color changes - ONLY use `styleTokens` prop.**
Never use these approaches:
- ❌ Creating CSS files (e.g., `agent-styles.css`, `theme.css`)
- ❌ Creating `<style>` tags or internal stylesheets
- ❌ Using `style` attribute on the component
- ❌ Using `className` prop
- ❌ Inline styles
- ❌ CSS modules
- ❌ Styled-components or any CSS-in-JS libraries
**Why:** The component controls its own internal styling through the `styleTokens` API. External CSS cannot reach into the embedded iframe.
## Invalid Implementation Approaches
Never do these:
- ❌ Create custom chat UIs from scratch
- ❌ Use third-party chat libraries (socket.io, WebSocket libraries, etc.)
- ❌ Call `embedAgentforceClient` directly from `@salesforce/agentforce-conversation-client`
- ❌ Build custom WebSocket or REST API chat implementations
**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.
## Invalid Update Patterns
When updating an existing component:
- ❌ Delete and recreate the component
- ❌ Remove all props and start over
- ❌ Copy the entire component to a new file
**Why:** This loses configuration, introduces errors, and creates unnecessary diffs. Always update props in place.
## Examples
### ❌ Wrong - Using containerStyle
```tsx
<AgentforceConversationClient agentId="0Xx..." containerStyle={{ width: 420, height: 600 }} />
```
### ✅ Correct - Using width/height directly
```tsx
<AgentforceConversationClient agentId="0Xx..." width="420px" height="600px" />
```
### ❌ Wrong - Creating CSS file
```css
/* agent-styles.css */
.agentforce-chat {
background: red;
color: white;
}
```
```tsx
import "./agent-styles.css";
<AgentforceConversationClient className="agentforce-chat" />;
```
### ✅ Correct - Using styleTokens
```tsx
<AgentforceConversationClient
agentId="0Xx..."
styleTokens={{
headerBlockBackground: "red",
headerBlockTextColor: "white",
}}
/>
```
### ❌ Wrong - Creating style tag
```tsx
<>
<style>{`.agent-chat { background: blue; }`}</style>
<AgentforceConversationClient agentId="0Xx..." />
</>
```
### ✅ Correct - Using styleTokens
```tsx
<AgentforceConversationClient
agentId="0Xx..."
styleTokens={{
headerBlockBackground: "blue",
}}
/>
```
### ❌ Wrong - Editing implementation file
Reading or editing: `node_modules/@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client/src/AgentforceConversationClient.tsx`
feat: syncing webapp skills sync to afv @W-21338965@ (#57) * feat: removing old webapp skills * feat: adding sync of skills from webapps to afv * feat: adding the first iteration of skills * feat: pin template deps to latest npm versions and flatten skill folders - Add pin-template-deps.js to resolve "*" deps to exact npm versions - Integrate pinning into sync-template-skills npm script - Remove check-template-skills-versions.js (no longer needed) - Simplify workflow to single sync step - Flatten skill output: one folder per skill with cleaned names Made-with: Cursor * fix: resolve skill validation errors - Move .template-versions.json from skills/ to root - Shorten skill names to meet 64-char limit: - salesforce-webapp-feature-micro-frontend-generating-micro-frontend-lwc → salesforce-webapp-micro-frontend-lwc - salesforce-webapp-feature-react-agentforce-conversation-client-integrating-agentforce-conversation-client → salesforce-webapp-agentforce-conversation-client - salesforce-webapp-feature-react-file-upload-implementing-file-upload → salesforce-webapp-react-file-upload - Expand descriptions to meet 20-word minimum with trigger context * Add webapp skills from template, sync script updates - Rename skill folders from salesforce-webapp-* to *-webapp-* convention - Update sync-template-skills.js: set SKILL.md front matter name to dest folder - Remove sync-template-skills workflow and pin-template-deps script - Add .synced-template-skills.json manifest, deploying-webapp-to-salesforce skill - Replace salesforce-webapp-designing-webapp-ui-ux with designing-webapp-ui-ux Made-with: Cursor * Align SKILL.md front matter name with folder for all webapp skills Made-with: Cursor * Fix skill validation: description length and trigger context for configuring-webapp-metadata, creating-webapp Made-with: Cursor * Rename sync script to sync-webapp-skills, drop manifest file - Rename sync-template-skills.js to sync-webapp-skills.js - Update package.json script to sync-webapp-skills - Remove .synced-template-skills.json creation and add to .gitignore Made-with: Cursor * Revert sync-react-b2e-sample and sync-react-b2x-sample to upstream version Made-with: Cursor * Sync script: pin b2e and b2x to latest, sync skills from template - Pin both template packages to latest in sync-webapp-skills.js - Update package.json / package-lock.json (b2x 1.109.0) - Sync skills: managing-webapp-agentforce-conversation-client, bar-line-chart, remove building-webapp-analytics-charts and integrating-webapp-agentforce-conversation-client - Minor skill content updates Made-with: Cursor * Remove interactive map, weather widget, and Unsplash skills (no longer in template) Made-with: Cursor --------- Co-authored-by: Hemant Singh Bisht <hsinghbisht@salesforce.com>
2026-03-20 01:16:27 +08:00
### ✅ Correct - Editing usage file
Reading and editing: usage files where the component is imported and used (for example, `src/app.tsx`, a route component, or a feature page)