@salesforce/webapp-template-base-react-app-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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.44.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.43.1...v1.44.0) (2026-02-20)
7
+
8
+ **Note:** Version bump only for package @salesforce/webapp-template-base-react-app-experimental
9
+
10
+ ## [1.43.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.43.0...v1.43.1) (2026-02-20)
11
+
12
+ ### Bug Fixes
13
+
14
+ - fixing b2e template ([#137](https://github.com/salesforce-experience-platform-emu/webapps/issues/137)) ([73992a4](https://github.com/salesforce-experience-platform-emu/webapps/commit/73992a4b39a82f607b062a60dae16be494c80ba5))
15
+
6
16
  # [1.43.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.42.0...v1.43.0) (2026-02-20)
7
17
 
8
18
  **Note:** Version bump only for package @salesforce/webapp-template-base-react-app-experimental
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-base-react-app-experimental",
3
- "version": "1.43.0",
3
+ "version": "1.44.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -15,5 +15,5 @@
15
15
  "test:coverage": "npm run test",
16
16
  "test:e2e": "cd src/force-app/main/default/webapplications/base-react-app && rm -rf node_modules && npm ci && npx playwright install chromium && npm run build:e2e && npx playwright test"
17
17
  },
18
- "gitHead": "6987ff60e5d99e64b34cbe2383e54cda1727e151"
18
+ "gitHead": "00f5b3b58d400b13a1b1130d11f571c2e1366cb4"
19
19
  }
@@ -9,13 +9,6 @@ test.describe('base-react-app', () => {
9
9
  ).toBeVisible();
10
10
  });
11
11
 
12
- test('about page loads', async ({ page }) => {
13
- await page.goto('/about');
14
- await expect(page).toHaveURL(/\/about/);
15
- await expect(page.getByRole('heading', { name: 'About' })).toBeVisible();
16
- await expect(page.getByText('This is the about page.')).toBeVisible();
17
- });
18
-
19
12
  test('not found route shows 404', async ({ page }) => {
20
13
  await page.goto('/non-existent-route');
21
14
  await expect(page.getByRole('heading', { name: '404' })).toBeVisible();
@@ -1,29 +1,11 @@
1
- import { Outlet, NavLink } from 'react-router';
2
-
3
- const navLinkClass = ({ isActive }: { isActive: boolean }) =>
4
- `text-sm font-medium ${isActive ? 'text-gray-900' : 'text-gray-600 hover:text-gray-900'}`;
1
+ import { Outlet } from 'react-router';
2
+ import NavigationMenu from './navigationMenu';
5
3
 
6
4
  export default function AppLayout() {
7
5
  return (
8
6
  <>
9
- <nav className="sticky top-0 z-10 border-b border-gray-200 bg-white">
10
- <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
11
- <div className="flex h-14 items-center gap-8">
12
- <NavLink to="/" end className={navLinkClass}>
13
- Home
14
- </NavLink>
15
- <NavLink to="/about" className={navLinkClass}>
16
- About
17
- </NavLink>
18
- <NavLink to="/does-not-exist" className={navLinkClass}>
19
- 404
20
- </NavLink>
21
- </div>
22
- </div>
23
- </nav>
24
- <main>
25
- <Outlet />
26
- </main>
7
+ <NavigationMenu />
8
+ <Outlet />
27
9
  </>
28
10
  );
29
11
  }
@@ -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
+ }
@@ -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
+ };
@@ -1,7 +1,6 @@
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
5
 
7
6
  export const routes: RouteObject[] = [
@@ -14,11 +13,6 @@ export const routes: RouteObject[] = [
14
13
  element: <Home />,
15
14
  handle: { showInNavigation: true, label: 'Home' },
16
15
  },
17
- {
18
- path: 'about',
19
- element: <About />,
20
- handle: { showInNavigation: true, label: 'About' },
21
- },
22
16
  {
23
17
  path: '*',
24
18
  element: <NotFound />,