@salesforce/ui-bundle-template-app-react-sample-b2x 1.118.4 → 1.119.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.
Files changed (18) hide show
  1. package/dist/AGENT.md +82 -23
  2. package/dist/CHANGELOG.md +16 -0
  3. package/dist/force-app/main/default/uiBundles/propertyrentalapp/package.json +3 -3
  4. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/appLayout.tsx +13 -10
  5. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/layout/TopBar.tsx +41 -101
  6. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/layout/VerticalNav.tsx +7 -7
  7. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/avatar.tsx +109 -0
  8. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/dropdown-menu.tsx +257 -0
  9. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/components/ui/index.ts +25 -0
  10. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/context/TenantAccessContext.tsx +55 -0
  11. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/layouts/TenantRoute.tsx +3 -3
  12. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/authentication/menu/AuthMenu.tsx +93 -0
  13. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/utils/filterUtils.ts +10 -1
  14. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/routes.tsx +2 -2
  15. package/dist/package-lock.json +2 -2
  16. package/dist/package.json +1 -1
  17. package/package.json +1 -1
  18. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/hooks/useTenantAccess.ts +0 -38
package/dist/AGENT.md CHANGED
@@ -45,7 +45,7 @@ Replace `<appName>` with the actual folder name found under `uiBundles/`. The so
45
45
  └── data/ # Sample data for import (optional)
