@salesforce/ui-bundle-template-app-react-sample-b2e 12.6.3-canary.999.2.1.gd0b2ab15 → 12.7.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/CHANGELOG.md +9 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/package.json +6 -6
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/graphql-operations-types.ts +1 -2
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/appLayout.tsx +30 -5
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/applications/ApplicationDetailsModal.tsx +4 -1
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/dashboard/GlobalSearchBar.tsx +1 -1
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/dashboard/IssuesDonutChart.tsx +2 -2
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/dashboard/MaintenanceTable.tsx +72 -70
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/layout/TopBar.tsx +4 -1
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/layout/VerticalNav.tsx +61 -14
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/maintenanceRequests/MaintenanceDetailsModal.tsx +4 -1
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/ui/button.tsx +2 -2
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/ui/checkbox.tsx +1 -1
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/ui/input.tsx +1 -1
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/ui/select.tsx +1 -1
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/adapters/sobject/parseResponse.ts +1 -2
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/api/distinctValuesService.ts +3 -6
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/MergedSearchResults.tsx +2 -2
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/SourceSection.tsx +1 -1
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/__tests__/MergedSearchResults.test.tsx +21 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/types.ts +1 -3
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/pages/Home.tsx +45 -32
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/styles/global.css +2 -2
- package/dist/package-lock.json +2 -2
- package/dist/package.json +1 -1
- package/dist/scripts/network-senders.mjs +84 -0
- package/dist/scripts/org-setup-xml.mjs +11 -6
- package/dist/scripts/org-setup.mjs +13 -5
- package/package.json +4 -4
- package/dist/LICENSE.txt +0 -82
package/dist/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
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
|
+
## [12.7.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.6.3...v12.7.0) (2026-09-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **template-sfdx-project:** preserve target network sender addresses @W-24209513@ ([#993](https://github.com/salesforce-experience-platform-emu/webapps/issues/993)) ([fddbfdd](https://github.com/salesforce-experience-platform-emu/webapps/commit/fddbfddcb41270720372b0fd4c486f043d9ba8c5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [12.6.3](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.6.2...v12.6.3) (2026-09-14)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"graphql:schema": "node scripts/get-graphql-schema.mjs"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@salesforce/platform-sdk": "^12.
|
|
23
|
-
"@salesforce/ui-bundle": "^12.
|
|
22
|
+
"@salesforce/platform-sdk": "^12.7.0",
|
|
23
|
+
"@salesforce/ui-bundle": "^12.7.0",
|
|
24
24
|
"@tailwindcss/vite": "^4.1.17",
|
|
25
25
|
"class-variance-authority": "^0.7.1",
|
|
26
26
|
"clsx": "^2.1.1",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@graphql-eslint/eslint-plugin": "^4.1.0",
|
|
48
48
|
"@graphql-tools/utils": "^11.0.0",
|
|
49
49
|
"@playwright/test": "^1.49.0",
|
|
50
|
-
"@salesforce/graphiti": "^12.
|
|
51
|
-
"@salesforce/vite-plugin-ui-bundle": "^12.
|
|
50
|
+
"@salesforce/graphiti": "^12.7.0",
|
|
51
|
+
"@salesforce/vite-plugin-ui-bundle": "^12.7.0",
|
|
52
52
|
"@testing-library/jest-dom": "^6.6.3",
|
|
53
53
|
"@testing-library/react": "^16.1.0",
|
|
54
54
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@types/react": "^19.2.5",
|
|
57
57
|
"@types/react-dom": "^19.2.3",
|
|
58
58
|
"@vitejs/plugin-react": "^5.1.1",
|
|
59
|
-
"@vitest/ui": "^4.1.
|
|
59
|
+
"@vitest/ui": "^4.1.11",
|
|
60
60
|
"eslint": "^9.39.1",
|
|
61
61
|
"eslint-plugin-react": "^7.37.2",
|
|
62
62
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"typescript-eslint": "^8.46.4",
|
|
72
72
|
"vite": "^7.2.4",
|
|
73
73
|
"vite-plugin-graphql-codegen": "^3.6.3",
|
|
74
|
-
"vitest": "^4.1.
|
|
74
|
+
"vitest": "^4.1.11"
|
|
75
75
|
},
|
|
76
76
|
"overrides": {
|
|
77
77
|
"lodash": "^4.18.1",
|
|
@@ -7,8 +7,7 @@ export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> =
|
|
|
7
7
|
[_ in K]?: never;
|
|
8
8
|
};
|
|
9
9
|
export type Incremental<T> =
|
|
10
|
-
| T
|
|
11
|
-
| { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never };
|
|
10
|
+
T | { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never };
|
|
12
11
|
/** All built-in and custom scalars, mapped to their actual values */
|
|
13
12
|
export type Scalars = {
|
|
14
13
|
ID: { input: string; output: string };
|
|
@@ -1,12 +1,37 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { Outlet } from "react-router";
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Outlet, useLocation, matchPath } from "react-router";
|
|
3
3
|
import { TopBar } from "./components/layout/TopBar";
|
|
4
4
|
import { VerticalNav } from "./components/layout/VerticalNav";
|
|
5
5
|
import { AgentforceConversationClient } from "./components/AgentforceConversationClient";
|
|
6
|
+
import { LIST_PAGE_ROUTES, PATHS } from "./lib/routeConfig";
|
|
6
7
|
import { Toaster } from "./components/ui/sonner";
|
|
7
8
|
|
|
9
|
+
const PAGE_TITLES = [
|
|
10
|
+
{ path: PATHS.HOME, label: "Dashboard" },
|
|
11
|
+
{ path: PATHS.SEARCH, label: "Search" },
|
|
12
|
+
...Object.values(LIST_PAGE_ROUTES),
|
|
13
|
+
];
|
|
14
|
+
|
|
8
15
|
export default function AppLayout() {
|
|
9
16
|
const [isNavOpen, setIsNavOpen] = useState(false);
|
|
17
|
+
const closeNav = useCallback(() => setIsNavOpen(false), []);
|
|
18
|
+
const location = useLocation();
|
|
19
|
+
const mainRef = useRef<HTMLElement>(null);
|
|
20
|
+
const previousPathname = useRef<string | null>(null);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const title = PAGE_TITLES.find((page) => matchPath(page.path, location.pathname))?.label;
|
|
24
|
+
document.title = `${title ?? "Page Not Found"} · ZENLEASE`;
|
|
25
|
+
if (previousPathname.current !== null && previousPathname.current !== location.pathname) {
|
|
26
|
+
const main = mainRef.current;
|
|
27
|
+
const target = main?.querySelector<HTMLElement>("h1") ?? main;
|
|
28
|
+
if (target) {
|
|
29
|
+
if (!target.hasAttribute("tabindex")) target.setAttribute("tabindex", "-1");
|
|
30
|
+
target.focus();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
previousPathname.current = location.pathname;
|
|
34
|
+
}, [location.pathname]);
|
|
10
35
|
|
|
11
36
|
return (
|
|
12
37
|
<div className="flex flex-col">
|
|
@@ -18,15 +43,15 @@ export default function AppLayout() {
|
|
|
18
43
|
Skip to main content
|
|
19
44
|
</a>
|
|
20
45
|
{/* Top Bar */}
|
|
21
|
-
<TopBar onMenuClick={() => setIsNavOpen(true)} />
|
|
46
|
+
<TopBar isOpen={isNavOpen} onMenuClick={() => setIsNavOpen(true)} />
|
|
22
47
|
|
|
23
48
|
{/* Main Content Area with Sidebar */}
|
|
24
49
|
<div className="flex flex-1 overflow-hidden">
|
|
25
50
|
{/* Vertical Navigation */}
|
|
26
|
-
<VerticalNav isOpen={isNavOpen} onClose={
|
|
51
|
+
<VerticalNav isOpen={isNavOpen} onClose={closeNav} />
|
|
27
52
|
|
|
28
53
|
{/* Page Content */}
|
|
29
|
-
<main id="main-content" className="flex-1 overflow-auto">
|
|
54
|
+
<main id="main-content" ref={mainRef} className="flex-1 overflow-auto">
|
|
30
55
|
<Outlet />
|
|
31
56
|
</main>
|
|
32
57
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useRef } from "react";
|
|
2
2
|
import {
|
|
3
3
|
Dialog,
|
|
4
4
|
DialogContent,
|
|
@@ -25,6 +25,7 @@ export const ApplicationDetailsModal: React.FC<ApplicationDetailsModalProps> = (
|
|
|
25
25
|
const status = application.Status__c?.value || "Unknown";
|
|
26
26
|
const [selectedStatus, setSelectedStatus] = useState(status);
|
|
27
27
|
const [isSaving, setIsSaving] = useState(false);
|
|
28
|
+
const statusSelectRef = useRef<HTMLSelectElement>(null);
|
|
28
29
|
|
|
29
30
|
const isStatusEditable =
|
|
30
31
|
status.toLowerCase() !== "approved" && status.toLowerCase() !== "rejected";
|
|
@@ -40,6 +41,7 @@ export const ApplicationDetailsModal: React.FC<ApplicationDetailsModalProps> = (
|
|
|
40
41
|
onClose();
|
|
41
42
|
} catch (error) {
|
|
42
43
|
console.error("Error saving status:", error);
|
|
44
|
+
statusSelectRef.current?.focus();
|
|
43
45
|
} finally {
|
|
44
46
|
setIsSaving(false);
|
|
45
47
|
}
|
|
@@ -100,6 +102,7 @@ export const ApplicationDetailsModal: React.FC<ApplicationDetailsModalProps> = (
|
|
|
100
102
|
</h3>
|
|
101
103
|
{isStatusEditable ? (
|
|
102
104
|
<select
|
|
105
|
+
ref={statusSelectRef}
|
|
103
106
|
value={selectedStatus}
|
|
104
107
|
onChange={(e) => setSelectedStatus(e.target.value)}
|
|
105
108
|
aria-label="Application status"
|
|
@@ -75,7 +75,7 @@ export function GlobalSearchBar({
|
|
|
75
75
|
value={searchQuery}
|
|
76
76
|
onChange={(e) => onSearchQueryChange(e.target.value)}
|
|
77
77
|
onKeyDown={handleKeyDown}
|
|
78
|
-
className="flex-1 outline-none text-gray-600 bg-transparent min-w-0"
|
|
78
|
+
className="flex-1 outline-none focus-visible:ring-2 focus-visible:ring-gray-600 rounded-sm text-gray-600 placeholder:text-gray-600 bg-transparent min-w-0"
|
|
79
79
|
aria-label={`Search ${labelPlural}`}
|
|
80
80
|
/>
|
|
81
81
|
<button
|
|
@@ -57,9 +57,9 @@ export const IssuesDonutChart: React.FC<IssuesDonutChartProps> = ({ data, loadin
|
|
|
57
57
|
|
|
58
58
|
return (
|
|
59
59
|
<Card className="p-4 border-gray-200 shadow-sm flex flex-col relative">
|
|
60
|
-
<
|
|
60
|
+
<h2 className="text-sm font-medium text-primary-purple mb-2 uppercase tracking-wide">
|
|
61
61
|
Top Maintenance Issues
|
|
62
|
-
</
|
|
62
|
+
</h2>
|
|
63
63
|
{loading ? (
|
|
64
64
|
<>
|
|
65
65
|
<div className="flex items-center justify-center" style={{ height: 300 }}>
|
|
@@ -50,80 +50,82 @@ export const MaintenanceTable: React.FC<MaintenanceTableProps> = ({ requests, lo
|
|
|
50
50
|
See All
|
|
51
51
|
</Button>
|
|
52
52
|
</div>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
53
|
+
{!loading && requests.length === 0 ? (
|
|
54
|
+
<p className="text-center py-8 text-gray-500">No maintenance requests</p>
|
|
55
|
+
) : (
|
|
56
|
+
<ul role="list" aria-hidden={loading || undefined} className="space-y-4">
|
|
57
|
+
{loading
|
|
58
|
+
? Array.from({ length: 5 }, (_, i) => (
|
|
59
|
+
<li key={i} className="flex items-center p-4 bg-gray-50 rounded-lg">
|
|
60
|
+
<Skeleton className="w-12 h-12 rounded-lg shrink-0" />
|
|
61
|
+
<div className="ml-4 w-64 shrink-0 space-y-2">
|
|
62
|
+
<Skeleton className="h-4 w-40" />
|
|
63
|
+
<Skeleton className="h-3 w-32" />
|
|
64
|
+
</div>
|
|
65
|
+
<div className="ml-4 w-80 shrink-0">
|
|
66
|
+
<Skeleton className="h-3 w-56" />
|
|
67
|
+
</div>
|
|
68
|
+
<div className="ml-4 w-48 shrink-0 flex items-center gap-2">
|
|
69
|
+
<Skeleton className="w-8 h-8 rounded-full shrink-0" />
|
|
70
|
+
<Skeleton className="h-4 w-24" />
|
|
71
|
+
</div>
|
|
72
|
+
</li>
|
|
73
|
+
))
|
|
74
|
+
: requests.slice(0, 5).map((request) => {
|
|
75
|
+
const issueType = request.Type__c?.value || "General";
|
|
76
|
+
const propertyAddress = request.Property__r?.Address__c?.value || "Unknown Address";
|
|
77
|
+
const description = request.Description__c?.value || "";
|
|
78
|
+
const tenantName = request.User__r?.Name?.value || "Unknown";
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
return (
|
|
81
|
+
<li
|
|
82
|
+
key={request.Id}
|
|
83
|
+
className="flex items-center p-4 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors"
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
className={`flex items-center justify-center w-12 h-12 ${issueIconColors[issueType] || "bg-purple-100"} rounded-lg flex-shrink-0`}
|
|
87
|
+
>
|
|
88
|
+
{issueIcons[issueType] ? (
|
|
89
|
+
<img src={issueIcons[issueType]} alt="" className="w-6 h-6" />
|
|
90
|
+
) : (
|
|
91
|
+
<span className="text-2xl">🔧</span>
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
<div className="ml-4 w-64 flex-shrink-0">
|
|
96
|
+
<div className="flex items-center gap-2 mb-1">
|
|
97
|
+
<h3 className="font-semibold text-gray-900">{issueType}</h3>
|
|
98
|
+
<span className="text-gray-500">|</span>
|
|
99
|
+
<span className="text-sm text-gray-600 truncate">
|
|
100
|
+
{propertyAddress.split(",")[0]}
|
|
101
|
+
</span>
|
|
102
|
+
</div>
|
|
103
|
+
<p className="text-sm text-gray-500">
|
|
104
|
+
Request ID: {request.Id.substring(0, 8)}...
|
|
105
|
+
</p>
|
|
106
|
+
</div>
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
<div className="ml-4 w-80 flex-shrink-0">
|
|
109
|
+
<p className="text-sm text-gray-700 truncate">
|
|
110
|
+
{description || "No description"}
|
|
111
|
+
</p>
|
|
112
|
+
</div>
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
<div className="ml-4 w-48 flex-shrink-0 flex items-center gap-2">
|
|
115
|
+
<div className="w-8 h-8 bg-gray-300 rounded-full flex items-center justify-center flex-shrink-0">
|
|
116
|
+
<span className="text-sm font-medium text-gray-700">
|
|
117
|
+
{tenantName.charAt(0) || "?"}
|
|
118
|
+
</span>
|
|
119
|
+
</div>
|
|
120
|
+
<span className="text-sm text-gray-700 font-medium truncate">
|
|
121
|
+
{tenantName}
|
|
122
|
+
</span>
|
|
123
|
+
</div>
|
|
124
|
+
</li>
|
|
125
|
+
);
|
|
126
|
+
})}
|
|
127
|
+
</ul>
|
|
128
|
+
)}
|
|
127
129
|
</Card>
|
|
128
130
|
);
|
|
129
131
|
};
|
package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/layout/TopBar.tsx
CHANGED
|
@@ -5,9 +5,10 @@ import { getUserInfo } from "../../api/dashboard/dashboard";
|
|
|
5
5
|
|
|
6
6
|
interface TopBarProps {
|
|
7
7
|
onMenuClick?: () => void;
|
|
8
|
+
isOpen?: boolean;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export const TopBar: React.FC<TopBarProps> = ({ onMenuClick }) => {
|
|
11
|
+
export const TopBar: React.FC<TopBarProps> = ({ onMenuClick, isOpen = false }) => {
|
|
11
12
|
const [userName, setUserName] = useState<string>("User");
|
|
12
13
|
|
|
13
14
|
useEffect(() => {
|
|
@@ -27,6 +28,8 @@ export const TopBar: React.FC<TopBarProps> = ({ onMenuClick }) => {
|
|
|
27
28
|
onClick={onMenuClick}
|
|
28
29
|
className="p-2 hover:bg-purple-700 rounded-md transition-colors md:hidden"
|
|
29
30
|
aria-label="Toggle menu"
|
|
31
|
+
aria-expanded={isOpen}
|
|
32
|
+
aria-controls={isOpen ? "mobile-nav" : undefined}
|
|
30
33
|
>
|
|
31
34
|
<Menu className="w-6 h-6" />
|
|
32
35
|
</button>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Dialog } from "radix-ui";
|
|
2
|
+
import React, { useRef } from "react";
|
|
2
3
|
import { Link, useLocation } from "react-router";
|
|
3
|
-
import { Search as SearchIcon } from "lucide-react";
|
|
4
|
+
import { Search as SearchIcon, X } from "lucide-react";
|
|
4
5
|
import dashboardIcon from "../../assets/icons/dashboard.svg";
|
|
5
6
|
import filesIcon from "../../assets/icons/files.svg";
|
|
6
7
|
import propertiesIcon from "../../assets/icons/properties.svg";
|
|
@@ -31,6 +32,10 @@ interface VerticalNavProps {
|
|
|
31
32
|
|
|
32
33
|
export const VerticalNav: React.FC<VerticalNavProps> = ({ isOpen = false, onClose }) => {
|
|
33
34
|
const location = useLocation();
|
|
35
|
+
const mobileNavRef = useRef<HTMLElement>(null);
|
|
36
|
+
|
|
37
|
+
const triggerRef = useRef<HTMLElement | null>(null);
|
|
38
|
+
const navigatingRef = useRef(false);
|
|
34
39
|
|
|
35
40
|
const isActive = (path: string) => {
|
|
36
41
|
if (path === "/") {
|
|
@@ -46,7 +51,19 @@ export const VerticalNav: React.FC<VerticalNavProps> = ({ isOpen = false, onClos
|
|
|
46
51
|
<Link
|
|
47
52
|
key={item.path}
|
|
48
53
|
to={item.path}
|
|
49
|
-
onClick={
|
|
54
|
+
onClick={
|
|
55
|
+
handleClick
|
|
56
|
+
? (event) => {
|
|
57
|
+
navigatingRef.current =
|
|
58
|
+
item.path !== location.pathname &&
|
|
59
|
+
!event.metaKey &&
|
|
60
|
+
!event.ctrlKey &&
|
|
61
|
+
!event.shiftKey &&
|
|
62
|
+
!event.altKey;
|
|
63
|
+
handleClick();
|
|
64
|
+
}
|
|
65
|
+
: undefined
|
|
66
|
+
}
|
|
50
67
|
aria-current={isActive(item.path) ? "page" : undefined}
|
|
51
68
|
className={`flex flex-col items-center justify-center gap-2 py-4 px-2 transition-colors ${
|
|
52
69
|
isActive(item.path)
|
|
@@ -75,18 +92,48 @@ export const VerticalNav: React.FC<VerticalNavProps> = ({ isOpen = false, onClos
|
|
|
75
92
|
{navContent()}
|
|
76
93
|
</nav>
|
|
77
94
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
<Dialog.Root
|
|
96
|
+
open={isOpen}
|
|
97
|
+
onOpenChange={(open) => {
|
|
98
|
+
if (!open) onClose?.();
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
<Dialog.Portal>
|
|
102
|
+
<Dialog.Overlay className="fixed inset-0 z-40 bg-black/50" />
|
|
103
|
+
<Dialog.Content
|
|
104
|
+
aria-describedby={undefined}
|
|
105
|
+
className="fixed inset-y-0 left-0 z-50 w-24 overflow-y-auto border-r border-gray-200 bg-white py-4"
|
|
106
|
+
onOpenAutoFocus={(event) => {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
triggerRef.current =
|
|
109
|
+
document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
110
|
+
navigatingRef.current = false;
|
|
111
|
+
mobileNavRef.current?.focus();
|
|
112
|
+
}}
|
|
113
|
+
onCloseAutoFocus={(event) => {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
if (!navigatingRef.current) triggerRef.current?.focus();
|
|
116
|
+
}}
|
|
85
117
|
>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
118
|
+
<Dialog.Title className="sr-only">Navigation menu</Dialog.Title>
|
|
119
|
+
<Dialog.Close
|
|
120
|
+
className="mx-auto mb-2 flex size-11 items-center justify-center rounded-md text-gray-600 focus-visible:outline-2 focus-visible:outline-offset-2"
|
|
121
|
+
aria-label="Close navigation"
|
|
122
|
+
>
|
|
123
|
+
<X className="size-5" aria-hidden />
|
|
124
|
+
</Dialog.Close>
|
|
125
|
+
<nav
|
|
126
|
+
id="mobile-nav"
|
|
127
|
+
ref={mobileNavRef}
|
|
128
|
+
tabIndex={-1}
|
|
129
|
+
aria-label="Main menu"
|
|
130
|
+
className="flex flex-col gap-4 outline-none"
|
|
131
|
+
>
|
|
132
|
+
{navContent(onClose)}
|
|
133
|
+
</nav>
|
|
134
|
+
</Dialog.Content>
|
|
135
|
+
</Dialog.Portal>
|
|
136
|
+
</Dialog.Root>
|
|
90
137
|
</>
|
|
91
138
|
);
|
|
92
139
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useRef } from "react";
|
|
2
2
|
import {
|
|
3
3
|
Dialog,
|
|
4
4
|
DialogContent,
|
|
@@ -37,6 +37,7 @@ export const MaintenanceDetailsModal: React.FC<MaintenanceDetailsModalProps> = (
|
|
|
37
37
|
const status = request.Status__c?.value || "New";
|
|
38
38
|
const [selectedStatus, setSelectedStatus] = useState(status);
|
|
39
39
|
const [isSaving, setIsSaving] = useState(false);
|
|
40
|
+
const statusSelectRef = useRef<HTMLSelectElement>(null);
|
|
40
41
|
|
|
41
42
|
// Determine if status is editable
|
|
42
43
|
// All statuses except Resolved can be edited
|
|
@@ -54,6 +55,7 @@ export const MaintenanceDetailsModal: React.FC<MaintenanceDetailsModalProps> = (
|
|
|
54
55
|
onClose();
|
|
55
56
|
} catch (error) {
|
|
56
57
|
console.error("Error saving status:", error);
|
|
58
|
+
statusSelectRef.current?.focus();
|
|
57
59
|
} finally {
|
|
58
60
|
setIsSaving(false);
|
|
59
61
|
}
|
|
@@ -133,6 +135,7 @@ export const MaintenanceDetailsModal: React.FC<MaintenanceDetailsModalProps> = (
|
|
|
133
135
|
</h3>
|
|
134
136
|
{isStatusEditable ? (
|
|
135
137
|
<select
|
|
138
|
+
ref={statusSelectRef}
|
|
136
139
|
value={selectedStatus}
|
|
137
140
|
onChange={(e) => setSelectedStatus(e.target.value)}
|
|
138
141
|
aria-label="Maintenance request status"
|
package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/ui/button.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { Slot } from 'radix-ui';
|
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
6
|
|
|
7
7
|
const buttonVariants = cva(
|
|
8
|
-
"focus-visible:border-ring focus-visible:ring-ring
|
|
8
|
+
"focus-visible:border-ring focus-visible:ring-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
@@ -17,7 +17,7 @@ const buttonVariants = cva(
|
|
|
17
17
|
ghost:
|
|
18
18
|
'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',
|
|
19
19
|
destructive:
|
|
20
|
-
'bg-destructive/10 hover:bg-destructive/20
|
|
20
|
+
'bg-destructive/10 hover:bg-destructive/20 dark:bg-destructive/20 text-red-700 dark:text-destructive dark:hover:bg-destructive/30',
|
|
21
21
|
link: 'text-primary underline-offset-4 hover:underline',
|
|
22
22
|
},
|
|
23
23
|
size: {
|
package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/ui/checkbox.tsx
CHANGED
|
@@ -14,7 +14,7 @@ function Checkbox({
|
|
|
14
14
|
<CheckboxPrimitive.Root
|
|
15
15
|
data-slot="checkbox"
|
|
16
16
|
className={cn(
|
|
17
|
-
'border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring
|
|
17
|
+
'border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[4px] border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 aria-invalid:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50',
|
|
18
18
|
className
|
|
19
19
|
)}
|
|
20
20
|
{...props}
|
package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/ui/input.tsx
CHANGED
|
@@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
|
|
8
8
|
type={type}
|
|
9
9
|
data-slot="input"
|
|
10
10
|
className={cn(
|
|
11
|
-
'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring
|
|
11
|
+
'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground placeholder:italic w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
12
12
|
className
|
|
13
13
|
)}
|
|
14
14
|
{...props}
|
package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/ui/select.tsx
CHANGED
|
@@ -42,7 +42,7 @@ function SelectTrigger({
|
|
|
42
42
|
data-slot="select-trigger"
|
|
43
43
|
data-size={size}
|
|
44
44
|
className={cn(
|
|
45
|
-
"border-input data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring
|
|
45
|
+
"border-input data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-3 aria-invalid:ring-3 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
46
46
|
className
|
|
47
47
|
)}
|
|
48
48
|
{...props}
|
|
@@ -31,8 +31,7 @@ export function parseSObjectResponse(
|
|
|
31
31
|
request: SourceRequest<SObjectSourceConfig>,
|
|
32
32
|
): SourceResult | null {
|
|
33
33
|
const queryRoot = (root?.uiapi as Record<string, unknown> | undefined)?.query as
|
|
34
|
-
|
|
35
|
-
| undefined;
|
|
34
|
+
Record<string, RawSourceResult | null | undefined> | undefined;
|
|
36
35
|
|
|
37
36
|
const raw = queryRoot?.[request.source.key];
|
|
38
37
|
if (raw == null) return null;
|
|
@@ -64,18 +64,15 @@ export async function fetchDistinctValues(
|
|
|
64
64
|
|
|
65
65
|
const root = response.data as Record<string, unknown> | undefined;
|
|
66
66
|
const aggregate = (root?.uiapi as Record<string, unknown> | undefined)?.aggregate as
|
|
67
|
-
|
|
68
|
-
| undefined;
|
|
67
|
+
Record<string, unknown> | undefined;
|
|
69
68
|
const objectAgg = aggregate?.[objectName] as
|
|
70
|
-
|
|
71
|
-
| undefined;
|
|
69
|
+
{ edges?: Array<{ node?: { aggregate?: Record<string, unknown> } }> } | undefined;
|
|
72
70
|
const edges = objectAgg?.edges ?? [];
|
|
73
71
|
|
|
74
72
|
return edges
|
|
75
73
|
.map((edge) => {
|
|
76
74
|
const field = edge?.node?.aggregate?.[fieldName] as
|
|
77
|
-
|
|
78
|
-
| undefined;
|
|
75
|
+
{ value?: string | null; displayValue?: string | null; label?: string | null } | undefined;
|
|
79
76
|
const value = field?.value;
|
|
80
77
|
if (value == null || value === "") return null;
|
|
81
78
|
return { value, label: field?.label ?? field?.displayValue ?? value };
|
|
@@ -171,14 +171,14 @@ export function MergedSearchResults({
|
|
|
171
171
|
<Skeleton key={i} className="h-48 w-full rounded-lg" />
|
|
172
172
|
))}
|
|
173
173
|
</div>
|
|
174
|
-
) : isShortQuery ? (
|
|
174
|
+
) : error ? null : isShortQuery ? (
|
|
175
175
|
<p className="py-12 text-center text-sm text-muted-foreground">{shortQueryMessage}</p>
|
|
176
176
|
) : mergedResults.length === 0 ? (
|
|
177
177
|
<p className="py-12 text-center text-sm text-muted-foreground">
|
|
178
178
|
{emptyMessage ?? "No results found."}
|
|
179
179
|
</p>
|
|
180
180
|
) : (
|
|
181
|
-
<ul className={gridClassName}>
|
|
181
|
+
<ul role="list" className={gridClassName}>
|
|
182
182
|
{mergedResults.map(({ sourceKey, node }, i) => {
|
|
183
183
|
const source = handle.sources[sourceKey]?.config;
|
|
184
184
|
if (!source) return null;
|
|
@@ -159,7 +159,7 @@ export function SourceSection({
|
|
|
159
159
|
)}
|
|
160
160
|
|
|
161
161
|
{showResults && (
|
|
162
|
-
<ul className="divide-y">
|
|
162
|
+
<ul role="list" className="divide-y">
|
|
163
163
|
{nodes.map((node, i) => (
|
|
164
164
|
<li key={getNodeKey(node, idField, i)} className="py-3">
|
|
165
165
|
{renderResult(node)}
|
|
@@ -70,6 +70,27 @@ function renderMerged(handle: SearchHandle) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
describe("<MergedSearchResults> empty vs. short-query messaging", () => {
|
|
73
|
+
it("distinguishes a failed request from a successful search with no matches", () => {
|
|
74
|
+
const { rerender } = renderMerged(makeHandle({ q: "Sunset", error: "Service unavailable" }));
|
|
75
|
+
|
|
76
|
+
expect(screen.getByRole("status")).toHaveTextContent("Search failed.");
|
|
77
|
+
expect(screen.queryByText("No results found.")).not.toBeInTheDocument();
|
|
78
|
+
|
|
79
|
+
rerender(
|
|
80
|
+
<MemoryRouter>
|
|
81
|
+
<MergedSearchResults handle={makeHandle({ q: "Sunset", loading: true })} />
|
|
82
|
+
</MemoryRouter>,
|
|
83
|
+
);
|
|
84
|
+
expect(screen.getByRole("status")).toHaveTextContent("Searching…");
|
|
85
|
+
|
|
86
|
+
rerender(
|
|
87
|
+
<MemoryRouter>
|
|
88
|
+
<MergedSearchResults handle={makeHandle({ q: "Sunset" })} />
|
|
89
|
+
</MemoryRouter>,
|
|
90
|
+
);
|
|
91
|
+
expect(screen.getAllByText("No results found.")).toHaveLength(2);
|
|
92
|
+
});
|
|
93
|
+
|
|
73
94
|
it("prompts for a longer query below MIN_QUERY_LENGTH, and reports zero matches at/above it", () => {
|
|
74
95
|
const { rerender } = renderMerged(makeHandle({ q: "ab", mergedResults: [] }));
|
|
75
96
|
|
package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/types.ts
CHANGED
|
@@ -31,9 +31,7 @@ export type { CmsSourceConfig };
|
|
|
31
31
|
* it explicitly.
|
|
32
32
|
*/
|
|
33
33
|
export type DisplayField =
|
|
34
|
-
| string
|
|
35
|
-
| { name: string; raw: true }
|
|
36
|
-
| { name: string; subfields: DisplayField[] };
|
|
34
|
+
string | { name: string; raw: true } | { name: string; subfields: DisplayField[] };
|
|
37
35
|
|
|
38
36
|
/** Configuration for one SObject source in a search experience. */
|
|
39
37
|
export interface SObjectSourceConfig {
|
|
@@ -44,6 +44,7 @@ export default function Home() {
|
|
|
44
44
|
topMaintenanceIssueCount: 0,
|
|
45
45
|
});
|
|
46
46
|
const [metricsLoading, setMetricsLoading] = useState(true);
|
|
47
|
+
const [metricsError, setMetricsError] = useState(false);
|
|
47
48
|
const [maintenanceRequests, setMaintenanceRequests] = useState<
|
|
48
49
|
NonNullable<DashboardMaintenanceNode>[]
|
|
49
50
|
>([]);
|
|
@@ -59,7 +60,10 @@ export default function Home() {
|
|
|
59
60
|
setMaintenanceRequests(rawRequests);
|
|
60
61
|
}
|
|
61
62
|
} catch (error) {
|
|
62
|
-
if (!cancelled)
|
|
63
|
+
if (!cancelled) {
|
|
64
|
+
console.error("Error loading dashboard metrics:", error);
|
|
65
|
+
setMetricsError(true);
|
|
66
|
+
}
|
|
63
67
|
} finally {
|
|
64
68
|
if (!cancelled) setMetricsLoading(false);
|
|
65
69
|
}
|
|
@@ -134,6 +138,9 @@ export default function Home() {
|
|
|
134
138
|
<PageContainer>
|
|
135
139
|
<div className="max-w-7xl mx-auto space-y-6">
|
|
136
140
|
<h1 className="sr-only">Dashboard</h1>
|
|
141
|
+
<div role="status" aria-live="polite" className="sr-only">
|
|
142
|
+
{metricsLoading ? "Loading dashboard…" : metricsError ? "" : "Dashboard loaded."}
|
|
143
|
+
</div>
|
|
137
144
|
<GlobalSearchBar
|
|
138
145
|
searchableObjects={SEARCHABLE_OBJECTS}
|
|
139
146
|
selectedObjectApiName={selectedObjectApiName}
|
|
@@ -145,41 +152,47 @@ export default function Home() {
|
|
|
145
152
|
labelPlural={labelPlural}
|
|
146
153
|
/>
|
|
147
154
|
|
|
148
|
-
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
{metricsError ? (
|
|
156
|
+
<p role="alert" className="text-destructive">
|
|
157
|
+
Unable to load dashboard data. Reload this page to try again.
|
|
158
|
+
</p>
|
|
159
|
+
) : (
|
|
160
|
+
<div className="grid grid-cols-1 lg:grid-cols-[70%_30%] gap-6">
|
|
161
|
+
<div className="space-y-6">
|
|
162
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
163
|
+
<StatCard
|
|
164
|
+
title="Total Properties"
|
|
165
|
+
loading={metricsLoading}
|
|
166
|
+
value={metrics.totalProperties}
|
|
167
|
+
trend={{ value: trends.totalProperties.trend, isPositive: true }}
|
|
168
|
+
subtitle={`Last month total ${trends.totalProperties.previous}`}
|
|
169
|
+
/>
|
|
170
|
+
<StatCard
|
|
171
|
+
title="Units Available"
|
|
172
|
+
loading={metricsLoading}
|
|
173
|
+
value={metrics.unitsAvailable}
|
|
174
|
+
trend={{ value: trends.unitsAvailable.trend, isPositive: false }}
|
|
175
|
+
subtitle={`Last month total ${trends.unitsAvailable.previous}/${metrics.totalProperties}`}
|
|
176
|
+
/>
|
|
177
|
+
<StatCard
|
|
178
|
+
title="Occupied Units"
|
|
179
|
+
loading={metricsLoading}
|
|
180
|
+
value={metrics.occupiedUnits}
|
|
181
|
+
trend={{ value: trends.occupiedUnits.trend, isPositive: true }}
|
|
182
|
+
subtitle={`Last month total ${trends.occupiedUnits.previous}`}
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
<MaintenanceTable
|
|
186
|
+
requests={maintenanceRequests}
|
|
160
187
|
loading={metricsLoading}
|
|
161
|
-
|
|
162
|
-
trend={{ value: trends.unitsAvailable.trend, isPositive: false }}
|
|
163
|
-
subtitle={`Last month total ${trends.unitsAvailable.previous}/${metrics.totalProperties}`}
|
|
164
|
-
/>
|
|
165
|
-
<StatCard
|
|
166
|
-
title="Occupied Units"
|
|
167
|
-
loading={metricsLoading}
|
|
168
|
-
value={metrics.occupiedUnits}
|
|
169
|
-
trend={{ value: trends.occupiedUnits.trend, isPositive: true }}
|
|
170
|
-
subtitle={`Last month total ${trends.occupiedUnits.previous}`}
|
|
188
|
+
onView={handleViewMaintenance}
|
|
171
189
|
/>
|
|
172
190
|
</div>
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
onView={handleViewMaintenance}
|
|
177
|
-
/>
|
|
178
|
-
</div>
|
|
179
|
-
<div>
|
|
180
|
-
<IssuesDonutChart data={chartData} loading={metricsLoading} />
|
|
191
|
+
<div>
|
|
192
|
+
<IssuesDonutChart data={chartData} loading={metricsLoading} />
|
|
193
|
+
</div>
|
|
181
194
|
</div>
|
|
182
|
-
|
|
195
|
+
)}
|
|
183
196
|
</div>
|
|
184
197
|
</PageContainer>
|
|
185
198
|
);
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
--destructive: oklch(0.577 0.245 27.325);
|
|
114
114
|
--border: oklch(0.922 0 0);
|
|
115
115
|
--input: oklch(0.922 0 0);
|
|
116
|
-
--ring: oklch(0.
|
|
116
|
+
--ring: oklch(0.556 0 0);
|
|
117
117
|
--chart-1: oklch(0.646 0.222 41.116);
|
|
118
118
|
--chart-2: oklch(0.6 0.118 184.704);
|
|
119
119
|
--chart-3: oklch(0.398 0.07 227.392);
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
|
|
166
166
|
@layer base {
|
|
167
167
|
* {
|
|
168
|
-
@apply border-border outline-ring
|
|
168
|
+
@apply border-border outline-ring;
|
|
169
169
|
}
|
|
170
170
|
body {
|
|
171
171
|
@apply bg-background text-foreground;
|
package/dist/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/ui-bundle-template-base-sfdx-project",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.7.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@salesforce/ui-bundle-template-base-sfdx-project",
|
|
9
|
-
"version": "12.
|
|
9
|
+
"version": "12.7.0",
|
|
10
10
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"fast-xml-parser": "^5.9.3",
|
package/dist/package.json
CHANGED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join, resolve, dirname } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { XMLBuilder } from 'fast-xml-parser';
|
|
6
|
+
import { parseNetworkDocument, NetworkXmlError } from './org-setup-xml.mjs';
|
|
7
|
+
import { escapeSoqlString } from './org-setup-utils.mjs';
|
|
8
|
+
|
|
9
|
+
const builder = new XMLBuilder({
|
|
10
|
+
ignoreAttributes: false,
|
|
11
|
+
commentPropName: '#comment',
|
|
12
|
+
format: true,
|
|
13
|
+
indentBy: ' ',
|
|
14
|
+
suppressEmptyNode: true,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export function preserveNetworkSenders(projectDir, targetOrg, run = execFileSync) {
|
|
18
|
+
const project = JSON.parse(readFileSync(join(projectDir, 'sfdx-project.json'), 'utf8'));
|
|
19
|
+
const files = (project.packageDirectories ?? []).flatMap(({ path }) => {
|
|
20
|
+
const dir = join(projectDir, path, 'main/default/networks');
|
|
21
|
+
if (!existsSync(dir)) return [];
|
|
22
|
+
return readdirSync(dir)
|
|
23
|
+
.filter((name) => name.endsWith('.network-meta.xml'))
|
|
24
|
+
.map((name) => ({ name: name.slice(0, -'.network-meta.xml'.length), path: join(dir, name) }));
|
|
25
|
+
});
|
|
26
|
+
if (!files.length) return;
|
|
27
|
+
|
|
28
|
+
const names = [...new Set(files.map(({ name }) => `'${escapeSoqlString(name)}'`))];
|
|
29
|
+
const response = JSON.parse(run('sf', [
|
|
30
|
+
'data', 'query', '--target-org', targetOrg,
|
|
31
|
+
'--query', `SELECT Name, EmailSenderAddress FROM Network WHERE Name IN (${names.join(',')})`,
|
|
32
|
+
'--json',
|
|
33
|
+
], { cwd: projectDir, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 60000 }));
|
|
34
|
+
if (response.status !== 0 || !Array.isArray(response.result?.records) || !response.result.done) {
|
|
35
|
+
throw new Error('Could not read all target Network sender addresses; deployment stopped.');
|
|
36
|
+
}
|
|
37
|
+
const senders = new Map(response.result.records.map((record) => [record.Name, record.EmailSenderAddress]));
|
|
38
|
+
|
|
39
|
+
const updates = files.map((file) => {
|
|
40
|
+
const original = readFileSync(file.path, 'utf8');
|
|
41
|
+
const document = parseNetworkDocument(original);
|
|
42
|
+
const network = document.Network;
|
|
43
|
+
let changed = false;
|
|
44
|
+
if (senders.has(file.name)) {
|
|
45
|
+
const sender = senders.get(file.name);
|
|
46
|
+
if (typeof sender !== 'string' || !sender.trim()) {
|
|
47
|
+
throw new Error(`The target Network "${file.name}" has no sender address; deployment stopped.`);
|
|
48
|
+
}
|
|
49
|
+
if (typeof network.emailSenderAddress !== 'string') {
|
|
50
|
+
throw new NetworkXmlError(`Expected one emailSenderAddress in ${file.name}.network-meta.xml`);
|
|
51
|
+
}
|
|
52
|
+
if (network.emailSenderAddress !== sender) {
|
|
53
|
+
network.emailSenderAddress = sender;
|
|
54
|
+
changed = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Sender changes belong to the site's Administration workspace.
|
|
58
|
+
if ('newSenderAddress' in network) {
|
|
59
|
+
delete network.newSenderAddress;
|
|
60
|
+
changed = true;
|
|
61
|
+
}
|
|
62
|
+
return { ...file, xml: changed ? builder.build(document) : original, changed };
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
for (const file of updates) {
|
|
66
|
+
if (file.changed) writeFileSync(file.path, file.xml);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
71
|
+
const args = process.argv.slice(2);
|
|
72
|
+
if (args.length !== 2 || args[0] !== '--target-org' || !args[1].trim()) {
|
|
73
|
+
console.error('Usage: node scripts/network-senders.mjs --target-org <alias>');
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
} else {
|
|
76
|
+
try {
|
|
77
|
+
preserveNetworkSenders(resolve(dirname(fileURLToPath(import.meta.url)), '..'), args[1]);
|
|
78
|
+
console.log('Network metadata prepared with the target org sender addresses.');
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error(`Network metadata preparation failed: ${error.message}`);
|
|
81
|
+
process.exitCode = 1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -39,6 +39,7 @@ const parser = new XMLParser({
|
|
|
39
39
|
ignoreAttributes: false,
|
|
40
40
|
parseTagValue: false,
|
|
41
41
|
parseAttributeValue: false,
|
|
42
|
+
commentPropName: '#comment',
|
|
42
43
|
});
|
|
43
44
|
|
|
44
45
|
/**
|
|
@@ -73,22 +74,26 @@ export function assertSafeProfileName(name) {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
/**
|
|
76
|
-
* Parse + assert this is a Network metadata document. Returns the parsed
|
|
77
|
-
*
|
|
77
|
+
* Parse + assert this is a Network metadata document. Returns the full parsed
|
|
78
|
+
* document. Throws NetworkXmlError if the root is missing (e.g. a file
|
|
78
79
|
* that is not actually network metadata).
|
|
79
80
|
*/
|
|
80
|
-
export function
|
|
81
|
+
export function parseNetworkDocument(xml) {
|
|
81
82
|
let parsed;
|
|
82
83
|
try {
|
|
83
|
-
parsed = parser.parse(xml);
|
|
84
|
+
parsed = parser.parse(xml, true);
|
|
84
85
|
} catch (e) {
|
|
85
86
|
throw new NetworkXmlError(`network metadata is not well-formed XML: ${e.message}`);
|
|
86
87
|
}
|
|
87
88
|
const network = parsed?.[NETWORK_ROOT];
|
|
88
|
-
if (network == null || typeof network !== 'object') {
|
|
89
|
+
if (network == null || typeof network !== 'object' || Array.isArray(network)) {
|
|
89
90
|
throw new NetworkXmlError(`expected a <${NETWORK_ROOT}> root node, but none was found`);
|
|
90
91
|
}
|
|
91
|
-
return
|
|
92
|
+
return parsed;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function parseNetwork(xml) {
|
|
96
|
+
return parseNetworkDocument(xml)[NETWORK_ROOT];
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
/** Normalize a fast-xml-parser child (absent | scalar | array) to an array. */
|
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
import { tmpdir } from 'node:os';
|
|
56
56
|
|
|
57
57
|
import { validateConfig } from './org-setup-config-schema.mjs';
|
|
58
|
+
import { preserveNetworkSenders } from './network-senders.mjs';
|
|
58
59
|
import {
|
|
59
60
|
addProfileToMemberGroups,
|
|
60
61
|
enableSelfRegInXml,
|
|
@@ -1149,9 +1150,14 @@ function ensureLogoutUrl(logoutUrl, siteName, targetOrg) {
|
|
|
1149
1150
|
writeFileSync(networkXmlPath, result.xml);
|
|
1150
1151
|
console.log(` Set <logoutUrl>${absoluteUrl}</logoutUrl> in ${siteName}.network-meta.xml`);
|
|
1151
1152
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1153
|
+
try {
|
|
1154
|
+
preserveNetworkSenders(ROOT, targetOrg);
|
|
1155
|
+
} catch (e) {
|
|
1156
|
+
console.error(` ERROR: cannot prepare Network metadata for "${siteName}" — ${e.message}. Skipping logout URL deployment.`);
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
// Logout URL deployment is best-effort.
|
|
1155
1161
|
const deployResult = spawnSync('sf', [
|
|
1156
1162
|
'project', 'deploy', 'start',
|
|
1157
1163
|
'--target-org', targetOrg,
|
|
@@ -1160,8 +1166,7 @@ function ensureLogoutUrl(logoutUrl, siteName, targetOrg) {
|
|
|
1160
1166
|
if (deployResult.status !== 0) {
|
|
1161
1167
|
console.error(
|
|
1162
1168
|
` ERROR: failed to deploy <logoutUrl> for "${siteName}" (sf exit ${deployResult.status ?? 1}). ` +
|
|
1163
|
-
`
|
|
1164
|
-
`set the logout URL manually in the site's Administration settings.`,
|
|
1169
|
+
`Set the logout URL manually in the site's Administration settings.`,
|
|
1165
1170
|
);
|
|
1166
1171
|
return;
|
|
1167
1172
|
}
|
|
@@ -1208,6 +1213,8 @@ function enableSelfRegistration(selfRegConfig, siteName, targetOrg) {
|
|
|
1208
1213
|
writeFileSync(networkXmlPath, result.xml);
|
|
1209
1214
|
console.log(` Updated ${siteName}.network-meta.xml: selfRegistration=true, selfRegProfile=${selfRegProfile}`);
|
|
1210
1215
|
|
|
1216
|
+
preserveNetworkSenders(ROOT, targetOrg);
|
|
1217
|
+
|
|
1211
1218
|
// Re-deploy only the network file
|
|
1212
1219
|
const deployResult = spawnSync('sf', [
|
|
1213
1220
|
'project', 'deploy', 'start',
|
|
@@ -2118,6 +2125,7 @@ async function main() {
|
|
|
2118
2125
|
throw new StepError(`deploy blocked — ${licenseGate.reason}`);
|
|
2119
2126
|
}
|
|
2120
2127
|
}
|
|
2128
|
+
preserveNetworkSenders(ROOT, targetOrg);
|
|
2121
2129
|
run('Deploy metadata', 'sf', ['project', 'deploy', 'start', '--target-org', targetOrg], {
|
|
2122
2130
|
timeout: 180000,
|
|
2123
2131
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/ui-bundle-template-app-react-sample-b2e",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.7.0",
|
|
4
4
|
"description": "Salesforce sample property rental React app",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"clean": "rm -rf dist"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@salesforce/ui-bundle": "12.
|
|
19
|
+
"@salesforce/ui-bundle": "^12.7.0",
|
|
20
20
|
"sonner": "^1.7.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"@testing-library/user-event": "^14.5.2",
|
|
26
26
|
"@types/react": "^19.2.7",
|
|
27
27
|
"@types/react-dom": "^19.2.3",
|
|
28
|
-
"@vitest/ui": "^4.1.
|
|
28
|
+
"@vitest/ui": "^4.1.11",
|
|
29
29
|
"jsdom": "^25.0.1",
|
|
30
30
|
"react-dom": "^19.2.1",
|
|
31
31
|
"react-router": "^8.0.0",
|
|
32
|
-
"vitest": "^4.1.
|
|
32
|
+
"vitest": "^4.1.11"
|
|
33
33
|
},
|
|
34
34
|
"nx": {
|
|
35
35
|
"targets": {
|
package/dist/LICENSE.txt
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
Terms of Use
|
|
2
|
-
|
|
3
|
-
Copyright 2026 Salesforce, Inc. All rights reserved.
|
|
4
|
-
|
|
5
|
-
These Terms of Use govern the download, installation, and/or use of this
|
|
6
|
-
software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
|
|
7
|
-
last updated on April 15, 2025, and constitute a legally binding
|
|
8
|
-
agreement between you and Salesforce. If you do not agree to these Terms of
|
|
9
|
-
Use, do not install or use the Software.
|
|
10
|
-
|
|
11
|
-
Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
|
|
12
|
-
copyright license to reproduce, prepare derivative works of, publicly
|
|
13
|
-
display, publicly perform, sublicense, and distribute the Software and
|
|
14
|
-
derivative works subject to these Terms. These Terms shall be included in
|
|
15
|
-
all copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
Subject to the limited rights expressly granted hereunder, Salesforce
|
|
18
|
-
reserves all rights, title, and interest in and to all intellectual
|
|
19
|
-
property subsisting in the Software. No rights are granted to you hereunder
|
|
20
|
-
other than as expressly set forth herein. Users residing in countries on
|
|
21
|
-
the United States Office of Foreign Assets Control sanction list, or which
|
|
22
|
-
are otherwise subject to a US export embargo, may not use the Software.
|
|
23
|
-
|
|
24
|
-
Implementation of the Software may require development work, for which you
|
|
25
|
-
are responsible. The Software may contain bugs, errors and
|
|
26
|
-
incompatibilities and is made available on an AS IS basis without support,
|
|
27
|
-
updates, or service level commitments.
|
|
28
|
-
|
|
29
|
-
Salesforce reserves the right at any time to modify, suspend, or
|
|
30
|
-
discontinue, the Software (or any part thereof) with or without notice. You
|
|
31
|
-
agree that Salesforce shall not be liable to you or to any third party for
|
|
32
|
-
any modification, suspension, or discontinuance.
|
|
33
|
-
|
|
34
|
-
You agree to defend Salesforce against any claim, demand, suit or
|
|
35
|
-
proceeding made or brought against Salesforce by a third party arising out
|
|
36
|
-
of or accruing from (a) your use of the Software, and (b) any application
|
|
37
|
-
you develop with the Software that infringes any copyright, trademark,
|
|
38
|
-
trade secret, trade dress, patent, or other intellectual property right of
|
|
39
|
-
any person or defames any person or violates their rights of publicity or
|
|
40
|
-
privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
|
|
41
|
-
from any damages, attorney fees, and costs finally awarded against
|
|
42
|
-
Salesforce as a result of, or for any amounts paid by Salesforce under a
|
|
43
|
-
settlement approved by you in writing of, a Claim Against Salesforce,
|
|
44
|
-
provided Salesforce (x) promptly gives you written notice of the Claim
|
|
45
|
-
Against Salesforce, (y) gives you sole control of the defense and
|
|
46
|
-
settlement of the Claim Against Salesforce (except that you may not settle
|
|
47
|
-
any Claim Against Salesforce unless it unconditionally releases Salesforce
|
|
48
|
-
of all liability), and (z) gives you all reasonable assistance, at your
|
|
49
|
-
expense.
|
|
50
|
-
|
|
51
|
-
WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
|
|
52
|
-
SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
53
|
-
IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
|
|
54
|
-
INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
|
55
|
-
PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
|
|
56
|
-
OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
|
|
57
|
-
CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
|
|
58
|
-
HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
59
|
-
|
|
60
|
-
These Terms of Use shall be governed exclusively by the internal laws of
|
|
61
|
-
the State of California, without regard to its conflicts of laws
|
|
62
|
-
rules. Each party hereby consents to the exclusive jurisdiction of the
|
|
63
|
-
state and federal courts located in San Francisco County, California to
|
|
64
|
-
adjudicate any dispute arising out of or relating to these Terms of Use and
|
|
65
|
-
the download, installation, and/or use of the Software. Except as expressly
|
|
66
|
-
stated herein, these Terms of Use constitute the entire agreement between
|
|
67
|
-
the parties, and supersede all prior and contemporaneous agreements,
|
|
68
|
-
proposals, or representations, written or oral, concerning their subject
|
|
69
|
-
matter. No modification, amendment, or waiver of any provision of these
|
|
70
|
-
Terms of Use shall be effective unless it is by an update to these Terms of
|
|
71
|
-
Use that Salesforce makes available, or is in writing and signed by the
|
|
72
|
-
party against whom the modification, amendment, or waiver is to be
|
|
73
|
-
asserted.
|
|
74
|
-
|
|
75
|
-
Data Privacy: Salesforce may collect, process, and store device,
|
|
76
|
-
system, and other information related to your use of the Software. This
|
|
77
|
-
information includes, but is not limited to, IP address, user metrics, and
|
|
78
|
-
other data ("Usage Data"). Salesforce may use Usage Data for analytics,
|
|
79
|
-
product development, and marketing purposes. You acknowledge that files
|
|
80
|
-
generated in conjunction with the Software may contain sensitive or
|
|
81
|
-
confidential data, and you are solely responsible for anonymizing and
|
|
82
|
-
protecting such data.
|