@salesforce/webapp-template-feature-react-authentication-experimental 1.53.0 → 1.53.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  "version": "1.0.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "start": "vite",
7
+ "dev": "vite",
8
8
  "build": "tsc -b && vite build",
9
9
  "build:e2e": "npm run build && node scripts/rewrite-e2e-assets.mjs",
10
10
  "lint": "eslint .",
@@ -1,10 +1,82 @@
1
- import { Outlet } from 'react-router';
2
- import NavigationMenu from './navigationMenu';
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
- <NavigationMenu />
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,6 +1,6 @@
1
1
  import { createContext, useContext, useState, useEffect, useCallback, type ReactNode } from "react";
2
2
  import { getCurrentUser } from "@salesforce/webapp-experimental/api";
3
- import { API_ROUTES } from "../components/auth/authenticationConfig";
3
+ import { API_ROUTES } from "../authenticationConfig";
4
4
 
5
5
  interface User {
6
6
  readonly id: string;
@@ -3,7 +3,7 @@ import { StatusAlert } from "../alerts/status-alert";
3
3
  import { FooterLink } from "../footers/footer-link";
4
4
  import { SubmitButton } from "./submit-button";
5
5
  import { CardLayout } from "../layout/card-layout";
6
- import { useFormContext } from "../../hooks/form";
6
+ import { useFormContext } from "../hooks/form";
7
7
  import { useId } from "react";
8
8
 
9
9
  /**
@@ -1,7 +1,7 @@
1
1
  import { Button } from "../../components/ui/button";
2
2
  import { Spinner } from "../../components/ui/spinner";
3
3
  import { cn } from "../../lib/utils";
4
- import { useFormContext } from "../../hooks/form";
4
+ import { useFormContext } from "../hooks/form";
5
5
 
6
6
  interface SubmitButtonProps extends Omit<React.ComponentProps<typeof Button>, "type"> {
7
7
  /** Button text when not submitting */
@@ -1,5 +1,5 @@
1
1
  import { Navigate, Outlet, useSearchParams } from "react-router";
2
- import { useAuth } from "../../context/AuthContext";
2
+ import { useAuth } from "../context/AuthContext";
3
3
  import { getStartUrl } from "../authHelpers";
4
4
  import { CardSkeleton } from "../layout/card-skeleton";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { Navigate, Outlet, useLocation } from "react-router";
2
- import { useAuth } from "../../context/AuthContext";
2
+ import { useAuth } from "../context/AuthContext";
3
3
  import { AUTH_REDIRECT_PARAM, ROUTES } from "../authenticationConfig";
4
4
  import { CardSkeleton } from "../layout/card-skeleton";
5
5
 
@@ -6,10 +6,10 @@
6
6
  import { useEffect, useState, useCallback, useRef } from "react";
7
7
  import { useLocation } from "react-router";
8
8
  import { X } from "lucide-react";
9
- import { useAuth } from "../../context/AuthContext";
9
+ import { useAuth } from "../context/AuthContext";
10
10
  import { pollSessionTimeServlet, extendSessionTime } from "./sessionTimeService";
11
- import { useCountdownTimer } from "../../hooks/useCountdownTimer";
12
- import { useRetryWithBackoff } from "../../hooks/useRetryWithBackoff";
11
+ import { useCountdownTimer } from "../hooks/useCountdownTimer";
12
+ import { useRetryWithBackoff } from "../hooks/useRetryWithBackoff";
13
13
  import { Alert, AlertTitle, AlertDescription } from "../../components/ui/alert";
14
14
  import { Button } from "../../components/ui/button";
15
15
  import {
@@ -1,16 +1,16 @@
1
1
  import type { RouteObject } from 'react-router';
2
2
  import Home from './pages/Home';
3
3
  import NotFound from './pages/NotFound';
4
- import AuthAppLayout from "./components/auth/layouts/AuthAppLayout";
5
- import Login from "./pages/Login";
6
- import Register from "./pages/Register";
7
- import ForgotPassword from "./pages/ForgotPassword";
8
- import ResetPassword from "./pages/ResetPassword";
9
- import Profile from "./pages/Profile";
10
- import ChangePassword from "./components/auth/pages/ChangePassword";
11
- import AuthenticationRoute from "./components/auth/layouts/authenticationRouteLayout";
12
- import PrivateRoute from "./components/auth/privateRouteLayout";
13
- import { ROUTES } from "./components/auth/authenticationConfig";
4
+ import AuthAppLayout from "./auth/layouts/AuthAppLayout";
5
+ import Login from "./auth/pages/Login";
6
+ import Register from "./auth/pages/Register";
7
+ import ForgotPassword from "./auth/pages/ForgotPassword";
8
+ import ResetPassword from "./auth/pages/ResetPassword";
9
+ import Profile from "./auth/pages/Profile";
10
+ import ChangePassword from "./auth/pages/ChangePassword";
11
+ import AuthenticationRoute from "./auth/layouts/authenticationRouteLayout";
12
+ import PrivateRoute from "./auth/layouts/privateRouteLayout";
13
+ import { ROUTES } from "./auth/authenticationConfig";
14
14
 
15
15
  export const routes: RouteObject[] = [
16
16
  {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-base-sfdx-project-experimental",
3
- "version": "1.53.0",
3
+ "version": "1.53.2",
4
4
  "description": "Base SFDX project template",
5
5
  "private": true,
6
6
  "files": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-feature-react-authentication-experimental",
3
- "version": "1.53.0",
3
+ "version": "1.53.2",
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.53.0",
19
+ "@salesforce/webapp-experimental": "^1.53.2",
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
- "start": {
39
+ "dev": {
40
40
  "executor": "@salesforce/webapp-template-cli-experimental:dev-server"
41
41
  }
42
42
  }
43
43
  },
44
- "gitHead": "ecdad417f3e8de0f911ff1113ff9fe7fb1360f22"
44
+ "gitHead": "8866eb09bf1e24f023333d1ecc491a1e1a6c8904"
45
45
  }