@salesforce/webapp-template-app-react-template-vibe-experimental 1.43.0 → 1.44.0
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 +19 -0
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/e2e/app.spec.ts +0 -7
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/package-lock.json +2349 -829
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/package.json +1 -1
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/appLayout.tsx +2 -0
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/navigationMenu.tsx +80 -0
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/ChangePassword.tsx +8 -5
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/ForgotPassword.tsx +5 -4
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/Login.tsx +11 -8
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/Register.tsx +5 -4
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/ResetPassword.tsx +5 -5
- package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/router-utils.tsx +35 -0
- package/dist/package.json +1 -1
- package/package.json +2 -2
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@radix-ui/react-label": "^2.1.8",
|
|
18
18
|
"@radix-ui/react-select": "^2.2.6",
|
|
19
19
|
"@radix-ui/react-slot": "^1.2.4",
|
|
20
|
-
"@salesforce/agentforce-conversation-client": "^1.
|
|
20
|
+
"@salesforce/agentforce-conversation-client": "^1.43.1",
|
|
21
21
|
"@salesforce/sdk-data": "^1.11.2",
|
|
22
22
|
"@salesforce/webapp-experimental": "*",
|
|
23
23
|
"@tailwindcss/vite": "^4.1.17",
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Outlet } from "react-router";
|
|
8
|
+
import NavigationMenu from "./navigationMenu";
|
|
8
9
|
import AgentforceConversationClient from "./components/AgentforceConversationClient";
|
|
9
10
|
|
|
10
11
|
export default function AppLayout(): React.ReactElement {
|
|
11
12
|
return (
|
|
12
13
|
<>
|
|
14
|
+
<NavigationMenu />
|
|
13
15
|
<Outlet />
|
|
14
16
|
<AgentforceConversationClient />
|
|
15
17
|
</>
|
package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/navigationMenu.tsx
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Link, useLocation } from 'react-router';
|
|
2
|
+
import { getAllRoutes } from './router-utils';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
export default function NavigationMenu() {
|
|
6
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
7
|
+
const location = useLocation();
|
|
8
|
+
|
|
9
|
+
const isActive = (path: string) => location.pathname === path;
|
|
10
|
+
|
|
11
|
+
const toggleMenu = () => setIsOpen(!isOpen);
|
|
12
|
+
|
|
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
|
+
);
|
|
27
|
+
|
|
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
|
+
);
|
|
80
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { Link } from "react-router";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import {
|
|
4
|
+
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
5
5
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
6
6
|
import { AuthForm } from "../components/forms/auth-form";
|
|
7
7
|
import { useAppForm } from "../hooks/form";
|
|
@@ -27,10 +27,13 @@ export default function ChangePassword() {
|
|
|
27
27
|
try {
|
|
28
28
|
// [Dev Note] Custom Apex Endpoint: /auth/change-password
|
|
29
29
|
// You must ensure this Apex class exists in your org
|
|
30
|
-
const response = await
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const response = await uiApiClient.post(
|
|
31
|
+
`${window.location.origin}/sfdcapi/services/apexrest/auth/change-password`,
|
|
32
|
+
{
|
|
33
|
+
currentPassword: formFieldValues.currentPassword,
|
|
34
|
+
newPassword: formFieldValues.newPassword,
|
|
35
|
+
},
|
|
36
|
+
);
|
|
34
37
|
await handleApiResponse(response, "Password change failed");
|
|
35
38
|
setSuccess(true);
|
|
36
39
|
form.reset();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
3
|
+
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
4
4
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
5
5
|
import { AuthForm } from "../components/forms/auth-form";
|
|
6
6
|
import { useAppForm } from "../hooks/form";
|
|
@@ -24,9 +24,10 @@ export default function ForgotPassword() {
|
|
|
24
24
|
try {
|
|
25
25
|
// [Dev Note] Custom Apex Endpoint: /auth/forgot-password
|
|
26
26
|
// You must ensure this Apex class exists in your org
|
|
27
|
-
const response = await
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const response = await uiApiClient.post(
|
|
28
|
+
`${window.location.origin}/sfdcapi/services/apexrest/auth/forgot-password`,
|
|
29
|
+
{ username: value.username.trim() },
|
|
30
|
+
);
|
|
30
31
|
await handleApiResponse(response, "Failed to send reset link");
|
|
31
32
|
setSuccess(true);
|
|
32
33
|
} catch (err) {
|
package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/Login.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { useNavigate, useSearchParams, Link } from "react-router";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import {
|
|
4
|
+
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
5
5
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
6
6
|
import { AuthForm } from "../components/forms/auth-form";
|
|
7
7
|
import { useAppForm } from "../hooks/form";
|
|
@@ -26,15 +26,18 @@ export default function Login() {
|
|
|
26
26
|
setSubmitError(null);
|
|
27
27
|
try {
|
|
28
28
|
// [Dev Note] Salesforce Integration:
|
|
29
|
-
// We use
|
|
30
|
-
// "/
|
|
29
|
+
// We use uiApiClient.post with an absolute path to call the custom Apex REST auth endpoint.
|
|
30
|
+
// "/sfdcapi/services/apexrest/auth/login" refers to a custom Apex Class exposed as a REST resource.
|
|
31
31
|
// You must ensure this Apex class exists in your org and handles the login logic
|
|
32
32
|
// (e.g., creating a session or returning a token).
|
|
33
|
-
const response = await
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
const response = await uiApiClient.post(
|
|
34
|
+
`${window.location.origin}/sfdcapi/services/apexrest/auth/login`,
|
|
35
|
+
{
|
|
36
|
+
email: value.email.trim().toLowerCase(),
|
|
37
|
+
password: value.password,
|
|
38
|
+
startUrl: getStartUrl(searchParams),
|
|
39
|
+
},
|
|
40
|
+
);
|
|
38
41
|
const result = await handleApiResponse<AuthResponse>(response, "Login failed");
|
|
39
42
|
if (result?.redirectUrl) {
|
|
40
43
|
// Hard navigate to the URL which establishes the server session cookie
|
package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/Register.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { useNavigate, useSearchParams } from "react-router";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import {
|
|
4
|
+
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
5
5
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
6
6
|
import { AuthForm } from "../components/forms/auth-form";
|
|
7
7
|
import { useAppForm } from "../hooks/form";
|
|
@@ -50,9 +50,10 @@ export default function Register() {
|
|
|
50
50
|
// [Dev Note] Calls the custom Apex REST endpoint for user registration.
|
|
51
51
|
// Ensure your Apex logic handles duplicate checks and user creation (e.g., Site.createExternalUser).
|
|
52
52
|
const { confirmPassword, ...request } = formFieldValues;
|
|
53
|
-
const response = await
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const response = await uiApiClient.post(
|
|
54
|
+
`${window.location.origin}/sfdcapi/services/apexrest/auth/register`,
|
|
55
|
+
{ request },
|
|
56
|
+
);
|
|
56
57
|
const result = await handleApiResponse<AuthResponse>(response, "Registration failed");
|
|
57
58
|
if (result?.redirectUrl) {
|
|
58
59
|
// Hard navigate to the URL which logs the new user in
|
package/dist/force-app/main/default/webapplications/appreacttemplatevibe/src/pages/ResetPassword.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { Link, useSearchParams } from "react-router";
|
|
3
|
-
import {
|
|
3
|
+
import { uiApiClient } from "@salesforce/webapp-experimental/api";
|
|
4
4
|
import { CardLayout } from "../components/layout/card-layout";
|
|
5
5
|
import { CenteredPageLayout } from "../components/layout/centered-page-layout";
|
|
6
6
|
import { AuthForm } from "../components/forms/auth-form";
|
|
@@ -24,10 +24,10 @@ export default function ResetPassword() {
|
|
|
24
24
|
try {
|
|
25
25
|
// [Dev Note] Custom Apex Endpoint: /auth/reset-password
|
|
26
26
|
// You must ensure this Apex class exists in your org
|
|
27
|
-
const response = await
|
|
28
|
-
|
|
29
|
-
newPassword: value.newPassword,
|
|
30
|
-
|
|
27
|
+
const response = await uiApiClient.post(
|
|
28
|
+
`${window.location.origin}/services/apexrest/auth/reset-password`,
|
|
29
|
+
{ token, newPassword: value.newPassword },
|
|
30
|
+
);
|
|
31
31
|
await handleApiResponse(response, "Password reset failed");
|
|
32
32
|
setSuccess(true);
|
|
33
33
|
// Scroll to top of page after successful submission so user sees it
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { RouteObject } from 'react-router';
|
|
2
|
+
import { routes } from './routes';
|
|
3
|
+
|
|
4
|
+
export type RouteWithFullPath = RouteObject & { fullPath: string };
|
|
5
|
+
|
|
6
|
+
const flatMapRoutes = (
|
|
7
|
+
route: RouteObject,
|
|
8
|
+
parentPath: string = ''
|
|
9
|
+
): RouteWithFullPath[] => {
|
|
10
|
+
let fullPath: string;
|
|
11
|
+
|
|
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
|
+
}
|
|
24
|
+
|
|
25
|
+
const routeWithPath = { ...route, fullPath };
|
|
26
|
+
|
|
27
|
+
const childRoutes =
|
|
28
|
+
route.children?.flatMap(child => flatMapRoutes(child, fullPath)) || [];
|
|
29
|
+
|
|
30
|
+
return [routeWithPath, ...childRoutes];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const getAllRoutes = (): RouteWithFullPath[] => {
|
|
34
|
+
return routes.flatMap(route => flatMapRoutes(route));
|
|
35
|
+
};
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-app-react-template-vibe-experimental",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.0",
|
|
4
4
|
"description": "Vibe coding starter app template",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "00f5b3b58d400b13a1b1130d11f571c2e1366cb4"
|
|
47
47
|
}
|