46
46
  ```
47
47
 
48
- ## Web application source structure
48
+ ## UI Bundle source structure
49
49
 
50
50
  All application code lives inside the UI Bundle's `src/` directory:
51
51
 
@@ -95,9 +95,11 @@ Used for SFDX metadata tooling. Scripts here target LWC/Aura, not the React app.
95
95
 
96
96
  **One-time org setup:** `node scripts/org-setup.mjs --target-org <alias>` runs login, deploy, permset assignment, data import, GraphQL schema/codegen, UI Bundle build, and optionally the dev server. Use `--help` for all flags.
97
97
 
98
- ### 2. Web app directory (primary workspace)
98
+ ### 2. UI Bundle directory (primary workspace)
99
99
 
100
- **Always `cd` into the UI Bundle directory for dev/build/lint/test:**
100
+ **ALL dev, build, lint, and test commands MUST be run from inside the UI Bundle directory (`<sfdx-source>/uiBundles/<appName>/`). Never run them from the project root.**
101
+
102
+ Resolve the correct path from `sfdx-project.json` before running any command. Do not hardcode the path.
101
103
 
102
104
  | Command | Purpose |
103
105
  |---------|---------|
@@ -109,13 +111,17 @@ Used for SFDX metadata tooling. Scripts here target LWC/Aura, not the React app.
109
111
  | `npm run graphql:codegen` | Generate GraphQL types from schema |
110
112
  | `npm run graphql:schema` | Fetch GraphQL schema from org |
111
113
 
112
- **Before completing any change:** run `npm run build` and `npm run lint` from the UI Bundle directory. Both must pass with zero errors.
114
+ **After every task, without exception:**
115
+ 1. Run `npm run build` from the UI Bundle directory — must pass with zero errors.
116
+ 2. Run `npm run lint` from the UI Bundle directory — must pass with zero errors.
117
+ 3. Run `npm run dev` to start the dev server so the user can verify the result.
113
118
 
119
+ Do not consider a task complete until all three steps have been run successfully.
114
120
  ## Development conventions
115
121
 
116
122
  ### UI
117
123
 
118
- - **Component library:** shadcn/ui primitives in `src/components/ui/`. Always use these over raw HTML equivalents.
124
+ - **Component library:** shadcn/ui primitives in `src/components/ui/`. Always use these over raw HTML equivalents. **Before importing any component, verify both the file exists in `src/components/ui/` AND the named export exists within that file.** Never assume a component or export is available — read the file to confirm the exact exports before importing.
119
125
  - **Styling:** Tailwind CSS only. No inline `style={{}}`. Use `cn()` from `@/lib/utils` for conditional classes.
120
126
  - **Icons:** Lucide React.
121
127
  - **Path alias:** `@/*` maps to `src/*`. Use it for all imports.
@@ -140,6 +146,10 @@ Used for SFDX metadata tooling. Scripts here target LWC/Aura, not the React app.
140
146
 
141
147
  ### Data access (Salesforce)
142
148
 
149
+ **Before writing any code that connects to Salesforce, you MUST invoke the `using-ui-bundle-salesforce-data` skill. Do not write any data access code without consulting it first.**
150
+
151
+ This applies to: GraphQL queries/mutations, REST calls, SDK initialization, custom hooks that fetch data, or any code that imports from `@salesforce/sdk-data`.
152
+
143
153
  - **All data access uses the Data SDK** (`@salesforce/sdk-data`) via `createDataSDK()`.
144
154
  - **Never** use `fetch()` or `axios` directly for Salesforce data.
145
155
  - **GraphQL is preferred** for record operations (`sdk.graphql`). Use `sdk.fetch` only when GraphQL cannot cover the case (UI API REST, Apex REST, Connect REST, Einstein LLM).
@@ -149,25 +159,74 @@ Used for SFDX metadata tooling. Scripts here target LWC/Aura, not the React app.
149
159
  - Use `__SF_API_VERSION__` global for API version in REST calls.
150
160
  - **Blocked APIs:** Enterprise REST query endpoint (`/query` with SOQL), `@AuraEnabled` Apex, Chatter API.
151
161
 
162
+ #### Permitted APIs
163
+
164
+ | API | Method | Endpoints / Use Case |
165
+ |-----|--------|----------------------|
166
+ | GraphQL | `sdk.graphql` | All record queries and mutations via `uiapi { }` namespace |
167
+ | UI API REST | `sdk.fetch` | `/services/data/v{ver}/ui-api/records/{id}` |
168
+ | Apex REST | `sdk.fetch` | `/services/apexrest/{resource}` |
169
+ | Connect REST | `sdk.fetch` | `/services/data/v{ver}/connect/...` |
170
+ | Einstein LLM | `sdk.fetch` | `/services/data/v{ver}/einstein/llm/prompt/generations` |
171
+
172
+ Any endpoint not listed above is not permitted.
173
+
174
+ #### GraphQL non-negotiable rules
175
+
176
+ 1. **Schema is the single source of truth** — every entity and field name must be confirmed via the schema search script before use. Never guess.
177
+ 2. **`@optional` on all record fields** — FLS causes entire queries to fail if any field is inaccessible. Apply to every scalar, parent, and child relationship field.
178
+ 3. **Correct mutation syntax** — mutations wrap under `uiapi(input: { allOrNone: true/false })`, not bare `uiapi { ... }`.
179
+ 4. **Explicit `first:` in every query** — omitting it silently defaults to 10 records. Always include `pageInfo { hasNextPage endCursor }` for paginated queries.
180
+ 5. **SOQL-derived execution limits** — max 10 subqueries per request, max 5 levels of child-to-parent traversal, max 1 level parent-to-child, max 2,000 records per subquery.
181
+ 6. **HTTP 200 does not mean success** — Salesforce returns HTTP 200 even on failure. Always check the `errors` array in the response body.
182
+
183
+ #### GraphQL inline queries
184
+ Must use the `gql` template tag from `@salesforce/sdk-data` — plain template strings bypass `@graphql-eslint` schema validation. For complex queries, use external `.graphql` files with codegen.
185
+
186
+ #### Current user info
187
+ Use GraphQL (`uiapi { currentUser { Id Name { value } } }`), not Chatter (`/chatter/users/me`).
188
+
189
+ #### Schema file (`schema.graphql`)
190
+
191
+ The `schema.graphql` file at the SFDX project root is the source of truth for all entity and field name lookups. It is 265K+ lines — never open or parse it directly. Use the schema search script instead.
192
+
193
+ - **Generate/refresh:** Run `npm run graphql:schema` from the UI bundle directory
194
+ - **When to regenerate:** After any metadata deployment that changes objects, fields, or permission sets
195
+ - **Custom objects** only appear in the schema after metadata deployment AND permission set assignment
196
+ - **After regenerating:** Always re-run `npm run graphql:codegen` and `npm run build` (schema changes may affect generated types)
197
+
152
198
  ### CSP trusted sites
153
199
 
154
200
  Any external domain the app calls (APIs, CDNs, fonts) must have a `.cspTrustedSite-meta.xml` file under `<sfdx-source>/cspTrustedSites/`. Unregistered domains are blocked at runtime. Each subdomain needs its own entry. URLs must be HTTPS with no trailing slash, no path, and no wildcards.
155
201
 
202
+ ## Building and launching the app
203
+
204
+ All build, dev, and test commands run from the UI Bundle directory. Before running any command, read the UI Bundle's `package.json` to confirm available scripts — do not assume script names.
205
+
206
+ Typical scripts found in the UI Bundle:
207
+
208
+ | Command | Purpose |
209
+ |---------|---------|
210
+ | `npm run build` | TypeScript check + Vite production build |
211
+ | `npm run dev` | Start Vite dev server |
212
+ | `npm run lint` | ESLint |
213
+ | `npm run test` | Vitest unit tests |
214
+ | `npm run graphql:codegen` | Generate GraphQL types |
215
+ | `npm run graphql:schema` | Fetch GraphQL schema from org |
216
+
217
+ If dependencies have not been installed yet, run `npm install` in the UI Bundle directory first. Alternatively, run `npm run sf-project-setup` from the project root — it resolves the UI Bundle directory automatically and runs install, build, and dev in sequence.
218
+
219
+ **After any JavaScript or TypeScript change, run `npm run build` to validate the change.** If the build fails, read the error output, identify the cause, fix it, and run `npm run build` again. Do not move on until the build passes.
220
+
156
221
  ## Deploying
157
222
 
158
223
  **Deployment order matters.** Metadata (objects, permission sets) must be deployed before fetching the GraphQL schema. After any metadata deployment that changes objects, fields, or permissions, re-run schema fetch and codegen.
159
224
 
160
- **Recommended sequence:**
225
+ **Deployment steps:**
161
226
 
162
227
  1. Authenticate to the target org
163
228
  2. Build the UI Bundle (`npm run build` in the UI Bundle directory)
164
229
  3. Deploy metadata (`sf project deploy start --source-dir <packageDir> --target-org <alias>`)
165
- 4. Assign permission sets
166
- 5. Import data (only with user confirmation)
167
- 6. Fetch GraphQL schema + run codegen (`npm run graphql:schema && npm run graphql:codegen`)
168
- 7. Rebuild the UI Bundle (schema changes may affect generated types)
169
-
170
- **Or use the one-time org setup:** `node scripts/org-setup.mjs --target-org <alias>`
171
230
 
172
231
  ```bash
173
232
  # Deploy UI Bundle only
@@ -177,17 +236,17 @@ sf project deploy start --source-dir <sfdx-source>/ui-bundles --target-org <alia
177
236
  sf project deploy start --source-dir <packageDir> --target-org <alias>
178
237
  ```
179
238
 
180
- ## Skills
239
+ **Do not open the app after deployment.** Do not run `sf org open`, do not guess the runtime URL, and do not construct paths like `/s/<appName>`. Deployment is complete when the `sf project deploy start` command succeeds.
181
240
 
182
- Check for available skills before implementing any of the following:
241
+ ## Post-deployment org setup
183
242
 
184
- | Area | When to consult |
185
- |------|----------------|
186
- | UI generation | Building pages, components, modifying header/footer/layout |
187
- | Salesforce data access | Reading/writing records, GraphQL queries, REST calls |
188
- | Metadata and deployment | Scaffolding apps, configuring CSP, deployment sequencing |
189
- | Feature installation | Before building something from scratch check if a pre-built feature exists |
190
- | File upload | Adding file upload with Salesforce ContentVersion |
191
- | Agentforce conversation | Adding or modifying the Agentforce chat widget |
243
+ These steps apply after a fresh deployment to configure the org. They are not part of routine deployment.
244
+
245
+ 1. Assign permission sets
246
+ 2. Import data (only with user confirmation)
247
+ 3. Fetch GraphQL schema + run codegen (`npm run graphql:schema && npm run graphql:codegen`)
248
+ 4. Rebuild the UI Bundle (`npm run build`schema changes may affect generated types)
249
+
250
+ ## Skills
192
251
 
193
- Skills are the authoritative source for detailed patterns, constraints, and code examples in each area. This file provides project-level orientation; skills provide implementation depth.
252
+ Before starting any task, check whether a relevant skill exists. If one does, invoke it before writing any code or making any implementation decision. Skills are the authoritative source for patterns, constraints, and code examples.
package/dist/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
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.119.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.119.0...v1.119.1) (2026-03-31)
7
+
8
+ **Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
9
+
10
+
11
+
12
+
13
+
14
+ # [1.119.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.118.4...v1.119.0) (2026-03-31)
15
+
16
+ **Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.118.4](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.118.3...v1.118.4) (2026-03-31)
7
23
 
8
24
  **Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
@@ -15,8 +15,8 @@
15
15
  "graphql:schema": "node scripts/get-graphql-schema.mjs"
16
16
  },
17
17
  "dependencies": {
18
- "@salesforce/sdk-data": "^1.118.4",
19
- "@salesforce/ui-bundle": "^1.118.4",
18
+ "@salesforce/sdk-data": "^1.119.1",
19
+ "@salesforce/ui-bundle": "^1.119.1",
20
20
  "@tailwindcss/vite": "^4.1.17",
21
21
  "class-variance-authority": "^0.7.1",
22
22
  "clsx": "^2.1.1",
@@ -47,7 +47,7 @@
47
47
  "@graphql-eslint/eslint-plugin": "^4.1.0",
48
48
  "@graphql-tools/utils": "^11.0.0",
49
49
  "@playwright/test": "^1.49.0",
50
- "@salesforce/vite-plugin-ui-bundle": "^1.118.4",
50
+ "@salesforce/vite-plugin-ui-bundle": "^1.119.1",
51
51
  "@testing-library/jest-dom": "^6.6.3",
52
52
  "@testing-library/react": "^16.1.0",
53
53
  "@testing-library/user-event": "^14.5.2",
@@ -1,24 +1,27 @@
1
1
  import { useState } from "react";
2
2
  import { Outlet } from "react-router";
3
3
  import { TopBar } from "@/components/layout/TopBar";
4
- import { NavMenu } from "@/components/layout/VerticalNav";
4
+ import { VerticalNav } from "@/components/layout/VerticalNav";
5
5
  import { Toaster } from "@/components/ui/sonner";
6
+ import { TenantAccessProvider } from "@/context/TenantAccessContext";
6
7
 
7
8
  export default function AppLayout() {
8
9
  const [isNavOpen, setIsNavOpen] = useState(false);
9
10
 
10
11
  return (
11
- <div className="flex min-h-screen flex-col bg-gray-50">
12
- <Toaster />
13
- <TopBar onMenuClick={() => setIsNavOpen(true)} />
12
+ <TenantAccessProvider>
13
+ <div className="flex min-h-screen flex-col bg-gray-50">
14
+ <Toaster />
15
+ <TopBar onMenuClick={() => setIsNavOpen(true)} />
14
16
 
15
- <div className="flex flex-1 overflow-hidden">
16
- <NavMenu isOpen={isNavOpen} onClose={() => setIsNavOpen(false)} />
17
+ <div className="flex flex-1 overflow-hidden">
18
+ <VerticalNav isOpen={isNavOpen} onClose={() => setIsNavOpen(false)} />
17
19
 
18
- <main className="flex-1 overflow-auto bg-gray-50 p-4 md:p-8" role="main">
19
- <Outlet />
20
- </main>
20
+ <main className="flex-1 overflow-auto bg-gray-50 p-4 md:p-8" role="main">
21
+ <Outlet />
22
+ </main>
23
+ </div>
21
24
  </div>
22
- </div>
25
+ </TenantAccessProvider>
23
26
  );
24
27
  }
@@ -1,41 +1,61 @@
1
- import { useState } from "react";
2
- import { ChevronDown, Menu, UserPen, LogOut, User, Loader2 } from "lucide-react";
1
+ import { ChevronDown, Menu, User } from "lucide-react";
3
2
  import { Link } from "react-router";
4
- import { useAuth } from "@/features/authentication/context/AuthContext";
5
3
  import { ROUTES } from "@/features/authentication/authenticationConfig";
6
4
  import zenLogo from "@/assets/icons/zen-logo.svg";
5
+ import { Avatar, AvatarFallback } from "@/components/ui/avatar";
6
+ import { Button } from "@/components/ui/button";
7
+ import { AuthMenu } from "@/features/authentication/menu/AuthMenu";
7
8
 
8
9
  export interface TopBarProps {
9
10
  onMenuClick?: () => void;
10
11
  }
11
12
 
12
13
  export function TopBar({ onMenuClick }: TopBarProps) {
13
- const { user, isAuthenticated, loading } = useAuth();
14
-
15
14
  return (
16
- <header
17
- className="flex h-16 items-center justify-between bg-teal-700 px-6 text-white"
18
- role="banner"
19
- >
15
+ <header className="flex h-16 items-center justify-between bg-teal-700 px-6 text-white">
20
16
  <div className="flex items-center gap-4">
21
- <button
22
- type="button"
17
+ <Button
18
+ variant="ghost"
19
+ size="icon"
23
20
  onClick={onMenuClick}
24
- className="rounded-md p-2 transition-colors hover:bg-teal-600 md:hidden"
21
+ className="text-white hover:bg-teal-600 md:hidden"
25
22
  aria-label="Toggle menu"
26
23
  >
27
- <Menu className="size-6" aria-hidden />
28
- </button>
24
+ <Menu className="size-6" />
25
+ </Button>
29
26
  <Logo />
30
27
  </div>
31
28
 
32
- {loading ? (
33
- <Loader2 className="size-5 animate-spin" aria-label="Loading" />
34
- ) : isAuthenticated ? (
35
- <AuthenticatedControls userName={user?.name ?? "User"} />
36
- ) : (
37
- <LoginLink />
38
- )}
29
+ <AuthMenu
30
+ trigger={(user) => (
31
+ <Button
32
+ variant="ghost"
33
+ className="h-10 gap-2 rounded-lg px-3 text-base text-white hover:bg-teal-600 hover:text-white"
34
+ aria-label="User menu"
35
+ >
36
+ <Avatar className="size-7 bg-teal-300 text-teal-900">
37
+ <AvatarFallback className="bg-teal-300 font-semibold text-teal-900">
38
+ {user.name.charAt(0).toUpperCase()}
39
+ </AvatarFallback>
40
+ </Avatar>
41
+ <span className="hidden font-medium md:inline">{user.name.toUpperCase()}</span>
42
+ <ChevronDown className="hidden size-4 md:block" />
43
+ </Button>
44
+ )}
45
+ guestContent={
46
+ <Button
47
+ asChild
48
+ variant="secondary"
49
+ size="icon"
50
+ className="rounded-full bg-white text-teal-700 hover:bg-teal-50 md:h-9 md:w-auto md:gap-2 md:rounded-lg md:px-4"
51
+ >
52
+ <Link to={ROUTES.LOGIN.PATH}>
53
+ <User className="size-5 md:size-4" />
54
+ <span className="hidden md:inline">Sign Up / Sign In</span>
55
+ </Link>
56
+ </Button>
57
+ }
58
+ />
39
59
  </header>
40
60
  );
41
61
  }
@@ -51,83 +71,3 @@ function Logo() {
51
71
  </div>
52
72
  );
53
73
  }
54
-
55
- function LoginLink() {
56
- return (
57
- <Link
58
- to={ROUTES.LOGIN.PATH}
59
- className="flex items-center gap-2 rounded-md bg-white px-4 py-2 font-medium text-teal-700 transition-colors hover:bg-teal-50"
60
- >
61
- <User className="size-4" aria-hidden />
62
- Sign Up / Sign In
63
- </Link>
64
- );
65
- }
66
-
67
- function AuthenticatedControls({ userName }: { userName: string }) {
68
- return (
69
- <div className="flex items-center gap-4">
70
- <UserMenu userName={userName} />
71
- </div>
72
- );
73
- }
74
-
75
- function UserMenu({ userName }: { userName: string }) {
76
- const { logout } = useAuth();
77
- const [open, setOpen] = useState(false);
78
-
79
- return (
80
- <div className="relative">
81
- <button
82
- type="button"
83
- onClick={() => setOpen((prev) => !prev)}
84
- className="flex items-center gap-2 rounded-md px-3 py-2 transition-colors hover:bg-teal-600"
85
- aria-label="User menu"
86
- aria-expanded={open}
87
- aria-haspopup="true"
88
- >
89
- <div
90
- className="flex size-8 items-center justify-center rounded-full bg-teal-300 font-semibold text-teal-900"
91
- aria-hidden
92
- >
93
- {userName.charAt(0).toUpperCase()}
94
- </div>
95
- <span className="hidden font-medium md:inline">{userName.toUpperCase()}</span>
96
- <ChevronDown className="hidden size-4 md:inline" aria-hidden />
97
- </button>
98
-
99
- {open && (
100
- <>
101
- <div className="fixed inset-0 z-40" onClick={() => setOpen(false)} aria-hidden />
102
- <div
103
- className="absolute right-0 top-full z-50 mt-2 w-48 overflow-hidden rounded-lg bg-white py-1 shadow-xl"
104
- role="menu"
105
- >
106
- <Link
107
- to={ROUTES.PROFILE.PATH}
108
- onClick={() => setOpen(false)}
109
- className="flex items-center gap-3 px-4 py-2.5 text-sm text-gray-700 transition-colors hover:bg-gray-100"
110
- role="menuitem"
111
- >
112
- <UserPen className="size-4" aria-hidden />
113
- Edit Profile
114
- </Link>
115
- <div className="mx-3 border-t border-gray-200" />
116
- <button
117
- type="button"
118
- onClick={() => {
119
- setOpen(false);
120
- logout();
121
- }}
122
- className="flex w-full items-center gap-3 px-4 py-2.5 text-sm text-gray-700 transition-colors hover:bg-gray-100"
123
- role="menuitem"
124
- >
125
- <LogOut className="size-4" aria-hidden />
126
- Log Out
127
- </button>
128
- </div>
129
- </>
130
- )}
131
- </div>
132
- );
133
- }
@@ -1,17 +1,17 @@
1
1
  import { Link, useLocation } from "react-router";
2
2
  import { Home, Search, BarChart3, Wrench, Phone, type LucideIcon } from "lucide-react";
3
3
  import { useAuth } from "@/features/authentication/context/AuthContext";
4
- import { useTenantAccess } from "@/hooks/useTenantAccess";
4
+ import { useTenantAccess } from "@/context/TenantAccessContext";
5
5
  import { useMemo } from "react";
6
6
 
7
- interface NavItem {
7
+ interface VerticalNavItem {
8
8
  path: string;
9
9
  icon: LucideIcon;
10
10
  label: string;
11
11
  authRequired?: boolean;
12
12
  }
13
13
 
14
- const navItems: NavItem[] = [
14
+ const navItems: VerticalNavItem[] = [
15
15
  { path: "/", icon: Home, label: "Home" },
16
16
  { path: "/dashboard", icon: BarChart3, label: "Dashboard", authRequired: true },
17
17
  { path: "/properties", icon: Search, label: "Property Search" },
@@ -19,15 +19,15 @@ const navItems: NavItem[] = [
19
19
  { path: "/contact", icon: Phone, label: "Contact Us" },
20
20
  ];
21
21
 
22
- interface NavMenuProps {
22
+ interface VerticalNavProps {
23
23
  isOpen?: boolean;
24
24
  onClose?: () => void;
25
25
  }
26
26
 
27
- export function NavMenu({ isOpen = false, onClose }: NavMenuProps) {
27
+ export function VerticalNav({ isOpen = false, onClose }: VerticalNavProps) {
28
28
  const location = useLocation();
29
- const { isAuthenticated, user } = useAuth();
30
- const { hasTenantRecord } = useTenantAccess(user?.id);
29
+ const { isAuthenticated } = useAuth();
30
+ const { hasTenantRecord } = useTenantAccess();
31
31
 
32
32
  const visibleItems = useMemo(
33
33
  () =>
@@ -0,0 +1,109 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Avatar as AvatarPrimitive } from 'radix-ui';
5
+
6
+ import { cn } from '@/lib/utils';
7
+
8
+ function Avatar({
9
+ className,
10
+ size = 'default',
11
+ ...props
12
+ }: React.ComponentProps<typeof AvatarPrimitive.Root> & {
13
+ size?: 'default' | 'sm' | 'lg';
14
+ }) {
15
+ return (
16
+ <AvatarPrimitive.Root
17
+ data-slot="avatar"
18
+ data-size={size}
19
+ className={cn(
20
+ 'group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6',
21
+ className
22
+ )}
23
+ {...props}
24
+ />
25
+ );
26
+ }
27
+
28
+ function AvatarImage({
29
+ className,
30
+ ...props
31
+ }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
32
+ return (
33
+ <AvatarPrimitive.Image
34
+ data-slot="avatar-image"
35
+ className={cn('aspect-square size-full', className)}
36
+ {...props}
37
+ />
38
+ );
39
+ }
40
+
41
+ function AvatarFallback({
42
+ className,
43
+ ...props
44
+ }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
45
+ return (
46
+ <AvatarPrimitive.Fallback
47
+ data-slot="avatar-fallback"
48
+ className={cn(
49
+ 'flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs',
50
+ className
51
+ )}
52
+ {...props}
53
+ />
54
+ );
55
+ }
56
+
57
+ function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>) {
58
+ return (
59
+ <span
60
+ data-slot="avatar-badge"
61
+ className={cn(
62
+ 'absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-background select-none',
63
+ 'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden',
64
+ 'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2',
65
+ 'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2',
66
+ className
67
+ )}
68
+ {...props}
69
+ />
70
+ );
71
+ }
72
+
73
+ function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>) {
74
+ return (
75
+ <div
76
+ data-slot="avatar-group"
77
+ className={cn(
78
+ 'group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background',
79
+ className
80
+ )}
81
+ {...props}
82
+ />
83
+ );
84
+ }
85
+
86
+ function AvatarGroupCount({
87
+ className,
88
+ ...props
89
+ }: React.ComponentProps<'div'>) {
90
+ return (
91
+ <div
92
+ data-slot="avatar-group-count"
93
+ className={cn(
94
+ 'relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3',
95
+ className
96
+ )}
97
+ {...props}
98
+ />
99
+ );
100
+ }
101
+
102
+ export {
103
+ Avatar,
104
+ AvatarImage,
105
+ AvatarFallback,
106
+ AvatarBadge,
107
+ AvatarGroup,
108
+ AvatarGroupCount,
109
+ };
@@ -0,0 +1,257 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
5
+ import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
6
+
7
+ import { cn } from '@/lib/utils';
8
+
9
+ function DropdownMenu({
10
+ ...props
11
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
12
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
13
+ }
14
+
15
+ function DropdownMenuPortal({
16
+ ...props
17
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
18
+ return (
19
+ <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
20
+ );
21
+ }
22
+
23
+ function DropdownMenuTrigger({
24
+ ...props
25
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
26
+ return (
27
+ <DropdownMenuPrimitive.Trigger
28
+ data-slot="dropdown-menu-trigger"
29
+ {...props}
30
+ />
31
+ );
32
+ }
33
+
34
+ function DropdownMenuContent({
35
+ className,
36
+ sideOffset = 4,
37
+ ...props
38
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
39
+ return (
40
+ <DropdownMenuPrimitive.Portal>
41
+ <DropdownMenuPrimitive.Content
42
+ data-slot="dropdown-menu-content"
43
+ sideOffset={sideOffset}
44
+ className={cn(
45
+ 'z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
46
+ className
47
+ )}
48
+ {...props}
49
+ />
50
+ </DropdownMenuPrimitive.Portal>
51
+ );
52
+ }
53
+
54
+ function DropdownMenuGroup({
55
+ ...props
56
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
57
+ return (
58
+ <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
59
+ );
60
+ }
61
+
62
+ function DropdownMenuItem({
63
+ className,
64
+ inset,
65
+ variant = 'default',
66
+ ...props
67
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
68
+ inset?: boolean;
69
+ variant?: 'default' | 'destructive';
70
+ }) {
71
+ return (
72
+ <DropdownMenuPrimitive.Item
73
+ data-slot="dropdown-menu-item"
74
+ data-inset={inset}
75
+ data-variant={variant}
76
+ className={cn(
77
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
78
+ className
79
+ )}
80
+ {...props}
81
+ />
82
+ );
83
+ }
84
+
85
+ function DropdownMenuCheckboxItem({
86
+ className,
87
+ children,
88
+ checked,
89
+ ...props
90
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
91
+ return (
92
+ <DropdownMenuPrimitive.CheckboxItem
93
+ data-slot="dropdown-menu-checkbox-item"
94
+ className={cn(
95
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
96
+ className
97
+ )}
98
+ checked={checked}
99
+ {...props}
100
+ >
101
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
102
+ <DropdownMenuPrimitive.ItemIndicator>
103
+ <CheckIcon className="size-4" />
104
+ </DropdownMenuPrimitive.ItemIndicator>
105
+ </span>
106
+ {children}
107
+ </DropdownMenuPrimitive.CheckboxItem>
108
+ );
109
+ }
110
+
111
+ function DropdownMenuRadioGroup({
112
+ ...props
113
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
114
+ return (
115
+ <DropdownMenuPrimitive.RadioGroup
116
+ data-slot="dropdown-menu-radio-group"
117
+ {...props}
118
+ />
119
+ );
120
+ }
121
+
122
+ function DropdownMenuRadioItem({
123
+ className,
124
+ children,
125
+ ...props
126
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
127
+ return (
128
+ <DropdownMenuPrimitive.RadioItem
129
+ data-slot="dropdown-menu-radio-item"
130
+ className={cn(
131
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
132
+ className
133
+ )}
134
+ {...props}
135
+ >
136
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
137
+ <DropdownMenuPrimitive.ItemIndicator>
138
+ <CircleIcon className="size-2 fill-current" />
139
+ </DropdownMenuPrimitive.ItemIndicator>
140
+ </span>
141
+ {children}
142
+ </DropdownMenuPrimitive.RadioItem>
143
+ );
144
+ }
145
+
146
+ function DropdownMenuLabel({
147
+ className,
148
+ inset,
149
+ ...props
150
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
151
+ inset?: boolean;
152
+ }) {
153
+ return (
154
+ <DropdownMenuPrimitive.Label
155
+ data-slot="dropdown-menu-label"
156
+ data-inset={inset}
157
+ className={cn(
158
+ 'px-2 py-1.5 text-sm font-medium data-[inset]:pl-8',
159
+ className
160
+ )}
161
+ {...props}
162
+ />
163
+ );
164
+ }
165
+
166
+ function DropdownMenuSeparator({
167
+ className,
168
+ ...props
169
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
170
+ return (
171
+ <DropdownMenuPrimitive.Separator
172
+ data-slot="dropdown-menu-separator"
173
+ className={cn('-mx-1 my-1 h-px bg-border', className)}
174
+ {...props}
175
+ />
176
+ );
177
+ }
178
+
179
+ function DropdownMenuShortcut({
180
+ className,
181
+ ...props
182
+ }: React.ComponentProps<'span'>) {
183
+ return (
184
+ <span
185
+ data-slot="dropdown-menu-shortcut"
186
+ className={cn(
187
+ 'ml-auto text-xs tracking-widest text-muted-foreground',
188
+ className
189
+ )}
190
+ {...props}
191
+ />
192
+ );
193
+ }
194
+
195
+ function DropdownMenuSub({
196
+ ...props
197
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
198
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
199
+ }
200
+
201
+ function DropdownMenuSubTrigger({
202
+ className,
203
+ inset,
204
+ children,
205
+ ...props
206
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
207
+ inset?: boolean;
208
+ }) {
209
+ return (
210
+ <DropdownMenuPrimitive.SubTrigger
211
+ data-slot="dropdown-menu-sub-trigger"
212
+ data-inset={inset}
213
+ className={cn(
214
+ "flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
215
+ className
216
+ )}
217
+ {...props}
218
+ >
219
+ {children}
220
+ <ChevronRightIcon className="ml-auto size-4" />
221
+ </DropdownMenuPrimitive.SubTrigger>
222
+ );
223
+ }
224
+
225
+ function DropdownMenuSubContent({
226
+ className,
227
+ ...props
228
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
229
+ return (
230
+ <DropdownMenuPrimitive.SubContent
231
+ data-slot="dropdown-menu-sub-content"
232
+ className={cn(
233
+ 'z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
234
+ className
235
+ )}
236
+ {...props}
237
+ />
238
+ );
239
+ }
240
+
241
+ export {
242
+ DropdownMenu,
243
+ DropdownMenuPortal,
244
+ DropdownMenuTrigger,
245
+ DropdownMenuContent,
246
+ DropdownMenuGroup,
247
+ DropdownMenuLabel,
248
+ DropdownMenuItem,
249
+ DropdownMenuCheckboxItem,
250
+ DropdownMenuRadioGroup,
251
+ DropdownMenuRadioItem,
252
+ DropdownMenuSeparator,
253
+ DropdownMenuShortcut,
254
+ DropdownMenuSub,
255
+ DropdownMenuSubTrigger,
256
+ DropdownMenuSubContent,
257
+ };
@@ -13,6 +13,14 @@
13
13
  */
