@salesforce/webapp-template-app-react-sample-b2x-experimental 1.84.0 → 1.85.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/skills/{webapp-react-add-component → webapp-react}/SKILL.md +5 -3
- package/dist/.a4drules/skills/{webapp-react-add-component → webapp-react}/implementation/header-footer.md +8 -0
- package/dist/.a4drules/skills/{webapp-react-add-component → webapp-react}/implementation/page.md +8 -7
- package/dist/.a4drules/skills/webapp-ui-ux/SKILL.md +11 -8
- package/dist/.a4drules/webapp-react.md +54 -0
- package/dist/CHANGELOG.md +16 -0
- package/dist/README.md +24 -0
- package/dist/force-app/main/default/data/Property_Image__c.json +1 -1
- package/dist/force-app/main/default/data/Property_Listing__c.json +1 -1
- package/dist/force-app/main/default/data/prepare-import-unique-fields.js +85 -0
- package/dist/force-app/main/default/permissionsets/Property_Management_Access.permissionset-meta.xml +0 -7
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/index.html +6 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/package.json +3 -3
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/applicationApi.ts +9 -9
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/graphql-operations-types.ts +296 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/graphqlClient.ts +12 -7
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/maintenanceRequestApi.ts +50 -38
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/propertyDetailGraphQL.ts +50 -102
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/propertyListingGraphQL.ts +211 -43
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/userApi.ts +43 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/appLayout.tsx +9 -208
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/appliances.svg +13 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/electrical.svg +39 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/hvac.svg +78 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/pest.svg +5 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/plumbing.svg +7 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/zen-logo.svg +5 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/MaintenanceRequestIcon.tsx +46 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/NavMenu.tsx +53 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/PropertyListingCard.tsx +55 -58
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/PropertyMap.tsx +93 -11
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/PropertySearchFilters.tsx +315 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/StatusBadge.tsx +36 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/TopBar.tsx +107 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyAddresses.ts +2 -2
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyListingAmenities.ts +55 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyListingPriceRange.ts +64 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyListingSearch.ts +14 -5
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyMapMarkers.ts +54 -11
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyPrimaryImages.ts +1 -1
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Application.tsx +42 -39
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Contact.tsx +10 -10
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Dashboard.tsx +64 -91
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/HelpCenter.tsx +1 -1
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Home.tsx +19 -9
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Maintenance.tsx +79 -100
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/NotFound.tsx +1 -1
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/PropertyDetails.tsx +62 -47
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/PropertyListings.tsx +3 -3
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/PropertySearch.tsx +230 -34
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/routes.tsx +10 -1
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/styles/global.css +64 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/utils/geocode.ts +30 -5
- package/dist/package.json +1 -1
- package/dist/setup-cli.mjs +271 -0
- package/package.json +1 -1
- /package/dist/.a4drules/skills/{webapp-react-add-component → webapp-react}/implementation/component.md +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: webapp-react
|
|
3
|
-
description:
|
|
2
|
+
name: webapp-react
|
|
3
|
+
description: Use when editing any React code in the web application — creating or modifying components, pages, layout, headers, footers, or any TSX/JSX files. Follow this skill for add component, add page, header/footer, and general React UI implementation patterns (shadcn UI and Tailwind CSS).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# React Web App (Components, Pages, Layout)
|
|
7
|
+
|
|
8
|
+
Use this skill whenever you are editing React/TSX code in the web app (creating or modifying components, pages, header/footer, or layout).
|
|
7
9
|
|
|
8
10
|
## Step 1 — Identify the type of component
|
|
9
11
|
|
|
@@ -116,6 +116,14 @@ AppLayout (appLayout.tsx)
|
|
|
116
116
|
- **Icons:** `lucide-react`; add `aria-hidden="true"` on decorative icons
|
|
117
117
|
- **Design tokens:** `bg-background`, `text-foreground`, `text-muted-foreground`, `border`, `bg-primary`
|
|
118
118
|
|
|
119
|
+
### Mobile hamburger / Menu icon — Must be functional
|
|
120
|
+
|
|
121
|
+
If the header includes a hamburger or `Menu` icon for mobile:
|
|
122
|
+
|
|
123
|
+
- **Do not** add a Menu/hamburger icon that does nothing. It must toggle a visible mobile menu.
|
|
124
|
+
- **Required:** (1) State: `const [isOpen, setIsOpen] = useState(false)`. (2) Button: `onClick={() => setIsOpen(!isOpen)}`, `aria-label="Toggle menu"`. (3) Conditional panel: `{isOpen && ( <div>...nav links...</div> )}` with responsive visibility (e.g. `md:hidden`). (4) Close on navigate: each link in the panel should `onClick={() => setIsOpen(false)}`.
|
|
125
|
+
- Implement in `appLayout.tsx` (or the component that owns the header). Use the `Menu` icon from `lucide-react`.
|
|
126
|
+
|
|
119
127
|
### Confirm — Header / Footer
|
|
120
128
|
|
|
121
129
|
- Header and footer appear on every page (navigate to at least two routes)
|
package/dist/.a4drules/skills/{webapp-react-add-component → webapp-react}/implementation/page.md
RENAMED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
### Rules
|
|
4
4
|
|
|
5
|
-
1.
|
|
6
|
-
2.
|
|
7
|
-
3. **
|
|
8
|
-
4. **
|
|
9
|
-
5. **
|
|
10
|
-
6. **
|
|
11
|
-
7. **
|
|
5
|
+
1. **Edit the component that owns the UI, never output raw HTML** — When editing the home page or any page content, modify the actual `.tsx` file that renders the target. If the target is inside a child component (e.g. `<GlobalSearchInput />` in `Home.tsx`), edit the child's file (e.g. `GlobalSearchInput.tsx`), not the parent. Do not wrap the component with extra elements in the parent; go into the component and change its JSX. Do not paste or generate raw HTML.
|
|
6
|
+
2. **`routes.tsx` is the only route registry** — never add routes in `app.tsx` or inside page files.
|
|
7
|
+
3. **All pages are children of the AppLayout route** — do not create top-level routes that bypass the layout shell.
|
|
8
|
+
4. **Default export per page** — each page file has exactly one default-export component.
|
|
9
|
+
5. **Path aliases in all imports** — use `@/pages/...`, `@/components/...`; no deep relative paths.
|
|
10
|
+
6. **No inline styles** — Tailwind utility classes and design tokens only.
|
|
11
|
+
7. **Catch-all last** — `path: '*'` (NotFound) must always remain the last child in the layout route.
|
|
12
|
+
8. **Never modify `appLayout.tsx`** when adding a page — layout changes are a separate concern.
|
|
12
13
|
|
|
13
14
|
### Step 1 — Create the page file
|
|
14
15
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: ui-ux
|
|
3
|
-
description: Comprehensive design guide for React + Tailwind + shadcn/ui
|
|
2
|
+
name: webapp-ui-ux
|
|
3
|
+
description: Use when editing any UI code in the web application — styling, layout, design, appearance, Tailwind, shadcn, colors, typography, icons, or visual/UX changes. Comprehensive design guide and searchable database for React + Tailwind + shadcn/ui (styles, color palettes, font pairings, UX guidelines, chart types).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Web App UI/UX
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use this skill whenever you are editing UI code in the web application — styling, layout, design, appearance, Tailwind, shadcn, colors, typography, icons, or any visual/UX change.
|
|
9
|
+
|
|
10
|
+
Comprehensive design guide for React + Tailwind + shadcn/ui. Contains 67 styles, 96 color palettes, 57 font pairings, 99 UX guidelines, and 25 chart types. Searchable database with priority-based recommendations.
|
|
9
11
|
|
|
10
12
|
## Prerequisites
|
|
11
13
|
|
|
@@ -200,9 +202,10 @@ These are frequently overlooked issues that make UI look unprofessional:
|
|
|
200
202
|
|
|
201
203
|
| Rule | Do | Don't |
|
|
202
204
|
|------|----|----- |
|
|
203
|
-
| **
|
|
205
|
+
| **Icons: Lucide only** | Use **lucide-react** for all UI icons: `import { IconName } from 'lucide-react'` | Use Heroicons, react-icons, or other icon libraries; use emojis as icons |
|
|
206
|
+
| **No emojis ever** | Use words + Lucide icons for labels, empty states, tooltips, headings | Use emojis anywhere in UI or user-facing text (e.g. 🎨 🚀 ⚙️) |
|
|
204
207
|
| **Stable hover states** | Use color/opacity transitions on hover | Use scale transforms that shift layout |
|
|
205
|
-
| **Correct brand logos** | Research official SVG from Simple Icons | Guess or use incorrect logo paths |
|
|
208
|
+
| **Correct brand logos** | Research official SVG from Simple Icons (when needed outside Lucide) | Guess or use incorrect logo paths |
|
|
206
209
|
| **Consistent icon sizing** | Use fixed viewBox (24x24) with w-6 h-6 | Mix different icon sizes randomly |
|
|
207
210
|
|
|
208
211
|
### Interaction & Cursor
|
|
@@ -237,8 +240,8 @@ These are frequently overlooked issues that make UI look unprofessional:
|
|
|
237
240
|
Before delivering UI code, verify these items:
|
|
238
241
|
|
|
239
242
|
### Visual Quality
|
|
240
|
-
- [ ] No emojis
|
|
241
|
-
- [ ] All icons from
|
|
243
|
+
- [ ] No emojis anywhere (UI, labels, empty states, tooltips—use words + Lucide icons only)
|
|
244
|
+
- [ ] All icons from **lucide-react** only (no Heroicons, react-icons, or emojis)
|
|
242
245
|
- [ ] Brand logos are correct (verified from Simple Icons)
|
|
243
246
|
- [ ] Hover states don't cause layout shift
|
|
244
247
|
- [ ] Use theme colors directly (bg-primary) not var() wrapper
|
|
@@ -18,6 +18,15 @@ For layout, navigation, and generation rules, see **webapp.md**.
|
|
|
18
18
|
- Dev server: `npm run dev`
|
|
19
19
|
- Build: `npm run build`
|
|
20
20
|
|
|
21
|
+
## Routing (React Router)
|
|
22
|
+
|
|
23
|
+
Use a **single** router package for the app. When using `createBrowserRouter` and `RouterProvider` from `react-router`, all routing imports must come from **`react-router`** — not from `react-router-dom`.
|
|
24
|
+
|
|
25
|
+
- ✅ `import { createBrowserRouter, RouterProvider, Link, useNavigate, useLocation, Outlet } from 'react-router';`
|
|
26
|
+
- ❌ `import { Link } from 'react-router-dom';` when the app uses `RouterProvider` from `react-router`
|
|
27
|
+
|
|
28
|
+
Mixing packages causes "Cannot destructure property 'basename' of ... as it is null" because `Link`/hooks from `react-router-dom` read a different context than the one provided by `RouterProvider` from `react-router`.
|
|
29
|
+
|
|
21
30
|
## Component Library (MANDATORY)
|
|
22
31
|
|
|
23
32
|
Use **shadcn/ui** for UI components:
|
|
@@ -28,6 +37,42 @@ import { Card, CardHeader, CardContent } from '@/components/ui/card';
|
|
|
28
37
|
import { Input } from '@/components/ui/input';
|
|
29
38
|
```
|
|
30
39
|
|
|
40
|
+
## Icons & No Emojis (MANDATORY)
|
|
41
|
+
|
|
42
|
+
- **Icons:** Use **lucide-react** only. Do not use Heroicons, Simple Icons, or other icon libraries in the web app.
|
|
43
|
+
- ✅ `import { Menu, Settings, Bell } from 'lucide-react';` then `<Menu className="w-5 h-5" />`
|
|
44
|
+
- ❌ Any emoji character as an icon or visual element (e.g. 🎨 🚀 ⚙️ 🔔)
|
|
45
|
+
- ❌ Other icon libraries (e.g. `@heroicons/react`, `react-icons`, custom SVG icon sets)
|
|
46
|
+
- **No emojis ever:** Do not use emojis anywhere in the app: no emojis in UI labels, buttons, headings, empty states, tooltips, or any user-facing text. Use words and lucide-react icons instead.
|
|
47
|
+
- ✅ "Settings" with `<Settings />` icon
|
|
48
|
+
- ❌ "⚙️ Settings" or "Settings 🔧"
|
|
49
|
+
- For icon usage patterns and naming, see the **webapp-ui-ux** skill (`.a4drules/skills/webapp-ui-ux/`, especially `data/icons.csv`).
|
|
50
|
+
|
|
51
|
+
## Editing UI — Source Files Only (CRITICAL)
|
|
52
|
+
|
|
53
|
+
When asked to edit the home page, a section, or any on-screen UI:
|
|
54
|
+
|
|
55
|
+
- **Always edit the actual React/TSX source files.** Never output, paste, or generate raw HTML. The UI is built from components; the agent must locate the component file(s) that render the target area and change **JSX in those files**.
|
|
56
|
+
- **Do not** replace JSX with HTML strings, and do not copy browser-rendered DOM (e.g. expanded `<div>`, `data-slot`, long class strings) into the codebase. That is the output of React + shadcn; the source is `.tsx` with `<Card>`, `<Input>`, etc.
|
|
57
|
+
- **Edit inside the component that owns the UI.** If the element to change is rendered by a **child component** (e.g. `<GlobalSearchInput />` in `Home.tsx`), make the edit **inside that component's file** (e.g. `GlobalSearchInput.tsx`). Do **not** only wrap the component with extra elements in the parent (e.g. adding a `<section>` or `<div>` around `<GlobalSearchInput />`). The parent composes components; the visual/content change belongs in the component that actually renders that part of the UI.
|
|
58
|
+
- **Where to edit:**
|
|
59
|
+
- **Home page content:** `src/pages/Home.tsx` — but if the target is inside a child (e.g. `<GlobalSearchInput />`), edit the child's file, not the parent.
|
|
60
|
+
- **Layout, header, nav:** `src/appLayout.tsx`.
|
|
61
|
+
- **Feature-specific UI (e.g. search, list):** open the **specific component file** that renders the target (e.g. `GlobalSearchInput.tsx` for the search input UI).
|
|
62
|
+
- **Steps:** (1) Identify which **component** owns the section (follow the import: e.g. `GlobalSearchInput` → its file). (2) Open that component's file and modify the JSX there. (3) Only change the parent (e.g. `Home.tsx`) if the change is layout/ordering of components, not the internals of a child. Do not emit a standalone HTML snippet as the “edit.”
|
|
63
|
+
|
|
64
|
+
## Mobile Nav / Hamburger — Must Be Functional
|
|
65
|
+
|
|
66
|
+
When adding a navigation menu that includes a hamburger (or Menu icon) for mobile:
|
|
67
|
+
|
|
68
|
+
- **Do not** add a hamburger/Menu icon that does nothing. The icon must **toggle a visible mobile menu**.
|
|
69
|
+
- **Required implementation:**
|
|
70
|
+
1. **State:** e.g. `const [isOpen, setIsOpen] = useState(false);`
|
|
71
|
+
2. **Toggle button:** The hamburger/Menu button must have `onClick={() => setIsOpen(!isOpen)}` and `aria-label="Toggle menu"` (or equivalent).
|
|
72
|
+
3. **Conditional panel:** A mobile-only menu panel that renders when `isOpen` is true, e.g. `{isOpen && ( <div className="..."> ... nav links ... </div> )}`. Use responsive classes (e.g. `md:hidden`) so the panel is shown only on small screens if the desktop nav is separate.
|
|
73
|
+
4. **Close on navigation:** Each nav link in the mobile panel should call `onClick={() => setIsOpen(false)}` (or similar) so the menu closes when the user navigates.
|
|
74
|
+
- Implement this in `appLayout.tsx` (or the component that owns the header/nav). See existing apps for the full pattern (state + button + conditional panel + link onClick).
|
|
75
|
+
|
|
31
76
|
## Styling
|
|
32
77
|
|
|
33
78
|
- Use **Tailwind CSS** utility classes
|
|
@@ -137,11 +182,20 @@ window.location.reload();
|
|
|
137
182
|
- ❌ Using LWC patterns (`@wire`, LDS) in React
|
|
138
183
|
- ❌ Hardcoded Salesforce IDs or URLs
|
|
139
184
|
- ❌ Missing error handling for async operations
|
|
185
|
+
- ❌ Mixing `react-router` and `react-router-dom` (e.g. `RouterProvider` from `react-router` but `Link` from `react-router-dom`) — use one package for all routing imports
|
|
186
|
+
- ❌ Using emojis anywhere in the app (labels, icons, empty states, headings, tooltips)
|
|
187
|
+
- ❌ Using any icon library other than **lucide-react** (no Heroicons, react-icons, or emoji-as-icon)
|
|
188
|
+
- ❌ Outputting or pasting raw HTML when editing UI — always edit the React/TSX source files (e.g. `Home.tsx`, `appLayout.tsx`, feature components)
|
|
189
|
+
- ❌ Adding a hamburger or Menu icon for mobile nav without implementing toggle state, conditional menu panel, and close-on-navigate
|
|
140
190
|
|
|
141
191
|
## Quality Checklist
|
|
142
192
|
|
|
143
193
|
- [ ] Entry point maintained (`app.tsx`)
|
|
144
194
|
- [ ] Uses shadcn/ui and Tailwind
|
|
195
|
+
- [ ] Icons from **lucide-react** only; no emojis anywhere in UI or user-facing text
|
|
196
|
+
- [ ] UI changes made by editing .tsx source files (never by pasting raw HTML)
|
|
197
|
+
- [ ] If mobile hamburger exists: it has toggle state, conditional menu panel, and close on link click
|
|
198
|
+
- [ ] All routing imports from same package as router (e.g. `react-router` only)
|
|
145
199
|
- [ ] DataSDK used for all Salesforce API calls
|
|
146
200
|
- [ ] Proper error handling with try/catch
|
|
147
201
|
- [ ] Loading and error states implemented
|
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.85.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.84.1...v1.85.0) (2026-03-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.84.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.84.0...v1.84.1) (2026-03-10)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [1.84.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.83.0...v1.84.0) (2026-03-09)
|
|
7
23
|
|
|
8
24
|
|
package/dist/README.md
CHANGED
|
@@ -76,6 +76,30 @@ Replace `<alias>` with your target org alias.
|
|
|
76
76
|
sf data import tree --plan force-app/main/default/data/data-plan.json --target-org <alias>
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
## Using setup-cli.mjs
|
|
80
|
+
|
|
81
|
+
When this app is built (e.g. from the monorepo or from a published package), a `setup-cli.mjs` script is included at the project root. It runs the full setup in one go: login (if needed), deploy metadata, assign the `Property_Management_Access` permission set, prepare and import sample data, fetch GraphQL schema and run codegen, build the web app, and optionally start the dev server.
|
|
82
|
+
|
|
83
|
+
Run from the **project root** (the directory that contains `force-app/`, `sfdx-project.json`, and `setup-cli.mjs`):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
node setup-cli.mjs --target-org <alias>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Common options:
|
|
90
|
+
|
|
91
|
+
| Option | Description |
|
|
92
|
+
| --------------------- | ---------------------------------------------------------------- |
|
|
93
|
+
| `--skip-login` | Skip browser login (org already authenticated) |
|
|
94
|
+
| `--skip-data` | Skip data preparation and import |
|
|
95
|
+
| `--skip-graphql` | Skip GraphQL schema fetch and codegen |
|
|
96
|
+
| `--skip-webapp-build` | Skip `npm install` and web app build |
|
|
97
|
+
| `--skip-dev` | Do not start the dev server at the end |
|
|
98
|
+
| `--permset <name>` | Permission set to assign (default: `Property_Management_Access`) |
|
|
99
|
+
| `--app <name>` | Web app folder name when multiple exist |
|
|
100
|
+
|
|
101
|
+
For all options: `node setup-cli.mjs --help`.
|
|
102
|
+
|
|
79
103
|
## Configure Your Salesforce DX Project
|
|
80
104
|
|
|
81
105
|
The `sfdx-project.json` file contains useful configuration information for your project. See [Salesforce DX Project Configuration](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm) in the _Salesforce DX Developer Guide_ for details about this file.
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"referenceId": "ImageRef12"
|
|
139
139
|
},
|
|
140
140
|
"Name": "Beverly Hills Estate Primary",
|
|
141
|
-
"Property__c": "@
|
|
141
|
+
"Property__c": "@PropertyRef10",
|
|
142
142
|
"Image_URL__c": "https://images.unsplash.com/photo-1613490493576-7fde63acd811?w=800&h=600&fit=crop",
|
|
143
143
|
"Image_Type__c": "Primary",
|
|
144
144
|
"Display_Order__c": 1,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Updates unique fields in data JSON files so "sf data import tree" can be run
|
|
4
|
+
* repeatedly (e.g. after org already has data). Run before: node prepare-import-unique-fields.js
|
|
5
|
+
*/
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const dataDir = __dirname;
|
|
9
|
+
const runId = Date.now();
|
|
10
|
+
const runSuffix2 = String(runId % 100).padStart(2, "0"); // 00-99 for Company_Code__c (10-char limit)
|
|
11
|
+
|
|
12
|
+
// Contact: Email + LastName — unique so re-runs don't hit DUPLICATES_DETECTED (matching may use name)
|
|
13
|
+
const contactPath = path.join(dataDir, "Contact.json");
|
|
14
|
+
let contact = JSON.parse(fs.readFileSync(contactPath, "utf8"));
|
|
15
|
+
contact.records.forEach((r, i) => {
|
|
16
|
+
if (r.Email && r.Email.includes("@"))
|
|
17
|
+
r.Email = r.Email.replace(/\+[0-9]+@/, "@").replace("@", "+" + runId + "@");
|
|
18
|
+
if (r.LastName)
|
|
19
|
+
r.LastName = r.LastName.replace(/\s*\[[0-9-]+\]$/, "") + " [" + runId + "-" + i + "]";
|
|
20
|
+
});
|
|
21
|
+
fs.writeFileSync(contactPath, JSON.stringify(contact, null, 2));
|
|
22
|
+
|
|
23
|
+
// Agent__c: License_Number__c — strip any existing suffix and add run id + index (each record must be unique)
|
|
24
|
+
const agentPath = path.join(dataDir, "Agent__c.json");
|
|
25
|
+
let agent = JSON.parse(fs.readFileSync(agentPath, "utf8"));
|
|
26
|
+
agent.records.forEach((r, i) => {
|
|
27
|
+
if (r.License_Number__c)
|
|
28
|
+
r.License_Number__c =
|
|
29
|
+
r.License_Number__c.replace(/-[0-9]+(-[0-9]+)?$/, "") + "-" + runId + "-" + i;
|
|
30
|
+
});
|
|
31
|
+
fs.writeFileSync(agentPath, JSON.stringify(agent, null, 2));
|
|
32
|
+
|
|
33
|
+
// Property_Management_Company__c: Company_Code__c — max 10 chars, use 8-char base + 2-digit suffix
|
|
34
|
+
const companyPath = path.join(dataDir, "Property_Management_Company__c.json");
|
|
35
|
+
let company = JSON.parse(fs.readFileSync(companyPath, "utf8"));
|
|
36
|
+
company.records.forEach((r) => {
|
|
37
|
+
if (r.Company_Code__c) r.Company_Code__c = r.Company_Code__c.slice(0, 8) + runSuffix2; // 8-char base + 2-digit = 10 chars max
|
|
38
|
+
});
|
|
39
|
+
fs.writeFileSync(companyPath, JSON.stringify(company, null, 2));
|
|
40
|
+
|
|
41
|
+
// Property_Owner__c: Email__c — add +runId before @
|
|
42
|
+
const ownerPath = path.join(dataDir, "Property_Owner__c.json");
|
|
43
|
+
let owner = JSON.parse(fs.readFileSync(ownerPath, "utf8"));
|
|
44
|
+
owner.records.forEach((r) => {
|
|
45
|
+
if (r.Email__c && r.Email__c.includes("@"))
|
|
46
|
+
r.Email__c = r.Email__c.replace(/\+[0-9]+@/, "@").replace("@", "+" + runId + "@");
|
|
47
|
+
});
|
|
48
|
+
fs.writeFileSync(ownerPath, JSON.stringify(owner, null, 2));
|
|
49
|
+
|
|
50
|
+
// Remap @TenantRefN in dependent files to only use refs that exist in Tenant__c.json (fix UnresolvableRefsError)
|
|
51
|
+
const tenantPath = path.join(dataDir, "Tenant__c.json");
|
|
52
|
+
const tenantData = JSON.parse(fs.readFileSync(tenantPath, "utf8"));
|
|
53
|
+
const validTenantRefs = tenantData.records.map((r) => r.attributes?.referenceId).filter(Boolean);
|
|
54
|
+
if (validTenantRefs.length === 0) throw new Error("Tenant__c.json has no referenceIds");
|
|
55
|
+
|
|
56
|
+
function remapTenantRef(refValue) {
|
|
57
|
+
if (typeof refValue !== "string" || !refValue.startsWith("@TenantRef")) return refValue;
|
|
58
|
+
const match = refValue.match(/^@(TenantRef)(\d+)$/);
|
|
59
|
+
if (!match) return refValue;
|
|
60
|
+
const n = parseInt(match[2], 10);
|
|
61
|
+
const idx = (n - 1) % validTenantRefs.length;
|
|
62
|
+
return "@" + validTenantRefs[idx];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const leasePath = path.join(dataDir, "Lease__c.json");
|
|
66
|
+
let lease = JSON.parse(fs.readFileSync(leasePath, "utf8"));
|
|
67
|
+
lease.records.forEach((r) => {
|
|
68
|
+
if (r.Tenant__c) r.Tenant__c = remapTenantRef(r.Tenant__c);
|
|
69
|
+
});
|
|
70
|
+
fs.writeFileSync(leasePath, JSON.stringify(lease, null, 2));
|
|
71
|
+
|
|
72
|
+
const maintPath = path.join(dataDir, "Maintenance_Request__c.json");
|
|
73
|
+
let maint = JSON.parse(fs.readFileSync(maintPath, "utf8"));
|
|
74
|
+
maint.records.forEach((r) => {
|
|
75
|
+
if (r.User__c && String(r.User__c).startsWith("@TenantRef"))
|
|
76
|
+
r.User__c = remapTenantRef(r.User__c);
|
|
77
|
+
});
|
|
78
|
+
fs.writeFileSync(maintPath, JSON.stringify(maint, null, 2));
|
|
79
|
+
|
|
80
|
+
console.log(
|
|
81
|
+
"Unique fields updated: runId=%s companySuffix=%s validTenants=%s",
|
|
82
|
+
runId,
|
|
83
|
+
runSuffix2,
|
|
84
|
+
validTenantRefs.length,
|
|
85
|
+
);
|
package/dist/force-app/main/default/permissionsets/Property_Management_Access.permissionset-meta.xml
CHANGED
|
@@ -367,43 +367,36 @@
|
|
|
367
367
|
<field>Agent__c.License_Number__c</field>
|
|
368
368
|
<readable>true</readable>
|
|
369
369
|
</fieldPermissions>
|
|
370
|
-
|
|
371
370
|
<fieldPermissions>
|
|
372
371
|
<editable>true</editable>
|
|
373
372
|
<field>Agent__c.License_Expiry__c</field>
|
|
374
373
|
<readable>true</readable>
|
|
375
374
|
</fieldPermissions>
|
|
376
|
-
|
|
377
375
|
<fieldPermissions>
|
|
378
376
|
<editable>true</editable>
|
|
379
377
|
<field>Agent__c.Agent_Type__c</field>
|
|
380
378
|
<readable>true</readable>
|
|
381
379
|
</fieldPermissions>
|
|
382
|
-
|
|
383
380
|
<fieldPermissions>
|
|
384
381
|
<editable>true</editable>
|
|
385
382
|
<field>Agent__c.Territory__c</field>
|
|
386
383
|
<readable>true</readable>
|
|
387
384
|
</fieldPermissions>
|
|
388
|
-
|
|
389
385
|
<fieldPermissions>
|
|
390
386
|
<editable>true</editable>
|
|
391
387
|
<field>Agent__c.Emergency_Alt__c</field>
|
|
392
388
|
<readable>true</readable>
|
|
393
389
|
</fieldPermissions>
|
|
394
|
-
|
|
395
390
|
<fieldPermissions>
|
|
396
391
|
<editable>true</editable>
|
|
397
392
|
<field>Agent__c.Language__c</field>
|
|
398
393
|
<readable>true</readable>
|
|
399
394
|
</fieldPermissions>
|
|
400
|
-
|
|
401
395
|
<fieldPermissions>
|
|
402
396
|
<editable>true</editable>
|
|
403
397
|
<field>Agent__c.Availability__c</field>
|
|
404
398
|
<readable>true</readable>
|
|
405
399
|
</fieldPermissions>
|
|
406
|
-
|
|
407
400
|
<fieldPermissions>
|
|
408
401
|
<editable>true</editable>
|
|
409
402
|
<field>Agent__c.Office_Location__c</field>
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
8
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
9
|
+
<link
|
|
10
|
+
href="https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700&display=swap"
|
|
11
|
+
rel="stylesheet"
|
|
12
|
+
/>
|
|
7
13
|
<title>ZENLEASE</title>
|
|
8
14
|
</head>
|
|
9
15
|
<body>
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"graphql:schema": "node scripts/get-graphql-schema.mjs"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@salesforce/sdk-data": "^1.
|
|
19
|
-
"@salesforce/webapp-experimental": "^1.
|
|
18
|
+
"@salesforce/sdk-data": "^1.85.0",
|
|
19
|
+
"@salesforce/webapp-experimental": "^1.85.0",
|
|
20
20
|
"@tailwindcss/vite": "^4.1.17",
|
|
21
21
|
"@tanstack/react-form": "^1.28.4",
|
|
22
22
|
"@types/leaflet": "^1.9.21",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@graphql-eslint/eslint-plugin": "^4.1.0",
|
|
44
44
|
"@graphql-tools/utils": "^11.0.0",
|
|
45
45
|
"@playwright/test": "^1.49.0",
|
|
46
|
-
"@salesforce/vite-plugin-webapp-experimental": "^1.
|
|
46
|
+
"@salesforce/vite-plugin-webapp-experimental": "^1.85.0",
|
|
47
47
|
"@testing-library/jest-dom": "^6.6.3",
|
|
48
48
|
"@testing-library/react": "^16.1.0",
|
|
49
49
|
"@testing-library/user-event": "^14.5.2",
|
package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/applicationApi.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create Application__c (property application) record via Salesforce UI API.
|
|
3
|
-
* Uses only fields that exist in
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Uses only fields that exist in the shared schema (Property__c, Status__c, Start_Date__c,
|
|
4
|
+
* Employment__c, References__c). Applicant contact details are stored in
|
|
5
|
+
* Employment__c so no data is lost if custom contact fields aren’t deployed.
|
|
6
6
|
*/
|
|
7
7
|
import { createRecord } from "@salesforce/webapp-experimental/api";
|
|
8
8
|
|
|
@@ -17,11 +17,11 @@ export interface ApplicationRecordInput {
|
|
|
17
17
|
Phone__c?: string | null;
|
|
18
18
|
Start_Date__c?: string | null;
|
|
19
19
|
Preferred_Term__c?: string | null;
|
|
20
|
-
|
|
20
|
+
Employment__c?: string | null;
|
|
21
21
|
References__c?: string | null;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
function buildEmploymentBlob(input: ApplicationRecordInput): string {
|
|
25
25
|
const lines: string[] = [];
|
|
26
26
|
const contact = [
|
|
27
27
|
input.First_Name__c,
|
|
@@ -33,13 +33,13 @@ function buildEmploymentInfoBlob(input: ApplicationRecordInput): string {
|
|
|
33
33
|
.filter(Boolean)
|
|
34
34
|
.join(", ");
|
|
35
35
|
if (contact) lines.push(`Contact: ${contact}`);
|
|
36
|
-
if (input.
|
|
36
|
+
if (input.Employment__c?.trim()) lines.push(input.Employment__c.trim());
|
|
37
37
|
return lines.join("\n\n") || "";
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Creates an Application__c record. Uses only core fields to avoid POST_BODY_PARSE_ERROR
|
|
42
|
-
* when custom contact fields are not yet in the org. Contact + employment text go into
|
|
42
|
+
* when custom contact fields are not yet in the org. Contact + employment text go into Employment__c.
|
|
43
43
|
*/
|
|
44
44
|
export async function createApplicationRecord(
|
|
45
45
|
input: ApplicationRecordInput,
|
|
@@ -55,9 +55,9 @@ export async function createApplicationRecord(
|
|
|
55
55
|
if (input.Start_Date__c != null && input.Start_Date__c !== "") {
|
|
56
56
|
fields.Start_Date__c = input.Start_Date__c;
|
|
57
57
|
}
|
|
58
|
-
const employmentBlob =
|
|
58
|
+
const employmentBlob = buildEmploymentBlob(input);
|
|
59
59
|
if (employmentBlob) {
|
|
60
|
-
fields.
|
|
60
|
+
fields.Employment__c = employmentBlob;
|
|
61
61
|
}
|
|
62
62
|
if (input.References__c != null && input.References__c !== "") {
|
|
63
63
|
fields.References__c = input.References__c;
|