@salesforce/webapp-template-app-react-template-b2e-experimental 1.116.0 → 1.116.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.
package/dist/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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.116.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.116.0...v1.116.1) (2026-03-25)
7
+
8
+ **Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
9
+
10
+
11
+
12
+
13
+
6
14
  # [1.116.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.115.0...v1.116.0) (2026-03-25)
7
15
 
8
16
  **Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
@@ -15,8 +15,8 @@
15
15
  "graphql:schema": "node scripts/get-graphql-schema.mjs"
16
16
  },
17
17
  "dependencies": {
18
- "@salesforce/sdk-data": "^1.116.0",
19
- "@salesforce/webapp-experimental": "^1.116.0",
18
+ "@salesforce/sdk-data": "^1.116.1",
19
+ "@salesforce/webapp-experimental": "^1.116.1",
20
20
  "@tailwindcss/vite": "^4.1.17",
21
21
  "class-variance-authority": "^0.7.1",
22
22
  "clsx": "^2.1.1",
@@ -42,7 +42,7 @@
42
42
  "@graphql-eslint/eslint-plugin": "^4.1.0",
43
43
  "@graphql-tools/utils": "^11.0.0",
44
44
  "@playwright/test": "^1.49.0",
45
- "@salesforce/vite-plugin-webapp-experimental": "^1.116.0",
45
+ "@salesforce/vite-plugin-webapp-experimental": "^1.116.1",
46
46
  "@testing-library/jest-dom": "^6.6.3",
47
47
  "@testing-library/react": "^16.1.0",
48
48
  "@testing-library/user-event": "^14.5.2",
@@ -0,0 +1,46 @@
1
+ import SEARCH_ACCOUNTS_QUERY from "./query/searchAccounts.graphql?raw";
2
+ import DISTINCT_INDUSTRIES_QUERY from "./query/distinctAccountIndustries.graphql?raw";
3
+ import DISTINCT_TYPES_QUERY from "./query/distinctAccountTypes.graphql?raw";
4
+ import {
5
+ searchObjects,
6
+ fetchDistinctValues,
7
+ type ObjectSearchOptions,
8
+ type PicklistOption,
9
+ } from "../../features/object-search/api/objectSearchService";
10
+ import type {
11
+ SearchAccountsQuery,
12
+ SearchAccountsQueryVariables,
13
+ DistinctAccountIndustriesQuery,
14
+ DistinctAccountTypesQuery,
15
+ } from "../graphql-operations-types";
16
+
17
+ export type AccountSearchResult = NonNullable<SearchAccountsQuery["uiapi"]["query"]["Account"]>;
18
+
19
+ export type AccountSearchOptions = ObjectSearchOptions<
20
+ SearchAccountsQueryVariables["where"],
21
+ SearchAccountsQueryVariables["orderBy"]
22
+ >;
23
+
24
+ export type { PicklistOption };
25
+
26
+ export async function searchAccounts(
27
+ options: AccountSearchOptions = {},
28
+ ): Promise<AccountSearchResult> {
29
+ return searchObjects<AccountSearchResult, SearchAccountsQuery, SearchAccountsQueryVariables>(
30
+ SEARCH_ACCOUNTS_QUERY,
31
+ "Account",
32
+ options,
33
+ );
34
+ }
35
+
36
+ export async function fetchDistinctIndustries(): Promise<PicklistOption[]> {
37
+ return fetchDistinctValues<DistinctAccountIndustriesQuery>(
38
+ DISTINCT_INDUSTRIES_QUERY,
39
+ "Account",
40
+ "Industry",
41
+ );
42
+ }
43
+
44
+ export async function fetchDistinctTypes(): Promise<PicklistOption[]> {
45
+ return fetchDistinctValues<DistinctAccountTypesQuery>(DISTINCT_TYPES_QUERY, "Account", "Type");
46
+ }
@@ -0,0 +1,19 @@
1
+ query DistinctAccountIndustries {
2
+ uiapi {
3
+ aggregate {
4
+ Account(groupBy: { Industry: { group: true } }) {
5
+ edges {
6
+ node {
7
+ aggregate @optional {
8
+ Industry @optional {
9
+ value
10
+ displayValue
11
+ label
12
+ }
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,19 @@
1
+ query DistinctAccountTypes {
2
+ uiapi {
3
+ aggregate {
4
+ Account(groupBy: { Type: { group: true } }) {
5
+ edges {
6
+ node {
7
+ aggregate @optional {
8
+ Type @optional {
9
+ value
10
+ displayValue
11
+ label
12
+ }
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,121 @@
1
+ query GetAccountDetail($id: ID!) {
2
+ uiapi {
3
+ query {
4
+ Account(where: { Id: { eq: $id } }) {
5
+ edges {
6
+ node {
7
+ Id
8
+ Name @optional {
9
+ value
10
+ displayValue
11
+ }
12
+ Owner @optional {
13
+ Name @optional {
14
+ value
15
+ displayValue
16
+ }
17
+ }
18
+ Phone @optional {
19
+ value
20
+ displayValue
21
+ }
22
+ Fax @optional {
23
+ value
24
+ displayValue
25
+ }
26
+ Parent @optional {
27
+ Name @optional {
28
+ value
29
+ displayValue
30
+ }
31
+ }
32
+ Website @optional {
33
+ value
34
+ displayValue
35
+ }
36
+ Type @optional {
37
+ value
38
+ displayValue
39
+ }
40
+ NumberOfEmployees @optional {
41
+ value
42
+ displayValue
43
+ }
44
+ Industry @optional {
45
+ value
46
+ displayValue
47
+ }
48
+ AnnualRevenue @optional {
49
+ value
50
+ displayValue
51
+ }
52
+ Description @optional {
53
+ value
54
+ displayValue
55
+ }
56
+ BillingStreet @optional {
57
+ value
58
+ displayValue
59
+ }
60
+ BillingCity @optional {
61
+ value
62
+ displayValue
63
+ }
64
+ BillingState @optional {
65
+ value
66
+ displayValue
67
+ }
68
+ BillingPostalCode @optional {
69
+ value
70
+ displayValue
71
+ }
72
+ BillingCountry @optional {
73
+ value
74
+ displayValue
75
+ }
76
+ ShippingStreet @optional {
77
+ value
78
+ displayValue
79
+ }
80
+ ShippingCity @optional {
81
+ value
82
+ displayValue
83
+ }
84
+ ShippingState @optional {
85
+ value
86
+ displayValue
87
+ }
88
+ ShippingPostalCode @optional {
89
+ value
90
+ displayValue
91
+ }
92
+ ShippingCountry @optional {
93
+ value
94
+ displayValue
95
+ }
96
+ CreatedBy @optional {
97
+ Name @optional {
98
+ value
99
+ displayValue
100
+ }
101
+ }
102
+ CreatedDate @optional {
103
+ value
104
+ displayValue
105
+ }
106
+ LastModifiedBy @optional {
107
+ Name @optional {
108
+ value
109
+ displayValue
110
+ }
111
+ }
112
+ LastModifiedDate @optional {
113
+ value
114
+ displayValue
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
@@ -0,0 +1,51 @@
1
+ query SearchAccounts(
2
+ $first: Int
3
+ $after: String
4
+ $where: Account_Filter
5
+ $orderBy: Account_OrderBy
6
+ ) {
7
+ uiapi {
8
+ query {
9
+ Account(first: $first, after: $after, where: $where, orderBy: $orderBy) {
10
+ edges {
11
+ node {
12
+ Id
13
+ Name @optional {
14
+ value
15
+ displayValue
16
+ }
17
+ Industry @optional {
18
+ value
19
+ displayValue
20
+ }
21
+ Type @optional {
22
+ value
23
+ displayValue
24
+ }
25
+ Phone @optional {
26
+ value
27
+ displayValue
28
+ }
29
+ Owner @optional {
30
+ Name @optional {
31
+ value
32
+ displayValue
33
+ }
34
+ }
35
+ AnnualRevenue @optional {
36
+ value
37
+ displayValue
38
+ }
39
+ }
40
+ }
41
+ pageInfo {
42
+ hasNextPage
43
+ hasPreviousPage
44
+ endCursor
45
+ startCursor
46
+ }
47
+ totalCount
48
+ }
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,361 @@
1
+ import { useState } from "react";
2
+ import { useParams, useNavigate } from "react-router";
3
+ import { createDataSDK } from "@salesforce/sdk-data";
4
+ import { AlertCircle, ChevronDown, ChevronRight, FileQuestion } from "lucide-react";
5
+ import GET_ACCOUNT_DETAIL from "../api/account/query/getAccountDetail.graphql?raw";
6
+ import type {
7
+ GetAccountDetailQuery,
8
+ GetAccountDetailQueryVariables,
9
+ } from "../api/graphql-operations-types";
10
+ import { Alert, AlertTitle, AlertDescription } from "../components/ui/alert";
11
+ import { Button } from "../components/ui/button";
12
+ import { Card, CardContent } from "../components/ui/card";
13
+ import {
14
+ fieldValue,
15
+ getAddressFieldLines,
16
+ formatDateTimeField,
17
+ } from "../features/object-search/utils/fieldUtils";
18
+ import {
19
+ Collapsible,
20
+ CollapsibleTrigger,
21
+ CollapsibleContent,
22
+ } from "../components/ui/collapsible";
23
+ import { Separator } from "../components/ui/separator";
24
+ import { Skeleton } from "../components/ui/skeleton";
25
+ import { useCachedAsyncData } from "../features/object-search/hooks/useCachedAsyncData";
26
+ import { ObjectBreadcrumb } from "../features/object-search/components/ObjectBreadcrumb";
27
+
28
+ type AccountNode = NonNullable<
29
+ NonNullable<
30
+ NonNullable<NonNullable<GetAccountDetailQuery["uiapi"]["query"]["Account"]>["edges"]>[number]
31
+ >["node"]
32
+ >;
33
+
34
+ async function fetchAccountDetail(recordId: string): Promise<AccountNode | null | undefined> {
35
+ const data = await createDataSDK();
36
+ const response = await data.graphql?.<GetAccountDetailQuery, GetAccountDetailQueryVariables>(
37
+ GET_ACCOUNT_DETAIL,
38
+ { id: recordId },
39
+ );
40
+
41
+ if (response?.errors?.length) {
42
+ throw new Error(response.errors.map((e) => e.message).join("; "));
43
+ }
44
+
45
+ return response?.data?.uiapi?.query?.Account?.edges?.[0]?.node;
46
+ }
47
+
48
+ export default function AccountObjectDetail() {
49
+ const { recordId } = useParams();
50
+ const navigate = useNavigate();
51
+
52
+ const {
53
+ data: account,
54
+ loading,
55
+ error,
56
+ } = useCachedAsyncData(() => fetchAccountDetail(recordId!), [recordId], {
57
+ key: `account:${recordId}`,
58
+ });
59
+
60
+ return (
61
+ <div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
62
+ <ObjectBreadcrumb
63
+ listPath="/accounts"
64
+ listLabel="Accounts"
65
+ loading={loading}
66
+ recordName={
67
+ account
68
+ ? (fieldValue(account.Name) ?? "")
69
+ : error
70
+ ? "Error"
71
+ : loading
72
+ ? undefined
73
+ : "Not Found"
74
+ }
75
+ />
76
+
77
+ {/* Loading state */}
78
+ {loading && <AccountDetailSkeleton />}
79
+
80
+ {/* Error state */}
81
+ {error && <AccountDetailError onBack={() => navigate(-1)} />}
82
+
83
+ {/* Not found state */}
84
+ {!loading && !error && !account && <AccountDetailNotFound onBack={() => navigate(-1)} />}
85
+
86
+ {/* Content */}
87
+ {account && <AccountDetailContent account={account} />}
88
+ </div>
89
+ );
90
+ }
91
+
92
+ function AccountDetailContent({ account }: { account: AccountNode }) {
93
+ const billingAddress = getAddressFieldLines({
94
+ street: fieldValue(account.BillingStreet),
95
+ city: fieldValue(account.BillingCity),
96
+ state: fieldValue(account.BillingState),
97
+ postalCode: fieldValue(account.BillingPostalCode),
98
+ country: fieldValue(account.BillingCountry),
99
+ });
100
+
101
+ const shippingAddress = getAddressFieldLines({
102
+ street: fieldValue(account.ShippingStreet),
103
+ city: fieldValue(account.ShippingCity),
104
+ state: fieldValue(account.ShippingState),
105
+ postalCode: fieldValue(account.ShippingPostalCode),
106
+ country: fieldValue(account.ShippingCountry),
107
+ });
108
+
109
+ const dateTimeOptions = { dateStyle: "medium", timeStyle: "short" } as const;
110
+ const createdDate = formatDateTimeField(
111
+ fieldValue(account.CreatedDate),
112
+ undefined,
113
+ dateTimeOptions,
114
+ );
115
+ const lastModifiedDate = formatDateTimeField(
116
+ fieldValue(account.LastModifiedDate),
117
+ undefined,
118
+ dateTimeOptions,
119
+ );
120
+
121
+ return (
122
+ <>
123
+ <h1 className="text-2xl font-bold mb-4">Account: {fieldValue(account.Name)}</h1>
124
+
125
+ <Card>
126
+ <CardContent className="space-y-8 pt-6">
127
+ {/* Top section */}
128
+ <div>
129
+ <div className="space-y-4">
130
+ <FieldRow>
131
+ <FieldItem label="Account Owner">{fieldValue(account.Owner?.Name)}</FieldItem>
132
+ <FieldItem label="Phone">
133
+ <TelephoneField value={fieldValue(account.Phone)} />
134
+ </FieldItem>
135
+ </FieldRow>
136
+ <FieldRow>
137
+ <FieldItem label="Account Name">{fieldValue(account.Name)}</FieldItem>
138
+ <FieldItem label="Fax">
139
+ <TelephoneField value={fieldValue(account.Fax)} />
140
+ </FieldItem>
141
+ </FieldRow>
142
+ <FieldRow>
143
+ <FieldItem label="Parent Account">{fieldValue(account.Parent?.Name)}</FieldItem>
144
+ <FieldItem label="Website">{fieldValue(account.Website)}</FieldItem>
145
+ </FieldRow>
146
+ </div>
147
+ </div>
148
+
149
+ <Separator />
150
+
151
+ {/* Additional Information */}
152
+ <Section title="Additional Information">
153
+ <FieldRow>
154
+ <FieldItem label="Type">{fieldValue(account.Type)}</FieldItem>
155
+ <FieldItem label="Employees">{fieldValue(account.NumberOfEmployees)}</FieldItem>
156
+ </FieldRow>
157
+ <FieldRow>
158
+ <FieldItem label="Industry">{fieldValue(account.Industry)}</FieldItem>
159
+ <FieldItem label="Annual Revenue">{fieldValue(account.AnnualRevenue)}</FieldItem>
160
+ </FieldRow>
161
+ <FieldItem label="Description">{fieldValue(account.Description)}</FieldItem>
162
+ </Section>
163
+
164
+ <Separator />
165
+
166
+ {/* Address Information */}
167
+ <Section title="Address Information">
168
+ <FieldRow>
169
+ <FieldItem label="Billing Address">
170
+ {billingAddress ? billingAddress.map((line, i) => <div key={i}>{line}</div>) : null}
171
+ </FieldItem>
172
+ <FieldItem label="Shipping Address">
173
+ {shippingAddress
174
+ ? shippingAddress.map((line, i) => <div key={i}>{line}</div>)
175
+ : null}
176
+ </FieldItem>
177
+ </FieldRow>
178
+ </Section>
179
+
180
+ <Separator />
181
+
182
+ {/* System Information */}
183
+ <Section title="System Information">
184
+ <FieldRow>
185
+ <FieldItem label="Created By">
186
+ {[fieldValue(account.CreatedBy?.Name), createdDate].filter(Boolean).join(" ") ||
187
+ null}
188
+ </FieldItem>
189
+ <FieldItem label="Last Modified By">
190
+ {[fieldValue(account.LastModifiedBy?.Name), lastModifiedDate]
191
+ .filter(Boolean)
192
+ .join(" ") || null}
193
+ </FieldItem>
194
+ </FieldRow>
195
+ </Section>
196
+ </CardContent>
197
+ </Card>
198
+ </>
199
+ );
200
+ }
201
+
202
+ function TelephoneField({ value }: { value?: string | null }) {
203
+ if (!value) return null;
204
+ return (
205
+ <a href={`tel:${value}`} className="underline">
206
+ {value}
207
+ </a>
208
+ );
209
+ }
210
+
211
+ function FieldItem({ label, children }: { label: string; children: React.ReactNode }) {
212
+ return (
213
+ <div>
214
+ <dt className="text-sm text-muted-foreground">{label}</dt>
215
+ <dd className="mt-0.5">{children ?? "—"}</dd>
216
+ </div>
217
+ );
218
+ }
219
+
220
+ function FieldRow({ children }: { children: React.ReactNode }) {
221
+ return <div className="grid grid-cols-2 gap-x-8 gap-y-4">{children}</div>;
222
+ }
223
+
224
+ function Section({ title, children }: { title: string; children: React.ReactNode }) {
225
+ const [open, setOpen] = useState(true);
226
+ return (
227
+ <Collapsible open={open} onOpenChange={setOpen}>
228
+ <CollapsibleTrigger className="flex items-center gap-2 cursor-pointer text-lg font-semibold py-2">
229
+ {open ? <ChevronDown className="size-5" /> : <ChevronRight className="size-5" />}
230
+ {title}
231
+ </CollapsibleTrigger>
232
+ <CollapsibleContent>
233
+ <div className="mt-2 space-y-4">{children}</div>
234
+ </CollapsibleContent>
235
+ </Collapsible>
236
+ );
237
+ }
238
+
239
+ function AccountDetailError({ onBack }: { onBack: () => void }) {
240
+ return (
241
+ <>
242
+ <Alert variant="destructive" role="alert">
243
+ <AlertCircle />
244
+ <AlertTitle>
245
+ <h2>Failed to load account</h2>
246
+ </AlertTitle>
247
+ <AlertDescription>
248
+ Something went wrong while loading this account. Please try again later.
249
+ </AlertDescription>
250
+ </Alert>
251
+ <div className="mt-4 flex gap-3">
252
+ <Button variant="outline" onClick={onBack}>
253
+ ← Back
254
+ </Button>
255
+ <Button variant="outline" onClick={() => window.location.reload()}>
256
+ Retry
257
+ </Button>
258
+ </div>
259
+ </>
260
+ );
261
+ }
262
+
263
+ function AccountDetailNotFound({ onBack }: { onBack: () => void }) {
264
+ return (
265
+ <Card>
266
+ <CardContent className="flex flex-col items-center justify-center py-16 text-center">
267
+ <FileQuestion className="size-12 text-muted-foreground mb-4" />
268
+ <h2 className="text-lg font-semibold mb-1">Account not found</h2>
269
+ <p className="text-sm text-muted-foreground mb-6">
270
+ The account you're looking for doesn't exist or may have been deleted.
271
+ </p>
272
+ <Button variant="outline" onClick={onBack}>
273
+ ← Go back
274
+ </Button>
275
+ </CardContent>
276
+ </Card>
277
+ );
278
+ }
279
+
280
+ function AccountDetailSkeleton() {
281
+ return (
282
+ <>
283
+ <Skeleton className="h-8 w-56 mb-4" />
284
+
285
+ <Card>
286
+ <CardContent className="space-y-8 pt-6">
287
+ {/* Top section: field rows */}
288
+ <div>
289
+ <div className="space-y-4">
290
+ <SkeletonFieldRow />
291
+ <SkeletonFieldRow />
292
+ <SkeletonFieldRow />
293
+ </div>
294
+ </div>
295
+
296
+ <Separator />
297
+
298
+ {/* Additional Information */}
299
+ <SkeletonSection />
300
+
301
+ <Separator />
302
+
303
+ {/* Address Information */}
304
+ <div className="space-y-4">
305
+ <Skeleton className="h-7 w-48 py-2" />
306
+ <div className="grid grid-cols-2 gap-x-8 gap-y-4">
307
+ <div>
308
+ <Skeleton className="h-4 w-28 mb-1.5" />
309
+ <Skeleton className="h-5 w-44 mb-1" />
310
+ <Skeleton className="h-5 w-36 mb-1" />
311
+ <Skeleton className="h-5 w-28" />
312
+ </div>
313
+ <div>
314
+ <Skeleton className="h-4 w-32 mb-1.5" />
315
+ <Skeleton className="h-5 w-44 mb-1" />
316
+ <Skeleton className="h-5 w-36 mb-1" />
317
+ <Skeleton className="h-5 w-28" />
318
+ </div>
319
+ </div>
320
+ </div>
321
+
322
+ <Separator />
323
+
324
+ {/* System Information */}
325
+ <div className="space-y-4">
326
+ <Skeleton className="h-7 w-48 py-2" />
327
+ <SkeletonFieldRow />
328
+ </div>
329
+ </CardContent>
330
+ </Card>
331
+ </>
332
+ );
333
+ }
334
+
335
+ function SkeletonField() {
336
+ return (
337
+ <div>
338
+ <Skeleton className="h-4 w-24 mb-1.5" />
339
+ <Skeleton className="h-5 w-40" />
340
+ </div>
341
+ );
342
+ }
343
+
344
+ function SkeletonFieldRow() {
345
+ return (
346
+ <div className="grid grid-cols-2 gap-x-8 gap-y-4">
347
+ <SkeletonField />
348
+ <SkeletonField />
349
+ </div>
350
+ );
351
+ }
352
+
353
+ function SkeletonSection() {
354
+ return (
355
+ <div className="space-y-4">
356
+ <Skeleton className="h-7 w-48 py-2" />
357
+ <SkeletonFieldRow />
358
+ <SkeletonFieldRow />
359
+ </div>
360
+ );
361
+ }
@@ -0,0 +1,301 @@
1
+ import { useMemo, useState } from "react";
2
+ import { Link } from "react-router";
3
+ import { AlertCircle, ChevronDown, SearchX } from "lucide-react";
4
+ import {
5
+ searchAccounts,
6
+ fetchDistinctIndustries,
7
+ fetchDistinctTypes,
8
+ } from "../api/account/accountSearchService";
9
+ import { useCachedAsyncData } from "../features/object-search/hooks/useCachedAsyncData";
10
+ import { fieldValue } from "../features/object-search/utils/fieldUtils";
11
+ import { useObjectSearchParams } from "../features/object-search/hooks/useObjectSearchParams";
12
+ import { Alert, AlertTitle, AlertDescription } from "../components/ui/alert";
13
+ import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card";
14
+ import { Button } from "../components/ui/button";
15
+ import {
16
+ Collapsible,
17
+ CollapsibleContent,
18
+ CollapsibleTrigger,
19
+ } from "../components/ui/collapsible";
20
+ import { Skeleton } from "../components/ui/skeleton";
21
+ import {
22
+ FilterProvider,
23
+ FilterResetButton,
24
+ } from "../features/object-search/components/FilterContext";
25
+ import { SearchFilter } from "../features/object-search/components/filters/SearchFilter";
26
+ import { TextFilter } from "../features/object-search/components/filters/TextFilter";
27
+ import { SelectFilter } from "../features/object-search/components/filters/SelectFilter";
28
+ import { MultiSelectFilter } from "../features/object-search/components/filters/MultiSelectFilter";
29
+ import { NumericRangeFilter } from "../features/object-search/components/filters/NumericRangeFilter";
30
+ import { DateFilter } from "../features/object-search/components/filters/DateFilter";
31
+ import { DateRangeFilter } from "../features/object-search/components/filters/DateRangeFilter";
32
+ import { ActiveFilters } from "../features/object-search/components/ActiveFilters";
33
+ import { SortControl } from "../features/object-search/components/SortControl";
34
+ import type { FilterFieldConfig } from "../features/object-search/utils/filterUtils";
35
+ import type { SortFieldConfig } from "../features/object-search/utils/sortUtils";
36
+ import type { Account_Filter, Account_OrderBy } from "../api/graphql-operations-types";
37
+ import type { AccountSearchResult } from "../api/account/accountSearchService";
38
+ import { ObjectBreadcrumb } from "../features/object-search/components/ObjectBreadcrumb";
39
+ import PaginationControls from "../features/object-search/components/PaginationControls";
40
+ import type { PaginationConfig } from "../features/object-search/hooks/useObjectSearchParams";
41
+
42
+ const PAGINATION_CONFIG: PaginationConfig = {
43
+ defaultPageSize: 6,
44
+ validPageSizes: [6, 12, 24, 48],
45
+ };
46
+
47
+ type AccountNode = NonNullable<
48
+ NonNullable<NonNullable<AccountSearchResult["edges"]>[number]>["node"]
49
+ >;
50
+
51
+ const FILTER_CONFIGS: FilterFieldConfig[] = [
52
+ {
53
+ field: "search",
54
+ label: "Search",
55
+ type: "search",
56
+ searchFields: ["Name", "Phone", "Industry"],
57
+ placeholder: "Search by name, phone, or industry...",
58
+ },
59
+ { field: "Name", label: "Account Name", type: "text", placeholder: "Search by name..." },
60
+ { field: "Industry", label: "Industry", type: "picklist" },
61
+ { field: "Type", label: "Type", type: "multipicklist" },
62
+ { field: "AnnualRevenue", label: "Annual Revenue", type: "numeric" },
63
+ { field: "CreatedDate", label: "Created Date", type: "date" },
64
+ { field: "LastModifiedDate", label: "Last Modified Date", type: "daterange" },
65
+ ];
66
+
67
+ const ACCOUNT_SORT_CONFIGS: SortFieldConfig<keyof Account_OrderBy>[] = [
68
+ { field: "Name", label: "Name" },
69
+ { field: "AnnualRevenue", label: "Annual Revenue" },
70
+ { field: "Industry", label: "Industry" },
71
+ { field: "CreatedDate", label: "Created Date" },
72
+ ];
73
+
74
+ // -- Component --------------------------------------------------------------
75
+
76
+ export default function AccountSearch() {
77
+ const [filtersOpen, setFiltersOpen] = useState(true);
78
+ const { data: industryOptions } = useCachedAsyncData(fetchDistinctIndustries, [], {
79
+ key: "distinctIndustries",
80
+ ttl: 300_000,
81
+ });
82
+ const { data: typeOptions } = useCachedAsyncData(fetchDistinctTypes, [], {
83
+ key: "distinctTypes",
84
+ ttl: 300_000,
85
+ });
86
+
87
+ const { filters, sort, query, pagination, resetAll } = useObjectSearchParams<
88
+ Account_Filter,
89
+ Account_OrderBy
90
+ >(FILTER_CONFIGS, ACCOUNT_SORT_CONFIGS, PAGINATION_CONFIG);
91
+
92
+ const searchKey = `accounts:${JSON.stringify({ where: query.where, orderBy: query.orderBy, first: pagination.pageSize, after: pagination.afterCursor })}`;
93
+ const { data, loading, error } = useCachedAsyncData(
94
+ () =>
95
+ searchAccounts({
96
+ where: query.where,
97
+ orderBy: query.orderBy,
98
+ first: pagination.pageSize,
99
+ after: pagination.afterCursor,
100
+ }),
101
+ [query.where, query.orderBy, pagination.pageSize, pagination.afterCursor],
102
+ { key: searchKey },
103
+ );
104
+
105
+ const pageInfo = data?.pageInfo;
106
+ const totalCount = data?.totalCount;
107
+ const hasNextPage = pageInfo?.hasNextPage ?? false;
108
+ const hasPreviousPage = pagination.pageIndex > 0;
109
+
110
+ const validAccountNodes = useMemo(
111
+ () =>
112
+ (data?.edges ?? []).reduce<AccountNode[]>((acc, edge) => {
113
+ if (edge?.node) acc.push(edge.node);
114
+ return acc;
115
+ }, []),
116
+ [data?.edges],
117
+ );
118
+
119
+ return (
120
+ <div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
121
+ <ObjectBreadcrumb listPath="/accounts" listLabel="Accounts" />
122
+
123
+ <h1 className="text-2xl font-bold mb-4">Search Accounts</h1>
124
+
125
+ <div className="flex flex-col lg:flex-row gap-6">
126
+ {/* Sidebar — Filter Panel */}
127
+ <aside className="w-full lg:w-80 shrink-0">
128
+ <FilterProvider
129
+ filters={filters.active}
130
+ onFilterChange={filters.set}
131
+ onFilterRemove={filters.remove}
132
+ onReset={resetAll}
133
+ >
134
+ <Card>
135
+ <Collapsible open={filtersOpen} onOpenChange={setFiltersOpen}>
136
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
137
+ <CardTitle className="text-base font-semibold">
138
+ <h2>Filters</h2>
139
+ </CardTitle>
140
+ <div className="flex items-center gap-1">
141
+ <FilterResetButton variant="destructive" size="sm" />
142
+ <CollapsibleTrigger asChild>
143
+ <Button variant="ghost" size="icon">
144
+ <ChevronDown
145
+ className={`h-4 w-4 transition-transform ${filtersOpen ? "" : "-rotate-90"}`}
146
+ />
147
+ <span className="sr-only">Toggle filters</span>
148
+ </Button>
149
+ </CollapsibleTrigger>
150
+ </div>
151
+ </CardHeader>
152
+ <CollapsibleContent>
153
+ <CardContent className="space-y-4 pt-0">
154
+ <SearchFilter
155
+ field="search"
156
+ label="Search"
157
+ placeholder="Search by name, phone, or industry..."
158
+ />
159
+ <TextFilter field="Name" label="Account Name" placeholder="Search by name..." />
160
+ <SelectFilter
161
+ field="Industry"
162
+ label="Industry"
163
+ options={industryOptions ?? []}
164
+ />
165
+ <MultiSelectFilter field="Type" label="Type" options={typeOptions ?? []} />
166
+ <NumericRangeFilter field="AnnualRevenue" label="Annual Revenue" />
167
+ <DateFilter field="CreatedDate" label="Created Date" />
168
+ <DateRangeFilter field="LastModifiedDate" label="Last Modified Date" />
169
+ </CardContent>
170
+ </CollapsibleContent>
171
+ </Collapsible>
172
+ </Card>
173
+ </FilterProvider>
174
+ </aside>
175
+
176
+ {/* Main area — Sort + Results */}
177
+ <div className="flex-1 min-w-0">
178
+ {/* Sort control + active filters */}
179
+ <div className="flex flex-wrap items-center gap-2 mb-4">
180
+ <SortControl
181
+ configs={ACCOUNT_SORT_CONFIGS}
182
+ sort={sort.current}
183
+ onSortChange={sort.set}
184
+ />
185
+ <ActiveFilters filters={filters.active} onRemove={filters.remove} />
186
+ </div>
187
+
188
+ <div className="min-h-112">
189
+ {/* Loading state */}
190
+ {loading && (
191
+ <>
192
+ <Skeleton className="h-5 w-30 mb-3" />
193
+ <div className="divide-y">
194
+ {Array.from({ length: pagination.pageSize }, (_, i) => (
195
+ <div key={i} className="flex items-center justify-between py-3">
196
+ <div className="space-y-2">
197
+ <Skeleton className="h-5 w-40" />
198
+ <Skeleton className="h-4 w-28" />
199
+ </div>
200
+ <div className="space-y-2 flex flex-col items-end">
201
+ <Skeleton className="h-4 w-24" />
202
+ <Skeleton className="h-4 w-20" />
203
+ </div>
204
+ </div>
205
+ ))}
206
+ </div>
207
+ </>
208
+ )}
209
+
210
+ {/* Error state */}
211
+ {error && (
212
+ <>
213
+ <p className="text-sm text-muted-foreground mb-3">0 accounts found</p>
214
+ <Alert variant="destructive" role="alert">
215
+ <AlertCircle />
216
+ <AlertTitle>Failed to load accounts</AlertTitle>
217
+ <AlertDescription>
218
+ Something went wrong while loading accounts. Please try again later.
219
+ </AlertDescription>
220
+ </Alert>
221
+ </>
222
+ )}
223
+
224
+ {/* Results list */}
225
+ {!loading && !error && validAccountNodes.length > 0 && (
226
+ <>
227
+ <p className="text-sm text-muted-foreground mb-3">
228
+ {totalCount != null && (hasNextPage || hasPreviousPage)
229
+ ? `${totalCount} account${totalCount !== 1 ? "s" : ""} found`
230
+ : `Showing ${validAccountNodes.length} account${validAccountNodes.length !== 1 ? "s" : ""}`}
231
+ </p>
232
+ <AccountResultsList nodes={validAccountNodes} />
233
+ </>
234
+ )}
235
+
236
+ {/* No results state */}
237
+ {!loading && !error && validAccountNodes.length === 0 && (
238
+ <div className="flex flex-col items-center justify-center py-16 text-center">
239
+ <SearchX className="size-12 text-muted-foreground mb-4" />
240
+ <h2 className="text-lg font-semibold mb-1">No accounts found</h2>
241
+ <p className="text-sm text-muted-foreground">
242
+ Try adjusting your filters or search criteria.
243
+ </p>
244
+ </div>
245
+ )}
246
+ </div>
247
+
248
+ {/* Pagination — always visible, disabled while loading or on error */}
249
+ <PaginationControls
250
+ pageIndex={pagination.pageIndex}
251
+ hasNextPage={hasNextPage}
252
+ hasPreviousPage={hasPreviousPage}
253
+ pageSize={pagination.pageSize}
254
+ pageSizeOptions={PAGINATION_CONFIG.validPageSizes}
255
+ onNextPage={() => {
256
+ if (pageInfo?.endCursor) pagination.goToNextPage(pageInfo.endCursor);
257
+ }}
258
+ onPreviousPage={pagination.goToPreviousPage}
259
+ onPageSizeChange={pagination.setPageSize}
260
+ disabled={loading || !!error}
261
+ />
262
+ </div>
263
+ </div>
264
+ </div>
265
+ );
266
+ }
267
+
268
+ // -- Result Components ------------------------------------------------------
269
+
270
+ function AccountResultsList({ nodes }: { nodes: AccountNode[] }) {
271
+ return (
272
+ <ul className="divide-y">
273
+ {nodes.map((node) => (
274
+ <AccountResultItem key={node.Id} node={node} />
275
+ ))}
276
+ </ul>
277
+ );
278
+ }
279
+
280
+ function AccountResultItem({ node }: { node: AccountNode }) {
281
+ return (
282
+ <li>
283
+ <Link
284
+ to={`/accounts/${node.Id}`}
285
+ className="flex items-center justify-between py-3 px-3 -mx-3 rounded-md transition-colors hover:bg-accent"
286
+ >
287
+ <div>
288
+ <span className="font-medium">{fieldValue(node.Name) ?? "\u2014"}</span>
289
+ <p className="text-sm text-muted-foreground">
290
+ {[fieldValue(node.Industry), fieldValue(node.Type)].filter(Boolean).join(" \u00B7 ") ||
291
+ "\u2014"}
292
+ </p>
293
+ </div>
294
+ <div className="text-right text-sm">
295
+ <p>{fieldValue(node.Phone) ?? ""}</p>
296
+ <p className="text-muted-foreground">{fieldValue(node.Owner?.Name) ?? ""}</p>
297
+ </div>
298
+ </Link>
299
+ </li>
300
+ );
301
+ }
@@ -1,12 +1,34 @@
1
- export default function Home() {
2
- return (
3
- <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
4
- <div className="text-center">
5
- <h1 className="text-4xl font-bold text-gray-900 mb-4">Home</h1>
6
- <p className="text-lg text-gray-600 mb-8">
7
- Welcome to your React application.
8
- </p>
9
- </div>
10
- </div>
11
- );
1
+ import { useState } from "react";
2
+ import { useNavigate } from "react-router";
3
+ import { SearchBar } from "../features/object-search/components/SearchBar";
4
+ import { Button } from "../components/ui/button";
5
+
6
+ export default function HomePage() {
7
+ const navigate = useNavigate();
8
+ const [text, setText] = useState("");
9
+
10
+ const handleSubmit = (e: React.SyntheticEvent<HTMLFormElement>) => {
11
+ e.preventDefault();
12
+ const params = text ? `?q=${encodeURIComponent(text)}` : "";
13
+ navigate(`/accounts${params}`);
14
+ };
15
+
16
+ return (
17
+ <div className="max-w-2xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
18
+ <div className="flex items-center gap-6 mb-6">
19
+ <h1 className="text-2xl font-bold">Account Search</h1>
20
+ <Button variant="outline" size="sm" onClick={() => navigate("/accounts")}>
21
+ Browse All Accounts
22
+ </Button>
23
+ </div>
24
+ <form onSubmit={handleSubmit} className="flex gap-2">
25
+ <SearchBar
26
+ placeholder="Search by name, phone, or industry..."
27
+ value={text}
28
+ handleChange={setText}
29
+ />
30
+ <Button type="submit">Search</Button>
31
+ </form>
32
+ </div>
33
+ );
12
34
  }
@@ -1,7 +1,10 @@
1
1
  import type { RouteObject } from 'react-router';
2
2
  import AppLayout from './appLayout';
3
- import Home from './features/object-search/__examples__/pages/Home';
3
+ import Home from './pages/Home';
4
4
  import NotFound from './pages/NotFound';
5
+ import AccountSearch from "./pages/AccountSearch";
6
+ import AccountObjectDetail from "./pages/AccountObjectDetailPage";
7
+
5
8
  export const routes: RouteObject[] = [
6
9
  {
7
10
  path: "/",
@@ -15,6 +18,14 @@ export const routes: RouteObject[] = [
15
18
  {
16
19
  path: '*',
17
20
  element: <NotFound />
21
+ },
22
+ {
23
+ path: "accounts/:recordId",
24
+ element: <AccountObjectDetail />
25
+ },
26
+ {
27
+ path: "accounts",
28
+ element: <AccountSearch />
18
29
  }
19
30
  ]
20
31
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-base-sfdx-project-experimental",
3
- "version": "1.116.0",
3
+ "version": "1.116.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.116.0",
9
+ "version": "1.116.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/webapp-template-base-sfdx-project-experimental",
3
- "version": "1.116.0",
3
+ "version": "1.116.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/webapp-template-app-react-template-b2e-experimental",
3
- "version": "1.116.0",
3
+ "version": "1.116.1",
4
4
  "description": "Salesforce React internal app template",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "",