@salesforce/ui-bundle-template-app-react-sample-b2x 11.68.1 → 11.68.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.
Files changed (38) hide show
  1. package/dist/CHANGELOG.md +8 -0
  2. package/dist/force-app/main/default/uiBundles/propertyrentalapp/package.json +4 -4
  3. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/api/objectSearchService.ts +2 -8
  4. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/hooks/useObjectSearchParams.ts +1 -19
  5. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/utils/debounce.ts +1 -12
  6. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/utils/filterUtils.ts +8 -123
  7. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/utils/sortUtils.ts +1 -17
  8. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/PropertySearch.tsx +3 -6
  9. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/routes.tsx +0 -10
  10. package/dist/force-app/main/default/uiBundles/propertyrentalapp/tsconfig.tsbuildinfo +1 -1
  11. package/dist/package-lock.json +2 -2
  12. package/dist/package.json +1 -1
  13. package/package.json +4 -1
  14. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/__examples__/api/accountSearchService.ts +0 -46
  15. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/__examples__/api/query/distinctAccountIndustries.graphql +0 -19
  16. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/__examples__/api/query/distinctAccountTypes.graphql +0 -19
  17. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/__examples__/api/query/getAccountDetail.graphql +0 -121
  18. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/__examples__/api/query/searchAccounts.graphql +0 -51
  19. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/__examples__/pages/AccountObjectDetailPage.tsx +0 -355
  20. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/__examples__/pages/AccountSearch.tsx +0 -304
  21. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/__examples__/pages/Home.tsx +0 -34
  22. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/ActiveFilters.tsx +0 -89
  23. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/FilterContext.tsx +0 -83
  24. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/ObjectBreadcrumb.tsx +0 -66
  25. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/SearchBar.tsx +0 -41
  26. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/SortControl.tsx +0 -143
  27. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/filters/BooleanFilter.tsx +0 -78
  28. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/filters/DateFilter.tsx +0 -128
  29. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/filters/DateRangeFilter.tsx +0 -70
  30. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/filters/FilterFieldWrapper.tsx +0 -43
  31. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/filters/MultiSelectFilter.tsx +0 -105
  32. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/filters/NumericRangeFilter.tsx +0 -171
  33. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/filters/SearchFilter.tsx +0 -52
  34. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/filters/SelectFilter.tsx +0 -97
  35. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/components/filters/TextFilter.tsx +0 -93
  36. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/hooks/useAsyncData.ts +0 -63
  37. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/hooks/useDebouncedCallback.ts +0 -34
  38. package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/features/object-search/utils/fieldUtils.ts +0 -29
