@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.
- package/lib/templates/project/angularextapp/CHANGELOG.md +161 -0
- package/lib/templates/project/angularextapp/README.md +110 -44
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/README.md +1 -1
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/package-lock.json +649 -1097
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/package.json +4 -4
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/_f_/_os_/api/object-search.service.ts +3 -6
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/_f_/authentication/social-login/social-login.html +39 -0
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/_f_/authentication/social-login/social-login.ts +107 -0
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/api/graphql-operations-types.ts +1 -2
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/components/ui/button/button.ts +1 -8
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/components/ui/dialog/dialog.html +1 -1
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/components/ui/icon/icon.ts +6 -0
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/pages/login/login-page.html +2 -0
- package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/pages/login/login-page.ts +2 -1
- package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig.cls +145 -0
- package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig.cls-meta.xml +5 -0
- package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig_Test.cls +181 -0
- package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig_Test.cls-meta.xml +5 -0
- package/lib/templates/project/angularextapp/package.json +1 -1
- package/lib/templates/project/angularextapp/scripts/network-senders.mjs +84 -0
- package/lib/templates/project/angularextapp/scripts/org-setup-xml.mjs +11 -6
- package/lib/templates/project/angularextapp/scripts/org-setup.mjs +13 -5
- package/lib/templates/project/angularintapp/_p_/_m_/_w_/_a_/package-lock.json +648 -1096
- package/lib/templates/project/reactexternalapp/CHANGELOG.md +129 -0
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package-lock.json +543 -531
- 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 +546 -534
- 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/angularbasic/package-lock.json +645 -1093
- package/lib/templates/uiBundles/reactbasic/package-lock.json +543 -531
- 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/lib/templates/uiBundles/vuebasic/package-lock.json +523 -519
- package/package.json +10 -10
|
@@ -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
|
+
}
|
|
@@ -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
|
});
|