Merge branch 'main' into experience-lwr-site

This commit is contained in:
Scott Mo 2026-03-17 10:18:16 -05:00 committed by GitHub
commit 19b470fb94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 89 additions and 12 deletions

View File

@ -134,6 +134,8 @@ jobs:
echo "" echo ""
echo "${BODY}" echo "${BODY}"
echo "Same flow as running locally: \`npm install\` then the sync scripts." echo "Same flow as running locally: \`npm install\` then the sync scripts."
echo "Below line is used in automated scripts to avoid internal SF validation on this PR"
echo "[skip-validate-pr]"
echo "EOFBODY" echo "EOFBODY"
} >> $GITHUB_OUTPUT } >> $GITHUB_OUTPUT

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@salesforce/afv-skills", "name": "@salesforce/afv-skills",
"version": "1.0.0", "version": "1.1.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@salesforce/afv-skills", "name": "@salesforce/afv-skills",
"version": "1.0.0", "version": "1.1.0",
"license": "CC-BY-NC-4.0", "license": "CC-BY-NC-4.0",
"devDependencies": { "devDependencies": {
"@salesforce/webapp-template-app-react-sample-b2e-experimental": "*", "@salesforce/webapp-template-app-react-sample-b2e-experimental": "*",

View File

@ -24,19 +24,94 @@ Fragments render data in a structured and unified way across various Salesforce
## ⚙️ Composition ## ⚙️ Composition
A fragment is a UEM (Unified Experience Model) tree of blocks and regions. The fragment you return must follow the Typescript interfaces below: A fragment is a UEM (Unified Experience Model) tree of blocks and regions. The fragment you return must follow the Typescript interfaces below:
- **Block definition**: Follow `{namespace}}/{{blockName}` convention and use the same value as the block's definition when it appears in a fragment.
```ts ```ts
interface BlockType { interface BlockType {
type: 'block' type: 'block'
definition: string // {namespace}/{blockName}, e.g. "bcx/heading" definition: string // {namespace}/{blockName}
attributes?: Record<string, any> attributes?: Record<string, any>
children?: (BlockType | RegionType)[] children?: (BlockType | RegionType)[]
} }
interface RegionType { interface RegionType {
type: 'region' type: 'region'
name: string name: string
children: BlockType[] children: BlockType[]
} }
``` ```
---
## 🔧 Available Metadata Actions
### When to Use Each Action
#### discoverUiComponents
**When:** You want to see what block components are available for fragments.
**Purpose:** Discover the palette of available blocks that can be used in fragment composition.
**Input Parameters:**
- `pageType` (required): "FRAGMENT"
- `pageContext` (optional): JSON object - not required for FRAGMENT type
- `searchQuery` (optional): String to filter components by name or description
**Returns:** List of components with:
- `definition`: Fully qualified name (e.g., "namespace/definiton")
- `description`: Component description
- `label`: Human-readable label
- `attributes`: Optional attribute metadata
**Use for:** Finding available blocks before building your fragment structure.
#### getUiComponentSchemas
**When:** You know which components you want but need to understand their properties and attributes.
**Purpose:** Get detailed JSON schemas for component configuration, including property types, required vs optional fields, and validation rules.
**Input Parameters:**
- `pageType` (required): "FRAGMENT"
- `pageContext` (optional): JSON object - not required for FRAGMENT type
- `componentDefinitions` (required): List of fully qualified names (e.g., ["namespace/definition"])
- `includeKnowledge` (optional): Boolean, defaults to true - includes additional component-specific guidance
**Returns:**
- `componentSchemas`: List of results (supports partial failures)
- **Success entries**: Contains JSON schema with property definitions, types, constraints
- **Failure entries**: Contains error message explaining why schema couldn't be retrieved
- `$defs`: Schema definitions and references (if schema transformation applied)
**Use for:** Understanding how to configure component attributes before adding blocks to your fragment.
**Key Feature:** Supports partial failures - if some components can't be found, you still get schemas for the successful ones.
---
## 💡 Typical Workflow
1. **Discover Available Blocks**
- Use `discoverUiComponents` to explore what blocks are available
- Optional: Use `searchQuery` to filter by keywords (e.g., "text", "button", "image")
2. **Select Components**
- Choose blocks that fit your fragment requirements
- Note their fully qualified definitions (e.g., "namespace/definition")
3. **Get Component Schemas**
- Use `getUiComponentSchemas` with the selected component definitions
- Review the JSON schemas to understand required and optional attributes
4. **Build Fragment**
- Construct your fragment using the UEM tree structure
- Configure block attributes according to the schemas
- Use the TypeScript interfaces defined above
---
## ⚠️ Important Notes
- Block definitions always follow the `{namespace}/{blockName}` convention
- Use the same definition format returned by `discoverUiComponents` when calling `getUiComponentSchemas`
- The FRAGMENT page type doesn't require additional `pageContext` parameters
- Schemas include both required and optional attributes - review carefully to ensure valid configuration