@salesforce/webapp-template-feature-react-file-upload-experimental 1.107.2 → 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/dist/.a4drules/features/feature-react-agentforce-conversation-client-embedded-agent-rule.md +30 -6
- package/dist/.a4drules/skills/creating-webapp/SKILL.md +20 -0
- package/dist/.a4drules/skills/deploying-to-salesforce/SKILL.md +229 -0
- package/dist/.a4drules/skills/exploring-graphql-schema/SKILL.md +7 -18
- 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/.a4drules/skills/using-graphql/SKILL.md +2 -1
- package/dist/.a4drules/webapp-code-quality.md +5 -2
- package/dist/.a4drules/webapp-data-access.md +25 -0
- package/dist/.a4drules/webapp-deployment.md +32 -0
- package/dist/.a4drules/webapp-react-typescript.md +4 -12
- package/dist/.a4drules/webapp-react.md +7 -13
- package/dist/AGENT.md +3 -0
- package/dist/CHANGELOG.md +19 -0
- package/dist/eslint.config.js +7 -0
- package/dist/force-app/main/default/webapplications/feature-react-file-upload/eslint.config.js +2 -0
- package/dist/force-app/main/default/webapplications/feature-react-file-upload/package.json +3 -9
- package/dist/force-app/main/default/webapplications/feature-react-file-upload/src/app.tsx +4 -1
- package/dist/force-app/main/default/webapplications/feature-react-file-upload/src/components/alerts/status-alert.tsx +1 -1
- package/dist/force-app/main/default/webapplications/feature-react-file-upload/tsconfig.json +7 -1
- package/dist/package-lock.json +9995 -0
- package/dist/package.json +7 -7
- package/package.json +2 -2
- package/dist/.a4drules/skills/generating-micro-frontend-lwc/SKILL.md +0 -137
- 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/dist/force-app/main/default/webapplications/feature-react-file-upload/tsconfig.tsbuildinfo +0 -1
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
|
|
@@ -5,10 +5,30 @@ paths:
|
|
|
5
5
|
- "**/webapplications/**/*"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
# First Steps (MUST FOLLOW)
|
|
9
|
+
|
|
10
|
+
**Always run `npm install` before doing anything else** when working in a web app directory (e.g. `force-app/main/default/webapplications/<appName>/` or a dist app path). Dependencies must be installed before running `npm run dev`, `npm run build`, `npm run lint`, or any other script. If `node_modules` is missing or stale, commands will fail.
|
|
11
|
+
|
|
8
12
|
# Skills-First (MUST FOLLOW)
|
|
9
13
|
|
|
10
14
|
**Before writing any code or running any command**, search for relevant skills (`SKILL.md` files) that cover your task. Read the full skill and follow its instructions. Skills live in `.a4drules/skills/` and `feature/*/skills/`. See **webapp-skills-first.md** for the full protocol and a task-to-skill lookup table.
|
|
11
15
|
|
|
16
|
+
# Deployment Order (MUST FOLLOW)
|
|
17
|
+
|
|
18
|
+
**Metadata deployments must complete before fetching GraphQL schema or running codegen.** The schema reflects the current org state; custom objects and fields appear only after metadata is deployed. Running schema fetch or codegen too early produces incomplete or incorrect types.
|
|
19
|
+
|
|
20
|
+
**Invoke the `deploying-to-salesforce` skill** (`.a4drules/skills/deploying-to-salesforce/`) whenever the task involves:
|
|
21
|
+
- Deploying metadata (objects, permission sets, layouts)
|
|
22
|
+
- Fetching GraphQL schema (`npm run graphql:schema`)
|
|
23
|
+
- Running GraphQL codegen (`npm run graphql:codegen`)
|
|
24
|
+
- Generating deploy/setup commands or syncing with the org
|
|
25
|
+
|
|
26
|
+
The skill enforces the correct sequence: **deploy metadata → assign permset → schema fetch → codegen**.
|
|
27
|
+
|
|
28
|
+
**Critical rules:**
|
|
29
|
+
- Do **not** run `npm run graphql:schema` before metadata (objects, permission sets) is deployed — the schema will not include custom objects/fields.
|
|
30
|
+
- Do **not** skip schema refetch after any metadata deployment — re-run `npm run graphql:schema` and `npm run graphql:codegen` from the webapp dir.
|
|
31
|
+
|
|
12
32
|
# Web App Generation
|
|
13
33
|
|
|
14
34
|
## Before `sf webapp generate`
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploying-to-salesforce
|
|
3
|
+
description: Enforces the correct order for deploying metadata, assigning permission sets, and fetching GraphQL schema. Use for ANY deployment to a Salesforce org — webapps, LWC, Aura, Apex, metadata, schema fetch, or org sync. Codifies setup-cli.mjs.
|
|
4
|
+
paths:
|
|
5
|
+
- "**/*"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Deploying to Salesforce
|
|
9
|
+
|
|
10
|
+
Guidance for AI agents deploying metadata to a Salesforce org or syncing with the org. **The order of operations is critical.** This skill codifies the exact sequence from `scripts/setup-cli.mjs` and documents **every Salesforce interaction**.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
Invoke this skill whenever the task involves:
|
|
15
|
+
|
|
16
|
+
- Deploying metadata (objects, permission sets, layouts, Apex, web applications)
|
|
17
|
+
- Generating deploy commands or setup instructions
|
|
18
|
+
- Fetching the GraphQL schema (`npm run graphql:schema`)
|
|
19
|
+
- Running GraphQL codegen (`npm run graphql:codegen`)
|
|
20
|
+
- Full org setup (login, deploy, permset, data, schema, build)
|
|
21
|
+
- Any manual step that touches the Salesforce org
|
|
22
|
+
|
|
23
|
+
## Canonical Sequence (from setup-cli.mjs)
|
|
24
|
+
|
|
25
|
+
Execute steps in this **exact order**. Steps marked **(SF)** perform a Salesforce API or CLI interaction.
|
|
26
|
+
|
|
27
|
+
### Step 1: Login — org authentication
|
|
28
|
+
|
|
29
|
+
| Action | Salesforce interaction? | Command |
|
|
30
|
+
|--------|-------------------------|---------|
|
|
31
|
+
| Check if org is connected | **(SF)** | `sf org display --target-org <alias> --json` |
|
|
32
|
+
| If not connected: authenticate | **(SF)** | `sf org login web --alias <alias>` |
|
|
33
|
+
|
|
34
|
+
- **Run when:** Org is not connected. **Omit when:** Org is already authenticated (check via `sf org display`).
|
|
35
|
+
- All subsequent steps require an authenticated org.
|
|
36
|
+
|
|
37
|
+
### Step 2: Webapp build — pre-deploy (required for entity deployment)
|
|
38
|
+
|
|
39
|
+
| Action | Salesforce interaction? | Command |
|
|
40
|
+
|--------|-------------------------|---------|
|
|
41
|
+
| Install dependencies | No | `npm install` (in each webapp dir) |
|
|
42
|
+
| Build web app | No | `npm run build` (in each webapp dir) |
|
|
43
|
+
|
|
44
|
+
- Produces `dist/` so `sf project deploy start` can deploy web application entities. Run **before** deploy when deploying web apps.
|
|
45
|
+
- **Run when:** Deploying web apps AND (`dist/` does not exist OR webapp source has changed since last build). **Omit when:** Not deploying, or `dist/` is current and no source changes.
|
|
46
|
+
|
|
47
|
+
### Step 3: Deploy metadata
|
|
48
|
+
|
|
49
|
+
| Action | Salesforce interaction? | Command |
|
|
50
|
+
|--------|-------------------------|---------|
|
|
51
|
+
| Deploy metadata | **(SF)** | See below |
|
|
52
|
+
|
|
53
|
+
**Check for a manifest (package.xml) first.** Only use it if present:
|
|
54
|
+
|
|
55
|
+
- **If `manifest/package.xml` (or `package.xml`) exists:** Deploy using the manifest:
|
|
56
|
+
```bash
|
|
57
|
+
sf project deploy start --manifest manifest/package.xml --target-org <alias>
|
|
58
|
+
```
|
|
59
|
+
- **If no manifest exists:** Deploy all metadata from the project (packageDirectories in sfdx-project.json):
|
|
60
|
+
```bash
|
|
61
|
+
sf project deploy start --target-org <alias>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Do not assume a manifest exists. Check the project root and common locations (e.g., `manifest/`, `config/`) before choosing the deploy command.
|
|
65
|
+
|
|
66
|
+
- Deploys objects, layouts, permission sets, Apex classes, web applications, and all other metadata.
|
|
67
|
+
- **Must complete successfully before schema fetch** — the schema reflects org state; custom objects/fields appear only after deployment.
|
|
68
|
+
- **Run when:** Metadata has changed since last deploy, or never deployed. **Omit when:** No metadata changes and deploy has already run successfully.
|
|
69
|
+
|
|
70
|
+
### Step 4: Post-deployment configuration — assign permissions and configure
|
|
71
|
+
|
|
72
|
+
| Action | Salesforce interaction? | Command |
|
|
73
|
+
|--------|-------------------------|---------|
|
|
74
|
+
| Assign permission set or group | **(SF)** | `sf org assign permset --name <name> --target-org <alias>` (works for both permsets and permset groups) |
|
|
75
|
+
| Assign profile to user | **(SF)** | `sf data update record` or at user creation |
|
|
76
|
+
| Other post-deploy config | **(SF)** | Varies (e.g., named credentials, connected apps, custom settings) |
|
|
77
|
+
|
|
78
|
+
**Example commands:**
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Permission set (assigns to default user of target org)
|
|
82
|
+
sf org assign permset --name Property_Management_Access --target-org myorg
|
|
83
|
+
|
|
84
|
+
# Permission set group (same command; pass the group name)
|
|
85
|
+
sf org assign permset --name My_Permset_Group --target-org myorg
|
|
86
|
+
|
|
87
|
+
# Assign to a specific user
|
|
88
|
+
sf org assign permset --name Property_Management_Access --target-org myorg --on-behalf-of user@example.com
|
|
89
|
+
|
|
90
|
+
# Profile — update existing user's profile (requires ProfileId and User Id)
|
|
91
|
+
sf data update record --sobject User --record-id <userId> --values "ProfileId=<profileId>" --target-org myorg
|
|
92
|
+
|
|
93
|
+
# Profile — get ProfileId first
|
|
94
|
+
sf data query --query "SELECT Id, Name FROM Profile WHERE Name='Standard User'" --target-org myorg
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- **Deploying does not mean assigning.** Even after permission sets, permission set groups, and profiles are deployed to the org, they must be explicitly assigned or configured for users. Deployment makes them available; assignment/configuration grants access.
|
|
98
|
+
- **Permission sets** — Assign to users so they have access to custom objects and fields. Required for GraphQL introspection to return the correct schema.
|
|
99
|
+
- **Permission set groups** — Assign to users when using grouped permission sets.
|
|
100
|
+
- **Profiles** — Ensure users have the correct profile; profile assignment may be done at user creation or via Setup.
|
|
101
|
+
- **Other post-deploy configuration** — Named credentials, connected apps, custom settings, flow activation, and any metadata that requires manual configuration after deploy.
|
|
102
|
+
- All of the above must exist in the org (deployed in Step 3).
|
|
103
|
+
- **Run when:** Any permission set, permission set group, profile, or other post-deploy config was deployed or changed and not yet assigned/configured. **Omit when:** All required assignments and configuration are already in place.
|
|
104
|
+
|
|
105
|
+
**Proactive behavior:** After a successful deploy, discover permission sets in the project (e.g., `force-app/main/default/permissionsets/*.permissionset-meta.xml`) and assign each one. Extract the API name from the filename (e.g., `Property_Management_Access.permissionset-meta.xml` → `Property_Management_Access`). If the user has not explicitly requested a full setup, you may ask: "Do you want me to assign the permission sets to your org?" — but do not skip this step silently; either run it or ask.
|
|
106
|
+
|
|
107
|
+
### Step 5: Data — prepare and import (optional)
|
|
108
|
+
|
|
109
|
+
| Action | Salesforce interaction? | Command |
|
|
110
|
+
|--------|-------------------------|---------|
|
|
111
|
+
| Prepare unique fields | No | `node scripts/prepare-import-unique-fields.js --data-dir <dataDir>` |
|
|
112
|
+
| Clean existing records | **(SF)** | `sf apex run --target-org <alias> --file <apex>` (per sobject, reverse plan order) |
|
|
113
|
+
| Import records | **(SF)** | `sf apex run --target-org <alias> --file <apex>` (per batch) |
|
|
114
|
+
|
|
115
|
+
- Only runs if `data/data-plan.json` and `data/` exist.
|
|
116
|
+
- Delete runs in reverse plan order (children before parents).
|
|
117
|
+
- Import uses Anonymous Apex with `Database.DMLOptions.duplicateRuleHeader.allowSave = true`.
|
|
118
|
+
- **Run when:** Data plan exists AND (never imported OR data files or plan changed). **Omit when:** No data plan, or data already imported and unchanged.
|
|
119
|
+
|
|
120
|
+
**Proactive behavior:** If `data/data-plan.json` and `data/` exist, you MUST ask the user: "Do you want me to import the sample data now? This will prepare unique fields, optionally clean existing records, and import data. Reply yes to proceed." Do not skip this step silently; either run it (after confirmation) or ask. Never import or clean without explicit user confirmation.
|
|
121
|
+
|
|
122
|
+
### Step 6: GraphQL schema and codegen
|
|
123
|
+
|
|
124
|
+
| Action | Salesforce interaction? | Command |
|
|
125
|
+
|--------|-------------------------|---------|
|
|
126
|
+
| Install webapp deps | No | `npm install` (in webapp dir) |
|
|
127
|
+
| Set default org | **(SF)** | `sf config set target-org <alias> --global` |
|
|
128
|
+
| Fetch schema (introspection) | **(SF)** | `npm run graphql:schema` (from webapp dir) |
|
|
129
|
+
| Generate types | No | `npm run graphql:codegen` (from webapp dir) |
|
|
130
|
+
|
|
131
|
+
- `graphql:schema` performs GraphQL introspection against the org — a **Salesforce API call**.
|
|
132
|
+
- Schema is written to `schema.graphql` at the SFDX project root.
|
|
133
|
+
- Codegen reads the schema file locally; no Salesforce interaction.
|
|
134
|
+
- **Run when:** Schema does not exist, OR metadata was deployed/changed since last schema fetch, OR permissions or post-deploy config was assigned since last schema fetch. **Omit when:** Schema exists and is current relative to org state.
|
|
135
|
+
|
|
136
|
+
### Step 7: Webapp build (if not done in Step 2)
|
|
137
|
+
|
|
138
|
+
| Action | Salesforce interaction? | Command |
|
|
139
|
+
|--------|-------------------------|---------|
|
|
140
|
+
| Build web app | No | `npm run build` (in webapp dir) |
|
|
141
|
+
|
|
142
|
+
- **Run when:** Build is needed (e.g., for dev server or deploy) AND (`dist/` does not exist OR webapp source has changed since last build). **Omit when:** `dist/` is current and no build needed.
|
|
143
|
+
|
|
144
|
+
### Step 8: Dev server (optional)
|
|
145
|
+
|
|
146
|
+
| Action | Salesforce interaction? | Command |
|
|
147
|
+
|--------|-------------------------|---------|
|
|
148
|
+
| Launch dev server | No | `npm run dev` (in webapp dir) |
|
|
149
|
+
|
|
150
|
+
- **Run when:** User requests to launch the dev server. **Omit when:** Not requested.
|
|
151
|
+
|
|
152
|
+
## Summary: All Salesforce Interactions (in order)
|
|
153
|
+
|
|
154
|
+
1. `sf org display` — check org connection
|
|
155
|
+
2. `sf org login web` — authenticate (if needed)
|
|
156
|
+
3. `sf project deploy start` — deploy metadata
|
|
157
|
+
4. `sf org assign permset` (permsets and permset groups) / profile assignment / other post-deploy config — assign permissions and configure
|
|
158
|
+
5. `sf apex run` — delete existing data (if data plan)
|
|
159
|
+
6. `sf apex run` — import data (if data plan)
|
|
160
|
+
7. `sf config set target-org` — set default org for schema
|
|
161
|
+
8. `npm run graphql:schema` — GraphQL introspection (Salesforce API)
|
|
162
|
+
|
|
163
|
+
## Post-Deploy Checklist (MUST NOT SKIP)
|
|
164
|
+
|
|
165
|
+
After **every successful metadata deploy**, the agent MUST address these before considering the task complete:
|
|
166
|
+
|
|
167
|
+
1. **Permission sets** — Discover `force-app/main/default/permissionsets/*.permissionset-meta.xml`, extract API names, and assign each via `sf org assign permset --name <name> --target-org <alias>`. If unsure, ask: "Do you want me to assign the permission sets (e.g., Property_Management_Access, Tenant_Maintenance_Access) to your org?"
|
|
168
|
+
2. **Data import** — If `data/data-plan.json` exists, ask: "Do you want me to import the sample data now? Reply yes to proceed." Do not import without confirmation.
|
|
169
|
+
3. **Schema refetch** — Run `npm run graphql:schema` and `npm run graphql:codegen` from the webapp dir (required after deploy).
|
|
170
|
+
|
|
171
|
+
Do not silently skip permission set assignment or data import. Either run them or ask the user.
|
|
172
|
+
|
|
173
|
+
## Agent Decision Criteria
|
|
174
|
+
|
|
175
|
+
Evaluate each step before running it. Ask:
|
|
176
|
+
|
|
177
|
+
- **Has this step ever run before?** If not, it is likely needed.
|
|
178
|
+
- **Have changes been made that require this step?** (e.g., metadata edits → deploy; deploy → schema refetch)
|
|
179
|
+
- **Is the current state sufficient?** (e.g., org connected, schema exists and is current, permissions and post-deploy config assigned)
|
|
180
|
+
|
|
181
|
+
Do not rely on CLI flags. Decide based on project state and what has changed.
|
|
182
|
+
|
|
183
|
+
## Evaluation: When Each Step Touches Salesforce
|
|
184
|
+
|
|
185
|
+
| Step | Salesforce interaction | Run when |
|
|
186
|
+
|------|------------------------|----------|
|
|
187
|
+
| 1. Login | Yes | Org not connected |
|
|
188
|
+
| 2. Webapp build | No | Deploying web apps AND dist missing or source changed |
|
|
189
|
+
| 3. Deploy | Yes | Metadata changed or never deployed |
|
|
190
|
+
| 4. Post-deploy config | Yes | Permission sets, permset groups, profiles, or other config deployed/changed and not assigned |
|
|
191
|
+
| 5. Data | Yes | Data plan exists AND (never imported OR data changed) |
|
|
192
|
+
| 6. GraphQL | Yes (schema only) | Schema missing or metadata/permissions changed since last fetch |
|
|
193
|
+
| 7. Webapp build | No | Build needed AND dist missing or source changed |
|
|
194
|
+
| 8. Dev | No | User requests dev server |
|
|
195
|
+
|
|
196
|
+
**Critical rule:** Steps 3 (deploy) and 4 (post-deploy config) must complete **before** step 6 (graphql:schema). The schema reflects the org state; running introspection too early yields an incomplete schema.
|
|
197
|
+
|
|
198
|
+
## Schema Refetch Rule (CRITICAL)
|
|
199
|
+
|
|
200
|
+
**After any metadata deployment**, you MUST re-run schema fetch and codegen:
|
|
201
|
+
|
|
202
|
+
- New custom objects
|
|
203
|
+
- New custom fields
|
|
204
|
+
- New or updated permission sets
|
|
205
|
+
- Any change to metadata that affects the GraphQL schema
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# From webapp dir (force-app/main/default/webapplications/<appName>/)
|
|
209
|
+
npm run graphql:schema
|
|
210
|
+
npm run graphql:codegen
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Do **not** assume the existing `schema.graphql` is current after metadata changes.
|
|
214
|
+
|
|
215
|
+
## One-Command Setup (Reference)
|
|
216
|
+
|
|
217
|
+
The project includes `scripts/setup-cli.mjs` which runs this sequence in batch. Use it when the user wants a full setup; otherwise, follow this skill and run only the steps that are needed based on current state.
|
|
218
|
+
|
|
219
|
+
## Prohibited Actions
|
|
220
|
+
|
|
221
|
+
- **Do not** run `npm run graphql:schema` before metadata is deployed — the schema will not include custom objects/fields
|
|
222
|
+
- **Do not** skip schema refetch after deploying new metadata — types and queries will be out of sync
|
|
223
|
+
- **Do not** assign permissions or configure before deploying — permission sets, permset groups, and profiles must exist in the org first
|
|
224
|
+
- **Do not** run GraphQL introspection before assigning permissions — the user may lack FLS for custom fields
|
|
225
|
+
|
|
226
|
+
## Related Skills
|
|
227
|
+
|
|
228
|
+
- **exploring-graphql-schema** — Schema exploration (grep-only) after schema exists
|
|
229
|
+
- **using-graphql** — Full GraphQL workflow (explore, query, codegen, lint)
|
|
@@ -11,6 +11,13 @@ paths:
|
|
|
11
11
|
|
|
12
12
|
Guidance for AI agents working with the Salesforce GraphQL API schema. **GREP ONLY** — the schema file is very large (~265,000+ lines). All lookups MUST use grep; do NOT open, read, stream, or parse the file.
|
|
13
13
|
|
|
14
|
+
## Deployment Prerequisites
|
|
15
|
+
|
|
16
|
+
The schema reflects the **current org state**. Custom objects and fields appear only after metadata is deployed.
|
|
17
|
+
|
|
18
|
+
- **Before** running `npm run graphql:schema`: Deploy all metadata (objects, permission sets, layouts) and assign the permission set to the target user. Invoke the `deploying-to-salesforce` skill for the full sequence.
|
|
19
|
+
- **After** any metadata deployment: Re-run `npm run graphql:schema` and `npm run graphql:codegen` so types and queries stay in sync.
|
|
20
|
+
|
|
14
21
|
## Schema File Location
|
|
15
22
|
|
|
16
23
|
**Location:** `schema.graphql` at the **SFDX project root** (NOT inside the webapp dir). All grep commands **must be run from the project root** where `schema.graphql` lives.
|
|
@@ -93,24 +100,6 @@ Search for `input <ObjectName>CreateInput` or `input <ObjectName>UpdateInput`:
|
|
|
93
100
|
grep -nE '^input[[:space:]]+AccountCreateInput\b' ./schema.graphql -A 30
|
|
94
101
|
```
|
|
95
102
|
|
|
96
|
-
## Common Operator Types
|
|
97
|
-
|
|
98
|
-
- **StringOperators**: `eq`, `ne`, `like`, `lt`, `gt`, `lte`, `gte`, `in`, `nin`
|
|
99
|
-
- **OrderByClause**: `order: ResultOrder` (ASC/DESC), `nulls: NullOrder` (FIRST/LAST)
|
|
100
|
-
|
|
101
|
-
## Field Value Wrappers
|
|
102
|
-
|
|
103
|
-
Salesforce GraphQL returns field values wrapped in typed objects:
|
|
104
|
-
|
|
105
|
-
| Wrapper Type | Access Pattern |
|
|
106
|
-
| --------------- | ---------------------------------- |
|
|
107
|
-
| `StringValue` | `FieldName { value }` |
|
|
108
|
-
| `IntValue` | `FieldName { value }` |
|
|
109
|
-
| `BooleanValue` | `FieldName { value }` |
|
|
110
|
-
| `DateTimeValue` | `FieldName { value displayValue }` |
|
|
111
|
-
| `PicklistValue` | `FieldName { value displayValue }` |
|
|
112
|
-
| `CurrencyValue` | `FieldName { value displayValue }` |
|
|
113
|
-
|
|
114
103
|
## Agent Workflow for Building Queries (grep-only)
|
|
115
104
|
|
|
116
105
|
**Pre-requisites (MANDATORY):**
|
|
@@ -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)
|