@salesforce/webapp-template-app-react-template-b2e-experimental 1.43.0 → 1.43.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.a4drules/skills/install-feature/SKILL.md +0 -1
- package/dist/CHANGELOG.md +11 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/e2e/app.spec.ts +0 -7
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/package-lock.json +3589 -3223
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/package.json +2 -10
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/app.tsx +19 -13
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/appLayout.tsx +9 -1
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/AgentforceConversationClient.tsx +127 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/index.ts +6 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/navigationMenu.tsx +73 -74
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/router-utils.tsx +24 -23
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/routes.tsx +0 -66
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/styles/global.css +10 -129
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/types/conversation.ts +21 -0
- package/dist/package.json +1 -1
- package/package.json +2 -2
- package/dist/force-app/main/default/classes/WebAppAuthUtils.cls +0 -68
- package/dist/force-app/main/default/classes/WebAppAuthUtils.cls-meta.xml +0 -5
- package/dist/force-app/main/default/classes/WebAppChangePassword.cls +0 -77
- package/dist/force-app/main/default/classes/WebAppChangePassword.cls-meta.xml +0 -5
- package/dist/force-app/main/default/classes/WebAppForgotPassword.cls +0 -71
- package/dist/force-app/main/default/classes/WebAppForgotPassword.cls-meta.xml +0 -5
- package/dist/force-app/main/default/classes/WebAppLogin.cls +0 -97
- package/dist/force-app/main/default/classes/WebAppLogin.cls-meta.xml +0 -5
- package/dist/force-app/main/default/classes/WebAppRegistration.cls +0 -162
- package/dist/force-app/main/default/classes/WebAppRegistration.cls-meta.xml +0 -5
- package/dist/force-app/main/default/digitalExperienceConfigs/appreacttemplateb2e1.digitalExperienceConfig +0 -8
- package/dist/force-app/main/default/digitalExperiences/site/appreacttemplateb2e1/appreacttemplateb2e1.digitalExperience-meta.xml +0 -11
- package/dist/force-app/main/default/digitalExperiences/site/appreacttemplateb2e1/sfdc_cms__site/appreacttemplateb2e1/_meta.json +0 -5
- package/dist/force-app/main/default/digitalExperiences/site/appreacttemplateb2e1/sfdc_cms__site/appreacttemplateb2e1/content.json +0 -10
- package/dist/force-app/main/default/networks/appreacttemplateb2e.network +0 -60
- package/dist/force-app/main/default/package.xml +0 -20
- package/dist/force-app/main/default/sites/appreacttemplateb2e.site +0 -31
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/alerts/status-alert.tsx +0 -45
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/auth/authentication-route.tsx +0 -21
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/auth/private-route.tsx +0 -36
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/footers/footer-link.tsx +0 -36
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/forms/auth-form.tsx +0 -81
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/forms/submit-button.tsx +0 -49
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/layout/card-layout.tsx +0 -23
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/layout/card-skeleton.tsx +0 -38
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/layout/centered-page-layout.tsx +0 -73
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/alert.tsx +0 -65
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/button.tsx +0 -54
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/card.tsx +0 -77
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/field.tsx +0 -111
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/index.ts +0 -71
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/input.tsx +0 -19
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/label.tsx +0 -19
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/pagination.tsx +0 -99
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/select.tsx +0 -151
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/skeleton.tsx +0 -13
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/spinner.tsx +0 -26
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/table.tsx +0 -114
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/tabs.tsx +0 -115
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/context/AuthContext.tsx +0 -83
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/hooks/form.tsx +0 -116
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/lib/utils.ts +0 -6
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/About.tsx +0 -12
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/ChangePassword.tsx +0 -98
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/ForgotPassword.tsx +0 -67
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/Login.tsx +0 -89
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/Profile.tsx +0 -177
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/Register.tsx +0 -130
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/ResetPassword.tsx +0 -101
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/new.tsx +0 -10
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/utils/authenticationConfig.ts +0 -52
- package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/utils/helpers.ts +0 -195
|
@@ -14,22 +14,14 @@
|
|
|
14
14
|
"graphql:schema": "node scripts/get-graphql-schema.mjs"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@
|
|
18
|
-
"@radix-ui/react-select": "^2.2.6",
|
|
19
|
-
"@radix-ui/react-slot": "^1.2.4",
|
|
17
|
+
"@salesforce/agentforce-conversation-client": "^1.43.0",
|
|
20
18
|
"@salesforce/sdk-data": "^1.11.2",
|
|
21
19
|
"@salesforce/webapp-experimental": "*",
|
|
22
20
|
"@tailwindcss/vite": "^4.1.17",
|
|
23
|
-
"@tanstack/react-form": "^1.28.3",
|
|
24
|
-
"class-variance-authority": "^0.7.1",
|
|
25
|
-
"clsx": "^2.1.1",
|
|
26
|
-
"lucide-react": "^0.562.0",
|
|
27
21
|
"react": "^19.2.0",
|
|
28
22
|
"react-dom": "^19.2.0",
|
|
29
23
|
"react-router": "^7.10.1",
|
|
30
|
-
"
|
|
31
|
-
"tailwindcss": "^4.1.17",
|
|
32
|
-
"zod": "^4.3.6"
|
|
24
|
+
"tailwindcss": "^4.1.17"
|
|
33
25
|
},
|
|
34
26
|
"devDependencies": {
|
|
35
27
|
"@eslint/js": "^9.39.1",
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { createBrowserRouter, RouterProvider } from
|
|
2
|
-
import { routes } from
|
|
3
|
-
import { StrictMode } from
|
|
4
|
-
import { createRoot } from
|
|
5
|
-
import
|
|
6
|
-
import "./styles/global.css";
|
|
1
|
+
import { createBrowserRouter, RouterProvider } from 'react-router';
|
|
2
|
+
import { routes } from '@/routes';
|
|
3
|
+
import { StrictMode } from 'react';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
5
|
+
import './styles/global.css';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
// Match Vite base so client-side routes work when deployed under a path (e.g. /lwr/application/ai/c-webapp2/).
|
|
8
|
+
// When served at root (e.g. e2e with static serve), use '/' so routes match.
|
|
9
|
+
const base = (import.meta.env.BASE_URL ?? '/').replace(/\/$/, '') || '/';
|
|
10
|
+
const basename =
|
|
11
|
+
typeof window !== 'undefined' &&
|
|
12
|
+
(window.location.pathname === '/' ||
|
|
13
|
+
!window.location.pathname.startsWith('/lwr/'))
|
|
14
|
+
? '/'
|
|
15
|
+
: base;
|
|
16
|
+
const router = createBrowserRouter(routes, { basename });
|
|
9
17
|
|
|
10
|
-
createRoot(document.getElementById(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</AuthProvider>
|
|
15
|
-
</StrictMode>,
|
|
18
|
+
createRoot(document.getElementById('root')!).render(
|
|
19
|
+
<StrictMode>
|
|
20
|
+
<RouterProvider router={router} />
|
|
21
|
+
</StrictMode>
|
|
16
22
|
);
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
import { Outlet } from "react-router";
|
|
2
8
|
import NavigationMenu from "./navigationMenu";
|
|
9
|
+
import AgentforceConversationClient from "./components/AgentforceConversationClient";
|
|
3
10
|
|
|
4
|
-
export default function AppLayout() {
|
|
11
|
+
export default function AppLayout(): React.ReactElement {
|
|
5
12
|
return (
|
|
6
13
|
<>
|
|
7
14
|
<NavigationMenu />
|
|
8
15
|
<Outlet />
|
|
16
|
+
<AgentforceConversationClient />
|
|
9
17
|
</>
|
|
10
18
|
);
|
|
11
19
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
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 { embedAgentforceClient } from "@salesforce/agentforce-conversation-client";
|
|
8
|
+
import { useEffect } from "react";
|
|
9
|
+
import type {
|
|
10
|
+
ResolvedEmbedOptions,
|
|
11
|
+
AgentforceConversationClientProps,
|
|
12
|
+
} from "../types/conversation";
|
|
13
|
+
|
|
14
|
+
const GLOBAL_HOST_ID = "agentforce-conversation-client-global-host";
|
|
15
|
+
const SINGLETON_KEY = "__agentforceConversationClientSingleton";
|
|
16
|
+
|
|
17
|
+
interface AgentforceConversationClientSingleton {
|
|
18
|
+
initPromise?: Promise<void>;
|
|
19
|
+
initialized: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface WindowWithAgentforceSingleton extends Window {
|
|
23
|
+
[SINGLETON_KEY]?: AgentforceConversationClientSingleton;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getSingleton(): AgentforceConversationClientSingleton {
|
|
27
|
+
const win = window as WindowWithAgentforceSingleton;
|
|
28
|
+
if (!win[SINGLETON_KEY]) {
|
|
29
|
+
win[SINGLETON_KEY] = {
|
|
30
|
+
initialized: false,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return win[SINGLETON_KEY]!;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getOrCreateGlobalHost(): HTMLDivElement {
|
|
37
|
+
let host = document.getElementById(GLOBAL_HOST_ID) as HTMLDivElement | null;
|
|
38
|
+
if (!host) {
|
|
39
|
+
host = document.createElement("div");
|
|
40
|
+
host.id = GLOBAL_HOST_ID;
|
|
41
|
+
document.body.appendChild(host);
|
|
42
|
+
}
|
|
43
|
+
return host;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getDefaultEmbedOptions(): ResolvedEmbedOptions {
|
|
47
|
+
return { salesforceOrigin: window.location.origin };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* React wrapper that embeds the Agentforce Conversation Client (copilot/agent UI)
|
|
52
|
+
* using Lightning Out. Requires a valid Salesforce session for the given org.
|
|
53
|
+
* Config is passed through from the consumer to the embed client as-is.
|
|
54
|
+
*/
|
|
55
|
+
export function AgentforceConversationClient({
|
|
56
|
+
agentforceClientConfig,
|
|
57
|
+
salesforceOrigin,
|
|
58
|
+
frontdoorUrl,
|
|
59
|
+
}: AgentforceConversationClientProps) {
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const singleton = getSingleton();
|
|
62
|
+
if (singleton.initialized || singleton.initPromise) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const initialize = (options: ResolvedEmbedOptions) => {
|
|
67
|
+
// If already initialized while this flow was in progress, no-op.
|
|
68
|
+
if (singleton.initialized) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const existingEmbed = document.querySelector('lightning-out-application[data-lo="acc"]');
|
|
72
|
+
if (existingEmbed) {
|
|
73
|
+
singleton.initialized = true;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const host = getOrCreateGlobalHost();
|
|
77
|
+
|
|
78
|
+
embedAgentforceClient({
|
|
79
|
+
container: host,
|
|
80
|
+
salesforceOrigin: salesforceOrigin ?? options.salesforceOrigin,
|
|
81
|
+
frontdoorUrl: frontdoorUrl ?? options.frontdoorUrl,
|
|
82
|
+
agentforceClientConfig: agentforceClientConfig,
|
|
83
|
+
});
|
|
84
|
+
singleton.initialized = true;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const shouldFetchFrontdoor = window.location.hostname === "localhost";
|
|
88
|
+
|
|
89
|
+
if (shouldFetchFrontdoor) {
|
|
90
|
+
singleton.initPromise = fetch("/__lo/frontdoor")
|
|
91
|
+
.then(async (res) => {
|
|
92
|
+
if (!res.ok) {
|
|
93
|
+
console.error("frontdoor fetch failed");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const { frontdoorUrl: resolvedFrontdoorUrl } = await res.json();
|
|
97
|
+
initialize({ frontdoorUrl: resolvedFrontdoorUrl });
|
|
98
|
+
})
|
|
99
|
+
.catch((err) => {
|
|
100
|
+
console.error("AgentforceConversationClient: failed to fetch frontdoor URL", err);
|
|
101
|
+
})
|
|
102
|
+
.finally(() => {
|
|
103
|
+
singleton.initPromise = undefined;
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
singleton.initPromise = Promise.resolve()
|
|
107
|
+
.then(() => {
|
|
108
|
+
initialize(getDefaultEmbedOptions());
|
|
109
|
+
})
|
|
110
|
+
.catch((err) => {
|
|
111
|
+
console.error("AgentforceConversationClient: failed to embed Agentforce client", err);
|
|
112
|
+
})
|
|
113
|
+
.finally(() => {
|
|
114
|
+
singleton.initPromise = undefined;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return () => {
|
|
119
|
+
// Intentionally no cleanup:
|
|
120
|
+
// This component guarantees a single LO initialization per window.
|
|
121
|
+
};
|
|
122
|
+
}, [salesforceOrigin, frontdoorUrl, agentforceClientConfig]);
|
|
123
|
+
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default AgentforceConversationClient;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* feature-react-agentforce-conversation-client – ACC Conversation Client
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export { AgentforceConversationClient } from "./components/AgentforceConversationClient";
|
|
6
|
+
export type { AgentforceConversationClientProps, ResolvedEmbedOptions } from "./types/conversation";
|
package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/navigationMenu.tsx
CHANGED
|
@@ -1,81 +1,80 @@
|
|
|
1
|
-
import { Link, useLocation } from
|
|
2
|
-
import { getAllRoutes } from
|
|
3
|
-
import { useState } from
|
|
1
|
+
import { Link, useLocation } from 'react-router';
|
|
2
|
+
import { getAllRoutes } from './router-utils';
|
|
3
|
+
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
export default function NavigationMenu() {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
7
|
+
const location = useLocation();
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const isActive = (path: string) => location.pathname === path;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const toggleMenu = () => setIsOpen(!isOpen);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
13
|
+
const navigationRoutes: { path: string; label: string }[] = getAllRoutes()
|
|
14
|
+
.filter(
|
|
15
|
+
route =>
|
|
16
|
+
route.handle?.showInNavigation === true &&
|
|
17
|
+
route.fullPath !== undefined &&
|
|
18
|
+
route.handle?.label !== undefined
|
|
19
|
+
)
|
|
20
|
+
.map(
|
|
21
|
+
route =>
|
|
22
|
+
({
|
|
23
|
+
path: route.fullPath,
|
|
24
|
+
label: route.handle?.label,
|
|
25
|
+
}) as { path: string; label: string }
|
|
26
|
+
);
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
28
|
+
return (
|
|
29
|
+
<nav className="bg-white border-b border-gray-200">
|
|
30
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
31
|
+
<div className="flex justify-between items-center h-16">
|
|
32
|
+
<Link to="/" className="text-xl font-semibold text-gray-900">
|
|
33
|
+
React App
|
|
34
|
+
</Link>
|
|
35
|
+
<button
|
|
36
|
+
onClick={toggleMenu}
|
|
37
|
+
className="p-2 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
38
|
+
aria-label="Toggle menu"
|
|
39
|
+
>
|
|
40
|
+
<div className="w-6 h-6 flex flex-col justify-center space-y-1.5">
|
|
41
|
+
<span
|
|
42
|
+
className={`block h-0.5 w-6 bg-current transition-all ${
|
|
43
|
+
isOpen ? 'rotate-45 translate-y-2' : ''
|
|
44
|
+
}`}
|
|
45
|
+
/>
|
|
46
|
+
<span
|
|
47
|
+
className={`block h-0.5 w-6 bg-current transition-all ${isOpen ? 'opacity-0' : ''}`}
|
|
48
|
+
/>
|
|
49
|
+
<span
|
|
50
|
+
className={`block h-0.5 w-6 bg-current transition-all ${
|
|
51
|
+
isOpen ? '-rotate-45 -translate-y-2' : ''
|
|
52
|
+
}`}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
{isOpen && (
|
|
58
|
+
<div className="pb-4">
|
|
59
|
+
<div className="flex flex-col space-y-2">
|
|
60
|
+
{navigationRoutes.map(item => (
|
|
61
|
+
<Link
|
|
62
|
+
key={item.path}
|
|
63
|
+
to={item.path}
|
|
64
|
+
onClick={() => setIsOpen(false)}
|
|
65
|
+
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
|
66
|
+
isActive(item.path)
|
|
67
|
+
? 'bg-blue-100 text-blue-700'
|
|
68
|
+
: 'text-gray-700 hover:bg-gray-100'
|
|
69
|
+
}`}
|
|
70
|
+
>
|
|
71
|
+
{item.label}
|
|
72
|
+
</Link>
|
|
73
|
+
))}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
</nav>
|
|
79
|
+
);
|
|
81
80
|
}
|
package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/router-utils.tsx
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import type { RouteObject } from
|
|
2
|
-
import { routes } from
|
|
1
|
+
import type { RouteObject } from 'react-router';
|
|
2
|
+
import { routes } from './routes';
|
|
3
3
|
|
|
4
4
|
export type RouteWithFullPath = RouteObject & { fullPath: string };
|
|
5
5
|
|
|
6
|
-
const flatMapRoutes = (
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const flatMapRoutes = (
|
|
7
|
+
route: RouteObject,
|
|
8
|
+
parentPath: string = ''
|
|
9
|
+
): RouteWithFullPath[] => {
|
|
10
|
+
let fullPath: string;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
12
|
+
if (route.index) {
|
|
13
|
+
fullPath = parentPath || '/';
|
|
14
|
+
} else if (route.path) {
|
|
15
|
+
if (route.path.startsWith('/')) {
|
|
16
|
+
fullPath = route.path;
|
|
17
|
+
} else {
|
|
18
|
+
fullPath =
|
|
19
|
+
parentPath === '/' ? `/${route.path}` : `${parentPath}/${route.path}`;
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
fullPath = parentPath;
|
|
23
|
+
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
const routeWithPath = { ...route, fullPath };
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const childRoutes =
|
|
28
|
+
route.children?.flatMap(child => flatMapRoutes(child, fullPath)) || [];
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
return [routeWithPath, ...childRoutes];
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
export const getAllRoutes = (): RouteWithFullPath[] => {
|
|
33
|
-
|
|
34
|
+
return routes.flatMap(route => flatMapRoutes(route));
|
|
34
35
|
};
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import type { RouteObject } from 'react-router';
|
|
2
2
|
import AppLayout from './appLayout';
|
|
3
3
|
import Home from './pages/Home';
|
|
4
|
-
import About from './pages/About';
|
|
5
4
|
import NotFound from './pages/NotFound';
|
|
6
|
-
import Login from "./pages/Login";
|
|
7
|
-
import Register from "./pages/Register";
|
|
8
|
-
import ForgotPassword from "./pages/ForgotPassword";
|
|
9
|
-
import ResetPassword from "./pages/ResetPassword";
|
|
10
|
-
import Profile from "./pages/Profile";
|
|
11
|
-
import ChangePassword from "./pages/ChangePassword";
|
|
12
|
-
import AuthenticationRoute from "./components/auth/authentication-route";
|
|
13
|
-
import PrivateRoute from "./components/auth/private-route";
|
|
14
|
-
import { ROUTES } from "./utils/authenticationConfig";
|
|
15
|
-
import New from "./pages/new";
|
|
16
5
|
|
|
17
6
|
export const routes: RouteObject[] = [
|
|
18
7
|
{
|
|
@@ -24,64 +13,9 @@ export const routes: RouteObject[] = [
|
|
|
24
13
|
element: <Home />,
|
|
25
14
|
handle: { showInNavigation: true, label: 'Home' }
|
|
26
15
|
},
|
|
27
|
-
{
|
|
28
|
-
path: "about",
|
|
29
|
-
element: <About />,
|
|
30
|
-
handle: { showInNavigation: true, label: "About" }
|
|
31
|
-
},
|
|
32
16
|
{
|
|
33
17
|
path: '*',
|
|
34
18
|
element: <NotFound />
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
element: <AuthenticationRoute />,
|
|
38
|
-
children: [
|
|
39
|
-
{
|
|
40
|
-
path: ROUTES.LOGIN.PATH,
|
|
41
|
-
element: <Login />,
|
|
42
|
-
handle: { showInNavigation: true, label: "Login", title: ROUTES.LOGIN.TITLE }
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
path: ROUTES.REGISTER.PATH,
|
|
46
|
-
element: <Register />,
|
|
47
|
-
handle: { showInNavigation: false, title: ROUTES.REGISTER.TITLE }
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
path: ROUTES.FORGOT_PASSWORD.PATH,
|
|
51
|
-
element: <ForgotPassword />,
|
|
52
|
-
handle: { showInNavigation: false, title: ROUTES.FORGOT_PASSWORD.TITLE }
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
path: ROUTES.RESET_PASSWORD.PATH,
|
|
56
|
-
element: <ResetPassword />,
|
|
57
|
-
handle: { showInNavigation: false, title: ROUTES.RESET_PASSWORD.TITLE }
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
element: <PrivateRoute />,
|
|
63
|
-
children: [
|
|
64
|
-
{
|
|
65
|
-
path: ROUTES.PROFILE.PATH,
|
|
66
|
-
element: <Profile />,
|
|
67
|
-
handle: { showInNavigation: true, label: "Profile", title: ROUTES.PROFILE.TITLE }
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
path: ROUTES.CHANGE_PASSWORD.PATH,
|
|
71
|
-
element: <ChangePassword />,
|
|
72
|
-
handle: { showInNavigation: false, title: ROUTES.CHANGE_PASSWORD.TITLE }
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
path: "contact",
|
|
78
|
-
element: <h1>Hello World from Contact Page</h1>,
|
|
79
|
-
handle: { showInNavigation: false }
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
path: "new",
|
|
83
|
-
element: <New />,
|
|
84
|
-
handle: { showInNavigation: true, label: "New Page" }
|
|
85
19
|
}
|
|
86
20
|
]
|
|
87
21
|
}
|
package/dist/force-app/main/default/webapplications/appreacttemplateb2e/src/styles/global.css
CHANGED
|
@@ -1,132 +1,13 @@
|
|
|
1
|
-
@import
|
|
2
|
-
|
|
3
|
-
:root {
|
|
4
|
-
color-scheme: light;
|
|
5
|
-
--radius: 0.625rem;
|
|
6
|
-
--spacing: 0.25rem;
|
|
7
|
-
--background: oklch(1 0 0);
|
|
8
|
-
--foreground: oklch(0.145 0 0);
|
|
9
|
-
--card: oklch(1 0 0);
|
|
10
|
-
--card-foreground: oklch(0.145 0 0);
|
|
11
|
-
--popover: oklch(1 0 0);
|
|
12
|
-
--popover-foreground: oklch(0.145 0 0);
|
|
13
|
-
--primary: oklch(0.205 0 0);
|
|
14
|
-
--primary-foreground: oklch(0.985 0 0);
|
|
15
|
-
--secondary: oklch(0.97 0 0);
|
|
16
|
-
--secondary-foreground: oklch(0.205 0 0);
|
|
17
|
-
--muted: oklch(0.97 0 0);
|
|
18
|
-
--muted-foreground: oklch(0.556 0 0);
|
|
19
|
-
--accent: oklch(0.97 0 0);
|
|
20
|
-
--accent-foreground: oklch(0.205 0 0);
|
|
21
|
-
--destructive: oklch(0.577 0.245 27.325);
|
|
22
|
-
--destructive-foreground: oklch(0.985 0 0);
|
|
23
|
-
--border: oklch(0.922 0 0);
|
|
24
|
-
--input: oklch(0.922 0 0);
|
|
25
|
-
--ring: oklch(0.708 0 0);
|
|
26
|
-
--chart-1: oklch(0.646 0.222 41.116);
|
|
27
|
-
--chart-2: oklch(0.6 0.118 184.704);
|
|
28
|
-
--chart-3: oklch(0.398 0.07 227.392);
|
|
29
|
-
--chart-4: oklch(0.828 0.189 84.429);
|
|
30
|
-
--chart-5: oklch(0.769 0.188 70.08);
|
|
31
|
-
--sidebar: oklch(0.985 0 0);
|
|
32
|
-
--sidebar-foreground: oklch(0.145 0 0);
|
|
33
|
-
--sidebar-primary: oklch(0.205 0 0);
|
|
34
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
35
|
-
--sidebar-accent: oklch(0.97 0 0);
|
|
36
|
-
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
37
|
-
--sidebar-border: oklch(0.922 0 0);
|
|
38
|
-
--sidebar-ring: oklch(0.708 0 0);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.dark {
|
|
42
|
-
color-scheme: dark;
|
|
43
|
-
--background: oklch(0.145 0 0);
|
|
44
|
-
--foreground: oklch(0.985 0 0);
|
|
45
|
-
--card: oklch(0.205 0 0);
|
|
46
|
-
--card-foreground: oklch(0.985 0 0);
|
|
47
|
-
--popover: oklch(0.269 0 0);
|
|
48
|
-
--popover-foreground: oklch(0.985 0 0);
|
|
49
|
-
--primary: oklch(0.922 0 0);
|
|
50
|
-
--primary-foreground: oklch(0.205 0 0);
|
|
51
|
-
--secondary: oklch(0.269 0 0);
|
|
52
|
-
--secondary-foreground: oklch(0.985 0 0);
|
|
53
|
-
--muted: oklch(0.269 0 0);
|
|
54
|
-
--muted-foreground: oklch(0.708 0 0);
|
|
55
|
-
--accent: oklch(0.371 0 0);
|
|
56
|
-
--accent-foreground: oklch(0.985 0 0);
|
|
57
|
-
--destructive: oklch(0.704 0.191 22.216);
|
|
58
|
-
--destructive-foreground: oklch(0.985 0 0);
|
|
59
|
-
--border: oklch(1 0 0 / 10%);
|
|
60
|
-
--input: oklch(1 0 0 / 15%);
|
|
61
|
-
--ring: oklch(0.556 0 0);
|
|
62
|
-
--chart-1: oklch(0.488 0.243 264.376);
|
|
63
|
-
--chart-2: oklch(0.696 0.17 162.48);
|
|
64
|
-
--chart-3: oklch(0.769 0.188 70.08);
|
|
65
|
-
--chart-4: oklch(0.627 0.265 303.9);
|
|
66
|
-
--chart-5: oklch(0.645 0.246 16.439);
|
|
67
|
-
--sidebar: oklch(0.205 0 0);
|
|
68
|
-
--sidebar-foreground: oklch(0.985 0 0);
|
|
69
|
-
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
70
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
71
|
-
--sidebar-accent: oklch(0.269 0 0);
|
|
72
|
-
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
73
|
-
--sidebar-border: oklch(1 0 0 / 10%);
|
|
74
|
-
--sidebar-ring: oklch(0.439 0 0);
|
|
75
|
-
}
|
|
1
|
+
@import 'tailwindcss';
|
|
76
2
|
|
|
77
3
|
@layer base {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
@apply border-[var(--border)];
|
|
88
|
-
}
|
|
89
|
-
body {
|
|
90
|
-
@apply bg-[var(--background)] text-[var(--foreground)] antialiased;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@theme inline {
|
|
95
|
-
--color-background: var(--background);
|
|
96
|
-
--color-foreground: var(--foreground);
|
|
97
|
-
--color-card: var(--card);
|
|
98
|
-
--color-card-foreground: var(--card-foreground);
|
|
99
|
-
--color-popover: var(--popover);
|
|
100
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
101
|
-
--color-primary: var(--primary);
|
|
102
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
103
|
-
--color-secondary: var(--secondary);
|
|
104
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
105
|
-
--color-muted: var(--muted);
|
|
106
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
107
|
-
--color-accent: var(--accent);
|
|
108
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
109
|
-
--color-destructive: var(--destructive);
|
|
110
|
-
--color-destructive-foreground: var(--destructive-foreground);
|
|
111
|
-
--color-border: var(--border);
|
|
112
|
-
--color-input: var(--input);
|
|
113
|
-
--color-ring: var(--ring);
|
|
114
|
-
--color-chart-1: var(--chart-1);
|
|
115
|
-
--color-chart-2: var(--chart-2);
|
|
116
|
-
--color-chart-3: var(--chart-3);
|
|
117
|
-
--color-chart-4: var(--chart-4);
|
|
118
|
-
--color-chart-5: var(--chart-5);
|
|
119
|
-
--color-sidebar: var(--sidebar);
|
|
120
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
121
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
122
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
123
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
124
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
125
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
126
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
127
|
-
--radius-sm: calc(var(--radius) - 4px);
|
|
128
|
-
--radius-md: calc(var(--radius) - 2px);
|
|
129
|
-
--radius-lg: var(--radius);
|
|
130
|
-
--radius-xl: calc(var(--radius) + 4px);
|
|
131
|
-
--spacing: var(--spacing);
|
|
4
|
+
html,
|
|
5
|
+
body,
|
|
6
|
+
#root {
|
|
7
|
+
@apply min-h-screen;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
body {
|
|
11
|
+
@apply antialiased bg-white;
|
|
12
|
+
}
|
|
132
13
|
}
|