@salesforce/afv-skills 1.5.1 → 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 +335 -189
- package/skills/generating-apex/assets/abstract.cls +12 -8
- package/skills/generating-apex/assets/batch.cls +7 -7
- package/skills/generating-apex/assets/domain.cls +5 -5
- package/skills/generating-apex/assets/dto.cls +11 -11
- package/skills/generating-apex/assets/exception.cls +1 -1
- package/skills/generating-apex/assets/interface.cls +2 -2
- package/skills/generating-apex/assets/invocable.cls +115 -0
- package/skills/generating-apex/assets/queueable.cls +6 -6
- package/skills/generating-apex/assets/rest-resource.cls +300 -0
- package/skills/generating-apex/assets/schedulable.cls +7 -7
- package/skills/generating-apex/assets/selector.cls +7 -7
- package/skills/generating-apex/assets/service.cls +4 -4
- package/skills/generating-apex/assets/trigger.cls +45 -0
- package/skills/generating-apex/assets/utility.cls +5 -5
- package/skills/generating-apex/references/AccountDeduplicationBatch.cls +7 -7
- package/skills/generating-apex/references/AccountSelector.cls +10 -10
- package/skills/generating-apex/references/AccountService.cls +9 -9
- package/skills/generating-apex-test/CREDITS.md +30 -0
- package/skills/generating-apex-test/SKILL.md +165 -74
- package/skills/generating-apex-test/assets/test-class-template.cls +23 -54
- package/skills/generating-apex-test/assets/test-data-factory-template.cls +0 -1
- package/skills/generating-apex-test/references/assertion-patterns.md +38 -95
- package/skills/generating-apex-test/references/async-testing.md +59 -142
- package/skills/generating-apex-test/references/mocking-patterns.md +77 -76
- package/skills/generating-apex-test/references/test-data-factory.md +29 -130
- package/skills/generating-experience-react-site/SKILL.md +9 -9
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience.md +1 -1
- package/skills/generating-flexipage/SKILL.md +28 -12
- 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 +1 -1
- 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 -138
- 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
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Commerce Store vs Storefront: Technical Reference
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Understanding the distinction between Commerce Store and Storefront is critical for successful Commerce B2B development. This document provides technical details about these two components and explains why they must be created in a specific order.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The Two Components
|
|
10
|
+
|
|
11
|
+
### 1. Commerce Store (Backend Data)
|
|
12
|
+
|
|
13
|
+
**What it is:**
|
|
14
|
+
- Runtime data and configuration created in the Salesforce org
|
|
15
|
+
- NOT source-controllable metadata
|
|
16
|
+
- Created through Commerce app UI
|
|
17
|
+
|
|
18
|
+
**What it includes:**
|
|
19
|
+
- Store configuration and settings
|
|
20
|
+
- Default buyer groups (associated with Accounts)
|
|
21
|
+
- Entitlement policies (who can see which products)
|
|
22
|
+
- Pricing policies and price book mappings
|
|
23
|
+
- Payment gateway configuration (Stripe, Adyen, etc.)
|
|
24
|
+
- Tax provider configuration (Avalara, Vertex, manual)
|
|
25
|
+
- Shipping methods and configurations
|
|
26
|
+
- Product catalog associations
|
|
27
|
+
- Inventory locations
|
|
28
|
+
- Search index configurations
|
|
29
|
+
|
|
30
|
+
**Where it lives:**
|
|
31
|
+
- Data records in standard Commerce objects:
|
|
32
|
+
- `WebStore` - Store settings and configuration
|
|
33
|
+
- `BuyerGroup` - Account-based buyer segments
|
|
34
|
+
- `EntitlementPolicy` - Product visibility rules
|
|
35
|
+
- `CommerceEntitlementProduct` - Product-policy associations
|
|
36
|
+
- `ProductCatalog` - Catalog definitions
|
|
37
|
+
- `Pricebook2` - Price books
|
|
38
|
+
- Additional payment, tax, shipping records
|
|
39
|
+
|
|
40
|
+
**How to create:**
|
|
41
|
+
- Via UI: Setup → Commerce → Stores
|
|
42
|
+
- Cannot be created via Metadata API
|
|
43
|
+
- Cannot be deployed via `sf project deploy`
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### 2. Storefront (Frontend Metadata)
|
|
48
|
+
|
|
49
|
+
**What it is:**
|
|
50
|
+
- Digital Experience (LWR site) for buyer-facing shopping experience
|
|
51
|
+
- Source-controllable as ExperienceBundle metadata
|
|
52
|
+
- Created automatically when you create a Commerce Store
|
|
53
|
+
|
|
54
|
+
**What it includes:**
|
|
55
|
+
- ExperienceBundle metadata (`StorefrontName.digitalExperience-meta.xml`)
|
|
56
|
+
- URL routing configuration (`sfdc_cms__route`)
|
|
57
|
+
- Page definitions (`sfdc_cms__view`)
|
|
58
|
+
- Homepage
|
|
59
|
+
- Product List Pages (PLP)
|
|
60
|
+
- Product Detail Pages (PDP)
|
|
61
|
+
- Shopping cart
|
|
62
|
+
- Checkout flow
|
|
63
|
+
- Order confirmation
|
|
64
|
+
- Search results
|
|
65
|
+
- Lightning Web Components (product cards, cart components, checkout)
|
|
66
|
+
- Branding and theme configuration (`sfdc_cms__brandingSet`, `sfdc_cms__theme`)
|
|
67
|
+
- Page layouts (`sfdc_cms__themeLayout`)
|
|
68
|
+
- Navigation structure
|
|
69
|
+
- Custom LWCs for extensions
|
|
70
|
+
|
|
71
|
+
**Where it lives:**
|
|
72
|
+
- `force-app/main/default/digitalExperiences/site/StorefrontName/`
|
|
73
|
+
- Example: `force-app/main/default/digitalExperiences/site/My_B2B_Store1/`
|
|
74
|
+
|
|
75
|
+
**How to create:**
|
|
76
|
+
- Automatically generated by Commerce Store setup wizard
|
|
77
|
+
- Retrieved from org using Salesforce CLI
|
|
78
|
+
- Cannot be manually created from scratch
|
|
79
|
+
|
|
80
|
+
**How to deploy:**
|
|
81
|
+
- Retrievable: `sf project retrieve start -m DigitalExperienceBundle:site/<name>`
|
|
82
|
+
- Deployable: `sf project deploy start -m DigitalExperienceBundle`
|
|
83
|
+
- Source-controllable in Git
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Why You Cannot Create Storefront Metadata from Scratch
|
|
88
|
+
|
|
89
|
+
### Technical Reasons
|
|
90
|
+
|
|
91
|
+
1. **Complex Dependency Chain**
|
|
92
|
+
- Create merchandisers store
|
|
93
|
+
- Create DigitalExperienceBundle
|
|
94
|
+
- Integrate both together
|
|
95
|
+
|
|
96
|
+
2. **Hundreds of Auto-Generated Configurations**
|
|
97
|
+
- Component IDs and region IDs (UUIDs)
|
|
98
|
+
- WebStore associations
|
|
99
|
+
- Commerce-managed component configurations
|
|
100
|
+
- Default routing rules
|
|
101
|
+
- Search configurations
|
|
102
|
+
- Cart and checkout flow definitions
|
|
103
|
+
- Payment integration settings
|
|
104
|
+
|
|
105
|
+
3. **Commerce-Managed Components**
|
|
106
|
+
- Product List Page (PLP) components
|
|
107
|
+
- Product Detail Page (PDP) components
|
|
108
|
+
- Cart components
|
|
109
|
+
- Checkout components
|
|
110
|
+
- Search components
|
|
111
|
+
- These require specific configurations from Store data
|
|
112
|
+
|
|
113
|
+
4. **Metadata API Limitation**
|
|
114
|
+
- Metadata API deploys metadata types (Apex, LWCs, objects)
|
|
115
|
+
- Metadata API CANNOT create SObject data (WebStore records)
|
|
116
|
+
- Store creation requires data operations, not metadata operations
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## The Required Creation Order
|
|
121
|
+
|
|
122
|
+
### Step 1: Create Commerce Store (Must Be First)
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
User Interface (Commerce App)
|
|
126
|
+
↓
|
|
127
|
+
WebStore Record Created
|
|
128
|
+
↓
|
|
129
|
+
BuyerGroup Records Created
|
|
130
|
+
↓
|
|
131
|
+
EntitlementPolicy Records Created
|
|
132
|
+
↓
|
|
133
|
+
Digital Experience Auto-Generated
|
|
134
|
+
↓
|
|
135
|
+
Commerce Components Configured
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Why this must be first:**
|
|
139
|
+
- Generates WebStore record with unique ID
|
|
140
|
+
- Creates default configurations
|
|
141
|
+
- Auto-generates associated Digital Experience
|
|
142
|
+
- Configures Commerce component relationships
|
|
143
|
+
- Sets up default buyer access rules
|
|
144
|
+
|
|
145
|
+
### Step 2: Retrieve Storefront Metadata
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
sf org list metadata --metadata-type DigitalExperienceConfig
|
|
149
|
+
↓
|
|
150
|
+
Select Store from List
|
|
151
|
+
↓
|
|
152
|
+
sf project retrieve start -m DigitalExperienceBundle:site/<name>
|
|
153
|
+
↓
|
|
154
|
+
Metadata Saved to Local Repository
|
|
155
|
+
↓
|
|
156
|
+
Now Editable and Source-Controllable
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Key Takeaway
|
|
162
|
+
|
|
163
|
+
**Commerce B2B = Store (data) + Storefront (metadata)**
|
|
164
|
+
|
|
165
|
+
1. Create Store → generates Storefront
|
|
166
|
+
2. Retrieve Storefront → customize and version control if needed
|
|
167
|
+
3. Deploy Storefront → only after creating Store in target org
|
|
168
|
+
|
|
169
|
+
**Never skip the Store creation. Never create Storefront metadata from scratch.**
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploying-ui-bundle
|
|
3
|
+
description: "Deploy a Salesforce UI bundle to an org — the full deployment sequence including org authentication, pre-deploy build, metadata deployment, permission set assignment, data import, GraphQL schema fetch, and codegen. Use whenever the user wants to deploy, push to org, assign permission sets, import data, fetch GraphQL schema, run codegen, or set up an org after development. Triggers on: deploy, push to org, deploy metadata, assign permission set, import data, schema fetch, codegen, org auth, authenticate org, build and deploy, post-deploy, org setup."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deploying a UI Bundle
|
|
7
|
+
|
|
8
|
+
The order of operations is critical when deploying to a Salesforce org. This sequence reflects the canonical flow.
|
|
9
|
+
|
|
10
|
+
## Step 1: Org Authentication
|
|
11
|
+
|
|
12
|
+
Check if the org is connected. If not, authenticate. All subsequent steps require an authenticated org.
|
|
13
|
+
|
|
14
|
+
## Step 2: Pre-deploy UI Bundle Build
|
|
15
|
+
|
|
16
|
+
Install dependencies and build the UI bundle to produce `dist/`. Required before deploying UI bundle entities.
|
|
17
|
+
|
|
18
|
+
Run when: deploying UI bundles and `dist/` is missing or source has changed.
|
|
19
|
+
|
|
20
|
+
## Step 3: Deploy Metadata
|
|
21
|
+
|
|
22
|
+
Check for a manifest (`manifest/package.xml` or `package.xml`) first. If present, deploy using the manifest. If not, deploy all metadata from the project.
|
|
23
|
+
|
|
24
|
+
Deploys objects, layouts, permission sets, Apex classes, UI bundles, and all other metadata. Must complete before schema fetch — the schema reflects org state.
|
|
25
|
+
|
|
26
|
+
## Step 4: Post-deploy Configuration
|
|
27
|
+
|
|
28
|
+
Deploying does not mean assigning. After deployment:
|
|
29
|
+
|
|
30
|
+
- **Permission sets / groups** — assign to users so they have access to custom objects and fields. Required for GraphQL introspection to return the correct schema.
|
|
31
|
+
- **Profiles** — ensure users have the correct profile.
|
|
32
|
+
- **Other config** — named credentials, connected apps, custom settings, flow activation.
|
|
33
|
+
|
|
34
|
+
Proactive behavior: after a successful deploy, discover permission sets in `force-app/main/default/permissionsets/` and assign each one (or ask the user).
|
|
35
|
+
|
|
36
|
+
## Step 5: Data Import (optional)
|
|
37
|
+
|
|
38
|
+
Only if `data/data-plan.json` exists. Delete runs in reverse plan order (children before parents). Import uses Anonymous Apex with duplicate rule save enabled.
|
|
39
|
+
|
|
40
|
+
Always ask the user before importing or cleaning data.
|
|
41
|
+
|
|
42
|
+
## Step 6: GraphQL Schema and Codegen
|
|
43
|
+
|
|
44
|
+
1. Set default org
|
|
45
|
+
2. Fetch schema (GraphQL introspection) — writes `schema.graphql` at project root
|
|
46
|
+
3. Generate types (codegen reads schema locally)
|
|
47
|
+
|
|
48
|
+
Run when: schema missing, or metadata/permissions changed since last fetch.
|
|
49
|
+
|
|
50
|
+
## Step 7: Final UI Bundle Build
|
|
51
|
+
|
|
52
|
+
Build the UI bundle if not already done in Step 2.
|
|
53
|
+
|
|
54
|
+
## Summary: Interaction Order
|
|
55
|
+
|
|
56
|
+
1. Check/authenticate org
|
|
57
|
+
2. Build UI bundle (if deploying UI bundles)
|
|
58
|
+
3. Deploy metadata
|
|
59
|
+
4. Assign permissions and configure
|
|
60
|
+
5. Import data (if data plan exists, with user confirmation)
|
|
61
|
+
6. Fetch GraphQL schema and run codegen
|
|
62
|
+
7. Build UI bundle (if needed)
|
|
63
|
+
|
|
64
|
+
## Critical Rules
|
|
65
|
+
|
|
66
|
+
- Deploy metadata **before** fetching schema — custom objects/fields appear only after deployment
|
|
67
|
+
- Assign permissions **before** schema fetch — the user may lack FLS for custom fields
|
|
68
|
+
- Re-run schema fetch and codegen **after every metadata deployment** that changes objects, fields, or permissions
|
|
69
|
+
- Never skip permission set assignment or data import silently — either run them or ask the user
|
|
70
|
+
|
|
71
|
+
## Post-deploy Checklist
|
|
72
|
+
|
|
73
|
+
After every successful metadata deploy:
|
|
74
|
+
|
|
75
|
+
1. Discover and assign permission sets (or ask the user)
|
|
76
|
+
2. If `data/data-plan.json` exists, ask the user about data import
|
|
77
|
+
3. Re-run schema fetch and codegen from the UI bundle directory
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Credits & Acknowledgments
|
|
2
|
+
|
|
3
|
+
This skill was influenced by the [sf-skills](https://github.com/Jaganpro/sf-skills) repository and built upon the collective wisdom of the Salesforce developer community. We gratefully acknowledge the following authors and resources whose ideas, patterns, and best practices have shaped this skill.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Authors & Contributors
|
|
8
|
+
|
|
9
|
+
### Jag Valaiyapathy (**[Jaganpro)](https://github.com/Jaganpro)**
|
|
10
|
+
|
|
11
|
+
**[sf-skills](https://github.com/Jaganpro/sf-skills)**
|
|
12
|
+
|
|
13
|
+
Key contributions influencing this skill:
|
|
14
|
+
|
|
15
|
+
- Pioneering open-source Salesforce skills for agentic coding tools
|
|
16
|
+
- Apex code generation and review patterns
|
|
17
|
+
- Best practices, anti-patterns, and design patterns reference material
|
|
18
|
+
- Template library for common Apex class types
|
|
19
|
+
|
|
20
|
+
This skill was influenced by the [sf-skills](https://github.com/Jaganpro/sf-skills) repository.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Special Thanks
|
|
25
|
+
|
|
26
|
+
To the entire Salesforce developer community for sharing knowledge, writing blogs, creating open-source tools, and helping each other build better solutions.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
*If we've missed anyone whose work influenced these skills, please let us know so we can add proper attribution.*
|