@salesforce/webapp-template-app-react-sample-b2e-experimental 1.61.3 → 1.62.0
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/{graphql.md → features/feature-graphql-graphql-data-access-rule.md} +127 -117
- package/dist/.a4drules/features/feature-react-agentforce-conversation-client-embedded-agent-rule.md +32 -0
- package/dist/.a4drules/features/feature-react-chart-analytics-charts-rule.md +27 -0
- package/dist/.a4drules/skills/feature-graphql-graphql-data-access/SKILL.md +155 -0
- package/dist/.a4drules/{graphql/tools/knowledge/lds-explore-graphql-schema.md → skills/feature-graphql-graphql-data-access/docs/explore-schema.md} +58 -29
- package/dist/.a4drules/{graphql/tools/knowledge/lds-generate-graphql-mutationquery.md → skills/feature-graphql-graphql-data-access/docs/generate-mutation-query.md} +52 -42
- package/dist/.a4drules/{graphql/tools/knowledge/lds-generate-graphql-readquery.md → skills/feature-graphql-graphql-data-access/docs/generate-read-query.md} +32 -22
- package/dist/.a4drules/{graphql/tools/schemas/shared.graphqls → skills/feature-graphql-graphql-data-access/docs/shared-schema.graphqls} +1 -1
- package/dist/.a4drules/skills/feature-micro-frontend-micro-frontend/SKILL.md +137 -0
- package/dist/.a4drules/skills/feature-react-agentforce-conversation-client-embedded-agent/SKILL.md +108 -0
- package/dist/.a4drules/skills/feature-react-agentforce-conversation-client-embedded-agent/docs/embed-examples.md +182 -0
- package/dist/.a4drules/skills/feature-react-chart-analytics-charts/SKILL.md +41 -0
- package/dist/.a4drules/skills/feature-react-chart-analytics-charts/docs/schema-mapping.md +4 -0
- package/dist/.a4drules/webapp-code-quality.md +136 -0
- package/dist/.a4drules/{images.md → webapp-images.md} +6 -4
- package/dist/.a4drules/webapp-no-node-e.md +3 -2
- package/dist/.a4drules/webapp-react.md +149 -0
- package/dist/.a4drules/{typescript.md → webapp-typescript.md} +9 -17
- package/dist/.a4drules/webapp.md +62 -45
- package/dist/CHANGELOG.md +16 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/vite.config.ts +2 -2
- package/dist/package.json +1 -1
- package/package.json +2 -2
- package/dist/.a4drules/README.md +0 -35
- package/dist/.a4drules/a4d-webapp-generate.md +0 -27
- package/dist/.a4drules/build-validation.md +0 -78
- package/dist/.a4drules/code-quality.md +0 -136
- package/dist/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +0 -205
- package/dist/.a4drules/react.md +0 -388
- package/dist/.a4drules/react_image_processing.md +0 -45
- package/dist/.a4drules/ui-layout.md +0 -23
- package/dist/.a4drules/webapp-nav-and-placeholders.md +0 -33
- package/dist/.a4drules/webapp-ui-first.md +0 -32
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/build/vite.config.d.ts +0 -2
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/build/vite.config.js +0 -93
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Code quality and build validation standards
|
|
3
|
+
paths:
|
|
4
|
+
- "force-app/main/default/webapplications/**/*"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Quality & Build Validation
|
|
8
|
+
|
|
9
|
+
Enforces ESLint, TypeScript, and build validation for consistent, maintainable code.
|
|
10
|
+
|
|
11
|
+
## MANDATORY Quality Gates
|
|
12
|
+
|
|
13
|
+
**Before completing any coding session** (from the web app directory `force-app/main/default/webapplications/<appName>/`):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run lint # MUST result in 0 errors
|
|
17
|
+
npm run build # MUST succeed (includes TypeScript check)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
**Must Pass:**
|
|
23
|
+
- `npm run build` completes successfully
|
|
24
|
+
- No TypeScript compilation errors
|
|
25
|
+
- No critical ESLint errors (0 errors)
|
|
26
|
+
|
|
27
|
+
**Can Be Warnings:**
|
|
28
|
+
- ESLint warnings (fix when convenient)
|
|
29
|
+
- Minor TypeScript warnings
|
|
30
|
+
|
|
31
|
+
## Key Commands
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm run dev # Start development server (vite)
|
|
35
|
+
npm run lint # Run ESLint
|
|
36
|
+
npm run build # TypeScript + Vite build; check deployment readiness
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Error Priority
|
|
40
|
+
|
|
41
|
+
**Fix Immediately:**
|
|
42
|
+
- TypeScript compilation errors
|
|
43
|
+
- Import/export errors
|
|
44
|
+
- Syntax errors
|
|
45
|
+
|
|
46
|
+
**Fix When Convenient:**
|
|
47
|
+
- ESLint warnings
|
|
48
|
+
- Unused variables
|
|
49
|
+
|
|
50
|
+
## Import Order (MANDATORY)
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// 1. React ecosystem
|
|
54
|
+
import { useState, useEffect } from 'react';
|
|
55
|
+
|
|
56
|
+
// 2. External libraries (alphabetical)
|
|
57
|
+
import clsx from 'clsx';
|
|
58
|
+
|
|
59
|
+
// 3. UI components (alphabetical)
|
|
60
|
+
import { Button } from '@/components/ui/button';
|
|
61
|
+
import { Card } from '@/components/ui/card';
|
|
62
|
+
|
|
63
|
+
// 4. Internal utilities (alphabetical)
|
|
64
|
+
import { useAuth } from '../hooks/useAuth';
|
|
65
|
+
import { formatDate } from '../utils/dateUtils';
|
|
66
|
+
|
|
67
|
+
// 5. Relative imports
|
|
68
|
+
import { ComponentA } from './ComponentA';
|
|
69
|
+
|
|
70
|
+
// 6. Type imports (separate, at end)
|
|
71
|
+
import type { User, ApiResponse } from '../types';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Naming Conventions
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// PascalCase: Components, classes
|
|
78
|
+
const UserProfile = () => {};
|
|
79
|
+
|
|
80
|
+
// camelCase: Variables, functions, properties
|
|
81
|
+
const userName = 'john';
|
|
82
|
+
const fetchUserData = async () => {};
|
|
83
|
+
|
|
84
|
+
// SCREAMING_SNAKE_CASE: Constants
|
|
85
|
+
const API_BASE_URL = 'https://api.example.com';
|
|
86
|
+
|
|
87
|
+
// kebab-case: Files
|
|
88
|
+
// user-profile.tsx, api-client.ts
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## React Component Structure
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
interface ComponentProps {
|
|
95
|
+
// Props interface first
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const Component: React.FC<ComponentProps> = ({ prop1, prop2 }) => {
|
|
99
|
+
// 1. Hooks
|
|
100
|
+
// 2. Computed values
|
|
101
|
+
// 3. Event handlers
|
|
102
|
+
// 4. JSX return
|
|
103
|
+
|
|
104
|
+
return <div />;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default Component;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Anti-Patterns (FORBIDDEN)
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
// NEVER disable ESLint without justification
|
|
114
|
+
// eslint-disable-next-line
|
|
115
|
+
|
|
116
|
+
// NEVER mutate state directly
|
|
117
|
+
state.items.push(newItem); // Wrong
|
|
118
|
+
setItems(prev => [...prev, newItem]); // Correct
|
|
119
|
+
|
|
120
|
+
// NEVER use magic numbers/strings
|
|
121
|
+
setTimeout(() => {}, 5000); // Wrong
|
|
122
|
+
const DEBOUNCE_DELAY = 5000; // Correct
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Troubleshooting
|
|
126
|
+
|
|
127
|
+
**Import Errors:**
|
|
128
|
+
```bash
|
|
129
|
+
npm install # Check missing dependencies
|
|
130
|
+
# Verify: file exists, case sensitivity, export/import match
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Build Failures:**
|
|
134
|
+
1. Run `npm run lint` to identify issues
|
|
135
|
+
2. Fix TypeScript/ESLint errors
|
|
136
|
+
3. Retry `npm run build`
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Image handling rules - Unsplash default, CSP compliance, accessibility
|
|
3
|
+
paths:
|
|
4
|
+
- "force-app/main/default/webapplications/**/*"
|
|
5
|
+
---
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**Applies to:** `force-app/main/default/webapplications/*/**/*.{js,jsx,ts,tsx,css,html}`
|
|
7
|
+
# Images
|
|
6
8
|
|
|
7
9
|
**Guidelines:**
|
|
8
10
|
- Default to Unsplash when the user does not specify an image source; it is pre-configured in CSP and works in Salesforce without extra setup.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
3
|
-
|
|
2
|
+
description: No node -e - use replace_in_file or write_to_file only
|
|
3
|
+
paths:
|
|
4
|
+
- "force-app/main/default/webapplications/**/*"
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# A4D Enforcement: No node -e
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: React-specific patterns and Salesforce data access for SFDX web apps
|
|
3
|
+
paths:
|
|
4
|
+
- "force-app/main/default/webapplications/**/*"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# React Web App (SFDX)
|
|
8
|
+
|
|
9
|
+
React-specific guidelines for data access, component library, and Salesforce integration.
|
|
10
|
+
|
|
11
|
+
For layout, navigation, and generation rules, see **webapp.md**.
|
|
12
|
+
|
|
13
|
+
## Project Structure
|
|
14
|
+
|
|
15
|
+
- Web app root: `force-app/main/default/webapplications/<appName>/`
|
|
16
|
+
- Entry: `src/app.tsx`
|
|
17
|
+
- Layout shell: `src/appLayout.tsx`
|
|
18
|
+
- Dev server: `npm run dev`
|
|
19
|
+
- Build: `npm run build`
|
|
20
|
+
|
|
21
|
+
## Component Library (MANDATORY)
|
|
22
|
+
|
|
23
|
+
Use **shadcn/ui** for UI components:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { Button } from '@/components/ui/button';
|
|
27
|
+
import { Card, CardHeader, CardContent } from '@/components/ui/card';
|
|
28
|
+
import { Input } from '@/components/ui/input';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Styling
|
|
32
|
+
|
|
33
|
+
- Use **Tailwind CSS** utility classes
|
|
34
|
+
- Follow consistent spacing, color, and typography conventions
|
|
35
|
+
|
|
36
|
+
## Module & Platform Restrictions
|
|
37
|
+
|
|
38
|
+
React apps must NOT import Salesforce platform modules:
|
|
39
|
+
|
|
40
|
+
- ❌ `@salesforce/*` (except `@salesforce/sdk-data`)
|
|
41
|
+
- ❌ `lightning/*`
|
|
42
|
+
- ❌ `@wire` (LWC-only)
|
|
43
|
+
|
|
44
|
+
Use standard web APIs and npm packages only.
|
|
45
|
+
|
|
46
|
+
## Data Access (CRITICAL)
|
|
47
|
+
|
|
48
|
+
### Use DataSDK for All Salesforce API Calls
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { getDataSDK } from '@salesforce/sdk-data';
|
|
52
|
+
|
|
53
|
+
const sdk = await getDataSDK();
|
|
54
|
+
// Use sdk.graphql?.() or sdk.fetch!() for API calls
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Do NOT use `axios` or raw `fetch` for Salesforce APIs. The SDK handles authentication and CSRF.
|
|
58
|
+
|
|
59
|
+
### Data Access Priority
|
|
60
|
+
|
|
61
|
+
1. **GraphQL** (preferred) — queries & mutations via `sdk.graphql?.()`
|
|
62
|
+
2. **UI API** — via `sdk.fetch!()` for `/services/data/v62.0/ui-api/*`
|
|
63
|
+
|
|
64
|
+
### Apex REST is NOT Available
|
|
65
|
+
|
|
66
|
+
Apex REST cannot be called from React applications. If Apex seems required:
|
|
67
|
+
1. Evaluate if GraphQL can accomplish the task
|
|
68
|
+
2. If not, inform the user the feature is not supported in React
|
|
69
|
+
|
|
70
|
+
### MCP Tool Integration
|
|
71
|
+
|
|
72
|
+
Before implementing data access:
|
|
73
|
+
1. Check if `orchestrate_lds_data_requirements` tool is available
|
|
74
|
+
2. Use it to get guidance on the appropriate pattern (GraphQL or UI API)
|
|
75
|
+
3. If it recommends Apex REST, ignore and use GraphQL instead
|
|
76
|
+
|
|
77
|
+
## Einstein LLM Gateway (AI Features)
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { getDataSDK } from '@salesforce/sdk-data';
|
|
81
|
+
|
|
82
|
+
async function callEinsteinGenerations(prompt: string): Promise<string> {
|
|
83
|
+
const sdk = await getDataSDK();
|
|
84
|
+
const resp = await sdk.fetch!('/services/data/v62.0/einstein/llm/prompt/generations', {
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: { 'Content-Type': 'application/json' },
|
|
87
|
+
body: JSON.stringify({
|
|
88
|
+
additionalConfig: { applicationName: 'PromptTemplateGenerationsInvocable' },
|
|
89
|
+
promptTextorId: prompt,
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (!resp.ok) throw new Error(`Einstein LLM failed (${resp.status})`);
|
|
94
|
+
const data = await resp.json();
|
|
95
|
+
return data?.generations?.[0]?.text || '';
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Error Handling
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
async function safeFetch<T>(fn: () => Promise<T>): Promise<T> {
|
|
103
|
+
try {
|
|
104
|
+
return await fn();
|
|
105
|
+
} catch (err) {
|
|
106
|
+
console.error('API Error:', err);
|
|
107
|
+
throw err;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Authentication Errors
|
|
113
|
+
|
|
114
|
+
On 401/403 response, trigger page refresh to redirect to login:
|
|
115
|
+
```typescript
|
|
116
|
+
window.location.reload();
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Security Standards
|
|
120
|
+
|
|
121
|
+
- Validate user permissions before data operations
|
|
122
|
+
- Respect record sharing rules and field-level security
|
|
123
|
+
- Never hardcode credentials or secrets
|
|
124
|
+
- Sanitize all user inputs
|
|
125
|
+
- Use HTTPS for all API calls
|
|
126
|
+
|
|
127
|
+
## Performance
|
|
128
|
+
|
|
129
|
+
- Use React Query or RTK Query for caching API data
|
|
130
|
+
- Use `React.memo`, `useMemo`, `useCallback` where appropriate
|
|
131
|
+
- Implement loading and error states
|
|
132
|
+
|
|
133
|
+
## Anti-Patterns (FORBIDDEN)
|
|
134
|
+
|
|
135
|
+
- ❌ Calling Apex REST from React
|
|
136
|
+
- ❌ Using `axios` or raw `fetch` for Salesforce APIs
|
|
137
|
+
- ❌ Direct DOM manipulation in React
|
|
138
|
+
- ❌ Using LWC patterns (`@wire`, LDS) in React
|
|
139
|
+
- ❌ Hardcoded Salesforce IDs or URLs
|
|
140
|
+
- ❌ Missing error handling for async operations
|
|
141
|
+
|
|
142
|
+
## Quality Checklist
|
|
143
|
+
|
|
144
|
+
- [ ] Entry point maintained (`app.tsx`)
|
|
145
|
+
- [ ] Uses shadcn/ui and Tailwind
|
|
146
|
+
- [ ] DataSDK used for all Salesforce API calls
|
|
147
|
+
- [ ] Proper error handling with try/catch
|
|
148
|
+
- [ ] Loading and error states implemented
|
|
149
|
+
- [ ] No hardcoded credentials or IDs
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Strict TypeScript standards for type-safe React applications
|
|
3
|
+
paths:
|
|
4
|
+
- "force-app/main/default/webapplications/**/*"
|
|
5
|
+
---
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Targets
|
|
6
|
-
- `**/*.ts`
|
|
7
|
-
- `**/*.tsx`
|
|
7
|
+
# TypeScript Standards
|
|
8
8
|
|
|
9
9
|
## MANDATORY Configuration
|
|
10
10
|
- `strict: true` - Enable all strict type checking
|
|
@@ -136,19 +136,11 @@ interface Account extends SalesforceRecord {
|
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
### GraphQL via DataSDK
|
|
139
|
-
Use `getDataSDK()` from `@salesforce/sdk-data` for all GraphQL operations. The SDK handles authentication and CSRF token management:
|
|
140
|
-
|
|
141
|
-
```typescript
|
|
142
|
-
import { getDataSDK } from '@salesforce/sdk-data';
|
|
143
139
|
|
|
144
|
-
|
|
145
|
-
const response = await data.graphql?.<GetAccountsQuery>(QUERY, variables);
|
|
140
|
+
See **webapp-react.md** for DataSDK usage patterns. Type your GraphQL responses:
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const accounts = response?.data;
|
|
142
|
+
```typescript
|
|
143
|
+
const response = await sdk.graphql?.<GetAccountsQuery>(QUERY, variables);
|
|
152
144
|
```
|
|
153
145
|
|
|
154
146
|
## Error Handling Types
|
package/dist/.a4drules/webapp.md
CHANGED
|
@@ -1,75 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Core web application rules for SFDX React apps
|
|
3
|
+
paths:
|
|
4
|
+
- "force-app/main/default/webapplications/**/*"
|
|
5
|
+
---
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
1. **No `node -e`.** This project forbids `node -e` for any operation (file edits, config, shell automation). Use `replace_in_file` or `write_to_file` only. See **webapp-no-node-e.md**.
|
|
7
|
+
# Web App Generation
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
## Before `sf webapp generate`
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
- **NEVER use `node -e`** for file manipulation, string replacement, or reading files. Forbidden. Use `replace_in_file` or `write_to_file` only.
|
|
10
|
-
- ALWAYS use `replace_in_file` or `write_to_file` for code changes.
|
|
11
|
-
- IF you must parse JSON (like package.json), use `jq` if available. Otherwise, read the file and process it internally.
|
|
12
|
-
- ALWAYS use `npm` or `yarn` commands directly rather than writing custom Node scripts to trigger them.
|
|
11
|
+
**Webapp name (`-n`):** Must be **alphanumerical only**—no spaces, hyphens, underscores, or special characters. Use only letters (A–Z, a–z) and digits (0–9). Example: `CoffeeBoutique` not `Coffee Boutique`.
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- Imports: Use absolute paths (e.g., `@/components/...`) if the `tsconfig.json` or `vite.config.ts` supports it.
|
|
18
|
-
- State: Default to `useState` for local state; avoid adding global state libraries unless requested.
|
|
13
|
+
```bash
|
|
14
|
+
sf webapp generate -n MyWebApp -t reactbasic
|
|
15
|
+
```
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
- Before running any build or test command, check for the existence of `node_modules`. If missing, prompt to run `npm install`.
|
|
22
|
-
- When searching for code, use `search_files` with regex rather than trying to `grep` or `awk` through the terminal.
|
|
23
|
-
- If a command fails twice, STOP and report the exact error to the user rather than attempting a third "creative" bash one-liner.
|
|
17
|
+
Do not use `create-react-app`, Vite, or other generic scaffolds; use `sf webapp generate` so the app is SFDX-aware.
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
## After Generation (MANDATORY)
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
After generating or when touching an existing app:
|
|
28
22
|
|
|
29
|
-
**
|
|
23
|
+
1. **Replace all default boilerplate** — "React App", "Vite + React", default `<title>`, placeholder text in shell. Use the actual app name.
|
|
24
|
+
2. **Populate the home page** — Never leave it as default template. Add real content: landing section, banners, hero, navigation to features.
|
|
25
|
+
3. **Update navigation and placeholders** — See [Navigation & Layout section](#navigation--layout-mandatory) below.
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
# Navigation & Layout (MANDATORY)
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
Agents consistently miss these. **You must not leave them default.**
|
|
34
30
|
|
|
35
|
-
|
|
31
|
+
## appLayout.tsx is the Source of Truth
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
- **Build navigation into the app layout** (`appLayout.tsx`). The layout must include nav (header, sidebar, or both) so every page shares the same shell.
|
|
34
|
+
- Path: `force-app/main/default/webapplications/<appName>/src/appLayout.tsx`
|
|
38
35
|
|
|
39
|
-
When
|
|
36
|
+
## When Making UI Changes
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
\`\`\`bash
|
|
43
|
-
sf webapp generate -n MyWebApp -t reactbasic
|
|
44
|
-
\`\`\`
|
|
45
|
-
Use the app name the user requested instead of \`MyWebApp\` if they specify one.
|
|
38
|
+
**When making any change** that affects navigation, header, footer, sidebar, theme, or overall layout:
|
|
46
39
|
|
|
47
|
-
|
|
40
|
+
1. **You MUST edit `src/appLayout.tsx`** (the layout used by `routes.tsx`).
|
|
41
|
+
2. Do not only edit pages/components and leave `appLayout.tsx` unchanged.
|
|
42
|
+
3. Before finishing: confirm you opened and modified `appLayout.tsx`. If you did not, the task is incomplete.
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
## Navigation Menu (Critical)
|
|
50
45
|
|
|
51
|
-
|
|
46
|
+
- **Always edit the navigation menu** in `appLayout.tsx`. Replace default nav items and labels with **app-specific** links and names.
|
|
47
|
+
- Do **not** leave template items (e.g. "Home", "About", generic placeholder links).
|
|
48
|
+
- Use real routes and labels matching the app (e.g. "Dashboard", "Products", "Orders").
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
**Check before finishing:** Did I change the nav items and labels to match this app?
|
|
54
51
|
|
|
52
|
+
## Placeholder Name & Design (Critical)
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
- **Replace the placeholder app name** everywhere: header, nav brand/logo, footer, `<title>` in `index.html`, any "Welcome to…" text.
|
|
55
|
+
- **Replace placeholder design** in the shell: default header/footer styling, generic branding.
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
- Maintain a running checklist and proceed through it sequentially.
|
|
60
|
-
- Quality gates (lint/build) remain required, but failures should be remediated inline and the workflow should continue through all feature tasks in this iteration unless the user directs otherwise.
|
|
57
|
+
**Check before finishing:** Is the app name and shell design still the template default? If yes, update it.
|
|
61
58
|
|
|
62
|
-
##
|
|
59
|
+
## Where to Edit
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
|
|
62
|
+
| What | Where |
|
|
63
|
+
| ------------------- | -------------------------------------------------------------------- |
|
|
64
|
+
| Layout/nav/branding | `force-app/main/default/webapplications/<appName>/src/appLayout.tsx` |
|
|
65
|
+
| Document title | `force-app/main/default/webapplications/<appName>/index.html` |
|
|
66
|
+
| Root page content | Component at root route (often `Home` in `routes.tsx`) |
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# Frontend Aesthetics
|
|
70
|
+
|
|
71
|
+
**Avoid AI slop.** Make creative, distinctive frontends:
|
|
72
|
+
|
|
73
|
+
- **Typography:** Avoid Inter, Roboto, Arial, Space Grotesk as defaults. Choose distinctive fonts.
|
|
74
|
+
- **Color:** Use cohesive color with sharp accents via CSS variables. Avoid purple-on-white clichés.
|
|
75
|
+
- **Motion:** Use high-impact motion (e.g. staggered reveals).
|
|
76
|
+
- **Depth:** Add atmosphere/depth in backgrounds.
|
|
77
|
+
|
|
78
|
+
Follow **webapplications-design-system** expert knowledge for full guidance.
|
|
79
|
+
|
|
80
|
+
# Development Cycle
|
|
81
|
+
|
|
82
|
+
- Execute tasks continuously until all planned items complete in the current iteration.
|
|
83
|
+
- Maintain a running checklist and proceed sequentially.
|
|
69
84
|
|
|
70
85
|
## Stop Conditions
|
|
71
86
|
|
|
72
87
|
Only stop when:
|
|
88
|
+
|
|
73
89
|
- All checklist items are completed and quality gates pass, or
|
|
74
90
|
- A blocking error cannot be resolved after reasonable remediation, or
|
|
75
91
|
- The user explicitly asks to pause.
|
|
92
|
+
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.62.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.61.4...v1.62.0) (2026-03-02)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.61.4](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.61.3...v1.61.4) (2026-03-02)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [1.61.3](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.61.2...v1.61.3) (2026-03-02)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { PluginOption } from 'vite';
|
|
2
1
|
import { defineConfig } from 'vite';
|
|
3
2
|
import react from '@vitejs/plugin-react';
|
|
4
3
|
import path from 'path';
|
|
@@ -11,6 +10,7 @@ export default defineConfig(({ mode }) => {
|
|
|
11
10
|
return {
|
|
12
11
|
// Ensure root base for e2e/static serve; plugin may override when deployed under a path
|
|
13
12
|
base: '/',
|
|
13
|
+
// Type assertion avoids Plugin type mismatch when dist has its own node_modules (vite/rollup)
|
|
14
14
|
plugins: [
|
|
15
15
|
tailwindcss(),
|
|
16
16
|
react(),
|
|
@@ -27,7 +27,7 @@ export default defineConfig(({ mode }) => {
|
|
|
27
27
|
// Fail build if codegen errors
|
|
28
28
|
throwOnBuild: true,
|
|
29
29
|
}),
|
|
30
|
-
] as PluginOption[],
|
|
30
|
+
] as import('vite').PluginOption[],
|
|
31
31
|
|
|
32
32
|
// Build configuration for MPA
|
|
33
33
|
build: {
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-app-react-sample-b2e-experimental",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
4
4
|
"description": "B2E starter app template",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "1a13800558455d1b4d9d5bce9946276ac2ca54a5"
|
|
47
47
|
}
|
package/dist/.a4drules/README.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# A4D Rules Index
|
|
2
|
-
|
|
3
|
-
Rules in this folder guide the agent for this SFDX project. **Knowledge** (expert content) lives in the **local-expert MCP** repo (e.g. `local-expert-mcp`); rules here reference when to call which expert.
|
|
4
|
-
|
|
5
|
-
## Always-apply rules (MUST follow)
|
|
6
|
-
|
|
7
|
-
| File | Purpose |
|
|
8
|
-
|------|--------|
|
|
9
|
-
| **webapp.md** | Main web app rules: invoke local-expert MCP (`webapplications-design-system` + `webapplications`), no `node -e`, React/SFDX workflow; **replace default boilerplate**; **populate home page**; **frontend aesthetics**—avoid AI slop, follow design-system expert. |
|
|
10
|
-
| **webapp-no-node-e.md** | No `node -e` for any file/config/shell work; use `replace_in_file` or `write_to_file` only. |
|
|
11
|
-
| **a4d-webapp-generate.md** | Before `sf webapp generate`: call `get_expert_knowledge` with `webapplications-design-system` and `webapplications`; then run CLI. |
|
|
12
|
-
| **webapp-ui-first.md** | Build UI (layout, components, styling) first; then implement business logic (APIs, state, handlers). |
|
|
13
|
-
| **webapp-nav-and-placeholders.md** | **Build navigation into the app layout** (`appLayout.tsx`). Always update nav menu (app-specific items/labels) and placeholder name/design (header/nav/footer/title). Often missed—mandatory. |
|
|
14
|
-
|
|
15
|
-
## Context-specific rules (by file pattern or topic)
|
|
16
|
-
|
|
17
|
-
| File | Purpose |
|
|
18
|
-
|------|--------|
|
|
19
|
-
| **react.md** | React web app structure, shadcn/Tailwind, data access, security; edit `appLayout.tsx` when changing layout. |
|
|
20
|
-
| **ui-layout.md** | When changing UI/nav/header/footer/sidebar/theme, always update `appLayout.tsx`. |
|
|
21
|
-
| **code-quality.md** | ESLint, Prettier, import order, naming, lint/build before completion; no `node -e`. |
|
|
22
|
-
| **build-validation.md** | `npm run build` must succeed from web app dir before completing. |
|
|
23
|
-
| **typescript.md** | TypeScript strictness, return types, interfaces. |
|
|
24
|
-
| **images.md** | Images: Unsplash default, CSP, alt text, error handling. |
|
|
25
|
-
| **react_image_processing.md** | Image handling (Unsplash, CSP, accessibility) for React components. |
|
|
26
|
-
| **graphql/** | GraphQL tools and knowledge (schemas, LDS guides). |
|
|
27
|
-
|
|
28
|
-
## Knowledge repository (experts)
|
|
29
|
-
|
|
30
|
-
Expert knowledge is served by the **local-expert MCP** (e.g. at `local-expert-mcp`). The agent must call **`get_expert_knowledge`** with the appropriate topic:
|
|
31
|
-
|
|
32
|
-
- **webapplications-design-system** — Always use for web app UI/design work (design system, typography, color, motion).
|
|
33
|
-
- **webapplications** — Use for app generation and structure; then call sub-topics as needed (e.g. `webapplications-best-practice`, `webapplications-feature-*`).
|
|
34
|
-
|
|
35
|
-
See the MCP repo's **rule-expert-mcp.md** for full topic list and when to call which expert.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: A4D rule — call expert MCP (webapplications + webapplications-design-system) before sf webapp generate
|
|
3
|
-
alwaysApply: true
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# A4D Rule: Before `sf webapp generate`
|
|
7
|
-
|
|
8
|
-
Before running **`sf webapp generate`**, you **must**:
|
|
9
|
-
|
|
10
|
-
1. **Call the expert MCP** (`get_expert_knowledge`) with topic **`webapplications-design-system`** — always invoke this expert for UI/design direction.
|
|
11
|
-
2. **Call the expert MCP** with topic **`webapplications`** to get generation and structure guidance.
|
|
12
|
-
3. Follow the instructions from the MCP responses.
|
|
13
|
-
4. Only after that, run `sf webapp generate` (e.g. `sf webapp generate -n <AppName> -t <template>`).
|
|
14
|
-
|
|
15
|
-
**Webapp name (`-n` / `<AppName>`):** Must be **alphanumerical only**—no spaces, hyphens, underscores, or other special characters. Use only letters (A–Z, a–z) and digits (0–9). If the desired name has spaces or special characters, use a single alphanumeric word (e.g. `CoffeeBoutique` instead of `Coffee Boutique` or `coffee-boutique`).
|
|
16
|
-
|
|
17
|
-
Do not run `sf webapp generate` without having invoked the expert MCP with **`webapplications-design-system`** and **`webapplications`** first.
|
|
18
|
-
|
|
19
|
-
When modifying an existing web app (UI, layout, or new features), **always** call `get_expert_knowledge` with topic **`webapplications-design-system`** before making UI or design changes.
|
|
20
|
-
|
|
21
|
-
**After generating (or when touching a new app):** Replace all default boilerplate content (e.g. "React App", "Vite + React", default document title in `index.html`, placeholder text in the shell) with the actual app name or user-facing copy. Do not leave generic template text in the UI or `<title>`.
|
|
22
|
-
|
|
23
|
-
**Home page content:** Populate the home page (root route) with real, app-specific content (e.g. landing section, banners, tiles, hero, links to features). Never leave the home page as the default template or placeholder.
|
|
24
|
-
|
|
25
|
-
**Navigation menu and placeholder name/design:** After generating or when delivering a web app, **you must** (1) **Edit the navigation menu** in `appLayout.tsx`: replace every default nav item and label with app-specific routes and names; do not leave template "Home"/"About" or placeholder links. (2) **Replace the placeholder app name** in the header, nav brand, footer, and `index.html` `<title>` with the actual app name. (3) **Update placeholder design** in the shell (header/footer/branding) so it is not the template default. See **webapp-nav-and-placeholders.md**. Agents often skip this—do not.
|
|
26
|
-
|
|
27
|
-
Prioritize webapplications generation first, and then generate the metadata.
|