@salesforce/templates 66.17.1 → 66.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/templates/project/reactexternalapp/CHANGELOG.md +129 -0
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package-lock.json +6 -6
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package.json +6 -6
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/forms/auth-form.tsx +14 -2
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/hooks/form.tsx +12 -3
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/layouts/privateRouteLayout.tsx +1 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/menu/AuthMenu.tsx +43 -5
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ChangePassword.tsx +1 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ForgotPassword.tsx +8 -4
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Login.tsx +1 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Register.tsx +1 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ResetPassword.tsx +2 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/sessionTimeout/SessionTimeoutValidator.tsx +32 -9
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/adapters/sobject/parseResponse.ts +1 -2
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/api/distinctValuesService.ts +3 -6
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/MergedSearchResults.tsx +4 -4
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/Search.tsx +5 -2
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/SourceSection.tsx +5 -4
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/PaginationControls.tsx +5 -6
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/SearchBar.tsx +4 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/CmsResultRow.tsx +52 -5
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/DefaultResultRow.tsx +4 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/types.ts +1 -3
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/appLayout.tsx +13 -4
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/alerts/status-alert.tsx +1 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/alert.tsx +1 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/button.tsx +2 -2
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/checkbox.tsx +1 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/input.tsx +1 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/select.tsx +1 -1
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/pages/AccountObjectDetailPage.tsx +34 -17
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/pages/NotFound.tsx +22 -15
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/routes.tsx +1 -0
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/styles/global.css +2 -2
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -1
- package/lib/templates/project/reactexternalapp/package.json +1 -1
- package/lib/templates/project/reactexternalapp/scripts/network-senders.mjs +84 -0
- package/lib/templates/project/reactexternalapp/scripts/org-setup-xml.mjs +11 -6
- package/lib/templates/project/reactexternalapp/scripts/org-setup.mjs +13 -5
- package/lib/templates/project/reactinternalapp/CHANGELOG.md +129 -0
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package-lock.json +6 -6
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package.json +6 -6
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/adapters/sobject/parseResponse.ts +1 -2
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/api/distinctValuesService.ts +3 -6
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/MergedSearchResults.tsx +4 -4
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/Search.tsx +5 -2
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/SourceSection.tsx +5 -4
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/PaginationControls.tsx +5 -6
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/SearchBar.tsx +4 -1
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/CmsResultRow.tsx +52 -5
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/DefaultResultRow.tsx +4 -1
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/types.ts +1 -3
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/appLayout.tsx +10 -4
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/alerts/status-alert.tsx +1 -1
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/alert.tsx +1 -1
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/button.tsx +2 -2
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/checkbox.tsx +1 -1
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/input.tsx +1 -1
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/select.tsx +1 -1
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/pages/AccountObjectDetailPage.tsx +30 -13
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/pages/NotFound.tsx +22 -15
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/routes.tsx +1 -0
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/styles/global.css +2 -2
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -1
- package/lib/templates/project/reactinternalapp/package.json +1 -1
- package/lib/templates/project/reactinternalapp/scripts/network-senders.mjs +84 -0
- package/lib/templates/project/reactinternalapp/scripts/org-setup-xml.mjs +11 -6
- package/lib/templates/project/reactinternalapp/scripts/org-setup.mjs +13 -5
- package/lib/templates/uiBundles/reactbasic/package-lock.json +6 -6
- package/lib/templates/uiBundles/reactbasic/package.json +6 -6
- package/lib/templates/uiBundles/reactbasic/src/components/alerts/status-alert.tsx +1 -1
- package/lib/templates/uiBundles/reactbasic/src/components/ui/alert.tsx +1 -1
- package/lib/templates/uiBundles/reactbasic/src/components/ui/button.tsx +2 -2
- package/lib/templates/uiBundles/reactbasic/src/components/ui/checkbox.tsx +1 -1
- package/lib/templates/uiBundles/reactbasic/src/components/ui/input.tsx +1 -1
- package/lib/templates/uiBundles/reactbasic/src/components/ui/select.tsx +1 -1
- package/lib/templates/uiBundles/reactbasic/src/styles/global.css +2 -2
- package/package.json +5 -5
|
@@ -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
|
});
|
|
@@ -3,6 +3,135 @@
|
|
|
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.9.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.8.0...v12.9.0) (2026-09-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [12.8.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.7.0...v12.8.0) (2026-09-23)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [12.7.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.6.3...v12.7.0) (2026-09-22)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **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))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [12.6.3](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.6.2...v12.6.3) (2026-09-14)
|
|
32
|
+
|
|
33
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [12.6.2](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.6.1...v12.6.2) (2026-09-14)
|
|
40
|
+
|
|
41
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## [12.6.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.6.0...v12.6.1) (2026-09-11)
|
|
48
|
+
|
|
49
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## [12.6.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.5.8...v12.6.0) (2026-09-11)
|
|
56
|
+
|
|
57
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## [12.5.8](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.5.7...v12.5.8) (2026-09-11)
|
|
64
|
+
|
|
65
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## [12.5.7](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.5.6...v12.5.7) (2026-09-11)
|
|
72
|
+
|
|
73
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
## [12.5.6](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.5.5...v12.5.6) (2026-09-11)
|
|
80
|
+
|
|
81
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## [12.5.5](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.5.4...v12.5.5) (2026-09-10)
|
|
88
|
+
|
|
89
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## [12.5.4](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.5.3...v12.5.4) (2026-09-09)
|
|
96
|
+
|
|
97
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## [12.5.3](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.5.2...v12.5.3) (2026-09-08)
|
|
104
|
+
|
|
105
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## [12.5.2](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.5.1...v12.5.2) (2026-09-08)
|
|
112
|
+
|
|
113
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
## [12.5.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.5.0...v12.5.1) (2026-09-07)
|
|
120
|
+
|
|
121
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
## [12.5.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.4.5...v12.5.0) (2026-09-04)
|
|
128
|
+
|
|
129
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
6
135
|
## [12.4.5](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.4.4...v12.4.5) (2026-09-03)
|
|
7
136
|
|
|
8
137
|
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@salesforce/agentforce-conversation-client": "^12.0.0",
|
|
13
|
-
"@salesforce/platform-sdk": "^12.
|
|
14
|
-
"@salesforce/ui-bundle": "^12.
|
|
13
|
+
"@salesforce/platform-sdk": "^12.9.0",
|
|
14
|
+
"@salesforce/ui-bundle": "^12.9.0",
|
|
15
15
|
"@tailwindcss/vite": "^4.1.17",
|
|
16
16
|
"class-variance-authority": "^0.7.1",
|
|
17
17
|
"clsx": "^2.1.1",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@graphql-eslint/eslint-plugin": "^4.1.0",
|
|
37
37
|
"@graphql-tools/utils": "^11.0.0",
|
|
38
38
|
"@playwright/test": "^1.49.0",
|
|
39
|
-
"@salesforce/graphiti": "^12.
|
|
40
|
-
"@salesforce/vite-plugin-ui-bundle": "^12.
|
|
39
|
+
"@salesforce/graphiti": "^12.9.0",
|
|
40
|
+
"@salesforce/vite-plugin-ui-bundle": "^12.9.0",
|
|
41
41
|
"@testing-library/jest-dom": "^6.6.3",
|
|
42
42
|
"@testing-library/react": "^16.1.0",
|
|
43
43
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@types/react": "^19.2.5",
|
|
46
46
|
"@types/react-dom": "^19.2.3",
|
|
47
47
|
"@vitejs/plugin-react": "^5.1.1",
|
|
48
|
-
"@vitest/ui": "^4.1.
|
|
48
|
+
"@vitest/ui": "^4.1.11",
|
|
49
49
|
"eslint": "^9.39.1",
|
|
50
50
|
"eslint-plugin-react": "^7.37.2",
|
|
51
51
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"typescript-eslint": "^8.46.4",
|
|
61
61
|
"vite": "^7.2.4",
|
|
62
62
|
"vite-plugin-graphql-codegen": "^3.6.3",
|
|
63
|
-
"vitest": "^4.1.
|
|
63
|
+
"vitest": "^4.1.11"
|
|
64
64
|
},
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=22"
|
|
@@ -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.9.0",
|
|
23
|
+
"@salesforce/ui-bundle": "^12.9.0",
|
|
24
24
|
"@tailwindcss/vite": "^4.1.17",
|
|
25
25
|
"class-variance-authority": "^0.7.1",
|
|
26
26
|
"clsx": "^2.1.1",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@graphql-eslint/eslint-plugin": "^4.1.0",
|
|
47
47
|
"@graphql-tools/utils": "^11.0.0",
|
|
48
48
|
"@playwright/test": "^1.49.0",
|
|
49
|
-
"@salesforce/graphiti": "^12.
|
|
50
|
-
"@salesforce/vite-plugin-ui-bundle": "^12.
|
|
49
|
+
"@salesforce/graphiti": "^12.9.0",
|
|
50
|
+
"@salesforce/vite-plugin-ui-bundle": "^12.9.0",
|
|
51
51
|
"@testing-library/jest-dom": "^6.6.3",
|
|
52
52
|
"@testing-library/react": "^16.1.0",
|
|
53
53
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@types/react": "^19.2.5",
|
|
56
56
|
"@types/react-dom": "^19.2.3",
|
|
57
57
|
"@vitejs/plugin-react": "^5.1.1",
|
|
58
|
-
"@vitest/ui": "^4.1.
|
|
58
|
+
"@vitest/ui": "^4.1.11",
|
|
59
59
|
"eslint": "^9.39.1",
|
|
60
60
|
"eslint-plugin-react": "^7.37.2",
|
|
61
61
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"typescript-eslint": "^8.46.4",
|
|
71
71
|
"vite": "^7.2.4",
|
|
72
72
|
"vite-plugin-graphql-codegen": "^3.6.3",
|
|
73
|
-
"vitest": "^4.1.
|
|
73
|
+
"vitest": "^4.1.11"
|
|
74
74
|
},
|
|
75
75
|
"overrides": {
|
|
76
76
|
"lodash": "^4.18.1",
|
|
@@ -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 };
|
|
@@ -137,7 +137,7 @@ export function MergedSearchResults({
|
|
|
137
137
|
whole-request/network failure). Shown once, above the grid. */}
|
|
138
138
|
{error && (
|
|
139
139
|
<Alert variant="destructive" role="alert">
|
|
140
|
-
<AlertCircle />
|
|
140
|
+
<AlertCircle aria-hidden="true" />
|
|
141
141
|
<AlertTitle>Search failed</AlertTitle>
|
|
142
142
|
<AlertDescription>{error}</AlertDescription>
|
|
143
143
|
</Alert>
|
|
@@ -151,7 +151,7 @@ export function MergedSearchResults({
|
|
|
151
151
|
.filter((c) => !!c.error)
|
|
152
152
|
.map((c) => (
|
|
153
153
|
<Alert key={c.config.key} variant="destructive" role="alert">
|
|
154
|
-
<AlertCircle />
|
|
154
|
+
<AlertCircle aria-hidden="true" />
|
|
155
155
|
<AlertTitle>Failed to load {c.config.label}</AlertTitle>
|
|
156
156
|
<AlertDescription>{c.error}</AlertDescription>
|
|
157
157
|
</Alert>
|
|
@@ -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;
|
package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/Search.tsx
CHANGED
|
@@ -82,6 +82,8 @@ interface SearchProps {
|
|
|
82
82
|
/** Optional override for the entire header region. */
|
|
83
83
|
renderHeader?: (handle: SearchHandle) => ReactNode;
|
|
84
84
|
className?: string;
|
|
85
|
+
/** Root element tag; use `"main"` when this owns its route's landmark (WCAG 1.3.1). */
|
|
86
|
+
as?: "div" | "main";
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
export function Search({
|
|
@@ -97,6 +99,7 @@ export function Search({
|
|
|
97
99
|
allScopeLabel,
|
|
98
100
|
renderHeader,
|
|
99
101
|
className,
|
|
102
|
+
as: Root = "div",
|
|
100
103
|
}: SearchProps) {
|
|
101
104
|
// Resolve restrictTo to a lockedScope value, surfacing a clear error if
|
|
102
105
|
// the (kind, key) pair doesn't match any source. Memoize so it's
|
|
@@ -136,7 +139,7 @@ export function Search({
|
|
|
136
139
|
const showTotalResults = !merged && sourcesInScope >= 2;
|
|
137
140
|
|
|
138
141
|
return (
|
|
139
|
-
<
|
|
142
|
+
<Root className={`max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6 space-y-6 ${className ?? ""}`}>
|
|
140
143
|
{renderHeader ? (
|
|
141
144
|
renderHeader(handle)
|
|
142
145
|
) : (
|
|
@@ -198,6 +201,6 @@ export function Search({
|
|
|
198
201
|
)}
|
|
199
202
|
</>
|
|
200
203
|
)}
|
|
201
|
-
</
|
|
204
|
+
</Root>
|
|
202
205
|
);
|
|
203
206
|
}
|
|
@@ -152,14 +152,14 @@ export function SourceSection({
|
|
|
152
152
|
|
|
153
153
|
{error && (
|
|
154
154
|
<Alert variant="destructive" role="alert">
|
|
155
|
-
<AlertCircle />
|
|
155
|
+
<AlertCircle aria-hidden="true" />
|
|
156
156
|
<AlertTitle>Failed to load {config.label}</AlertTitle>
|
|
157
157
|
<AlertDescription>{error}</AlertDescription>
|
|
158
158
|
</Alert>
|
|
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)}
|
|
@@ -171,9 +171,9 @@ export function SourceSection({
|
|
|
171
171
|
{showEmpty && (
|
|
172
172
|
<div className="flex flex-col items-center justify-center py-10 text-center">
|
|
173
173
|
{isShortQuery ? (
|
|
174
|
-
<Search className="size-10 text-muted-foreground mb-3" />
|
|
174
|
+
<Search aria-hidden="true" className="size-10 text-muted-foreground mb-3" />
|
|
175
175
|
) : (
|
|
176
|
-
<SearchX className="size-10 text-muted-foreground mb-3" />
|
|
176
|
+
<SearchX aria-hidden="true" className="size-10 text-muted-foreground mb-3" />
|
|
177
177
|
)}
|
|
178
178
|
<p className="text-sm text-muted-foreground">
|
|
179
179
|
{isShortQuery
|
|
@@ -195,6 +195,7 @@ export function SourceSection({
|
|
|
195
195
|
onPageSizeChange={pagination.setPageSize}
|
|
196
196
|
disabled={loading || !!error}
|
|
197
197
|
idPrefix={`page-size-${config.key}`}
|
|
198
|
+
navLabel={`${config.label} pagination`}
|
|
198
199
|
/>
|
|
199
200
|
</div>
|
|
200
201
|
</section>
|
|
@@ -37,6 +37,8 @@ interface PaginationControlsProps {
|
|
|
37
37
|
onGoToPage?: (pageIndex: number) => void;
|
|
38
38
|
disabled?: boolean;
|
|
39
39
|
idPrefix?: string;
|
|
40
|
+
/** Accessible name for the pagination `<nav>` landmark; keep it unique per instance (WCAG 1.3.1, landmark-unique). */
|
|
41
|
+
navLabel?: string;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -76,6 +78,7 @@ export function PaginationControls({
|
|
|
76
78
|
onGoToPage,
|
|
77
79
|
disabled = false,
|
|
78
80
|
idPrefix = "page-size",
|
|
81
|
+
navLabel = "Pagination",
|
|
79
82
|
}: PaginationControlsProps) {
|
|
80
83
|
const handlePageSizeChange = (next: string) => {
|
|
81
84
|
const size = parseInt(next, 10);
|
|
@@ -104,11 +107,7 @@ export function PaginationControls({
|
|
|
104
107
|
<Label htmlFor={selectId} className="text-sm font-normal whitespace-nowrap">
|
|
105
108
|
Results per page:
|
|
106
109
|
</Label>
|
|
107
|
-
<Select
|
|
108
|
-
value={pageSize.toString()}
|
|
109
|
-
onValueChange={handlePageSizeChange}
|
|
110
|
-
disabled={disabled}
|
|
111
|
-
>
|
|
110
|
+
<Select value={pageSize.toString()} onValueChange={handlePageSizeChange}>
|
|
112
111
|
<SelectTrigger id={selectId} className="w-16">
|
|
113
112
|
<SelectValue />
|
|
114
113
|
</SelectTrigger>
|
|
@@ -121,7 +120,7 @@ export function PaginationControls({
|
|
|
121
120
|
</SelectContent>
|
|
122
121
|
</Select>
|
|
123
122
|
</div>
|
|
124
|
-
<Pagination className="w-full mx-0 sm:justify-end">
|
|
123
|
+
<Pagination aria-label={navLabel} className="w-full mx-0 sm:justify-end">
|
|
125
124
|
<PaginationContent>
|
|
126
125
|
<PaginationItem>
|
|
127
126
|
<PaginationPrevious
|
|
@@ -38,7 +38,10 @@ export function SearchBar({ value, onChange, placeholder = "Search…", classNam
|
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
40
|
<div className={`relative flex-1 ${className ?? ""}`}>
|
|
41
|
-
<Search
|
|
41
|
+
<Search
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"
|
|
44
|
+
/>
|
|
42
45
|
<Input
|
|
43
46
|
type="text"
|
|
44
47
|
value={draft}
|
|
@@ -20,6 +20,11 @@ import { Link } from "react-router";
|
|
|
20
20
|
import type { CmsSourceConfig, CmsSearchItem } from "../../adapters/cms/types";
|
|
21
21
|
import { formatContentTypeLabel, isValidCmsFqn } from "../../adapters/cms/contentTypeUtils";
|
|
22
22
|
|
|
23
|
+
const EM_BLOCK_SPLIT = /(<(?:em)>[\s\S]*?<\/(?:em)>)/g;
|
|
24
|
+
const EM_BLOCK_EXEC = /^<(?:em)>([\s\S]*?)<\/(?:em)>$/;
|
|
25
|
+
const STRAY_TAG = /<\/?[a-zA-Z][^>]*>/g;
|
|
26
|
+
const ROUTE_TOKEN = /:([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
27
|
+
|
|
23
28
|
/** Formats an ISO date string for display; echoes the raw string on failure. */
|
|
24
29
|
function formatPublishedDate(dateStr: string): string {
|
|
25
30
|
const date = new Date(dateStr);
|
|
@@ -43,7 +48,7 @@ function resolveRoute(pattern: string, item: CmsSearchItem): string | null {
|
|
|
43
48
|
contentType: item.contentType,
|
|
44
49
|
};
|
|
45
50
|
let failed = false;
|
|
46
|
-
const out = pattern.replace(
|
|
51
|
+
const out = pattern.replace(ROUTE_TOKEN, (_match, token: string) => {
|
|
47
52
|
const value = tokens[token];
|
|
48
53
|
if (value == null || value === "") {
|
|
49
54
|
failed = true;
|
|
@@ -54,6 +59,44 @@ function resolveRoute(pattern: string, item: CmsSearchItem): string | null {
|
|
|
54
59
|
return failed ? null : out;
|
|
55
60
|
}
|
|
56
61
|
|
|
62
|
+
/**
|
|
63
|
+
* - Decodes every HTML entity the browser knows (named + numeric).
|
|
64
|
+
* - Runs twice to unwrap the double-encoding CMS search sometimes returns.
|
|
65
|
+
*/
|
|
66
|
+
function decodeEntities(input: string): string {
|
|
67
|
+
if (typeof document === "undefined") return input;
|
|
68
|
+
const el = document.createElement("textarea");
|
|
69
|
+
const pass = (s: string) => {
|
|
70
|
+
el.innerHTML = s;
|
|
71
|
+
return el.value;
|
|
72
|
+
};
|
|
73
|
+
return pass(pass(input));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Parses a snippet that may contain `<em>…</em>` segments and renders it as highlighted text,
|
|
78
|
+
* and strips any other HTML tags so their content renders as plain text.
|
|
79
|
+
*/
|
|
80
|
+
function renderHighlightedSnippet(snippet: string): ReactNode[] {
|
|
81
|
+
const decoded = decodeEntities(snippet);
|
|
82
|
+
const parts = decoded.split(EM_BLOCK_SPLIT);
|
|
83
|
+
return parts.map((part, i) => {
|
|
84
|
+
const emphasisMatch = EM_BLOCK_EXEC.exec(part);
|
|
85
|
+
if (emphasisMatch) {
|
|
86
|
+
return (
|
|
87
|
+
<mark key={i} className="bg-yellow-200 dark:bg-yellow-700/60 rounded-sm px-0.5">
|
|
88
|
+
{emphasisMatch[1].replace(STRAY_TAG, "")}
|
|
89
|
+
</mark>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return part.replace(STRAY_TAG, "");
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function toPlainText(raw: string): string {
|
|
97
|
+
return decodeEntities(raw).replace(STRAY_TAG, "");
|
|
98
|
+
}
|
|
99
|
+
|
|
57
100
|
interface CmsResultRowProps {
|
|
58
101
|
node: unknown;
|
|
59
102
|
source: CmsSourceConfig;
|
|
@@ -71,12 +114,16 @@ export function CmsResultRow({ node, source }: CmsResultRowProps) {
|
|
|
71
114
|
|
|
72
115
|
const content: ReactNode = (
|
|
73
116
|
<>
|
|
74
|
-
<span className="font-medium">{item.title
|
|
117
|
+
<span className="font-medium">{item.title ? renderHighlightedSnippet(item.title) : "—"}</span>
|
|
75
118
|
{item.highlightedSnippet && (
|
|
76
|
-
<p className="text-sm text-
|
|
119
|
+
<p className="text-sm text-neutral-600 dark:text-neutral-300">
|
|
120
|
+
{renderHighlightedSnippet(item.highlightedSnippet)}
|
|
121
|
+
</p>
|
|
77
122
|
)}
|
|
78
123
|
{subtitleParts.length > 0 && (
|
|
79
|
-
<p className="text-sm text-
|
|
124
|
+
<p className="text-sm text-neutral-600 dark:text-neutral-300">
|
|
125
|
+
{subtitleParts.join(" · ")}
|
|
126
|
+
</p>
|
|
80
127
|
)}
|
|
81
128
|
</>
|
|
82
129
|
);
|
|
@@ -90,7 +137,7 @@ export function CmsResultRow({ node, source }: CmsResultRowProps) {
|
|
|
90
137
|
<Link
|
|
91
138
|
to={href}
|
|
92
139
|
className="block hover:bg-accent rounded-md px-3 -mx-3 py-1 transition-colors"
|
|
93
|
-
aria-label={`View content: ${item.title}`}
|
|
140
|
+
aria-label={`View content: ${item.title ? toPlainText(item.title) : "content"}`}
|
|
94
141
|
>
|
|
95
142
|
{content}
|
|
96
143
|
</Link>
|
|
@@ -86,7 +86,9 @@ export function DefaultResultRow({ node, source }: DefaultResultRowProps) {
|
|
|
86
86
|
<>
|
|
87
87
|
<span className="font-medium">{title ?? "—"}</span>
|
|
88
88
|
{subtitleParts.length > 0 && (
|
|
89
|
-
<p className="text-sm text-
|
|
89
|
+
<p className="text-sm text-neutral-600 dark:text-neutral-300">
|
|
90
|
+
{subtitleParts.join(" · ")}
|
|
91
|
+
</p>
|
|
90
92
|
)}
|
|
91
93
|
</>
|
|
92
94
|
);
|
|
@@ -98,6 +100,7 @@ export function DefaultResultRow({ node, source }: DefaultResultRowProps) {
|
|
|
98
100
|
<Link
|
|
99
101
|
to={href}
|
|
100
102
|
className="block hover:bg-accent rounded-md px-3 -mx-3 py-1 transition-colors"
|
|
103
|
+
aria-label={`View: ${title ?? "result"}`}
|
|
101
104
|
>
|
|
102
105
|
{content}
|
|
103
106
|
</Link>
|
|
@@ -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 {
|