@salesforce/webapp-template-feature-react-authentication-experimental 1.53.1 → 1.54.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/README.md +1 -1
- package/dist/.a4drules/build-validation.md +1 -1
- package/dist/.a4drules/react.md +1 -1
- package/dist/AGENT.md +1 -1
- package/dist/CHANGELOG.md +19 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/package-lock.json +523 -535
- package/dist/force-app/main/default/webapplications/feature-react-authentication/package.json +1 -1
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/api/utils/accounts.ts +14 -6
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/appLayout.tsx +75 -3
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/auth/pages/Profile.tsx +17 -8
- package/dist/package.json +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDataSDK } from '@salesforce/webapp-experimental/api';
|
|
2
2
|
import HIGH_REVENUE_ACCOUNTS_QUERY from './query/highRevenueAccountsQuery.graphql?raw';
|
|
3
3
|
import type {
|
|
4
4
|
GetHighRevenueAccountsQuery,
|
|
@@ -24,10 +24,18 @@ type AccountNode = NonNullable<
|
|
|
24
24
|
export async function getHighRevenueAccounts(
|
|
25
25
|
variables: GetHighRevenueAccountsQueryVariables
|
|
26
26
|
): Promise<(AccountNode | null | undefined)[]> {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const data = await getDataSDK();
|
|
28
|
+
const response = await data.graphql?.<
|
|
29
|
+
GetHighRevenueAccountsQuery,
|
|
30
|
+
GetHighRevenueAccountsQueryVariables
|
|
31
|
+
>(HIGH_REVENUE_ACCOUNTS_QUERY, variables);
|
|
32
|
+
|
|
33
|
+
if (response?.errors?.length) {
|
|
34
|
+
const errorMessages = response.errors.map(e => e.message).join('; ');
|
|
35
|
+
throw new Error(`GraphQL Error: ${errorMessages}`);
|
|
36
|
+
}
|
|
31
37
|
|
|
32
|
-
return
|
|
38
|
+
return (
|
|
39
|
+
response?.data?.uiapi?.query?.Account?.edges?.map(edge => edge?.node) || []
|
|
40
|
+
);
|
|
33
41
|
}
|
package/dist/force-app/main/default/webapplications/feature-react-authentication/src/appLayout.tsx
CHANGED
|
@@ -1,10 +1,82 @@
|
|
|
1
|
-
import { Outlet } from 'react-router';
|
|
2
|
-
import
|
|
1
|
+
import { Outlet, Link, useLocation } from 'react-router';
|
|
2
|
+
import { getAllRoutes } from './router-utils';
|
|
3
|
+
import { useState } from 'react';
|
|
3
4
|
|
|
4
5
|
export default function AppLayout() {
|
|
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
|
+
|
|
5
28
|
return (
|
|
6
29
|
<>
|
|
7
|
-
<
|
|
30
|
+
<nav className="bg-white border-b border-gray-200">
|
|
31
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
32
|
+
<div className="flex justify-between items-center h-16">
|
|
33
|
+
<Link to="/" className="text-xl font-semibold text-gray-900">
|
|
34
|
+
React App
|
|
35
|
+
</Link>
|
|
36
|
+
<button
|
|
37
|
+
onClick={toggleMenu}
|
|
38
|
+
className="p-2 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
39
|
+
aria-label="Toggle menu"
|
|
40
|
+
>
|
|
41
|
+
<div className="w-6 h-6 flex flex-col justify-center space-y-1.5">
|
|
42
|
+
<span
|
|
43
|
+
className={`block h-0.5 w-6 bg-current transition-all ${
|
|
44
|
+
isOpen ? 'rotate-45 translate-y-2' : ''
|
|
45
|
+
}`}
|
|
46
|
+
/>
|
|
47
|
+
<span
|
|
48
|
+
className={`block h-0.5 w-6 bg-current transition-all ${isOpen ? 'opacity-0' : ''}`}
|
|
49
|
+
/>
|
|
50
|
+
<span
|
|
51
|
+
className={`block h-0.5 w-6 bg-current transition-all ${
|
|
52
|
+
isOpen ? '-rotate-45 -translate-y-2' : ''
|
|
53
|
+
}`}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
{isOpen && (
|
|
59
|
+
<div className="pb-4">
|
|
60
|
+
<div className="flex flex-col space-y-2">
|
|
61
|
+
{navigationRoutes.map(item => (
|
|
62
|
+
<Link
|
|
63
|
+
key={item.path}
|
|
64
|
+
to={item.path}
|
|
65
|
+
onClick={() => setIsOpen(false)}
|
|
66
|
+
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
|
67
|
+
isActive(item.path)
|
|
68
|
+
? 'bg-blue-100 text-blue-700'
|
|
69
|
+
: 'text-gray-700 hover:bg-gray-100'
|
|
70
|
+
}`}
|
|
71
|
+
>
|
|
72
|
+
{item.label}
|
|
73
|
+
</Link>
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
</nav>
|
|
8
80
|
<Outlet />
|
|
9
81
|
</>
|
|
10
82
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { getDataSDK } from "@salesforce/webapp-experimental/api";
|
|
5
5
|
|
|
6
6
|
import { CenteredPageLayout } from "../layout/centered-page-layout";
|
|
7
7
|
import { CardSkeleton } from "../layout/card-skeleton";
|
|
@@ -81,10 +81,14 @@ export default function Profile() {
|
|
|
81
81
|
setSubmitError(null);
|
|
82
82
|
setSuccess(false);
|
|
83
83
|
try {
|
|
84
|
-
const
|
|
84
|
+
const data = await getDataSDK();
|
|
85
|
+
const response: any = await data.graphql?.(MUTATE_PROFILE_GRAPHQL, {
|
|
85
86
|
input: { Id: user.id, User: { ...value } },
|
|
86
87
|
});
|
|
87
|
-
|
|
88
|
+
if (response?.errors?.length) {
|
|
89
|
+
throw new Error(response.errors.map((e: any) => e.message).join("; "));
|
|
90
|
+
}
|
|
91
|
+
setProfile(flattenGraphQLRecord(response?.data?.uiapi?.UserUpdate?.Record));
|
|
88
92
|
|
|
89
93
|
setSuccess(true);
|
|
90
94
|
// Scroll to top of page after successful update so user sees it
|
|
@@ -99,11 +103,16 @@ export default function Profile() {
|
|
|
99
103
|
useEffect(() => {
|
|
100
104
|
let mounted = true;
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
.then(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
getDataSDK()
|
|
107
|
+
.then((data) => data.graphql?.(QUERY_PROFILE_GRAPHQL, { userId: user.id }))
|
|
108
|
+
.then((response: any) => {
|
|
109
|
+
if (response?.errors?.length) {
|
|
110
|
+
throw new Error(response.errors.map((e: any) => e.message).join("; "));
|
|
111
|
+
}
|
|
112
|
+
if (mounted) {
|
|
113
|
+
setProfile(flattenGraphQLRecord(response?.data?.uiapi?.query?.User?.edges?.[0]?.node));
|
|
114
|
+
}
|
|
115
|
+
})
|
|
107
116
|
.catch((err: any) => {
|
|
108
117
|
if (mounted) {
|
|
109
118
|
setLoadError(getErrorMessage(err, "Failed to load profile"));
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-feature-react-authentication-experimental",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.54.0",
|
|
4
4
|
"description": "Authentication feature for web applications",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"clean": "rm -rf dist"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@salesforce/webapp-experimental": "^1.
|
|
19
|
+
"@salesforce/webapp-experimental": "^1.54.0",
|
|
20
20
|
"@tanstack/react-form": "^1.27.7",
|
|
21
21
|
"@types/react": "^19.2.7",
|
|
22
22
|
"@types/react-dom": "^19.2.3",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"build:dist-app": {
|
|
37
37
|
"executor": "@salesforce/webapp-template-cli-experimental:build-dist-app"
|
|
38
38
|
},
|
|
39
|
-
"
|
|
39
|
+
"dev": {
|
|
40
40
|
"executor": "@salesforce/webapp-template-cli-experimental:dev-server"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "b48827161c23db20c7e546a857fe8c9f5f560c20"
|
|
45
45
|
}
|