@salesforce/webapp-template-app-react-sample-b2x-experimental 1.84.1 → 1.85.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 +8 -0
- package/dist/README.md +24 -0
- package/dist/force-app/main/default/data/Property_Image__c.json +1 -1
- package/dist/force-app/main/default/data/Property_Listing__c.json +1 -1
- package/dist/force-app/main/default/data/prepare-import-unique-fields.js +85 -0
- package/dist/force-app/main/default/permissionsets/Property_Management_Access.permissionset-meta.xml +0 -7
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/index.html +6 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/package.json +3 -3
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/applicationApi.ts +9 -9
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/graphql-operations-types.ts +296 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/graphqlClient.ts +12 -7
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/maintenanceRequestApi.ts +50 -38
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/propertyDetailGraphQL.ts +50 -102
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/propertyListingGraphQL.ts +211 -43
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/api/userApi.ts +43 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/appLayout.tsx +9 -208
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/appliances.svg +13 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/electrical.svg +39 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/hvac.svg +78 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/pest.svg +5 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/plumbing.svg +7 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/assets/icons/zen-logo.svg +5 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/MaintenanceRequestIcon.tsx +46 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/NavMenu.tsx +53 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/PropertyListingCard.tsx +55 -58
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/PropertyMap.tsx +93 -11
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/PropertySearchFilters.tsx +315 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/StatusBadge.tsx +36 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/components/TopBar.tsx +107 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyAddresses.ts +2 -2
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyListingAmenities.ts +55 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyListingPriceRange.ts +64 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyListingSearch.ts +14 -5
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyMapMarkers.ts +54 -11
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/hooks/usePropertyPrimaryImages.ts +1 -1
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Application.tsx +42 -39
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Contact.tsx +10 -10
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Dashboard.tsx +64 -91
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/HelpCenter.tsx +1 -1
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Home.tsx +19 -9
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/Maintenance.tsx +79 -100
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/NotFound.tsx +1 -1
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/PropertyDetails.tsx +62 -47
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/PropertyListings.tsx +3 -3
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/pages/PropertySearch.tsx +230 -34
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/routes.tsx +10 -1
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/styles/global.css +64 -0
- package/dist/force-app/main/default/webapplications/appreactsampleb2x/src/utils/geocode.ts +30 -5
- package/dist/package.json +1 -1
- package/dist/setup-cli.mjs +271 -0
- package/package.json +1 -1
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Maintenance_Request__c: list via GraphQL, create via createRecord.
|
|
3
3
|
*/
|
|
4
4
|
import { createRecord } from "@salesforce/webapp-experimental/api";
|
|
5
|
-
import {
|
|
5
|
+
import { gql } from "@salesforce/sdk-data";
|
|
6
|
+
import type {
|
|
7
|
+
MaintenanceRequestsQuery,
|
|
8
|
+
MaintenanceRequestsQueryVariables,
|
|
9
|
+
} from "@/api/graphql-operations-types.js";
|
|
10
|
+
import { executeGraphQL } from "@/api/graphqlClient.js";
|
|
6
11
|
|
|
7
12
|
const OBJECT_API_NAME = "Maintenance_Request__c";
|
|
8
13
|
|
|
@@ -15,6 +20,8 @@ export interface MaintenanceRequestSummary {
|
|
|
15
20
|
priority: string | null;
|
|
16
21
|
status: string | null;
|
|
17
22
|
dateRequested: string | null;
|
|
23
|
+
/** Tenant / user the request is assigned to (from User__r lookup). */
|
|
24
|
+
tenantName: string | null;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
function pick<T>(obj: T, key: keyof T): unknown {
|
|
@@ -30,33 +37,47 @@ function str(x: unknown): string | null {
|
|
|
30
37
|
return String(x);
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
|
|
40
|
+
/** Node shape from MaintenanceRequests query (matches graphql-operations-types). */
|
|
41
|
+
interface MaintenanceRequestNode {
|
|
34
42
|
Id: string;
|
|
35
43
|
ApiName?: string | null;
|
|
36
44
|
Name?: { value?: unknown; displayValue?: string | null } | null;
|
|
37
|
-
Title__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
38
45
|
Description__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
39
46
|
Type__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
40
47
|
Priority__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
41
48
|
Status__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
42
|
-
|
|
43
|
-
};
|
|
49
|
+
Scheduled__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
50
|
+
User__r?: { Name?: { value?: unknown; displayValue?: string | null } | null } | null;
|
|
51
|
+
}
|
|
44
52
|
|
|
45
|
-
function nodeToSummary(node:
|
|
53
|
+
function nodeToSummary(node: MaintenanceRequestNode): MaintenanceRequestSummary {
|
|
54
|
+
const desc = str(pick(node, "Description__c"));
|
|
55
|
+
const userRef = node.User__r as
|
|
56
|
+
| { Name?: { value?: unknown; displayValue?: string | null } }
|
|
57
|
+
| undefined;
|
|
58
|
+
const tenantName =
|
|
59
|
+
str(
|
|
60
|
+
userRef?.Name && typeof userRef.Name === "object"
|
|
61
|
+
? (userRef.Name as { value?: unknown }).value
|
|
62
|
+
: null,
|
|
63
|
+
) ??
|
|
64
|
+
str(userRef?.Name?.displayValue) ??
|
|
65
|
+
null;
|
|
46
66
|
return {
|
|
47
67
|
id: node.Id,
|
|
48
68
|
name:
|
|
49
69
|
str(pick(node, "Name")) ?? str((node.Name as { displayValue?: string | null })?.displayValue),
|
|
50
|
-
title:
|
|
51
|
-
description:
|
|
70
|
+
title: desc,
|
|
71
|
+
description: desc,
|
|
52
72
|
type: str(pick(node, "Type__c")),
|
|
53
73
|
priority: str(pick(node, "Priority__c")),
|
|
54
74
|
status: str(pick(node, "Status__c")),
|
|
55
|
-
dateRequested: str(pick(node, "
|
|
75
|
+
dateRequested: str(pick(node, "Scheduled__c")),
|
|
76
|
+
tenantName,
|
|
56
77
|
};
|
|
57
78
|
}
|
|
58
79
|
|
|
59
|
-
const MAINTENANCE_REQUESTS_QUERY =
|
|
80
|
+
const MAINTENANCE_REQUESTS_QUERY = gql`
|
|
60
81
|
query MaintenanceRequests($first: Int!, $after: String) {
|
|
61
82
|
uiapi {
|
|
62
83
|
query {
|
|
@@ -69,10 +90,6 @@ const MAINTENANCE_REQUESTS_QUERY = /* GraphQL */ `
|
|
|
69
90
|
value
|
|
70
91
|
displayValue
|
|
71
92
|
}
|
|
72
|
-
Title__c {
|
|
73
|
-
value
|
|
74
|
-
displayValue
|
|
75
|
-
}
|
|
76
93
|
Description__c {
|
|
77
94
|
value
|
|
78
95
|
displayValue
|
|
@@ -89,10 +106,16 @@ const MAINTENANCE_REQUESTS_QUERY = /* GraphQL */ `
|
|
|
89
106
|
value
|
|
90
107
|
displayValue
|
|
91
108
|
}
|
|
92
|
-
|
|
109
|
+
Scheduled__c {
|
|
93
110
|
value
|
|
94
111
|
displayValue
|
|
95
112
|
}
|
|
113
|
+
User__r {
|
|
114
|
+
Name {
|
|
115
|
+
value
|
|
116
|
+
displayValue
|
|
117
|
+
}
|
|
118
|
+
}
|
|
96
119
|
}
|
|
97
120
|
cursor
|
|
98
121
|
}
|
|
@@ -106,28 +129,19 @@ const MAINTENANCE_REQUESTS_QUERY = /* GraphQL */ `
|
|
|
106
129
|
}
|
|
107
130
|
`;
|
|
108
131
|
|
|
109
|
-
interface MaintenanceRequestGraphQLResponse {
|
|
110
|
-
uiapi?: {
|
|
111
|
-
query?: {
|
|
112
|
-
Maintenance_Request__c?: {
|
|
113
|
-
edges?: ({ node?: Node | null } | null)[] | null;
|
|
114
|
-
} | null;
|
|
115
|
-
} | null;
|
|
116
|
-
} | null;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
132
|
export async function queryMaintenanceRequests(
|
|
120
133
|
first: number = 50,
|
|
121
134
|
after: string | null = null,
|
|
122
135
|
): Promise<MaintenanceRequestSummary[]> {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
136
|
+
const variables: MaintenanceRequestsQueryVariables = { first, after: after ?? null };
|
|
137
|
+
const response = await executeGraphQL<
|
|
138
|
+
MaintenanceRequestsQuery,
|
|
139
|
+
MaintenanceRequestsQueryVariables
|
|
140
|
+
>(MAINTENANCE_REQUESTS_QUERY, variables);
|
|
127
141
|
const edges = response.uiapi?.query?.Maintenance_Request__c?.edges ?? [];
|
|
128
142
|
const list: MaintenanceRequestSummary[] = [];
|
|
129
143
|
for (const e of edges) {
|
|
130
|
-
if (e?.node) list.push(nodeToSummary(e.node));
|
|
144
|
+
if (e?.node) list.push(nodeToSummary(e.node as MaintenanceRequestNode));
|
|
131
145
|
}
|
|
132
146
|
// Sort by date requested descending (newest first)
|
|
133
147
|
list.sort((a, b) => {
|
|
@@ -139,12 +153,11 @@ export async function queryMaintenanceRequests(
|
|
|
139
153
|
}
|
|
140
154
|
|
|
141
155
|
export interface CreateMaintenanceRequestInput {
|
|
142
|
-
|
|
143
|
-
Description__c?: string | null;
|
|
156
|
+
Description__c: string;
|
|
144
157
|
Type__c?: string | null;
|
|
145
158
|
Priority__c?: string;
|
|
146
159
|
Status__c?: string;
|
|
147
|
-
|
|
160
|
+
Scheduled__c?: string | null;
|
|
148
161
|
}
|
|
149
162
|
|
|
150
163
|
function getRecordIdFromResponse(result: Record<string, unknown>): string {
|
|
@@ -159,16 +172,15 @@ function getRecordIdFromResponse(result: Record<string, unknown>): string {
|
|
|
159
172
|
export async function createMaintenanceRequest(
|
|
160
173
|
input: CreateMaintenanceRequestInput,
|
|
161
174
|
): Promise<{ id: string }> {
|
|
162
|
-
const
|
|
163
|
-
if (!
|
|
175
|
+
const description = input.Description__c?.trim();
|
|
176
|
+
if (!description) throw new Error("Description is required");
|
|
164
177
|
const fields: Record<string, unknown> = {
|
|
165
|
-
|
|
178
|
+
Description__c: description,
|
|
166
179
|
Priority__c: input.Priority__c?.trim() || "Standard",
|
|
167
180
|
Status__c: input.Status__c?.trim() || "New",
|
|
168
181
|
};
|
|
169
|
-
if (input.Description__c?.trim()) fields.Description__c = input.Description__c.trim();
|
|
170
182
|
if (input.Type__c?.trim()) fields.Type__c = input.Type__c.trim();
|
|
171
|
-
if (input.
|
|
183
|
+
if (input.Scheduled__c?.trim()) fields.Scheduled__c = input.Scheduled__c.trim();
|
|
172
184
|
const result = (await createRecord(OBJECT_API_NAME, fields)) as unknown as Record<
|
|
173
185
|
string,
|
|
174
186
|
unknown
|
|
@@ -2,10 +2,23 @@
|
|
|
2
2
|
* GraphQL queries for Property_Listing__c detail and related Property__c data:
|
|
3
3
|
* Property_Image__c, Property_Cost__c, Property_Feature__c.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { gql } from "@salesforce/sdk-data";
|
|
6
|
+
import type {
|
|
7
|
+
ListingByIdQuery,
|
|
8
|
+
ListingByIdQueryVariables,
|
|
9
|
+
PropertyByIdQuery,
|
|
10
|
+
PropertyByIdQueryVariables,
|
|
11
|
+
PropertyImagesQuery,
|
|
12
|
+
PropertyImagesQueryVariables,
|
|
13
|
+
PropertyCostsQuery,
|
|
14
|
+
PropertyCostsQueryVariables,
|
|
15
|
+
PropertyFeaturesQuery,
|
|
16
|
+
PropertyFeaturesQueryVariables,
|
|
17
|
+
} from "@/api/graphql-operations-types.js";
|
|
18
|
+
import { executeGraphQL } from "@/api/graphqlClient.js";
|
|
6
19
|
|
|
7
20
|
// ---- Listing by Id ----
|
|
8
|
-
const LISTING_QUERY =
|
|
21
|
+
const LISTING_QUERY = gql`
|
|
9
22
|
query ListingById($listingId: ID!) {
|
|
10
23
|
uiapi {
|
|
11
24
|
query {
|
|
@@ -46,23 +59,11 @@ export interface ListingDetail {
|
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
export async function fetchListingById(listingId: string): Promise<ListingDetail | null> {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
node?: {
|
|
55
|
-
Id: string;
|
|
56
|
-
Name?: { value?: string | null; displayValue?: string | null } | null;
|
|
57
|
-
Listing_Price__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
58
|
-
Listing_Status__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
59
|
-
Property__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
60
|
-
} | null;
|
|
61
|
-
}> | null;
|
|
62
|
-
} | null;
|
|
63
|
-
} | null;
|
|
64
|
-
} | null;
|
|
65
|
-
}>(LISTING_QUERY, { listingId });
|
|
62
|
+
const variables: ListingByIdQueryVariables = { listingId };
|
|
63
|
+
const res = await executeGraphQL<ListingByIdQuery, ListingByIdQueryVariables>(
|
|
64
|
+
LISTING_QUERY,
|
|
65
|
+
variables,
|
|
66
|
+
);
|
|
66
67
|
const node = res.uiapi?.query?.Property_Listing__c?.edges?.[0]?.node;
|
|
67
68
|
if (!node) return null;
|
|
68
69
|
const prop = node.Property__c;
|
|
@@ -84,7 +85,7 @@ export async function fetchListingById(listingId: string): Promise<ListingDetail
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
// ---- Property by Id ----
|
|
87
|
-
const PROPERTY_QUERY =
|
|
88
|
+
const PROPERTY_QUERY = gql`
|
|
88
89
|
query PropertyById($propertyId: ID!) {
|
|
89
90
|
uiapi {
|
|
90
91
|
query {
|
|
@@ -100,7 +101,7 @@ const PROPERTY_QUERY = /* GraphQL */ `
|
|
|
100
101
|
value
|
|
101
102
|
displayValue
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
+
Type__c {
|
|
104
105
|
value
|
|
105
106
|
displayValue
|
|
106
107
|
}
|
|
@@ -116,7 +117,7 @@ const PROPERTY_QUERY = /* GraphQL */ `
|
|
|
116
117
|
value
|
|
117
118
|
displayValue
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
+
Sq_Ft__c {
|
|
120
121
|
value
|
|
121
122
|
displayValue
|
|
122
123
|
}
|
|
@@ -145,27 +146,11 @@ export interface PropertyDetail {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
export async function fetchPropertyById(propertyId: string): Promise<PropertyDetail | null> {
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
node?: {
|
|
154
|
-
Id: string;
|
|
155
|
-
Name?: { value?: string | null; displayValue?: string | null } | null;
|
|
156
|
-
Address__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
157
|
-
Property_Type__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
158
|
-
Monthly_Rent__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
159
|
-
Bedrooms__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
160
|
-
Bathrooms__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
161
|
-
Square_Footage__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
162
|
-
Description__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
163
|
-
} | null;
|
|
164
|
-
}> | null;
|
|
165
|
-
} | null;
|
|
166
|
-
} | null;
|
|
167
|
-
} | null;
|
|
168
|
-
}>(PROPERTY_QUERY, { propertyId });
|
|
149
|
+
const variables: PropertyByIdQueryVariables = { propertyId };
|
|
150
|
+
const res = await executeGraphQL<PropertyByIdQuery, PropertyByIdQueryVariables>(
|
|
151
|
+
PROPERTY_QUERY,
|
|
152
|
+
variables,
|
|
153
|
+
);
|
|
169
154
|
const node = res.uiapi?.query?.Property__c?.edges?.[0]?.node;
|
|
170
155
|
if (!node) return null;
|
|
171
156
|
const v = (f: { value?: unknown; displayValue?: string | null } | null | undefined) =>
|
|
@@ -182,13 +167,13 @@ export async function fetchPropertyById(propertyId: string): Promise<PropertyDet
|
|
|
182
167
|
? String(node.Address__c.value)
|
|
183
168
|
: (node.Address__c?.displayValue ?? null),
|
|
184
169
|
propertyType:
|
|
185
|
-
node.
|
|
186
|
-
? String(node.
|
|
187
|
-
: (node.
|
|
170
|
+
node.Type__c?.value != null
|
|
171
|
+
? String(node.Type__c.value)
|
|
172
|
+
: (node.Type__c?.displayValue ?? null),
|
|
188
173
|
monthlyRent: v(node.Monthly_Rent__c),
|
|
189
174
|
bedrooms: v(node.Bedrooms__c),
|
|
190
175
|
bathrooms: v(node.Bathrooms__c),
|
|
191
|
-
squareFootage: v(node.
|
|
176
|
+
squareFootage: v(node.Sq_Ft__c),
|
|
192
177
|
description:
|
|
193
178
|
node.Description__c?.value != null
|
|
194
179
|
? String(node.Description__c.value)
|
|
@@ -211,7 +196,7 @@ export async function fetchPropertyAddresses(
|
|
|
211
196
|
}
|
|
212
197
|
|
|
213
198
|
// ---- Property Images by Property Id ----
|
|
214
|
-
const IMAGES_QUERY =
|
|
199
|
+
const IMAGES_QUERY = gql`
|
|
215
200
|
query PropertyImages($propertyId: ID!) {
|
|
216
201
|
uiapi {
|
|
217
202
|
query {
|
|
@@ -257,24 +242,11 @@ export interface PropertyImageRecord {
|
|
|
257
242
|
}
|
|
258
243
|
|
|
259
244
|
export async function fetchImagesByPropertyId(propertyId: string): Promise<PropertyImageRecord[]> {
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
node?: {
|
|
266
|
-
Id: string;
|
|
267
|
-
Name?: { value?: string | null; displayValue?: string | null } | null;
|
|
268
|
-
Image_URL__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
269
|
-
Image_Type__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
270
|
-
Display_Order__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
271
|
-
Alt_Text__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
272
|
-
} | null;
|
|
273
|
-
}> | null;
|
|
274
|
-
} | null;
|
|
275
|
-
} | null;
|
|
276
|
-
} | null;
|
|
277
|
-
}>(IMAGES_QUERY, { propertyId });
|
|
245
|
+
const variables: PropertyImagesQueryVariables = { propertyId };
|
|
246
|
+
const res = await executeGraphQL<PropertyImagesQuery, PropertyImagesQueryVariables>(
|
|
247
|
+
IMAGES_QUERY,
|
|
248
|
+
variables,
|
|
249
|
+
);
|
|
278
250
|
const edges = res.uiapi?.query?.Property_Image__c?.edges ?? [];
|
|
279
251
|
const list: PropertyImageRecord[] = [];
|
|
280
252
|
for (const e of edges) {
|
|
@@ -304,7 +276,7 @@ export async function fetchImagesByPropertyId(propertyId: string): Promise<Prope
|
|
|
304
276
|
}
|
|
305
277
|
|
|
306
278
|
// ---- Property Costs by Property Id ----
|
|
307
|
-
const COSTS_QUERY =
|
|
279
|
+
const COSTS_QUERY = gql`
|
|
308
280
|
query PropertyCosts($propertyId: ID!) {
|
|
309
281
|
uiapi {
|
|
310
282
|
query {
|
|
@@ -350,24 +322,11 @@ export interface PropertyCostRecord {
|
|
|
350
322
|
}
|
|
351
323
|
|
|
352
324
|
export async function fetchCostsByPropertyId(propertyId: string): Promise<PropertyCostRecord[]> {
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
node?: {
|
|
359
|
-
Id: string;
|
|
360
|
-
Cost_Category__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
361
|
-
Cost_Amount__c?: { value?: unknown; displayValue?: string | null } | null;
|
|
362
|
-
Cost_Date__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
363
|
-
Description__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
364
|
-
Vendor__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
365
|
-
} | null;
|
|
366
|
-
}> | null;
|
|
367
|
-
} | null;
|
|
368
|
-
} | null;
|
|
369
|
-
} | null;
|
|
370
|
-
}>(COSTS_QUERY, { propertyId });
|
|
325
|
+
const variables: PropertyCostsQueryVariables = { propertyId };
|
|
326
|
+
const res = await executeGraphQL<PropertyCostsQuery, PropertyCostsQueryVariables>(
|
|
327
|
+
COSTS_QUERY,
|
|
328
|
+
variables,
|
|
329
|
+
);
|
|
371
330
|
const edges = res.uiapi?.query?.Property_Cost__c?.edges ?? [];
|
|
372
331
|
const list: PropertyCostRecord[] = [];
|
|
373
332
|
for (const e of edges) {
|
|
@@ -404,7 +363,7 @@ export async function fetchCostsByPropertyId(propertyId: string): Promise<Proper
|
|
|
404
363
|
}
|
|
405
364
|
|
|
406
365
|
// ---- Property Features by Property Id ----
|
|
407
|
-
const FEATURES_QUERY =
|
|
366
|
+
const FEATURES_QUERY = gql`
|
|
408
367
|
query PropertyFeatures($propertyId: ID!) {
|
|
409
368
|
uiapi {
|
|
410
369
|
query {
|
|
@@ -442,22 +401,11 @@ export interface PropertyFeatureRecord {
|
|
|
442
401
|
export async function fetchFeaturesByPropertyId(
|
|
443
402
|
propertyId: string,
|
|
444
403
|
): Promise<PropertyFeatureRecord[]> {
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
node?: {
|
|
451
|
-
Id: string;
|
|
452
|
-
Name?: { value?: string | null; displayValue?: string | null } | null;
|
|
453
|
-
Feature_Category__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
454
|
-
Description__c?: { value?: string | null; displayValue?: string | null } | null;
|
|
455
|
-
} | null;
|
|
456
|
-
}> | null;
|
|
457
|
-
} | null;
|
|
458
|
-
} | null;
|
|
459
|
-
} | null;
|
|
460
|
-
}>(FEATURES_QUERY, { propertyId });
|
|
404
|
+
const variables: PropertyFeaturesQueryVariables = { propertyId };
|
|
405
|
+
const res = await executeGraphQL<PropertyFeaturesQuery, PropertyFeaturesQueryVariables>(
|
|
406
|
+
FEATURES_QUERY,
|
|
407
|
+
variables,
|
|
408
|
+
);
|
|
461
409
|
const edges = res.uiapi?.query?.Property_Feature__c?.edges ?? [];
|
|
462
410
|
const list: PropertyFeatureRecord[] = [];
|
|
463
411
|
for (const e of edges) {
|