@salesforce/afv-skills 1.5.0 → 1.5.2
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 +16 -415
- package/package.json +5 -3
- package/skills/building-ui-bundle-app/SKILL.md +325 -0
- package/skills/building-ui-bundle-frontend/SKILL.md +122 -0
- package/skills/{building-webapp-react-components → building-ui-bundle-frontend}/implementation/component.md +1 -1
- package/skills/creating-b2b-commerce-store/SKILL.md +169 -0
- package/skills/creating-b2b-commerce-store/references/store-vs-storefront.md +169 -0
- package/skills/deploying-ui-bundle/SKILL.md +77 -0
- package/skills/generating-apex/CREDITS.md +30 -0
- package/skills/generating-apex/SKILL.md +399 -0
- package/skills/generating-apex/assets/abstract.cls +132 -0
- package/skills/generating-apex/assets/batch.cls +125 -0
- package/skills/generating-apex/assets/domain.cls +102 -0
- package/skills/generating-apex/assets/dto.cls +108 -0
- package/skills/generating-apex/assets/exception.cls +51 -0
- package/skills/generating-apex/assets/interface.cls +25 -0
- package/skills/generating-apex/assets/invocable.cls +115 -0
- package/skills/generating-apex/assets/queueable.cls +92 -0
- package/skills/generating-apex/assets/rest-resource.cls +300 -0
- package/skills/generating-apex/assets/schedulable.cls +75 -0
- package/skills/generating-apex/assets/selector.cls +92 -0
- package/skills/generating-apex/assets/service.cls +69 -0
- package/skills/generating-apex/assets/trigger.cls +45 -0
- package/skills/generating-apex/assets/utility.cls +97 -0
- package/skills/generating-apex/references/AccountDeduplicationBatch.cls +148 -0
- package/skills/generating-apex/references/AccountSelector.cls +193 -0
- package/skills/generating-apex/references/AccountService.cls +201 -0
- package/skills/generating-apex-test/CREDITS.md +30 -0
- package/skills/generating-apex-test/SKILL.md +199 -0
- package/skills/generating-apex-test/assets/test-class-template.cls +93 -0
- package/skills/generating-apex-test/assets/test-data-factory-template.cls +111 -0
- package/skills/generating-apex-test/references/assertion-patterns.md +108 -0
- package/skills/generating-apex-test/references/async-testing.md +193 -0
- package/skills/generating-apex-test/references/mocking-patterns.md +220 -0
- package/skills/generating-apex-test/references/test-data-factory.md +75 -0
- package/skills/generating-experience-react-site/SKILL.md +20 -9
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience.md +1 -1
- package/skills/generating-flexipage/SKILL.md +58 -60
- package/skills/generating-ui-bundle-features/SKILL.md +45 -0
- package/skills/generating-ui-bundle-metadata/SKILL.md +106 -0
- package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/SKILL.md +5 -5
- package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/references/constraints.md +2 -2
- package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/references/examples.md +1 -1
- package/skills/{implementing-webapp-file-upload → implementing-ui-bundle-file-upload}/SKILL.md +11 -11
- package/skills/searching-media/SKILL.md +342 -0
- package/skills/{using-webapp-salesforce-data → using-ui-bundle-salesforce-data}/SKILL.md +52 -25
- package/skills/using-ui-bundle-salesforce-data/references/mutation-query-generation.md +140 -0
- package/skills/using-ui-bundle-salesforce-data/references/query-testing.md +78 -0
- package/skills/using-ui-bundle-salesforce-data/references/read-query-generation.md +307 -0
- package/skills/using-ui-bundle-salesforce-data/references/schema-introspection.md +53 -0
- package/skills/using-ui-bundle-salesforce-data/references/ui-bundle-integration.md +221 -0
- package/skills/{using-webapp-salesforce-data → using-ui-bundle-salesforce-data/scripts}/graphql-search.sh +75 -23
- package/skills/building-webapp-data-visualization/SKILL.md +0 -72
- package/skills/building-webapp-data-visualization/implementation/bar-line-chart.md +0 -316
- package/skills/building-webapp-data-visualization/implementation/dashboard-layout.md +0 -189
- package/skills/building-webapp-data-visualization/implementation/donut-chart.md +0 -181
- package/skills/building-webapp-data-visualization/implementation/stat-card.md +0 -150
- package/skills/building-webapp-react-components/SKILL.md +0 -96
- package/skills/configuring-webapp-csp-trusted-sites/SKILL.md +0 -90
- package/skills/configuring-webapp-metadata/SKILL.md +0 -158
- package/skills/creating-webapp/SKILL.md +0 -140
- package/skills/deploying-webapp-to-salesforce/SKILL.md +0 -226
- package/skills/installing-webapp-features/SKILL.md +0 -210
- /package/skills/{building-webapp-react-components → building-ui-bundle-frontend}/implementation/header-footer.md +0 -0
- /package/skills/{building-webapp-react-components → building-ui-bundle-frontend}/implementation/page.md +0 -0
- /package/skills/{configuring-webapp-csp-trusted-sites/implementation/metadata-format.md → generating-ui-bundle-metadata/implementation/csp-metadata-format.md} +0 -0
- /package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/references/style-tokens.md +0 -0
- /package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/references/troubleshooting.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: generating-flexipage
|
|
3
|
-
description: "Use this skill when users need to create, generate, modify, or validate Salesforce Lightning pages (FlexiPages). Trigger when users mention RecordPage, AppPage, HomePage, Lightning pages, page layouts, adding components to pages, or page customization. Also use when users say things like
|
|
3
|
+
description: "Use this skill when users need to create, generate, modify, or validate Salesforce Lightning pages (FlexiPages). Trigger when users mention RecordPage, AppPage, HomePage, Lightning pages, page layouts, adding components to pages, or page customization. Also use when users say things like 'create a Lightning page', 'add a component to a page', 'customize the record page', 'generate a FlexiPage', or when they're working with FlexiPage XML files and need help with components, regions, or deployment errors. Always use this skill for any FlexiPage-related work, even if they just mention 'page' in the context of Salesforce."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## When to Use This Skill
|
|
@@ -20,6 +20,8 @@ Use this skill when you need to:
|
|
|
20
20
|
|
|
21
21
|
## Overview
|
|
22
22
|
|
|
23
|
+
**CRITICAL: When creating NEW FlexiPages, you MUST ALWAYS start with the CLI template command.** Never create FlexiPage XML from scratch - the CLI provides valid structure, proper regions, and correct component configuration that prevents deployment errors.
|
|
24
|
+
|
|
23
25
|
Generate Lightning pages (RecordPage, AppPage, HomePage) using CLI bootstrapping for component discovery and configuration.
|
|
24
26
|
|
|
25
27
|
---
|
|
@@ -28,6 +30,8 @@ Generate Lightning pages (RecordPage, AppPage, HomePage) using CLI bootstrapping
|
|
|
28
30
|
|
|
29
31
|
### Step 1: Bootstrap with CLI
|
|
30
32
|
|
|
33
|
+
**MANDATORY FOR NEW PAGES: This step is NOT optional.** Always use the CLI template command when creating a new FlexiPage. The CLI generates valid XML structure, proper regions, and correct metadata that prevents common deployment errors. Only skip this step if you're editing an existing FlexiPage file.
|
|
34
|
+
|
|
31
35
|
```bash
|
|
32
36
|
sf template generate flexipage \
|
|
33
37
|
--name <PageName> \
|
|
@@ -39,19 +43,38 @@ sf template generate flexipage \
|
|
|
39
43
|
--output-dir force-app/main/default/flexipages
|
|
40
44
|
```
|
|
41
45
|
|
|
42
|
-
**
|
|
43
|
-
- **RecordPage**: Requires `--sobject` (e.g., Account, Custom_Object__c)
|
|
44
|
-
- **RecordPage**: Requires `--primary-field` and `--secondary-fields` for dynamic highlights, `--detail-fields` for full record details. Use the most important identifying field as primary, e.g. Name. Use the secondary fields (max 12, recommended 4-6) to show a summary of the record. Use detail fields to show the full details of the record.
|
|
45
|
-
- **AppPage**: No additional requirements
|
|
46
|
-
- **HomePage**: No additional requirements
|
|
46
|
+
**CRITICAL:** If the `sf template generate flexipage` command fails, **STOP**.
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
|
|
51
|
-
```
|
|
48
|
+
1. Install the templates plugin:
|
|
49
|
+
```bash
|
|
50
|
+
sf plugins install templates
|
|
51
|
+
```
|
|
52
|
+
2. Retry the `sf template generate flexipage` command
|
|
53
|
+
3. Verify the FlexiPage XML file was created
|
|
54
|
+
|
|
55
|
+
Do NOT continue to Step 2 until the template command succeeds. The generated XML is required for the entire workflow.
|
|
56
|
+
|
|
57
|
+
#### **Template-specific requirements**
|
|
58
|
+
|
|
59
|
+
**RecordPage:**
|
|
60
|
+
- Requires `--sobject` (e.g., Account, Custom_Object__c)
|
|
61
|
+
- Requires field parameters:
|
|
62
|
+
- `--primary-field`: Most important identifying field (e.g., Name)
|
|
63
|
+
- `--secondary-fields`: Record summary (recommended 4-6, max 12)
|
|
64
|
+
- `--detail-fields`: Full record details, including required fields (e.g., Name)
|
|
52
65
|
|
|
66
|
+
**AppPage:**
|
|
67
|
+
- No additional requirements
|
|
53
68
|
|
|
54
|
-
**
|
|
69
|
+
**HomePage:**
|
|
70
|
+
- No additional requirements
|
|
71
|
+
|
|
72
|
+
#### **Field Selection Rules**
|
|
73
|
+
- **Validate fields exist**: Use MCP tools or describe commands to discover available fields for the object before specifying them in the command
|
|
74
|
+
- **Prefer compound fields**: Use `Name` (not `FirstName`/`LastName`), `BillingAddress` (not `BillingStreet`/`BillingCity`/`BillingState`), `MailingAddress`, etc. when available
|
|
75
|
+
- **Include required fields in detail-fields**: Always include object required fields (like `Name`) in the `--detail-fields` parameter, even if they're also used in `--primary-field` or `--secondary-fields`
|
|
76
|
+
|
|
77
|
+
#### **What you get**
|
|
55
78
|
- Valid FlexiPage XML with correct structure
|
|
56
79
|
- Pre-configured regions and basic components
|
|
57
80
|
- Proper field references and facet structure
|
|
@@ -59,17 +82,31 @@ npm install -g @salesforce/cli@latest
|
|
|
59
82
|
|
|
60
83
|
### Step 2: Deploy Base Page
|
|
61
84
|
|
|
85
|
+
Run a **dry-run** deployment of the entire project to validate the page and dependencies:
|
|
62
86
|
```bash
|
|
63
|
-
sf project deploy start --
|
|
87
|
+
sf project deploy start --dry-run -d "force-app/main/default" --test-level NoTestRun --wait 10 --json
|
|
64
88
|
```
|
|
65
89
|
|
|
66
|
-
**
|
|
90
|
+
**Critical:** Fix any deployment errors before proceeding. The page must validate successfully.
|
|
91
|
+
|
|
92
|
+
### Step 3: **STOP - No Further Modifications**
|
|
67
93
|
|
|
68
|
-
|
|
94
|
+
**MANDATORY: Stop after Step 2. Do not add components or edit the FlexiPage XML.**
|
|
69
95
|
|
|
70
|
-
|
|
96
|
+
This applies even if the user requested:
|
|
97
|
+
- Additional components
|
|
98
|
+
- Page customization
|
|
99
|
+
- Component configuration
|
|
71
100
|
|
|
72
|
-
|
|
101
|
+
What you CAN do:
|
|
102
|
+
- Suggest what components would be useful
|
|
103
|
+
- Explain what enhancements are possible
|
|
104
|
+
- Document what would need to be added manually
|
|
105
|
+
|
|
106
|
+
What you CANNOT do:
|
|
107
|
+
- Modify the XML file
|
|
108
|
+
- Add any components
|
|
109
|
+
- Make any enhancements
|
|
73
110
|
|
|
74
111
|
---
|
|
75
112
|
|
|
@@ -215,6 +252,10 @@ Every fieldInstance requires:
|
|
|
215
252
|
|
|
216
253
|
## Common Deployment Errors
|
|
217
254
|
|
|
255
|
+
### "We couldn't retrieve or load the information on the field"
|
|
256
|
+
**Cause:** Invalid field API name - field doesn't exist on the object or has incorrect spelling
|
|
257
|
+
**Fix:** Use MCP tools or describe commands to discover valid fields, then update the field reference (see Field Selection Rules)
|
|
258
|
+
|
|
218
259
|
### "Invalid field reference"
|
|
219
260
|
**Cause:** Used `ObjectName.Field` instead of `Record.Field`
|
|
220
261
|
**Fix:** Change to `Record.{FieldApiName}`
|
|
@@ -245,49 +286,6 @@ Every fieldInstance requires:
|
|
|
245
286
|
|
|
246
287
|
---
|
|
247
288
|
|
|
248
|
-
## Incremental Development Pattern
|
|
249
|
-
|
|
250
|
-
**Philosophy:** Deploy small, working increments. Don't build entire complex page at once.
|
|
251
|
-
|
|
252
|
-
**Process:**
|
|
253
|
-
1. **CLI bootstrap** → Deploy base page
|
|
254
|
-
2. **Add one component** → Deploy
|
|
255
|
-
3. **Add another component** → Deploy
|
|
256
|
-
4. **Repeat** until complete
|
|
257
|
-
|
|
258
|
-
**Benefits:**
|
|
259
|
-
- Isolated errors (know exactly what broke)
|
|
260
|
-
- Faster debugging
|
|
261
|
-
- Build confidence with each success
|
|
262
|
-
- Get user feedback early
|
|
263
|
-
|
|
264
|
-
**Anti-pattern:** Building entire complex page → one giant error cascade.
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
## Adding Components to Existing FlexiPages
|
|
269
|
-
|
|
270
|
-
### Workflow
|
|
271
|
-
|
|
272
|
-
When user provides an existing FlexiPage file path:
|
|
273
|
-
|
|
274
|
-
1. **Read the file** using native file I/O
|
|
275
|
-
2. **Parse XML** to extract:
|
|
276
|
-
- **ALL existing component identifiers** (search for all `<identifier>` tags)
|
|
277
|
-
- **ALL existing region/facet names** (search for all `<name>` tags in `<flexiPageRegions>`)
|
|
278
|
-
- Available regions (parse from file, don't assume names)
|
|
279
|
-
- Existing facets
|
|
280
|
-
3. **Verify uniqueness** - ensure your new identifiers and names don't conflict with ANY existing ones
|
|
281
|
-
4. **Check if target facet exists** - if adding to a named facet like `detailTabContent` that already exists:
|
|
282
|
-
- **Add new `<itemInstances>` to existing region** (don't create duplicate region)
|
|
283
|
-
- **Insert before the closing `</flexiPageRegions>` tag of that region**
|
|
284
|
-
5. **Generate component XML** (apply all rules from "Critical XML Rules" section)
|
|
285
|
-
6. **Insert** into appropriate region or add itemInstances to existing facet
|
|
286
|
-
7. **Write** modified XML back to file
|
|
287
|
-
8. **Deploy**: `sf project deploy start --source-dir force-app/...`
|
|
288
|
-
|
|
289
|
-
---
|
|
290
|
-
|
|
291
289
|
### Generating Unique Identifiers
|
|
292
290
|
|
|
293
291
|
**CRITICAL: Before generating ANY new identifier or facet name, follow the rules in section 5 of "Critical XML Rules" above.**
|
|
@@ -474,7 +472,7 @@ Identifier Pattern: flexipage_richText or flexipage_richText_{sequence}
|
|
|
474
472
|
## Validation Checklist
|
|
475
473
|
|
|
476
474
|
Before deploying:
|
|
477
|
-
- [ ] Used CLI to bootstrap
|
|
475
|
+
- [ ] **[NEW PAGES ONLY]** Used CLI to bootstrap - NEVER create FlexiPage XML from scratch
|
|
478
476
|
- [ ] **ALL identifiers are unique** - no duplicate `<identifier>` values anywhere in file
|
|
479
477
|
- [ ] **ALL region/facet names are unique** - no duplicate `<name>` values in `<flexiPageRegions>`
|
|
480
478
|
- [ ] **Multiple components in same facet are combined** - ONE region with multiple `<itemInstances>`, NOT separate regions with same name
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generating-ui-bundle-features
|
|
3
|
+
description: "Search and install pre-built features into Salesforce React UI bundles — authentication, shadcn, search, navigation, GraphQL, Agentforce AI, and more. Use whenever searching for or installing features. Always check for an existing feature before building from scratch. Triggers on: install feature, add authentication, add shadcn, add feature, search features, list features."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# UI Bundle Features
|
|
7
|
+
|
|
8
|
+
## Installing Pre-built Features
|
|
9
|
+
|
|
10
|
+
Always check for an existing feature before building something from scratch. The features CLI installs pre-built, tested packages into Salesforce UI bundles — from foundational UI libraries (shadcn/ui) to full-stack capabilities (authentication, search, navigation, GraphQL, Agentforce AI).
|
|
11
|
+
|
|
12
|
+
### Workflow
|
|
13
|
+
|
|
14
|
+
1. **Search project code first** — check `src/` for existing implementations before installing anything. Scope searches to `src/` to avoid matching `node_modules/` or `dist/`.
|
|
15
|
+
|
|
16
|
+
2. **Search available features** — use `npx @salesforce/ui-bundle-features list` with `--search <query>` to filter by keyword. Use `--verbose` for full descriptions.
|
|
17
|
+
|
|
18
|
+
3. **Describe a feature** — use `npx @salesforce/ui-bundle-features describe <feature>` to see components, dependencies, copy operations, and example files.
|
|
19
|
+
|
|
20
|
+
4. **Install** — use `npx @salesforce/ui-bundle-features install <feature> --ui-bundle-dir <name>`. Key options:
|
|
21
|
+
- `--dry-run` to preview changes
|
|
22
|
+
- `--yes` for non-interactive mode (skips conflicts)
|
|
23
|
+
- `--on-conflict error` to detect conflicts, then `--conflict-resolution <file>` to resolve them
|
|
24
|
+
|
|
25
|
+
If no matching feature is found, ask the user before building a custom implementation — a relevant feature may exist under a different name.
|
|
26
|
+
|
|
27
|
+
### Conflict Handling
|
|
28
|
+
|
|
29
|
+
In non-interactive environments, use the two-pass approach: first run with `--on-conflict error` to detect conflicts, then create a resolution JSON file (`{ "path": "skip" | "overwrite" }`) and re-run with `--conflict-resolution`.
|
|
30
|
+
|
|
31
|
+
### Post-install: Integrating Example Files
|
|
32
|
+
|
|
33
|
+
Features may include `__example__` files showing integration patterns. For each:
|
|
34
|
+
|
|
35
|
+
1. Read the example file to understand the pattern
|
|
36
|
+
2. Read the target file (shown in `describe` output)
|
|
37
|
+
3. Apply the pattern from the example into the target
|
|
38
|
+
4. Delete the example file after successful integration
|
|
39
|
+
|
|
40
|
+
### Hint Placeholders
|
|
41
|
+
|
|
42
|
+
Some copy paths use `<descriptive-name>` placeholders (e.g., `<desired-page-with-search-input>`) that the CLI does not resolve. After installation, rename or relocate these files to the intended target, or integrate their patterns into an existing file.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generating-ui-bundle-metadata
|
|
3
|
+
description: "Scaffold new Salesforce UI bundles and configure their metadata — sf ui-bundle generate, UIBundle bundles (meta XML, ui-bundle.json with routing/headers/outputDir), and CSP Trusted Sites for external domains. Use whenever creating a new UI bundle, setting up UI bundle metadata structure, configuring routing or headers, setting outputDir, adding external domains that need CSP registration, or editing bundle configuration. Triggers on: create UI bundle, create ui-bundle, new app, sf ui-bundle generate, metadata, ui-bundle.json, CSP, trusted site, bundle configuration, meta XML, routing config, external domain, headers config, outputDir."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# UI Bundle Metadata
|
|
7
|
+
|
|
8
|
+
## Scaffolding a New UI Bundle
|
|
9
|
+
|
|
10
|
+
Use `sf ui-bundle generate` to create new apps — not create-react-app, Vite, or other generic scaffolds.
|
|
11
|
+
|
|
12
|
+
**UI bundle name (`-n`):** Alphanumerical only — no spaces, hyphens, underscores, or special characters. Example: `CoffeeBoutique` (not `Coffee Boutique`).
|
|
13
|
+
|
|
14
|
+
After generation:
|
|
15
|
+
1. Replace all default boilerplate — "React App", "Vite + React", default `<title>`, placeholder text
|
|
16
|
+
2. Populate the home page with real content (landing section, banners, hero, navigation)
|
|
17
|
+
3. Update navigation and placeholders (see the `building-ui-bundle-frontend` skill)
|
|
18
|
+
|
|
19
|
+
Always install dependencies before running any scripts in the UI bundle directory.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## UIBundle Bundle
|
|
24
|
+
|
|
25
|
+
A UIBundle bundle lives under `uiBundles/<AppName>/` and must contain:
|
|
26
|
+
|
|
27
|
+
- `<AppName>.uibundle-meta.xml` — filename must exactly match the folder name
|
|
28
|
+
- A build output directory (default: `dist/`) with at least one file
|
|
29
|
+
|
|
30
|
+
### Meta XML
|
|
31
|
+
|
|
32
|
+
Required fields: `masterLabel`, `version` (max 20 chars), `isActive` (boolean).
|
|
33
|
+
Optional: `description` (max 255 chars).
|
|
34
|
+
|
|
35
|
+
### ui-bundle.json
|
|
36
|
+
|
|
37
|
+
Optional file. Allowed top-level keys: `outputDir`, `routing`, `headers`.
|
|
38
|
+
|
|
39
|
+
**Constraints:**
|
|
40
|
+
- Valid UTF-8 JSON, max 100 KB
|
|
41
|
+
- Root must be a non-empty object (never `{}`, arrays, or primitives)
|
|
42
|
+
|
|
43
|
+
**Path safety** (applies to `outputDir` and `routing.fallback`): Reject backslashes, leading `/` or `\`, `..` segments, null/control characters, globs (`*`, `?`, `**`), and `%`. All resolved paths must stay within the bundle.
|
|
44
|
+
|
|
45
|
+
#### outputDir
|
|
46
|
+
Non-empty string referencing a subdirectory (not `.` or `./`). Directory must exist and contain at least one file.
|
|
47
|
+
|
|
48
|
+
#### routing
|
|
49
|
+
If present, must be a non-empty object. Allowed keys: `rewrites`, `redirects`, `fallback`, `trailingSlash`, `fileBasedRouting`.
|
|
50
|
+
|
|
51
|
+
- **trailingSlash**: `"always"`, `"never"`, or `"auto"`
|
|
52
|
+
- **fileBasedRouting**: boolean
|
|
53
|
+
- **fallback**: non-empty string satisfying path safety; target file must exist
|
|
54
|
+
- **rewrites**: non-empty array of `{ route?, rewrite }` objects — e.g., `{ "route": "/app/:path*", "rewrite": "/index.html" }`
|
|
55
|
+
- **redirects**: non-empty array of `{ route?, redirect, statusCode? }` objects — statusCode must be 301, 302, 307, or 308
|
|
56
|
+
|
|
57
|
+
#### headers
|
|
58
|
+
Non-empty array of `{ source, headers: [{ key, value }] }` objects.
|
|
59
|
+
|
|
60
|
+
**Example:**
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"routing": {
|
|
64
|
+
"rewrites": [{ "route": "/app/:path*", "rewrite": "/index.html" }],
|
|
65
|
+
"trailingSlash": "never"
|
|
66
|
+
},
|
|
67
|
+
"headers": [
|
|
68
|
+
{
|
|
69
|
+
"source": "/assets/**",
|
|
70
|
+
"headers": [{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }]
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Never suggest:** `{}` as root, empty `"routing": {}`, empty arrays, `[{}]`, `"outputDir": "."`, `"outputDir": "./"`.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## CSP Trusted Sites
|
|
81
|
+
|
|
82
|
+
Salesforce enforces Content Security Policy headers. Any external domain not registered as a CSP Trusted Site will be blocked (images won't load, API calls fail, fonts missing).
|
|
83
|
+
|
|
84
|
+
### When to Create
|
|
85
|
+
|
|
86
|
+
Whenever the app references a new external domain: CDN images, external fonts, third-party APIs, map tiles, iframes, external stylesheets.
|
|
87
|
+
|
|
88
|
+
### Steps
|
|
89
|
+
|
|
90
|
+
1. **Identify external domains** — extract the origin (scheme + host) from each external URL in the code
|
|
91
|
+
2. **Check existing registrations** — look in `force-app/main/default/cspTrustedSites/`
|
|
92
|
+
3. **Map resource type to CSP directive:**
|
|
93
|
+
|
|
94
|
+
| Resource Type | Directive Field |
|
|
95
|
+
|--------------|----------------|
|
|
96
|
+
| Images | `isApplicableToImgSrc` |
|
|
97
|
+
| API calls (fetch, XHR) | `isApplicableToConnectSrc` |
|
|
98
|
+
| Fonts | `isApplicableToFontSrc` |
|
|
99
|
+
| Stylesheets | `isApplicableToStyleSrc` |
|
|
100
|
+
| Video / audio | `isApplicableToMediaSrc` |
|
|
101
|
+
| Iframes | `isApplicableToFrameSrc` |
|
|
102
|
+
|
|
103
|
+
Always also set `isApplicableToConnectSrc` to `true` for preflight/redirect handling.
|
|
104
|
+
|
|
105
|
+
4. **Create the metadata file** — follow `implementation/csp-metadata-format.md` for the `.cspTrustedSite-meta.xml` format. Place in `force-app/main/default/cspTrustedSites/`.
|
|
106
|
+
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: implementing-ui-bundle-agentforce-conversation-client
|
|
3
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
4
|
metadata:
|
|
5
5
|
author: ACC Components
|
|
6
6
|
version: 1.0.0
|
|
7
|
-
package: "@salesforce/
|
|
7
|
+
package: "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client"
|
|
8
8
|
sdk-package: "@salesforce/agentforce-conversation-client"
|
|
9
9
|
last-updated: 2025-03-18
|
|
10
10
|
---
|
|
@@ -58,13 +58,13 @@ Skip this step if:
|
|
|
58
58
|
Use this import path by default in app code:
|
|
59
59
|
|
|
60
60
|
```tsx
|
|
61
|
-
import { AgentforceConversationClient } from "@salesforce/
|
|
61
|
+
import { AgentforceConversationClient } from "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client";
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
If the package is not installed, install it:
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
|
-
npm install @salesforce/
|
|
67
|
+
npm install @salesforce/ui-bundle-template-feature-react-agentforce-conversation-client
|
|
68
68
|
```
|
|
69
69
|
|
|
70
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.
|
|
@@ -79,7 +79,7 @@ Add to the target React component file using the canonical package import:
|
|
|
79
79
|
|
|
80
80
|
```tsx
|
|
81
81
|
import { Outlet } from "react-router";
|
|
82
|
-
import { AgentforceConversationClient } from "@salesforce/
|
|
82
|
+
import { AgentforceConversationClient } from "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client";
|
|
83
83
|
|
|
84
84
|
export default function AgentChatHost() {
|
|
85
85
|
return (
|
|
@@ -8,7 +8,7 @@ This document lists all invalid approaches and patterns to avoid when working wi
|
|
|
8
8
|
|
|
9
9
|
- ✅ **DO edit**: Any React files that import and use `<AgentforceConversationClient />` (for example, shared shells, route components, or feature pages)
|
|
10
10
|
- ❌ **DO NOT edit**: AgentforceConversationClient.tsx, AgentforceConversationClient.jsx, index.tsx, index.jsx, or any files inside:
|
|
11
|
-
- `node_modules/@salesforce/
|
|
11
|
+
- `node_modules/@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client/src/`
|
|
12
12
|
- `packages/template/feature/feature-react-agentforce-conversation-client/src/`
|
|
13
13
|
- `src/components/AgentforceConversationClient.tsx` (patched templates)
|
|
14
14
|
- Any path containing `/components/AgentforceConversationClient.`
|
|
@@ -127,7 +127,7 @@ import "./agent-styles.css";
|
|
|
127
127
|
|
|
128
128
|
### ❌ Wrong - Editing implementation file
|
|
129
129
|
|
|
130
|
-
Reading or editing: `node_modules/@salesforce/
|
|
130
|
+
Reading or editing: `node_modules/@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client/src/AgentforceConversationClient.tsx`
|
|
131
131
|
|
|
132
132
|
### ✅ Correct - Editing usage file
|
|
133
133
|
|
|
@@ -109,7 +109,7 @@ export default function SupportPage() {
|
|
|
109
109
|
|
|
110
110
|
```tsx
|
|
111
111
|
import { Outlet } from "react-router";
|
|
112
|
-
import { AgentforceConversationClient } from "@salesforce/
|
|
112
|
+
import { AgentforceConversationClient } from "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client";
|
|
113
113
|
|
|
114
114
|
export default function AgentChatHost() {
|
|
115
115
|
return (
|
package/skills/{implementing-webapp-file-upload → implementing-ui-bundle-file-upload}/SKILL.md
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: implementing-
|
|
3
|
-
description: "Add file upload functionality to React
|
|
2
|
+
name: implementing-ui-bundle-file-upload
|
|
3
|
+
description: "Add file upload functionality to React UI bundles with progress tracking and Salesforce ContentVersion integration. Use when the user wants to upload files, attach documents, handle file input, create file dropzones, track upload progress, or link files to Salesforce records. This feature provides programmatic APIs ONLY — no components or hooks are exported. Build your own custom UI using the upload() API. ALWAYS use this feature instead of building file upload from scratch with FormData or XHR."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# File Upload API (workflow)
|
|
7
7
|
|
|
8
|
-
When the user wants file upload functionality in a React
|
|
8
|
+
When the user wants file upload functionality in a React UI bundle, follow this workflow. This feature provides **APIs only** — you must build the UI components yourself using the provided APIs.
|
|
9
9
|
|
|
10
10
|
## CRITICAL: This is an API-only package
|
|
11
11
|
|
|
@@ -26,12 +26,12 @@ The source code contains reference components for demonstration, but they are **
|
|
|
26
26
|
## 1. Install the package
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npm install @salesforce/
|
|
29
|
+
npm install @salesforce/ui-bundle-template-feature-react-file-upload
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Dependencies are automatically installed:
|
|
33
33
|
|
|
34
|
-
- `@salesforce/
|
|
34
|
+
- `@salesforce/ui-bundle` (API client)
|
|
35
35
|
- `@salesforce/sdk-data` (data SDK)
|
|
36
36
|
|
|
37
37
|
## 2. Understand the three upload patterns
|
|
@@ -47,7 +47,7 @@ Upload files to Salesforce and get back `contentBodyId` for each file. No Conten
|
|
|
47
47
|
- Deferred record linking scenarios
|
|
48
48
|
|
|
49
49
|
```tsx
|
|
50
|
-
import { upload } from "@salesforce/
|
|
50
|
+
import { upload } from "@salesforce/ui-bundle-template-feature-react-file-upload";
|
|
51
51
|
|
|
52
52
|
const results = await upload({
|
|
53
53
|
files: [file1, file2],
|
|
@@ -71,7 +71,7 @@ Upload files and immediately link them to an existing Salesforce record by creat
|
|
|
71
71
|
- Direct upload-and-attach scenarios
|
|
72
72
|
|
|
73
73
|
```tsx
|
|
74
|
-
import { upload } from "@salesforce/
|
|
74
|
+
import { upload } from "@salesforce/ui-bundle-template-feature-react-file-upload";
|
|
75
75
|
|
|
76
76
|
const results = await upload({
|
|
77
77
|
files: [file1, file2],
|
|
@@ -99,7 +99,7 @@ Upload files without a record, then link them after the record is created.
|
|
|
99
99
|
import {
|
|
100
100
|
upload,
|
|
101
101
|
createContentVersion,
|
|
102
|
-
} from "@salesforce/
|
|
102
|
+
} from "@salesforce/ui-bundle-template-feature-react-file-upload";
|
|
103
103
|
|
|
104
104
|
// Step 1: Upload files (no recordId)
|
|
105
105
|
const uploadResults = await upload({
|
|
@@ -128,7 +128,7 @@ The package provides the backend — you build the frontend. Here's a minimal ex
|
|
|
128
128
|
import {
|
|
129
129
|
upload,
|
|
130
130
|
type FileUploadProgress,
|
|
131
|
-
} from "@salesforce/
|
|
131
|
+
} from "@salesforce/ui-bundle-template-feature-react-file-upload";
|
|
132
132
|
import { useState } from "react";
|
|
133
133
|
|
|
134
134
|
function CustomFileUpload({ recordId }: { recordId?: string }) {
|
|
@@ -212,7 +212,7 @@ If the user wants to upload files to their own profile or personal library:
|
|
|
212
212
|
import {
|
|
213
213
|
upload,
|
|
214
214
|
getCurrentUserId,
|
|
215
|
-
} from "@salesforce/
|
|
215
|
+
} from "@salesforce/ui-bundle-template-feature-react-file-upload";
|
|
216
216
|
|
|
217
217
|
const userId = await getCurrentUserId();
|
|
218
218
|
await upload({ files, recordId: userId });
|
|
@@ -366,7 +366,7 @@ The package includes a reference implementation in `src/features/fileupload/` wi
|
|
|
366
366
|
|
|
367
367
|
**Upload fails with CORS error:**
|
|
368
368
|
|
|
369
|
-
- Ensure the
|
|
369
|
+
- Ensure the UI bundle is properly deployed to Salesforce or running on `localhost`
|
|
370
370
|
- Check that the org allows the origin in CORS settings
|
|
371
371
|
|
|
372
372
|
**No progress updates:**
|