@@ -1,51 +0,0 @@
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
- }
@@ -1,355 +0,0 @@
1
- import { useState } from "react";
2
- import { useParams, useNavigate } from "react-router";
3
- import { createDataSDK } from "@salesforce/platform-sdk";
4
- import { AlertCircle, ChevronDown, ChevronRight, FileQuestion } from "lucide-react";
5
- import GET_ACCOUNT_DETAIL from "../api/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 { fieldValue, getAddressFieldLines, formatDateTimeField } from "../../utils/fieldUtils";
14
- import {
15
- Collapsible,
16
- CollapsibleTrigger,
17
- CollapsibleContent,
18
- } from "../../../../components/ui/collapsible";
19
- import { Separator } from "../../../../components/ui/separator";
20
- import { Skeleton } from "../../../../components/ui/skeleton";
21
- import { useAsyncData } from "../../hooks/useAsyncData";
22
- import { ObjectBreadcrumb } from "../../components/ObjectBreadcrumb";
23
-
24
- type AccountNode = NonNullable<
25
- NonNullable<
26
- NonNullable<NonNullable<GetAccountDetailQuery["uiapi"]["query"]["Account"]>["edges"]>[number]
27
- >["node"]
28
- >;
29
-
30
- async function fetchAccountDetail(recordId: string): Promise<AccountNode | null | undefined> {
31
- const data = await createDataSDK();
32
- const result = await data.graphql!.query<GetAccountDetailQuery, GetAccountDetailQueryVariables>({
33
- query: GET_ACCOUNT_DETAIL,
34
- variables: { id: recordId },
35
- });
36
-
37
- if (result.errors?.length) {
38
- throw new Error(result.errors.map((e) => e.message).join("; "));
39
- }
40
-
41
- return result.data?.uiapi?.query?.Account?.edges?.[0]?.node;
42
- }
43
-
44
- export default function AccountObjectDetail() {
45
- const { recordId } = useParams();
46
- const navigate = useNavigate();
47
-
48
- const {
49
- data: account,
50
- loading,
51
- error,
52
- } = useAsyncData(() => fetchAccountDetail(recordId!), [recordId]);
53
-
54
- return (
55
- <div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
56
- <ObjectBreadcrumb
57
- listPath="/accounts"
58
- listLabel="Accounts"
59
- loading={loading}
60
- recordName={
61
- account
62
- ? (fieldValue(account.Name) ?? "")
63
- : error
64
- ? "Error"
65
- : loading
66
- ? undefined
67
- : "Not Found"
68
- }
69
- />
70
-
71
- {/* Loading state */}
72
- {loading && <AccountDetailSkeleton />}
73
-
74
- {/* Error state */}
75
- {error && <AccountDetailError onBack={() => navigate(-1)} />}
76
-
77
- {/* Not found state */}
78
- {!loading && !error && !account && <AccountDetailNotFound onBack={() => navigate(-1)} />}
79
-
80
- {/* Content */}
81
- {account && <AccountDetailContent account={account} />}
82
- </div>
83
- );
84
- }
85
-
86
- function AccountDetailContent({ account }: { account: AccountNode }) {
87
- const billingAddress = getAddressFieldLines({
88
- street: fieldValue(account.BillingStreet),
89
- city: fieldValue(account.BillingCity),
90
- state: fieldValue(account.BillingState),
91
- postalCode: fieldValue(account.BillingPostalCode),
92
- country: fieldValue(account.BillingCountry),
93
- });
94
-
95
- const shippingAddress = getAddressFieldLines({
96
- street: fieldValue(account.ShippingStreet),
97
- city: fieldValue(account.ShippingCity),
98
- state: fieldValue(account.ShippingState),
99
- postalCode: fieldValue(account.ShippingPostalCode),
100
- country: fieldValue(account.ShippingCountry),
101
- });
102
-
103
- const dateTimeOptions = { dateStyle: "medium", timeStyle: "short" } as const;
104
- const createdDate = formatDateTimeField(
105
- fieldValue(account.CreatedDate),
106
- undefined,
107
- dateTimeOptions,
108
- );
109
- const lastModifiedDate = formatDateTimeField(
110
- fieldValue(account.LastModifiedDate),
111
- undefined,
112
- dateTimeOptions,
113
- );
114
-
115
- return (
116
- <>
117
- <h1 className="text-2xl font-bold mb-4">Account: {fieldValue(account.Name)}</h1>
118
-
119
- <Card>
120
- <CardContent className="space-y-8 pt-6">
121
- {/* Top section */}
122
- <div>
123
- <div className="space-y-4">
124
- <FieldRow>
125
- <FieldItem label="Account Owner">{fieldValue(account.Owner?.Name)}</FieldItem>
126
- <FieldItem label="Phone">
127
- <TelephoneField value={fieldValue(account.Phone)} />
128
- </FieldItem>
129
- </FieldRow>
130
- <FieldRow>
131
- <FieldItem label="Account Name">{fieldValue(account.Name)}</FieldItem>
132
- <FieldItem label="Fax">
133
- <TelephoneField value={fieldValue(account.Fax)} />
134
- </FieldItem>
135
- </FieldRow>
136
- <FieldRow>
137
- <FieldItem label="Parent Account">{fieldValue(account.Parent?.Name)}</FieldItem>
138
- <FieldItem label="Website">{fieldValue(account.Website)}</FieldItem>
139
- </FieldRow>
140
- </div>
141
- </div>
142
-
143
- <Separator />
144
-
145
- {/* Additional Information */}
146
- <Section title="Additional Information">
147
- <FieldRow>
148
- <FieldItem label="Type">{fieldValue(account.Type)}</FieldItem>
149
- <FieldItem label="Employees">{fieldValue(account.NumberOfEmployees)}</FieldItem>
150
- </FieldRow>
151
- <FieldRow>
152
- <FieldItem label="Industry">{fieldValue(account.Industry)}</FieldItem>
153
- <FieldItem label="Annual Revenue">{fieldValue(account.AnnualRevenue)}</FieldItem>
154
- </FieldRow>
155
- <FieldItem label="Description">{fieldValue(account.Description)}</FieldItem>
156
- </Section>
157
-
158
- <Separator />
159
-
160
- {/* Address Information */}
161
- <Section title="Address Information">
162
- <FieldRow>
163
- <FieldItem label="Billing Address">
164
- {billingAddress ? billingAddress.map((line, i) => <div key={i}>{line}</div>) : null}
165
- </FieldItem>
166
- <FieldItem label="Shipping Address">
167
- {shippingAddress
168
- ? shippingAddress.map((line, i) => <div key={i}>{line}</div>)
169
- : null}
170
- </FieldItem>
171
- </FieldRow>
172
- </Section>
173
-
174
- <Separator />
175
-
176
- {/* System Information */}
177
- <Section title="System Information">
178
- <FieldRow>
179
- <FieldItem label="Created By">
180
- {[fieldValue(account.CreatedBy?.Name), createdDate].filter(Boolean).join(" ") ||
181
- null}
182
- </FieldItem>
183
- <FieldItem label="Last Modified By">
184
- {[fieldValue(account.LastModifiedBy?.Name), lastModifiedDate]
185
- .filter(Boolean)
186
- .join(" ") || null}
187
- </FieldItem>
188
- </FieldRow>
189
- </Section>
190
- </CardContent>
191
- </Card>
192
- </>
193
- );
194
- }
195
-
196
- function TelephoneField({ value }: { value?: string | null }) {
197
- if (!value) return null;
198
- return (
199
- <a href={`tel:${value}`} className="underline">
200
- {value}
201
- </a>
202
- );
203
- }
204
-
205
- function FieldItem({ label, children }: { label: string; children: React.ReactNode }) {
206
- return (
207
- <div>
208
- <dt className="text-sm text-muted-foreground">{label}</dt>
209
- <dd className="mt-0.5">{children ?? "—"}</dd>
210
- </div>
211
- );
212
- }
213
-
214
- function FieldRow({ children }: { children: React.ReactNode }) {
215
- return <div className="grid grid-cols-2 gap-x-8 gap-y-4">{children}</div>;
216
- }
217
-
218
- function Section({ title, children }: { title: string; children: React.ReactNode }) {
219
- const [open, setOpen] = useState(true);
220
- return (
221
- <Collapsible open={open} onOpenChange={setOpen}>
222
- <CollapsibleTrigger className="flex items-center gap-2 cursor-pointer text-lg font-semibold py-2">
223
- {open ? <ChevronDown className="size-5" /> : <ChevronRight className="size-5" />}
224
- {title}
225
- </CollapsibleTrigger>
226
- <CollapsibleContent>
227
- <div className="mt-2 space-y-4">{children}</div>
228
- </CollapsibleContent>
229
- </Collapsible>
230
- );
231
- }
232
-
233
- function AccountDetailError({ onBack }: { onBack: () => void }) {
234
- return (
235
- <>
236
- <Alert variant="destructive" role="alert">
237
- <AlertCircle />
238
- <AlertTitle>
239
- <h2>Failed to load account</h2>
240
- </AlertTitle>
241
- <AlertDescription>
242
- Something went wrong while loading this account. Please try again later.
243
- </AlertDescription>
244
- </Alert>
245
- <div className="mt-4 flex gap-3">
246
- <Button variant="outline" onClick={onBack}>
247
- ← Back
248
- </Button>
249
- <Button variant="outline" onClick={() => window.location.reload()}>
250
- Retry
251
- </Button>
252
- </div>
253
- </>
254
- );
255
- }
256
-
257
- function AccountDetailNotFound({ onBack }: { onBack: () => void }) {
258
- return (
259
- <Card>
260
- <CardContent className="flex flex-col items-center justify-center py-16 text-center">
261
- <FileQuestion className="size-12 text-muted-foreground mb-4" />
262
- <h2 className="text-lg font-semibold mb-1">Account not found</h2>
263
- <p className="text-sm text-muted-foreground mb-6">
264
- The account you're looking for doesn't exist or may have been deleted.
265
- </p>
266
- <Button variant="outline" onClick={onBack}>
267
- ← Go back
268
- </Button>
269
- </CardContent>
270
- </Card>
271
- );
272
- }
273
-
274
- function AccountDetailSkeleton() {
275
- return (
276
- <>
277
- <Skeleton className="h-8 w-56 mb-4" />
278
-
279
- <Card>
280
- <CardContent className="space-y-8 pt-6">
281
- {/* Top section: field rows */}
282
- <div>
283
- <div className="space-y-4">
284
- <SkeletonFieldRow />
285
- <SkeletonFieldRow />
286
- <SkeletonFieldRow />
287
- </div>
288
- </div>
289
-
290
- <Separator />
291
-
292
- {/* Additional Information */}
293
- <SkeletonSection />
294
-
295
- <Separator />
296
-
297
- {/* Address Information */}
298
- <div className="space-y-4">
299
- <Skeleton className="h-7 w-48 py-2" />
300
- <div className="grid grid-cols-2 gap-x-8 gap-y-4">
301
- <div>
302
- <Skeleton className="h-4 w-28 mb-1.5" />
303
- <Skeleton className="h-5 w-44 mb-1" />
304
- <Skeleton className="h-5 w-36 mb-1" />
305
- <Skeleton className="h-5 w-28" />
306
- </div>
307
- <div>
308
- <Skeleton className="h-4 w-32 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
- </div>
315
-
316
- <Separator />
317
-
318
- {/* System Information */}
319
- <div className="space-y-4">
320
- <Skeleton className="h-7 w-48 py-2" />
321
- <SkeletonFieldRow />
322
- </div>
323
- </CardContent>
324
- </Card>
325
- </>
326
- );
327
- }
328
-
329
- function SkeletonField() {
330
- return (
331
- <div>
332
- <Skeleton className="h-4 w-24 mb-1.5" />
333
- <Skeleton className="h-5 w-40" />
334
- </div>
335
- );
336
- }
337
-
338
- function SkeletonFieldRow() {
339
- return (
340
- <div className="grid grid-cols-2 gap-x-8 gap-y-4">
341
- <SkeletonField />
342
- <SkeletonField />
343
- </div>
344
- );
345
- }
346
-
347
- function SkeletonSection() {
348
- return (
349
- <div className="space-y-4">
350
- <Skeleton className="h-7 w-48 py-2" />
351
- <SkeletonFieldRow />
352
- <SkeletonFieldRow />
353
- </div>
354
- );
355
- }