@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
|
@@ -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 {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Outlet, Link, useLocation } from "react-router";
|
|
1
|
+
import { Outlet, Link, useLocation, matchPath } from "react-router";
|
|
2
2
|
import { getAllRoutes } from "./router-utils";
|
|
3
3
|
import { useEffect, useId, useRef, useState } from "react";
|
|
4
4
|
import { AuthMenu } from "./features/authentication/menu/AuthMenu";
|
|
@@ -11,11 +11,13 @@ export default function AppLayout() {
|
|
|
11
11
|
const navId = useId();
|
|
12
12
|
const outletWrapperRef = useRef<HTMLDivElement>(null);
|
|
13
13
|
const previousPathname = useRef<string | null>(null);
|
|
14
|
+
const menuButtonRef = useRef<HTMLButtonElement>(null);
|
|
14
15
|
|
|
15
16
|
useEffect(() => {
|
|
17
|
+
if (matchPath("/search", location.pathname)) document.title = "Search | MyApp";
|
|
16
18
|
if (previousPathname.current !== null && previousPathname.current !== location.pathname) {
|
|
17
19
|
const wrapper = outletWrapperRef.current;
|
|
18
|
-
const target = wrapper?.querySelector<HTMLElement>("h1
|
|
20
|
+
const target = wrapper?.querySelector<HTMLElement>("h1");
|
|
19
21
|
if (target) {
|
|
20
22
|
if (!target.hasAttribute("tabindex")) target.setAttribute("tabindex", "-1");
|
|
21
23
|
target.focus();
|
|
@@ -59,7 +61,7 @@ export default function AppLayout() {
|
|
|
59
61
|
>
|
|
60
62
|
Skip to main content
|
|
61
63
|
</a>
|
|
62
|
-
<nav className="bg-white border-b border-gray-200">
|
|
64
|
+
<nav aria-label="Primary" className="bg-white border-b border-gray-200">
|
|
63
65
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
64
66
|
<div className="flex justify-between items-center h-16">
|
|
65
67
|
<Link to="/" className="text-xl font-semibold text-gray-900">
|
|
@@ -68,6 +70,7 @@ export default function AppLayout() {
|
|
|
68
70
|
<div className="flex items-center gap-2">
|
|
69
71
|
<AuthMenu />
|
|
70
72
|
<Button
|
|
73
|
+
ref={menuButtonRef}
|
|
71
74
|
variant="ghost"
|
|
72
75
|
size="icon"
|
|
73
76
|
onClick={toggleMenu}
|
|
@@ -106,7 +109,13 @@ export default function AppLayout() {
|
|
|
106
109
|
asChild
|
|
107
110
|
className="justify-start"
|
|
108
111
|
>
|
|
109
|
-
<Link
|
|
112
|
+
<Link
|
|
113
|
+
to={item.path}
|
|
114
|
+
onClick={() => {
|
|
115
|
+
setIsOpen(false);
|
|
116
|
+
if (isActive(item.path)) menuButtonRef.current?.focus();
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
110
119
|
{item.label}
|
|
111
120
|
</Link>
|
|
112
121
|
</Button>
|
|
@@ -8,7 +8,7 @@ const statusAlertVariants = cva('', {
|
|
|
8
8
|
variant: {
|
|
9
9
|
error: '',
|
|
10
10
|
success: '',
|
|
11
|
-
info: 'text-blue-
|
|
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-
|
|
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
|
|
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/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/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}
|
|
@@ -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}
|
|
@@ -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}
|
package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/pages/AccountObjectDetailPage.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { 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,
|
|
@@ -83,28 +85,43 @@ export default function AccountObjectDetail() {
|
|
|
83
85
|
error,
|
|
84
86
|
} = useAsyncData(() => fetchAccountDetail(recordId!), [recordId]);
|
|
85
87
|
|
|
86
|
-
const pageTitle =
|
|
87
|
-
?
|
|
88
|
+
const pageTitle = loading
|
|
89
|
+
? "Loading Account | MyApp"
|
|
88
90
|
: error
|
|
89
91
|
? "Error | MyApp"
|
|
90
|
-
:
|
|
91
|
-
? "
|
|
92
|
+
: account
|
|
93
|
+
? `${fieldValue(account.Name) ?? "Account"} | MyApp`
|
|
92
94
|
: "Account Not Found | MyApp";
|
|
93
95
|
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (loading) {
|
|
98
|
+
setCompletionAnnouncement("");
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const main = mainRef.current;
|
|
102
|
+
const heading = main?.querySelector<HTMLElement>("h1");
|
|
103
|
+
if (heading) {
|
|
104
|
+
const active = document.activeElement;
|
|
105
|
+
if (active && active !== document.body && !main?.contains(active)) {
|
|
106
|
+
setCompletionAnnouncement(heading.textContent ?? "");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
setCompletionAnnouncement("");
|
|
110
|
+
if (!heading.hasAttribute("tabindex")) heading.setAttribute("tabindex", "-1");
|
|
111
|
+
heading.focus();
|
|
112
|
+
}
|
|
113
|
+
}, [loading, error, account, recordId]);
|
|
114
|
+
|
|
94
115
|
return (
|
|
95
|
-
<main className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
|
116
|
+
<main ref={mainRef} className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
|
96
117
|
<title>{pageTitle}</title>
|
|
97
|
-
|
|
118
|
+
<div role="status" aria-live="polite" className="sr-only">
|
|
119
|
+
{loading ? "Loading account" : completionAnnouncement}
|
|
120
|
+
</div>
|
|
98
121
|
{loading && <AccountDetailSkeleton />}
|
|
99
|
-
|
|
100
|
-
{/* Error state */}
|
|
101
122
|
{error && <AccountDetailError onBack={() => navigate(-1)} />}
|
|
102
|
-
|
|
103
|
-
{/* Not found state */}
|
|
104
123
|
{!loading && !error && !account && <AccountDetailNotFound onBack={() => navigate(-1)} />}
|
|
105
|
-
|
|
106
|
-
{/* Content */}
|
|
107
|
-
{account && <AccountDetailContent account={account} />}
|
|
124
|
+
{!loading && !error && account && <AccountDetailContent account={account} />}
|
|
108
125
|
</main>
|
|
109
126
|
);
|
|
110
127
|
}
|
|
@@ -258,7 +275,8 @@ function Section({ title, children }: { title: string; children: React.ReactNode
|
|
|
258
275
|
function AccountDetailError({ onBack }: { onBack: () => void }) {
|
|
259
276
|
return (
|
|
260
277
|
<>
|
|
261
|
-
|
|
278
|
+
{/* Completion is announced by heading focus or the persistent status. */}
|
|
279
|
+
<Alert variant="destructive" role={undefined}>
|
|
262
280
|
<AlertCircle aria-hidden="true" />
|
|
263
281
|
<AlertTitle>
|
|
264
282
|
<h1>Failed to load account</h1>
|
|
@@ -298,8 +316,7 @@ function AccountDetailNotFound({ onBack }: { onBack: () => void }) {
|
|
|
298
316
|
|
|
299
317
|
function AccountDetailSkeleton() {
|
|
300
318
|
return (
|
|
301
|
-
<div
|
|
302
|
-
<span className="sr-only">Loading account…</span>
|
|
319
|
+
<div>
|
|
303
320
|
<Skeleton className="h-8 w-56 mb-4" />
|
|
304
321
|
|
|
305
322
|
<Card>
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
}
|
|
@@ -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.
|
|
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
|
|
130
|
+
@apply border-border outline-ring;
|
|
131
131
|
}
|
|
132
132
|
body {
|
|
133
133
|
@apply bg-background text-foreground;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/app.tsx","./src/appLayout.tsx","./src/index.ts","./src/navigationMenu.tsx","./src/router-utils.tsx","./src/routes.tsx","./src/api/graphqlClient.ts","./src/components/CustomerWebClientChat.tsx","./src/components/ObjectBreadcrumb.tsx","./src/components/alerts/status-alert.tsx","./src/components/layouts/card-layout.tsx","./src/components/ui/alert.tsx","./src/components/ui/avatar.tsx","./src/components/ui/badge.tsx","./src/components/ui/breadcrumb.tsx","./src/components/ui/button.tsx","./src/components/ui/calendar.tsx","./src/components/ui/card.tsx","./src/components/ui/checkbox.tsx","./src/components/ui/collapsible.tsx","./src/components/ui/datePicker.tsx","./src/components/ui/dialog.tsx","./src/components/ui/dropdown-menu.tsx","./src/components/ui/field.tsx","./src/components/ui/index.ts","./src/components/ui/input.tsx","./src/components/ui/label.tsx","./src/components/ui/pagination.tsx","./src/components/ui/popover.tsx","./src/components/ui/select.tsx","./src/components/ui/separator.tsx","./src/components/ui/skeleton.tsx","./src/components/ui/sonner.tsx","./src/components/ui/spinner.tsx","./src/components/ui/table.tsx","./src/components/ui/tabs.tsx","./src/features/authentication/authHelpers.ts","./src/features/authentication/authenticationConfig.ts","./src/features/authentication/api/userProfileApi.ts","./src/features/authentication/components/SocialLogin.tsx","./src/features/authentication/context/AuthContext.tsx","./src/features/authentication/footers/footer-link.tsx","./src/features/authentication/forms/auth-form.tsx","./src/features/authentication/forms/submit-button.tsx","./src/features/authentication/hooks/form.tsx","./src/features/authentication/hooks/useCountdownTimer.ts","./src/features/authentication/hooks/useRetryWithBackoff.ts","./src/features/authentication/layout/centered-page-layout.tsx","./src/features/authentication/layouts/AuthAppLayout.tsx","./src/features/authentication/layouts/privateRouteLayout.tsx","./src/features/authentication/menu/AuthMenu.tsx","./src/features/authentication/pages/ChangePassword.tsx","./src/features/authentication/pages/ForgotPassword.tsx","./src/features/authentication/pages/Login.tsx","./src/features/authentication/pages/Profile.tsx","./src/features/authentication/pages/Register.tsx","./src/features/authentication/pages/ResetPassword.tsx","./src/features/authentication/sessionTimeout/SessionTimeoutValidator.tsx","./src/features/authentication/sessionTimeout/sessionTimeService.ts","./src/features/authentication/sessionTimeout/sessionTimeoutConfig.ts","./src/features/authentication/utils/helpers.ts","./src/features/language-switcher/LanguageSwitcher.tsx","./src/features/language-switcher/buildLanguageUrl.ts","./src/features/language-switcher/index.ts","./src/features/language-switcher/languages.ts","./src/features/language-switcher/__examples__/language-switcher-example.tsx","./src/features/language-switcher/__examples__/vite-config-site-example.ts","./src/features/search/constants.ts","./src/features/search/index.ts","./src/features/search/loadConfig.ts","./src/features/search/queryBuilder.ts","./src/features/search/types.ts","./src/features/search/__tests__/queryBuilder.test.ts","./src/features/search/adapters/registry.ts","./src/features/search/adapters/types.ts","./src/features/search/adapters/cms/channelResolver.ts","./src/features/search/adapters/cms/cmsQueryFragment.ts","./src/features/search/adapters/cms/contentTypeSessionCache.ts","./src/features/search/adapters/cms/contentTypeUtils.ts","./src/features/search/adapters/cms/index.ts","./src/features/search/adapters/cms/parseResponse.ts","./src/features/search/adapters/cms/searchChannel.ts","./src/features/search/adapters/cms/types.ts","./src/features/search/adapters/cms/__tests__/channelResolver.test.ts","./src/features/search/adapters/cms/__tests__/cmsQueryFragment.test.ts","./src/features/search/adapters/cms/__tests__/contentTypeSessionCache.test.ts","./src/features/search/adapters/cms/__tests__/contentTypeUtils.test.ts","./src/features/search/adapters/cms/__tests__/orgApiVersionService.test.ts","./src/features/search/adapters/cms/__tests__/parseResponse.test.ts","./src/features/search/adapters/cms/__tests__/searchChannel.test.ts","./src/features/search/adapters/cms/__tests__/searchableContentTypesService.test.ts","./src/features/search/adapters/cms/api/apiUtils.ts","./src/features/search/adapters/cms/api/orgApiVersionService.ts","./src/features/search/adapters/cms/api/searchableContentTypesService.ts","./src/features/search/adapters/cms/hooks/useSearchableContentTypes.ts","./src/features/search/adapters/sobject/index.ts","./src/features/search/adapters/sobject/parseResponse.ts","./src/features/search/adapters/sobject/queryFragment.ts","./src/features/search/api/distinctValuesService.ts","./src/features/search/api/searchService.ts","./src/features/search/api/__tests__/searchService.test.ts","./src/features/search/components/GlobalSearchBox.tsx","./src/features/search/components/MergedSearchResults.tsx","./src/features/search/components/Search.tsx","./src/features/search/components/SearchResults.tsx","./src/features/search/components/SourceSection.tsx","./src/features/search/components/__tests__/MergedSearchResults.test.tsx","./src/features/search/components/__tests__/Search.test.tsx","./src/features/search/components/__tests__/SourceSection.test.tsx","./src/features/search/components/controls/PaginationControls.tsx","./src/features/search/components/controls/ScopeSelector.tsx","./src/features/search/components/controls/SearchBar.tsx","./src/features/search/components/controls/SortControl.tsx","./src/features/search/components/filters/ActiveFilters.tsx","./src/features/search/components/filters/DefaultFilterPanel.tsx","./src/features/search/components/filters/FilterContext.tsx","./src/features/search/components/filters/inputs/BooleanFilter.tsx","./src/features/search/components/filters/inputs/DateRangeFilter.tsx","./src/features/search/components/filters/inputs/FilterFieldWrapper.tsx","./src/features/search/components/filters/inputs/MultiSelectFilter.tsx","./src/features/search/components/filters/inputs/NumericRangeFilter.tsx","./src/features/search/components/filters/inputs/SelectFilter.tsx","./src/features/search/components/filters/inputs/TextFilter.tsx","./src/features/search/components/results/CmsResultRow.tsx","./src/features/search/components/results/DefaultResultRow.tsx","./src/features/search/components/results/resolveResultRenderer.ts","./src/features/search/components/results/__tests__/CmsResultRow.test.tsx","./src/features/search/components/results/__tests__/resolveResultRenderer.test.ts","./src/features/search/hooks/useAsyncData.ts","./src/features/search/hooks/useDistinctValues.ts","./src/features/search/hooks/useSearch.ts","./src/features/search/utils/debounce.ts","./src/features/search/utils/fieldUtils.ts","./src/features/search/utils/filterUtils.ts","./src/features/search/utils/sortUtils.ts","./src/features/search/utils/__tests__/filterUtils.test.ts","./src/hooks/useAsyncData.ts","./src/lib/utils.ts","./src/pages/AccountObjectDetailPage.tsx","./src/pages/Home.tsx","./src/pages/NotFound.tsx","./src/pages/TestChatPage.tsx","./src/types/chat.ts","./src/types/globals.d.ts","./src/utils/accountFields.ts","./src/utils/__tests__/accountFields.test.ts","./e2e/app.spec.ts","./vite-env.d.ts","./vitest-env.d.ts","./vitest.setup.ts","../../../../../../../../../sdk/platform-sdk/types/env.d.ts"],"version":"5.9.3"}
|
|
1
|
+
{"root":["./src/app.tsx","./src/appLayout.tsx","./src/index.ts","./src/navigationMenu.tsx","./src/router-utils.tsx","./src/routes.tsx","./src/api/graphqlClient.ts","./src/components/CustomerWebClientChat.tsx","./src/components/ObjectBreadcrumb.tsx","./src/components/alerts/status-alert.tsx","./src/components/layouts/card-layout.tsx","./src/components/ui/alert.tsx","./src/components/ui/avatar.tsx","./src/components/ui/badge.tsx","./src/components/ui/breadcrumb.tsx","./src/components/ui/button.tsx","./src/components/ui/calendar.tsx","./src/components/ui/card.tsx","./src/components/ui/checkbox.tsx","./src/components/ui/collapsible.tsx","./src/components/ui/datePicker.tsx","./src/components/ui/dialog.tsx","./src/components/ui/dropdown-menu.tsx","./src/components/ui/field.tsx","./src/components/ui/index.ts","./src/components/ui/input.tsx","./src/components/ui/label.tsx","./src/components/ui/pagination.tsx","./src/components/ui/popover.tsx","./src/components/ui/select.tsx","./src/components/ui/separator.tsx","./src/components/ui/skeleton.tsx","./src/components/ui/sonner.tsx","./src/components/ui/spinner.tsx","./src/components/ui/table.tsx","./src/components/ui/tabs.tsx","./src/features/authentication/authHelpers.ts","./src/features/authentication/authenticationConfig.ts","./src/features/authentication/api/userProfileApi.ts","./src/features/authentication/components/SocialLogin.tsx","./src/features/authentication/context/AuthContext.tsx","./src/features/authentication/footers/footer-link.tsx","./src/features/authentication/forms/auth-form.tsx","./src/features/authentication/forms/submit-button.tsx","./src/features/authentication/hooks/form.tsx","./src/features/authentication/hooks/useCountdownTimer.ts","./src/features/authentication/hooks/useRetryWithBackoff.ts","./src/features/authentication/layout/centered-page-layout.tsx","./src/features/authentication/layouts/AuthAppLayout.tsx","./src/features/authentication/layouts/privateRouteLayout.tsx","./src/features/authentication/menu/AuthMenu.tsx","./src/features/authentication/pages/ChangePassword.tsx","./src/features/authentication/pages/ForgotPassword.tsx","./src/features/authentication/pages/Login.tsx","./src/features/authentication/pages/Profile.tsx","./src/features/authentication/pages/Register.tsx","./src/features/authentication/pages/ResetPassword.tsx","./src/features/authentication/sessionTimeout/SessionTimeoutValidator.tsx","./src/features/authentication/sessionTimeout/sessionTimeService.ts","./src/features/authentication/sessionTimeout/sessionTimeoutConfig.ts","./src/features/authentication/utils/helpers.ts","./src/features/language-switcher/LanguageSwitcher.tsx","./src/features/language-switcher/buildLanguageUrl.ts","./src/features/language-switcher/index.ts","./src/features/language-switcher/languages.ts","./src/features/language-switcher/__examples__/language-switcher-example.tsx","./src/features/language-switcher/__examples__/vite-config-site-example.ts","./src/features/search/constants.ts","./src/features/search/index.ts","./src/features/search/loadConfig.ts","./src/features/search/queryBuilder.ts","./src/features/search/types.ts","./src/features/search/__tests__/queryBuilder.test.ts","./src/features/search/adapters/registry.ts","./src/features/search/adapters/types.ts","./src/features/search/adapters/cms/channelResolver.ts","./src/features/search/adapters/cms/cmsQueryFragment.ts","./src/features/search/adapters/cms/contentTypeSessionCache.ts","./src/features/search/adapters/cms/contentTypeUtils.ts","./src/features/search/adapters/cms/index.ts","./src/features/search/adapters/cms/parseResponse.ts","./src/features/search/adapters/cms/searchChannel.ts","./src/features/search/adapters/cms/types.ts","./src/features/search/adapters/cms/__tests__/channelResolver.test.ts","./src/features/search/adapters/cms/__tests__/cmsQueryFragment.test.ts","./src/features/search/adapters/cms/__tests__/contentTypeSessionCache.test.ts","./src/features/search/adapters/cms/__tests__/contentTypeUtils.test.ts","./src/features/search/adapters/cms/__tests__/orgApiVersionService.test.ts","./src/features/search/adapters/cms/__tests__/parseResponse.test.ts","./src/features/search/adapters/cms/__tests__/searchChannel.test.ts","./src/features/search/adapters/cms/__tests__/searchableContentTypesService.test.ts","./src/features/search/adapters/cms/api/apiUtils.ts","./src/features/search/adapters/cms/api/orgApiVersionService.ts","./src/features/search/adapters/cms/api/searchableContentTypesService.ts","./src/features/search/adapters/cms/hooks/useSearchableContentTypes.ts","./src/features/search/adapters/sobject/index.ts","./src/features/search/adapters/sobject/parseResponse.ts","./src/features/search/adapters/sobject/queryFragment.ts","./src/features/search/api/distinctValuesService.ts","./src/features/search/api/searchService.ts","./src/features/search/api/__tests__/searchService.test.ts","./src/features/search/components/GlobalSearchBox.tsx","./src/features/search/components/MergedSearchResults.tsx","./src/features/search/components/Search.tsx","./src/features/search/components/SearchResults.tsx","./src/features/search/components/SourceSection.tsx","./src/features/search/components/__tests__/MergedSearchResults.test.tsx","./src/features/search/components/__tests__/Search.test.tsx","./src/features/search/components/__tests__/SourceSection.test.tsx","./src/features/search/components/controls/PaginationControls.tsx","./src/features/search/components/controls/ScopeSelector.tsx","./src/features/search/components/controls/SearchBar.tsx","./src/features/search/components/controls/SortControl.tsx","./src/features/search/components/filters/ActiveFilters.tsx","./src/features/search/components/filters/DefaultFilterPanel.tsx","./src/features/search/components/filters/FilterContext.tsx","./src/features/search/components/filters/inputs/BooleanFilter.tsx","./src/features/search/components/filters/inputs/DateRangeFilter.tsx","./src/features/search/components/filters/inputs/FilterFieldWrapper.tsx","./src/features/search/components/filters/inputs/MultiSelectFilter.tsx","./src/features/search/components/filters/inputs/NumericRangeFilter.tsx","./src/features/search/components/filters/inputs/SelectFilter.tsx","./src/features/search/components/filters/inputs/TextFilter.tsx","./src/features/search/components/results/CmsResultRow.tsx","./src/features/search/components/results/DefaultResultRow.tsx","./src/features/search/components/results/resolveResultRenderer.ts","./src/features/search/components/results/__tests__/CmsResultRow.test.tsx","./src/features/search/components/results/__tests__/DefaultResultRow.test.tsx","./src/features/search/components/results/__tests__/resolveResultRenderer.test.ts","./src/features/search/hooks/useAsyncData.ts","./src/features/search/hooks/useDistinctValues.ts","./src/features/search/hooks/useSearch.ts","./src/features/search/hooks/__tests__/useSearch.test.ts","./src/features/search/utils/debounce.ts","./src/features/search/utils/fieldUtils.ts","./src/features/search/utils/filterUtils.ts","./src/features/search/utils/sortUtils.ts","./src/features/search/utils/__tests__/filterUtils.test.ts","./src/hooks/useAsyncData.ts","./src/lib/utils.ts","./src/pages/AccountObjectDetailPage.tsx","./src/pages/Home.tsx","./src/pages/NotFound.tsx","./src/pages/TestChatPage.tsx","./src/types/chat.ts","./src/types/globals.d.ts","./src/utils/accountFields.ts","./src/utils/__tests__/accountFields.test.ts","./e2e/app.spec.ts","./vite-env.d.ts","./vitest-env.d.ts","./vitest.setup.ts","../../../../../../../../../sdk/platform-sdk/types/env.d.ts"],"version":"5.9.3"}
|
|
@@ -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
|
+
}
|