14
14
 
15
15
  export { Alert, AlertTitle, AlertDescription, AlertAction } from './alert';
16
+ export {
17
+ Avatar,
18
+ AvatarImage,
19
+ AvatarFallback,
20
+ AvatarBadge,
21
+ AvatarGroup,
22
+ AvatarGroupCount,
23
+ } from './avatar';
16
24
  export { Button, buttonVariants } from './button';
17
25
  export {
18
26
  Card,
@@ -35,6 +43,23 @@ export {
35
43
  DialogTitle,
36
44
  DialogTrigger,
37
45
  } from './dialog';
46
+ export {
47
+ DropdownMenu,
48
+ DropdownMenuPortal,
49
+ DropdownMenuTrigger,
50
+ DropdownMenuContent,
51
+ DropdownMenuGroup,
52
+ DropdownMenuLabel,
53
+ DropdownMenuItem,
54
+ DropdownMenuCheckboxItem,
55
+ DropdownMenuRadioGroup,
56
+ DropdownMenuRadioItem,
57
+ DropdownMenuSeparator,
58
+ DropdownMenuShortcut,
59
+ DropdownMenuSub,
60
+ DropdownMenuSubTrigger,
61
+ DropdownMenuSubContent,
62
+ } from './dropdown-menu';
38
63
  export {
39
64
  Field,
40
65
  FieldDescription,
@@ -0,0 +1,55 @@
1
+ import { createContext, useContext, useEffect, useState, type ReactNode } from "react";
2
+ import { useAuth } from "@/features/authentication/context/AuthContext";
3
+ import { hasTenantAccess } from "@/api/tenantApi";
4
+
5
+ interface TenantAccessContextType {
6
+ hasTenantRecord: boolean;
7
+ loading: boolean;
8
+ }
9
+
10
+ const TenantAccessContext = createContext<TenantAccessContextType>({
11
+ hasTenantRecord: false,
12
+ loading: true,
13
+ });
14
+
15
+ export function TenantAccessProvider({ children }: { children: ReactNode }) {
16
+ const { user } = useAuth();
17
+ const [hasTenantRecord, setHasTenantRecord] = useState(false);
18
+ const [loading, setLoading] = useState(true);
19
+
20
+ useEffect(() => {
21
+ const id = user?.id?.trim() ?? "";
22
+ if (!id) {
23
+ setHasTenantRecord(false);
24
+ setLoading(false);
25
+ return;
26
+ }
27
+
28
+ let cancelled = false;
29
+ setLoading(true);
30
+ hasTenantAccess(id)
31
+ .then((allowed) => {
32
+ if (!cancelled) setHasTenantRecord(allowed);
33
+ })
34
+ .catch(() => {
35
+ if (!cancelled) setHasTenantRecord(false);
36
+ })
37
+ .finally(() => {
38
+ if (!cancelled) setLoading(false);
39
+ });
40
+
41
+ return () => {
42
+ cancelled = true;
43
+ };
44
+ }, [user?.id]);
45
+
46
+ return (
47
+ <TenantAccessContext.Provider value={{ hasTenantRecord, loading }}>
48
+ {children}
49
+ </TenantAccessContext.Provider>
50
+ );
51
+ }
52
+
53
+ export function useTenantAccess(): TenantAccessContextType {
54
+ return useContext(TenantAccessContext);
55
+ }
@@ -1,12 +1,12 @@
1
1
  import { Navigate, Outlet, useLocation } from "react-router";
2
2
  import { useAuth } from "@/features/authentication/context/AuthContext";
3
3
  import { ROUTES } from "@/features/authentication/authenticationConfig";
4
- import { useTenantAccess } from "@/hooks/useTenantAccess";
4
+ import { useTenantAccess } from "@/context/TenantAccessContext";
5
5
 
6
6
  export default function TenantRoute() {
7
7
  const location = useLocation();
8
- const { isAuthenticated, loading, user } = useAuth();
9
- const { hasTenantRecord, loading: tenantLoading } = useTenantAccess(user?.id);
8
+ const { isAuthenticated, loading } = useAuth();
9
+ const { hasTenantRecord, loading: tenantLoading } = useTenantAccess();
10
10
 
11
11
  if (loading || tenantLoading) return null;
12
12
 
@@ -0,0 +1,93 @@
1
+ import { CircleUser, LogIn, LogOut, UserPen, UserPlus } from "lucide-react";
2
+ import { Link } from "react-router";
3
+ import { useAuth } from "../context/AuthContext";
4
+ import { ROUTES } from "../authenticationConfig";
5
+ import { Button } from "../../../components/ui/button";
6
+ import { Skeleton } from "../../../components/ui/skeleton";
7
+ import {
8
+ DropdownMenu,
9
+ DropdownMenuContent,
10
+ DropdownMenuItem,
11
+ DropdownMenuLabel,
12
+ DropdownMenuSeparator,
13
+ DropdownMenuTrigger,
14
+ } from "../../../components/ui/dropdown-menu";
15
+
16
+ interface User {
17
+ readonly id: string;
18
+ readonly name: string;
19
+ }
20
+
21
+ export interface AuthMenuProps {
22
+ /** Custom trigger button for the authenticated user's dropdown */
23
+ trigger?: (user: User) => React.ReactNode;
24
+ /** Content rendered instead of the dropdown when the user is not logged in (e.g. a standalone Sign In button) */
25
+ guestContent?: React.ReactNode;
26
+ /** Extra menu items inserted after "Edit Profile" and before "Sign Out" */
27
+ menuItems?: React.ReactNode;
28
+ /** CSS class applied to the DropdownMenuContent wrapper */
29
+ className?: string;
30
+ }
31
+
32
+ export function AuthMenu({ trigger, guestContent, menuItems, className }: AuthMenuProps) {
33
+ const { user, isAuthenticated, loading, logout } = useAuth();
34
+
35
+ if (loading) {
36
+ return <Skeleton className="size-8 rounded-full" />;
37
+ }
38
+
39
+ if (!isAuthenticated && guestContent) {
40
+ return <>{guestContent}</>;
41
+ }
42
+
43
+ const defaultTrigger = (
44
+ <Button variant="ghost" size="icon" aria-label="User menu">
45
+ <CircleUser className="size-6" />
46
+ </Button>
47
+ );
48
+
49
+ const triggerNode = (isAuthenticated && user && trigger?.(user)) || defaultTrigger;
50
+
51
+ return (
52
+ <DropdownMenu>
53
+ <DropdownMenuTrigger asChild>{triggerNode}</DropdownMenuTrigger>
54
+
55
+ <DropdownMenuContent align="end" className={className ?? "w-48"}>
56
+ {isAuthenticated ? (
57
+ <>
58
+ <DropdownMenuLabel className="truncate">{user?.name}</DropdownMenuLabel>
59
+ <DropdownMenuSeparator />
60
+ <DropdownMenuItem asChild>
61
+ <Link to={ROUTES.PROFILE.PATH}>
62
+ <UserPen className="size-4" />
63
+ Edit Profile
64
+ </Link>
65
+ </DropdownMenuItem>
66
+ {menuItems}
67
+ <DropdownMenuItem onClick={() => logout()}>
68
+ <LogOut className="size-4" />
69
+ Sign Out
70
+ </DropdownMenuItem>
71
+ </>
72
+ ) : (
73
+ <>
74
+ <DropdownMenuItem asChild>
75
+ <Link to={ROUTES.LOGIN.PATH}>
76
+ <LogIn className="size-4" />
77
+ Log In
78
+ </Link>
79
+ </DropdownMenuItem>
80
+ <DropdownMenuItem asChild>
81
+ <Link to={ROUTES.REGISTER.PATH}>
82
+ <UserPlus className="size-4" />
83
+ Register
84
+ </Link>
85
+ </DropdownMenuItem>
86
+ </>
87
+ )}
88
+ </DropdownMenuContent>
89
+ </DropdownMenu>
90
+ );
91
+ }
92
+
93
+ export default AuthMenu;
@@ -385,7 +385,16 @@ function buildSingleFilter<TFilter>(
385
385
  if (!value) return null;
386
386
  const searchFields = config?.searchFields ?? [];
387
387
  if (searchFields.length === 0) return null;
388
- const clauses = searchFields.map((f) => ({ [f]: { like: `%${value}%` } }) as TFilter);
388
+ // Supports dot-notation for relationship fields (e.g. "User__r.Name")
389
+ // by building nested filter objects: { User__r: { Name: { like: "%x%" } } }
390
+ const clauses = searchFields.map((f) => {
391
+ const parts = f.split(".");
392
+ let clause: Record<string, unknown> = { like: `%${value}%` };
393
+ for (let i = parts.length - 1; i >= 0; i--) {
394
+ clause = { [parts[i]]: clause };
395
+ }
396
+ return clause as TFilter;
397
+ });
389
398
  if (clauses.length === 1) return clauses[0];
390
399
  return { or: clauses } as TFilter;
391
400
  }
@@ -49,7 +49,7 @@ export const routes: RouteObject[] = [
49
49
  {
50
50
  path: ROUTES.LOGIN.PATH,
51
51
  element: <Login />,
52
- handle: { showInNavigation: true, label: "Login", title: ROUTES.LOGIN.TITLE }
52
+ handle: { showInNavigation: false, label: "Login", title: ROUTES.LOGIN.TITLE }
53
53
  },
54
54
  {
55
55
  path: ROUTES.REGISTER.PATH,
@@ -74,7 +74,7 @@ export const routes: RouteObject[] = [
74
74
  {
75
75
  path: ROUTES.PROFILE.PATH,
76
76
  element: <Profile />,
77
- handle: { showInNavigation: true, label: "Profile", title: ROUTES.PROFILE.TITLE }
77
+ handle: { showInNavigation: false, label: "Profile", title: ROUTES.PROFILE.TITLE }
78
78
  },
79
79
  {
80
80
  path: ROUTES.CHANGE_PASSWORD.PATH,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-base-sfdx-project-experimental",
3
- "version": "1.118.4",
3
+ "version": "1.119.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@salesforce/webapp-template-base-sfdx-project-experimental",
9
- "version": "1.118.4",
9
+ "version": "1.119.1",
10
10
  "license": "SEE LICENSE IN LICENSE.txt",
11
11
  "devDependencies": {
12
12
  "@lwc/eslint-plugin-lwc": "^3.3.0",
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/ui-bundle-template-base-sfdx-project",
3
- "version": "1.118.4",
3
+ "version": "1.119.1",
4
4
  "description": "Base SFDX project template",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "publishConfig": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/ui-bundle-template-app-react-sample-b2x",
3
- "version": "1.118.4",
3
+ "version": "1.119.1",
4
4
  "description": "Salesforce sample property rental React app",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "",
@@ -1,38 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { hasTenantAccess } from "@/api/tenantApi";
3
-
4
- export function useTenantAccess(userId: string | undefined): {
5
- hasTenantRecord: boolean;
6
- loading: boolean;
7
- } {
8
- const [hasTenantRecord, setHasTenantRecord] = useState(false);
9
- const [loading, setLoading] = useState(false);
10
-
11
- useEffect(() => {
12
- const id = userId?.trim() ?? "";
13
- if (!id) {
14
- setHasTenantRecord(false);
15
- setLoading(false);
16
- return;
17
- }
18
-
19
- let cancelled = false;
20
- setLoading(true);
21
- hasTenantAccess(id)
22
- .then((allowed) => {
23
- if (!cancelled) setHasTenantRecord(allowed);
24
- })
25
- .catch(() => {
26
- if (!cancelled) setHasTenantRecord(false);
27
- })
28
- .finally(() => {
29
- if (!cancelled) setLoading(false);
30
- });
31
-
32
- return () => {
33
- cancelled = true;
34
- };
35
- }, [userId]);
36
-
37
- return { hasTenantRecord, loading };
38
- }