@salesforce/templates 66.17.1 → 66.17.3

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.
Files changed (103) hide show
  1. package/lib/templates/project/angularextapp/CHANGELOG.md +161 -0
  2. package/lib/templates/project/angularextapp/README.md +110 -44
  3. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/README.md +1 -1
  4. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/package-lock.json +649 -1097
  5. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/package.json +4 -4
  6. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/_f_/_os_/api/object-search.service.ts +3 -6
  7. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/_f_/authentication/social-login/social-login.html +39 -0
  8. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/_f_/authentication/social-login/social-login.ts +107 -0
  9. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/api/graphql-operations-types.ts +1 -2
  10. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/components/ui/button/button.ts +1 -8
  11. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/components/ui/dialog/dialog.html +1 -1
  12. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/components/ui/icon/icon.ts +6 -0
  13. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/pages/login/login-page.html +2 -0
  14. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/pages/login/login-page.ts +2 -1
  15. package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig.cls +145 -0
  16. package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig.cls-meta.xml +5 -0
  17. package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig_Test.cls +181 -0
  18. package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig_Test.cls-meta.xml +5 -0
  19. package/lib/templates/project/angularextapp/package.json +1 -1
  20. package/lib/templates/project/angularextapp/scripts/network-senders.mjs +84 -0
  21. package/lib/templates/project/angularextapp/scripts/org-setup-xml.mjs +11 -6
  22. package/lib/templates/project/angularextapp/scripts/org-setup.mjs +13 -5
  23. package/lib/templates/project/angularintapp/_p_/_m_/_w_/_a_/package-lock.json +648 -1096
  24. package/lib/templates/project/reactexternalapp/CHANGELOG.md +129 -0
  25. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package-lock.json +543 -531
  26. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package.json +6 -6
  27. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/forms/auth-form.tsx +14 -2
  28. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/hooks/form.tsx +12 -3
  29. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/layouts/privateRouteLayout.tsx +1 -1
  30. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/menu/AuthMenu.tsx +43 -5
  31. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ChangePassword.tsx +1 -1
  32. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ForgotPassword.tsx +8 -4
  33. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Login.tsx +1 -1
  34. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Register.tsx +1 -1
  35. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ResetPassword.tsx +2 -1
  36. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/sessionTimeout/SessionTimeoutValidator.tsx +32 -9
  37. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/adapters/sobject/parseResponse.ts +1 -2
  38. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/api/distinctValuesService.ts +3 -6
  39. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/MergedSearchResults.tsx +4 -4
  40. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/Search.tsx +5 -2
  41. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/SourceSection.tsx +5 -4
  42. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/PaginationControls.tsx +5 -6
  43. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/SearchBar.tsx +4 -1
  44. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/CmsResultRow.tsx +52 -5
  45. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/DefaultResultRow.tsx +4 -1
  46. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/types.ts +1 -3
  47. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/appLayout.tsx +13 -4
  48. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/alerts/status-alert.tsx +1 -1
  49. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/alert.tsx +1 -1
  50. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/button.tsx +2 -2
  51. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/checkbox.tsx +1 -1
  52. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/input.tsx +1 -1
  53. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/select.tsx +1 -1
  54. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/pages/AccountObjectDetailPage.tsx +34 -17
  55. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/pages/NotFound.tsx +22 -15
  56. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/routes.tsx +1 -0
  57. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/styles/global.css +2 -2
  58. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -1
  59. package/lib/templates/project/reactexternalapp/package.json +1 -1
  60. package/lib/templates/project/reactexternalapp/scripts/network-senders.mjs +84 -0
  61. package/lib/templates/project/reactexternalapp/scripts/org-setup-xml.mjs +11 -6
  62. package/lib/templates/project/reactexternalapp/scripts/org-setup.mjs +13 -5
  63. package/lib/templates/project/reactinternalapp/CHANGELOG.md +129 -0
  64. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package-lock.json +546 -534
  65. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package.json +6 -6
  66. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/adapters/sobject/parseResponse.ts +1 -2
  67. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/api/distinctValuesService.ts +3 -6
  68. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/MergedSearchResults.tsx +4 -4
  69. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/Search.tsx +5 -2
  70. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/SourceSection.tsx +5 -4
  71. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/PaginationControls.tsx +5 -6
  72. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/SearchBar.tsx +4 -1
  73. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/CmsResultRow.tsx +52 -5
  74. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/DefaultResultRow.tsx +4 -1
  75. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/types.ts +1 -3
  76. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/appLayout.tsx +10 -4
  77. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/alerts/status-alert.tsx +1 -1
  78. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/alert.tsx +1 -1
  79. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/button.tsx +2 -2
  80. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/checkbox.tsx +1 -1
  81. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/input.tsx +1 -1
  82. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/select.tsx +1 -1
  83. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/pages/AccountObjectDetailPage.tsx +30 -13
  84. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/pages/NotFound.tsx +22 -15
  85. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/routes.tsx +1 -0
  86. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/styles/global.css +2 -2
  87. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -1
  88. package/lib/templates/project/reactinternalapp/package.json +1 -1
  89. package/lib/templates/project/reactinternalapp/scripts/network-senders.mjs +84 -0
  90. package/lib/templates/project/reactinternalapp/scripts/org-setup-xml.mjs +11 -6
  91. package/lib/templates/project/reactinternalapp/scripts/org-setup.mjs +13 -5
  92. package/lib/templates/uiBundles/angularbasic/package-lock.json +645 -1093
  93. package/lib/templates/uiBundles/reactbasic/package-lock.json +543 -531
  94. package/lib/templates/uiBundles/reactbasic/package.json +6 -6
  95. package/lib/templates/uiBundles/reactbasic/src/components/alerts/status-alert.tsx +1 -1
  96. package/lib/templates/uiBundles/reactbasic/src/components/ui/alert.tsx +1 -1
  97. package/lib/templates/uiBundles/reactbasic/src/components/ui/button.tsx +2 -2
  98. package/lib/templates/uiBundles/reactbasic/src/components/ui/checkbox.tsx +1 -1
  99. package/lib/templates/uiBundles/reactbasic/src/components/ui/input.tsx +1 -1
  100. package/lib/templates/uiBundles/reactbasic/src/components/ui/select.tsx +1 -1
  101. package/lib/templates/uiBundles/reactbasic/src/styles/global.css +2 -2
  102. package/lib/templates/uiBundles/vuebasic/package-lock.json +523 -519
  103. package/package.json +10 -10
