@salesforce/webapp-template-app-react-sample-b2e-experimental 1.76.0 → 1.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +16 -0
- package/dist/force-app/main/default/objects/Maintenance_Request__c/Maintenance_Request__c.object-meta.xml +0 -4
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/package.json +4 -4
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/api/objectDetailService.ts +3 -26
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/api/objectInfoGraphQLService.ts +108 -165
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/api/objectInfoService.ts +9 -113
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/components/detail/UiApiDetailForm.tsx +2 -2
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/hooks/useObjectInfoBatch.ts +1 -1
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/hooks/useObjectSearchData.ts +7 -228
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/hooks/useRecordDetailLayout.ts +1 -20
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/types/filters/picklist.ts +5 -31
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/types/objectInfo/objectInfo.ts +46 -163
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/types/schema.d.ts +200 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/utils/apiUtils.ts +3 -69
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/utils/graphQLObjectInfoAdapter.ts +37 -279
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/features/global-search/utils/recordUtils.ts +4 -4
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/index.ts +117 -3
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/lib/maintenanceAdapter.ts +2 -23
- package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/pages/Maintenance.tsx +21 -4
- package/dist/package.json +1 -1
- package/package.json +3 -3
|
@@ -49,13 +49,13 @@ const getFetchableFieldsFromLayoutItem = function (
|
|
|
49
49
|
|
|
50
50
|
// add field: fieldType
|
|
51
51
|
const fieldMetadata = metadata.fields[comp.apiName];
|
|
52
|
-
fields[comp.apiName] = fieldMetadata
|
|
52
|
+
fields[comp.apiName] = fieldMetadata?.dataType ?? "";
|
|
53
53
|
|
|
54
54
|
// add relatedField if one exists (Id field -> add relationship name so we request Owner.Name)
|
|
55
55
|
if (comp.apiName in metadata.fields) {
|
|
56
56
|
const relationshipName = fieldMetadata?.relationshipName;
|
|
57
57
|
if (relationshipName) {
|
|
58
|
-
fields[relationshipName] = fieldMetadata.dataType;
|
|
58
|
+
fields[relationshipName] = fieldMetadata.dataType ?? "";
|
|
59
59
|
|
|
60
60
|
relationFieldMap[comp.apiName] = relationshipName;
|
|
61
61
|
}
|
|
@@ -65,7 +65,7 @@ const getFetchableFieldsFromLayoutItem = function (
|
|
|
65
65
|
const idField = findIdFieldForRelationship(metadata, comp.apiName);
|
|
66
66
|
if (idField) {
|
|
67
67
|
const idMeta = metadata.fields[idField];
|
|
68
|
-
fields[idField] = idMeta
|
|
68
|
+
fields[idField] = idMeta?.dataType ?? "";
|
|
69
69
|
relationFieldMap[idField] = comp.apiName;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -137,7 +137,7 @@ export const calculateFieldsToFetch = function (
|
|
|
137
137
|
const fields = getFetchableFieldsFromLayout(metadata, layout, relationFieldMap);
|
|
138
138
|
let fieldsToFetch = Object.keys(fields);
|
|
139
139
|
if (shouldPrefixedWithEntityName) {
|
|
140
|
-
fieldsToFetch = fieldsToFetch.map((field) => `${metadata.
|
|
140
|
+
fieldsToFetch = fieldsToFetch.map((field) => `${metadata.ApiName}.${field}`);
|
|
141
141
|
}
|
|
142
142
|
// populate field types for o11y logging
|
|
143
143
|
const fieldTypes = Object.values(fields).filter((fieldType) => fieldType !== "");
|
|
@@ -1,6 +1,120 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Public API for the Global Search feature package.
|
|
3
|
+
*
|
|
4
|
+
* Design goals:
|
|
5
|
+
* - Export **API services, hooks, types, schemas, and utilities** that customers can import from node_modules.
|
|
6
|
+
* - Do **not** export UI components or feature constants (customers build their own UI).
|
|
7
|
+
*
|
|
8
|
+
* Source implementation lives under `src/features/global-search/**`.
|
|
3
9
|
*/
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// API layer
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
export { objectInfoService } from "./features/global-search/api/objectInfoService";
|
|
16
|
+
export {
|
|
17
|
+
objectDetailService,
|
|
18
|
+
extractFieldsFromLayout,
|
|
19
|
+
} from "./features/global-search/api/objectDetailService";
|
|
20
|
+
export type { RecordDetailResult } from "./features/global-search/api/objectDetailService";
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
getRecordsGraphQL,
|
|
24
|
+
getRecordByIdGraphQL,
|
|
25
|
+
buildGetRecordsQuery,
|
|
26
|
+
buildWhereFromCriteria,
|
|
27
|
+
buildOrderByFromSort,
|
|
28
|
+
} from "./features/global-search/api/recordListGraphQLService";
|
|
29
|
+
export type {
|
|
30
|
+
RecordListGraphQLResult,
|
|
31
|
+
RecordListGraphQLVariables,
|
|
32
|
+
RecordListGraphQLOptions,
|
|
33
|
+
GraphQLRecordNode,
|
|
34
|
+
} from "./features/global-search/api/recordListGraphQLService";
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Hooks
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
export { useObjectInfoBatch } from "./features/global-search/hooks/useObjectInfoBatch";
|
|
41
|
+
export {
|
|
42
|
+
useObjectListMetadata,
|
|
43
|
+
useObjectColumns,
|
|
44
|
+
useObjectFilters,
|
|
45
|
+
} from "./features/global-search/hooks/useObjectSearchData";
|
|
46
|
+
export { useRecordListGraphQL } from "./features/global-search/hooks/useRecordListGraphQL";
|
|
47
|
+
export { useRecordDetailLayout } from "./features/global-search/hooks/useRecordDetailLayout";
|
|
48
|
+
|
|
49
|
+
export type { ObjectListMetadata } from "./features/global-search/hooks/useObjectSearchData";
|
|
50
|
+
|
|
51
|
+
export type {
|
|
52
|
+
UseRecordListGraphQLOptions,
|
|
53
|
+
UseRecordListGraphQLReturn,
|
|
54
|
+
} from "./features/global-search/hooks/useRecordListGraphQL";
|
|
55
|
+
|
|
56
|
+
export type {
|
|
57
|
+
UseRecordDetailLayoutParams,
|
|
58
|
+
UseRecordDetailLayoutReturn,
|
|
59
|
+
} from "./features/global-search/hooks/useRecordDetailLayout";
|
|
60
|
+
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// Types + Zod schemas (runtime validation)
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
ColumnArraySchema,
|
|
67
|
+
SearchResultRecordArraySchema,
|
|
68
|
+
KeywordSearchResultSchema,
|
|
69
|
+
SearchResultsResponseSchema,
|
|
70
|
+
} from "./features/global-search/types/search/searchResults";
|
|
71
|
+
export type {
|
|
72
|
+
Column,
|
|
73
|
+
SearchResultRecord,
|
|
74
|
+
KeywordSearchResult,
|
|
75
|
+
SearchResultsResponse,
|
|
76
|
+
} from "./features/global-search/types/search/searchResults";
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
FilterArraySchema,
|
|
80
|
+
FilterCriteriaArraySchema,
|
|
81
|
+
FILTER_OPERATORS,
|
|
82
|
+
} from "./features/global-search/types/filters/filters";
|
|
83
|
+
export type {
|
|
84
|
+
Filter,
|
|
85
|
+
FilterCriteria,
|
|
86
|
+
FilterOperator,
|
|
87
|
+
FiltersResponse,
|
|
88
|
+
} from "./features/global-search/types/filters/filters";
|
|
89
|
+
|
|
90
|
+
export type { PicklistValue } from "./features/global-search/types/filters/picklist";
|
|
91
|
+
|
|
92
|
+
export type {
|
|
93
|
+
ObjectInfoBatchResponse,
|
|
94
|
+
ObjectInfoResult,
|
|
95
|
+
} from "./features/global-search/types/objectInfo/objectInfo";
|
|
96
|
+
|
|
97
|
+
export { LayoutResponseSchema } from "./features/global-search/types/recordDetail/recordDetail";
|
|
98
|
+
export type { LayoutResponse } from "./features/global-search/types/recordDetail/recordDetail";
|
|
99
|
+
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Utilities
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
|
|
104
|
+
export { fetchAndValidate, safeEncodePath } from "./features/global-search/utils/apiUtils";
|
|
105
|
+
export { debounce } from "./features/global-search/utils/debounce";
|
|
106
|
+
export { createFiltersKey } from "./features/global-search/utils/cacheUtils";
|
|
107
|
+
export {
|
|
108
|
+
calculateFieldsToFetch,
|
|
109
|
+
getSafeKey,
|
|
110
|
+
isValidSalesforceId,
|
|
111
|
+
} from "./features/global-search/utils/recordUtils";
|
|
112
|
+
export { parseFilterValue } from "./features/global-search/utils/filterUtils";
|
|
113
|
+
export { sanitizeFilterValue } from "./features/global-search/utils/sanitizationUtils";
|
|
114
|
+
export {
|
|
115
|
+
getGraphQLNodeValue,
|
|
116
|
+
getDisplayValueForDetailFieldFromNode,
|
|
117
|
+
getDisplayValueForLayoutItemFromNode,
|
|
118
|
+
getGraphQLRecordDisplayName,
|
|
119
|
+
} from "./features/global-search/utils/graphQLNodeFieldUtils";
|
|
120
|
+
export { graphQLNodeToSearchResultRecordData } from "./features/global-search/utils/graphQLRecordAdapter";
|
package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/lib/maintenanceAdapter.ts
CHANGED
|
@@ -46,27 +46,6 @@ function getTenantNameFromNode(n: MaintenanceNode): string {
|
|
|
46
46
|
return "Unknown";
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
function mapPriority(priority: string | undefined): MaintenanceRequest["priority"] {
|
|
50
|
-
if (!priority) return "medium";
|
|
51
|
-
const p = priority.toLowerCase();
|
|
52
|
-
if (p.includes("emergency")) return "emergency";
|
|
53
|
-
if (p.includes("high") || p.includes("same day")) return "high";
|
|
54
|
-
if (p.includes("medium") || p.includes("standard")) return "medium";
|
|
55
|
-
if (p.includes("low")) return "low";
|
|
56
|
-
return "medium";
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function mapStatus(status: string | undefined): string {
|
|
60
|
-
if (!status) return "new";
|
|
61
|
-
const s = status.toLowerCase().replace(/\s+/g, "_");
|
|
62
|
-
if (s === "completed" || s === "resolved") return "completed";
|
|
63
|
-
if (s === "in_progress") return "in_progress";
|
|
64
|
-
if (s === "assigned") return "assigned";
|
|
65
|
-
if (s === "scheduled") return "scheduled";
|
|
66
|
-
if (s === "new") return "new";
|
|
67
|
-
return "new";
|
|
68
|
-
}
|
|
69
|
-
|
|
70
49
|
export function nodeToMaintenanceRequest(
|
|
71
50
|
node: Record<string, unknown> | undefined,
|
|
72
51
|
): MaintenanceRequest {
|
|
@@ -95,8 +74,8 @@ export function nodeToMaintenanceRequest(
|
|
|
95
74
|
id: n.Id ?? "",
|
|
96
75
|
propertyAddress: n.Property__r?.Address__c?.value ?? "Unknown Address",
|
|
97
76
|
issueType: n.Type__c?.value ?? "General",
|
|
98
|
-
priority:
|
|
99
|
-
status:
|
|
77
|
+
priority: (n.Priority__c?.value as "emergency" | "high" | "medium" | "low") ?? "medium",
|
|
78
|
+
status: n.Status__c?.value ?? "New",
|
|
100
79
|
assignedWorker: assignedWorkerName,
|
|
101
80
|
scheduledDateTime: scheduledDate?.toLocaleString(),
|
|
102
81
|
description: n.Description__c?.value ?? "",
|
package/dist/force-app/main/default/webapplications/appreactsampleb2e/src/pages/Maintenance.tsx
CHANGED
|
@@ -9,6 +9,19 @@ import { StatusBadge } from "../components/StatusBadge.js";
|
|
|
9
9
|
import { MaintenanceDetailsModal } from "../components/MaintenanceDetailsModal.js";
|
|
10
10
|
import { updateMaintenanceStatus } from "../api/maintenance.js";
|
|
11
11
|
import type { MaintenanceRequest } from "../lib/types.js";
|
|
12
|
+
import PlumbingIcon from "../assets/icons/plumbing.svg";
|
|
13
|
+
import HVACIcon from "../assets/icons/hvac.svg";
|
|
14
|
+
import ElectricalIcon from "../assets/icons/electrical.svg";
|
|
15
|
+
import AppliancesIcon from "../assets/icons/appliances.svg";
|
|
16
|
+
import PestIcon from "../assets/icons/pest.svg";
|
|
17
|
+
|
|
18
|
+
const issueIcons: Record<string, string> = {
|
|
19
|
+
Plumbing: PlumbingIcon,
|
|
20
|
+
HVAC: HVACIcon,
|
|
21
|
+
Electrical: ElectricalIcon,
|
|
22
|
+
Appliance: AppliancesIcon,
|
|
23
|
+
Pest: PestIcon,
|
|
24
|
+
};
|
|
12
25
|
|
|
13
26
|
export default function Maintenance() {
|
|
14
27
|
const list = useListPage(maintenanceRequestsListConfig);
|
|
@@ -123,17 +136,21 @@ export default function Maintenance() {
|
|
|
123
136
|
className="grid grid-cols-12 gap-4 px-6 py-5 hover:bg-gray-50 transition-colors cursor-pointer"
|
|
124
137
|
>
|
|
125
138
|
<div className="col-span-6 flex items-center gap-4">
|
|
126
|
-
<div className="w-16 h-16 rounded-lg
|
|
139
|
+
<div className="w-16 h-16 rounded-lg flex-shrink-0 overflow-hidden flex items-center justify-center bg-purple-100">
|
|
127
140
|
{request.imageUrl ? (
|
|
128
141
|
<img
|
|
129
142
|
src={request.imageUrl}
|
|
130
143
|
alt={request.description}
|
|
131
144
|
className="w-full h-full object-cover"
|
|
132
145
|
/>
|
|
146
|
+
) : issueIcons[request.issueType] ? (
|
|
147
|
+
<img
|
|
148
|
+
src={issueIcons[request.issueType]}
|
|
149
|
+
alt={request.issueType}
|
|
150
|
+
className="w-8 h-8"
|
|
151
|
+
/>
|
|
133
152
|
) : (
|
|
134
|
-
<
|
|
135
|
-
<span className="text-2xl">🔧</span>
|
|
136
|
-
</div>
|
|
153
|
+
<span className="text-2xl">🔧</span>
|
|
137
154
|
)}
|
|
138
155
|
</div>
|
|
139
156
|
<div className="flex-1 min-w-0">
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-app-react-sample-b2e-experimental",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.77.0",
|
|
4
4
|
"description": "B2E starter app template",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"clean": "rm -rf dist"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@salesforce/webapp-experimental": "^1.
|
|
20
|
-
"@salesforce/webapp-template-feature-react-global-search-experimental": "^1.
|
|
19
|
+
"@salesforce/webapp-experimental": "^1.77.0",
|
|
20
|
+
"@salesforce/webapp-template-feature-react-global-search-experimental": "^1.77.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@testing-library/jest-dom": "^6.6.3",
|