@@ -19,8 +19,8 @@
19
19
  "graphql:schema": "node scripts/get-graphql-schema.mjs"
20
20
  },
21
21
  "dependencies": {
22
- "@salesforce/platform-sdk": "^12.4.5",
23
- "@salesforce/ui-bundle": "^12.4.5",
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.4.5",
50
- "@salesforce/vite-plugin-ui-bundle": "^12.4.5",
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.0",
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.0"
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
- | Record<string, RawSourceResult | null | undefined>
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
- | Record<string, unknown>
68
- | undefined;
67
+ Record<string, unknown> | undefined;
69
68
  const objectAgg = aggregate?.[objectName] as
70
- | { edges?: Array<{ node?: { aggregate?: Record<string, unknown> } }> }
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
- | { value?: string | null; displayValue?: string | null; label?: string | null }
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;
@@ -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
- <div className={`max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6 space-y-6 ${className ?? ""}`}>
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
- </div>
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 className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
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(/:([A-Za-z_][A-Za-z0-9_]*)/g, (_match, token: string) => {
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 ?? "—"}</span>
117
+ <span className="font-medium">{item.title ? renderHighlightedSnippet(item.title) : "—"}</span>
75
118
  {item.highlightedSnippet && (
76
- <p className="text-sm text-muted-foreground">{item.highlightedSnippet}</p>
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-muted-foreground">{subtitleParts.join(" · ")}</p>
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-muted-foreground">{subtitleParts.join(" · ")}</p>
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 {
@@ -1,5 +1,5 @@
1
1
  import { AgentforceConversationClient } from "./components/AgentforceConversationClient";
2
- import { Outlet, Link, useLocation } from "react-router";
2
+ import { Outlet, Link, useLocation, matchPath } from "react-router";
3
3
  import { getAllRoutes } from "./router-utils";
4
4
  import { useEffect, useId, useRef, useState } from "react";
5
5
 
@@ -9,11 +9,13 @@ export default function AppLayout() {
9
9
  const navId = useId();
10
10
  const outletWrapperRef = useRef<HTMLDivElement>(null);
11
11
  const previousPathname = useRef<string | null>(null);
12
+ const menuButtonRef = useRef<HTMLButtonElement>(null);
12
13
 
13
14
  useEffect(() => {
15
+ if (matchPath("/search", location.pathname)) document.title = "Search | MyApp";
14
16
  if (previousPathname.current !== null && previousPathname.current !== location.pathname) {
15
17
  const wrapper = outletWrapperRef.current;
16
- const target = wrapper?.querySelector<HTMLElement>("h1, main, [role='main']") ?? wrapper;
18
+ const target = wrapper?.querySelector<HTMLElement>("h1");
17
19
  if (target) {
18
20
  if (!target.hasAttribute("tabindex")) target.setAttribute("tabindex", "-1");
19
21
  target.focus();
@@ -57,13 +59,14 @@ export default function AppLayout() {
57
59
  >
58
60
  Skip to main content
59
61
  </a>
60
- <nav className="bg-white border-b border-gray-200">
62
+ <nav aria-label="Primary" className="bg-white border-b border-gray-200">
61
63
  <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
62
64
  <div className="flex justify-between items-center h-16">
63
65
  <Link to="/" className="text-xl font-semibold text-gray-900">
64
66
  React App
65
67
  </Link>
66
68
  <button
69
+ ref={menuButtonRef}
67
70
  onClick={toggleMenu}
68
71
  className="p-2 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
69
72
  aria-label="Toggle menu"
@@ -94,7 +97,10 @@ export default function AppLayout() {
94
97
  <Link
95
98
  key={item.path}
96
99
  to={item.path}
97
- onClick={() => setIsOpen(false)}
100
+ onClick={() => {
101
+ setIsOpen(false);
102
+ if (isActive(item.path)) menuButtonRef.current?.focus();
103
+ }}
98
104
  aria-current={isActive(item.path) ? "page" : undefined}
99
105
  className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
100
106
  isActive(item.path)
@@ -8,7 +8,7 @@ const statusAlertVariants = cva('', {
8
8
  variant: {
9
9
  error: '',
10
10
  success: '',
11
- info: 'text-blue-600 *:[svg]:text-current *:data-[slot=alert-description]:text-blue-600/90',
11
+ info: 'text-blue-700 dark:text-blue-400 *:[svg]:text-current *:data-[slot=alert-description]:text-blue-700 dark:*:data-[slot=alert-description]:text-blue-400',
12
12
  },
13
13
  },
14
14
  defaultVariants: {
@@ -10,7 +10,7 @@ const alertVariants = cva(
10
10
  variant: {
11
11
  default: 'bg-card text-card-foreground',
12
12
  destructive:
13
- 'text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current',
13
+ 'text-red-700 dark:text-red-400 bg-card *:data-[slot=alert-description]:text-red-700 dark:*:data-[slot=alert-description]:text-red-400 *:[svg]:text-current',
14
14
  },
15
15
  },
16
16
  defaultVariants: {
@@ -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/50 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",
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 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-red-700 dark:text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30',
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: {
@@ -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/50 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',
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}
@@ -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/50 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/70 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',
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}
@@ -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/50 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",
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}
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from "react";
1
+ import { useEffect, useRef, useState } from "react";
2
2
  import { useParams, useNavigate } from "react-router";
3
3
  import { createDataSDK } from "@salesforce/platform-sdk";
4
4
  import { AlertCircle, ChevronDown, ChevronRight, FileQuestion } from "lucide-react";
@@ -76,6 +76,8 @@ async function fetchAccountDetail(recordId: string): Promise<AccountNode | null
76
76
  export default function AccountObjectDetail() {
77
77
  const { recordId } = useParams();
78
78
  const navigate = useNavigate();
79
+ const mainRef = useRef<HTMLElement>(null);
80
+ const [completionAnnouncement, setCompletionAnnouncement] = useState("");
79
81
 
80
82
  const {
81
83
  data: account,
@@ -95,18 +97,33 @@ export default function AccountObjectDetail() {
95
97
  document.title = pageTitle;
96
98
  }, [pageTitle]);
97
99
 
100
+ useEffect(() => {
101
+ if (loading) {
102
+ setCompletionAnnouncement("");
103
+ return;
104
+ }
105
+ const main = mainRef.current;
106
+ const heading = main?.querySelector<HTMLElement>("h1");
107
+ if (heading) {
108
+ const active = document.activeElement;
109
+ if (active && active !== document.body && !main?.contains(active)) {
110
+ setCompletionAnnouncement(heading.textContent ?? "");
111
+ return;
112
+ }
113
+ setCompletionAnnouncement("");
114
+ if (!heading.hasAttribute("tabindex")) heading.setAttribute("tabindex", "-1");
115
+ heading.focus();
116
+ }
117
+ }, [loading, error, account, recordId]);
118
+
98
119
  return (
99
- <main className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
100
- {/* Loading state */}
120
+ <main ref={mainRef} className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
121
+ <div role="status" aria-live="polite" className="sr-only">
122
+ {loading ? "Loading account" : completionAnnouncement}
123
+ </div>
101
124
  {loading && <AccountDetailSkeleton />}
102
-
103
- {/* Error state */}
104
125
  {error && <AccountDetailError onBack={() => navigate(-1)} />}
105
-
106
- {/* Not found state */}
107
126
  {!loading && !error && !account && <AccountDetailNotFound onBack={() => navigate(-1)} />}
108
-
109
- {/* Content */}
110
127
  {!loading && !error && account && <AccountDetailContent account={account} />}
111
128
  </main>
112
129
  );
@@ -261,7 +278,8 @@ function Section({ title, children }: { title: string; children: React.ReactNode
261
278
  function AccountDetailError({ onBack }: { onBack: () => void }) {
262
279
  return (
263
280
  <>
264
- <Alert variant="destructive" role="alert">
281
+ {/* Alert hardcodes role="alert"; override so the h1-focus effect below is the only announcement path (WCAG 4.1.3) */}
282
+ <Alert variant="destructive" role={undefined}>
265
283
  <AlertCircle aria-hidden="true" />
266
284
  <AlertTitle>
267
285
  <h1>Failed to load account</h1>
@@ -284,7 +302,7 @@ function AccountDetailError({ onBack }: { onBack: () => void }) {
284
302
 
285
303
  function AccountDetailNotFound({ onBack }: { onBack: () => void }) {
286
304
  return (
287
- <Card role="status">
305
+ <Card>
288
306
  <CardContent className="flex flex-col items-center justify-center py-16 text-center">
289
307
  <FileQuestion aria-hidden="true" className="size-12 text-muted-foreground mb-4" />
290
308
  <h1 className="text-lg font-semibold mb-1">Account not found</h1>
@@ -301,8 +319,7 @@ function AccountDetailNotFound({ onBack }: { onBack: () => void }) {
301
319
 
302
320
  function AccountDetailSkeleton() {
303
321
  return (
304
- <div role="status" aria-live="polite">
305
- <span className="sr-only">Loading account…</span>
322
+ <div>
306
323
  <Skeleton className="h-8 w-56 mb-4" />
307
324
 
308
325
  <Card>
@@ -1,18 +1,25 @@
1
- import { Link } from 'react-router';
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { Link } from "react-router";
2
8
 
3
9
  export default function NotFound() {
4
- return (
5
- <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
6
- <div className="text-center">
7
- <h1 className="text-4xl font-bold text-gray-900 mb-4">404</h1>
8
- <p className="text-lg text-gray-600 mb-8">Page not found</p>
9
- <Link
10
- to="/"
11
- className="inline-block px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors"
12
- >
13
- Go to Home
14
- </Link>
15
- </div>
16
- </div>
17
- );
10
+ return (
11
+ <main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
12
+ <title>Page Not Found | MyApp</title>
13
+ <div className="text-center">
14
+ <h1 className="text-4xl font-bold text-gray-900 mb-4">404</h1>
15
+ <p className="text-lg text-gray-600 mb-8">Page not found</p>
16
+ <Link
17
+ to="/"
18
+ className="inline-block px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors"
19
+ >
20
+ Go to Home
21
+ </Link>
22
+ </div>
23
+ </main>
24
+ );
18
25
  }
@@ -19,6 +19,7 @@ export const routes: RouteObject[] = [
19
19
  path: "search",
20
20
  element: (
21
21
  <GlobalSearch
22
+ as="main"
22
23
  config={config}
23
24
  title="Search"
24
25
  searchPlaceholder="Search accounts, contacts, opportunities, and content..."
@@ -75,7 +75,7 @@
75
75
  --destructive: oklch(0.577 0.245 27.325);
76
76
  --border: oklch(0.922 0 0);
77
77
  --input: oklch(0.922 0 0);
78
- --ring: oklch(0.708 0 0);
78
+ --ring: oklch(0.556 0 0);
79
79
  --chart-1: oklch(0.646 0.222 41.116);
80
80
  --chart-2: oklch(0.6 0.118 184.704);
81
81
  --chart-3: oklch(0.398 0.07 227.392);
@@ -127,7 +127,7 @@
127
127
 
128
128
  @layer base {
129
129
  * {
130
- @apply border-border outline-ring/50;
130
+ @apply border-border outline-ring;
131
131
  }
132
132
  body {
133
133
  @apply bg-background text-foreground;