@salesforce/ui-bundle-template-app-react-sample-b2x 10.11.0 → 10.12.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/data/Application__c.json +10 -10
- package/dist/force-app/main/default/data/Contact.json +44 -0
- package/dist/force-app/main/default/data/data-plan.json +6 -0
- package/dist/force-app/main/default/objects/Application__c/fields/User__c.field-meta.xml +2 -2
- package/dist/force-app/main/default/uiBundles/propertyrentalapp/package.json +3 -3
- package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/api/applications/query/getUserDetails.graphql +16 -0
- package/dist/force-app/main/default/uiBundles/propertyrentalapp/src/pages/Application.tsx +70 -2
- package/dist/package-lock.json +2 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
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
|
+
## [10.12.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v10.11.1...v10.12.0) (2026-06-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [10.11.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v10.11.0...v10.11.1) (2026-06-12)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [10.11.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v10.10.3...v10.11.0) (2026-06-11)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"referenceId": "ApplicationRef1"
|
|
7
7
|
},
|
|
8
8
|
"Property__c": "@PropertyRef5",
|
|
9
|
-
"User__c":
|
|
9
|
+
"User__c": "@ContactRef1",
|
|
10
10
|
"Status__c": "Submitted",
|
|
11
11
|
"Start_Date__c": "2024-12-01",
|
|
12
12
|
"Employment__c": "TechCorp Inc. - Senior Software Engineer - $95,000/year",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"referenceId": "ApplicationRef2"
|
|
19
19
|
},
|
|
20
20
|
"Property__c": "@PropertyRef8",
|
|
21
|
-
"User__c":
|
|
21
|
+
"User__c": "@ContactRef2",
|
|
22
22
|
"Status__c": "Background Check",
|
|
23
23
|
"Start_Date__c": "2024-12-15",
|
|
24
24
|
"Employment__c": "City Hospital - Registered Nurse - $72,000/year",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"referenceId": "ApplicationRef3"
|
|
31
31
|
},
|
|
32
32
|
"Property__c": "@PropertyRef12",
|
|
33
|
-
"User__c":
|
|
33
|
+
"User__c": "@ContactRef3",
|
|
34
34
|
"Status__c": "Approved",
|
|
35
35
|
"Start_Date__c": "2024-11-01",
|
|
36
36
|
"Employment__c": "Global Consulting LLC - Management Consultant - $110,000/year",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"referenceId": "ApplicationRef4"
|
|
43
43
|
},
|
|
44
44
|
"Property__c": "@PropertyRef5",
|
|
45
|
-
"User__c":
|
|
45
|
+
"User__c": "@ContactRef3",
|
|
46
46
|
"Status__c": "Rejected",
|
|
47
47
|
"Start_Date__c": "2024-12-01",
|
|
48
48
|
"Employment__c": "Retail Store - Assistant Manager - $32,000/year",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"referenceId": "ApplicationRef5"
|
|
55
55
|
},
|
|
56
56
|
"Property__c": "@PropertyRef16",
|
|
57
|
-
"User__c":
|
|
57
|
+
"User__c": "@ContactRef3",
|
|
58
58
|
"Status__c": "Draft",
|
|
59
59
|
"Start_Date__c": "2025-01-15",
|
|
60
60
|
"Employment__c": "University - Graduate Student - $18,000/year stipend",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"referenceId": "ApplicationRef6"
|
|
67
67
|
},
|
|
68
68
|
"Property__c": "@PropertyRef20",
|
|
69
|
-
"User__c":
|
|
69
|
+
"User__c": "@ContactRef3",
|
|
70
70
|
"Status__c": "Submitted",
|
|
71
71
|
"Start_Date__c": "2025-01-01",
|
|
72
72
|
"Employment__c": "Local Business - Marketing Coordinator - $48,000/year (Co-signer: Parent, $85,000/year)",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"referenceId": "ApplicationRef7"
|
|
79
79
|
},
|
|
80
80
|
"Property__c": "@PropertyRef8",
|
|
81
|
-
"User__c":
|
|
81
|
+
"User__c": "@ContactRef3",
|
|
82
82
|
"Status__c": "Background Check",
|
|
83
83
|
"Start_Date__c": "2024-12-20",
|
|
84
84
|
"Employment__c": "Finance Corp - Financial Analyst - $78,000/year",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"referenceId": "ApplicationRef8"
|
|
91
91
|
},
|
|
92
92
|
"Property__c": "@PropertyRef3",
|
|
93
|
-
"User__c":
|
|
93
|
+
"User__c": "@ContactRef3",
|
|
94
94
|
"Status__c": "Approved",
|
|
95
95
|
"Start_Date__c": "2024-10-01",
|
|
96
96
|
"Employment__c": "Design Studio - UX Designer - $68,000/year",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"referenceId": "ApplicationRef9"
|
|
103
103
|
},
|
|
104
104
|
"Property__c": "@PropertyRef12",
|
|
105
|
-
"User__c":
|
|
105
|
+
"User__c": "@ContactRef3",
|
|
106
106
|
"Status__c": "Rejected",
|
|
107
107
|
"Start_Date__c": "2024-10-25",
|
|
108
108
|
"Employment__c": "Various part-time positions - $25,000/year",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"referenceId": "ApplicationRef10"
|
|
115
115
|
},
|
|
116
116
|
"Property__c": "@PropertyRef5",
|
|
117
|
-
"User__c":
|
|
117
|
+
"User__c": "@ContactRef3",
|
|
118
118
|
"Status__c": "Submitted",
|
|
119
119
|
"Start_Date__c": "2024-12-10",
|
|
120
120
|
"Employment__c": "Teaching - High School Teacher - $55,000/year",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"records": [
|
|
3
|
+
{
|
|
4
|
+
"attributes": {
|
|
5
|
+
"type": "Contact",
|
|
6
|
+
"referenceId": "ContactRef1"
|
|
7
|
+
},
|
|
8
|
+
"FirstName": "Jennifer",
|
|
9
|
+
"LastName": "Anderson",
|
|
10
|
+
"Email": "jennifer.anderson@example.com",
|
|
11
|
+
"Phone": "(555) 123-4567"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"attributes": {
|
|
15
|
+
"type": "Contact",
|
|
16
|
+
"referenceId": "ContactRef2"
|
|
17
|
+
},
|
|
18
|
+
"FirstName": "David",
|
|
19
|
+
"LastName": "Rodriguez",
|
|
20
|
+
"Email": "david.rodriguez@example.com",
|
|
21
|
+
"Phone": "(555) 234-5678"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"attributes": {
|
|
25
|
+
"type": "Contact",
|
|
26
|
+
"referenceId": "ContactRef3"
|
|
27
|
+
},
|
|
28
|
+
"FirstName": "Maria",
|
|
29
|
+
"LastName": "Garcia",
|
|
30
|
+
"Email": "maria.garcia@example.com",
|
|
31
|
+
"Phone": "(555) 345-6789"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"attributes": {
|
|
35
|
+
"type": "Contact",
|
|
36
|
+
"referenceId": "ContactRef4"
|
|
37
|
+
},
|
|
38
|
+
"FirstName": "James",
|
|
39
|
+
"LastName": "Brown",
|
|
40
|
+
"Email": "james.brown@example.com",
|
|
41
|
+
"Phone": "(555) 456-7890"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
3
3
|
<fullName>User__c</fullName>
|
|
4
4
|
<deleteConstraint>SetNull</deleteConstraint>
|
|
5
|
-
<description>The person applying (
|
|
5
|
+
<description>The person applying (Contact record)</description>
|
|
6
6
|
<externalId>false</externalId>
|
|
7
7
|
<label>Applicant</label>
|
|
8
|
-
<referenceTo>
|
|
8
|
+
<referenceTo>Contact</referenceTo>
|
|
9
9
|
<relationshipLabel>Applications</relationshipLabel>
|
|
10
10
|
<relationshipName>Applications</relationshipName>
|
|
11
11
|
<required>false</required>
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"graphql:schema": "node scripts/get-graphql-schema.mjs"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@salesforce/platform-sdk": "^10.
|
|
22
|
-
"@salesforce/ui-bundle": "^10.
|
|
21
|
+
"@salesforce/platform-sdk": "^10.12.0",
|
|
22
|
+
"@salesforce/ui-bundle": "^10.12.0",
|
|
23
23
|
"@tailwindcss/vite": "^4.1.17",
|
|
24
24
|
"class-variance-authority": "^0.7.1",
|
|
25
25
|
"clsx": "^2.1.1",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@graphql-eslint/eslint-plugin": "^4.1.0",
|
|
51
51
|
"@graphql-tools/utils": "^11.0.0",
|
|
52
52
|
"@playwright/test": "^1.49.0",
|
|
53
|
-
"@salesforce/vite-plugin-ui-bundle": "^10.
|
|
53
|
+
"@salesforce/vite-plugin-ui-bundle": "^10.12.0",
|
|
54
54
|
"@testing-library/jest-dom": "^6.6.3",
|
|
55
55
|
"@testing-library/react": "^16.1.0",
|
|
56
56
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -10,6 +10,62 @@ import { fetchPropertyDetailById } from "@/api/properties/propertyDetailGraphQL"
|
|
|
10
10
|
import { createApplicationRecord } from "@/api/applications/applicationApi";
|
|
11
11
|
import { useAuth } from "@/features/authentication/context/AuthContext";
|
|
12
12
|
import { useAsyncData } from "@/hooks/useAsyncData";
|
|
13
|
+
import { fetchUserContact } from "@/features/authentication/api/userProfileApi";
|
|
14
|
+
import { createRecord } from "@salesforce/ui-bundle/api";
|
|
15
|
+
import { executeGraphQL } from "@/api/graphqlClient.js";
|
|
16
|
+
import GET_USER_DETAILS_QUERY from "@/api/applications/query/getUserDetails.graphql?raw";
|
|
17
|
+
|
|
18
|
+
interface UserDetailsQueryResult {
|
|
19
|
+
uiapi?: {
|
|
20
|
+
currentUser?: {
|
|
21
|
+
Id?: string;
|
|
22
|
+
FirstName?: { value?: string };
|
|
23
|
+
LastName?: { value?: string };
|
|
24
|
+
Email?: { value?: string };
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function createContactForUser(): Promise<string | null> {
|
|
30
|
+
try {
|
|
31
|
+
// Fetch current user details
|
|
32
|
+
const userData = (await executeGraphQL(GET_USER_DETAILS_QUERY)) as UserDetailsQueryResult;
|
|
33
|
+
|
|
34
|
+
const currentUser = userData?.uiapi?.currentUser;
|
|
35
|
+
if (!currentUser) {
|
|
36
|
+
console.warn("Could not fetch current user details for Contact creation");
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const firstName = currentUser.FirstName?.value || "Test Property Rental App";
|
|
41
|
+
const lastName = currentUser.LastName?.value || "User";
|
|
42
|
+
const email = currentUser.Email?.value || null;
|
|
43
|
+
|
|
44
|
+
// Create Contact record
|
|
45
|
+
const contactFields: Record<string, unknown> = {
|
|
46
|
+
FirstName: firstName,
|
|
47
|
+
LastName: lastName,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (email) {
|
|
51
|
+
contactFields.Email = email;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const result = (await createRecord("Contact", contactFields)) as unknown as Record<
|
|
55
|
+
string,
|
|
56
|
+
unknown
|
|
57
|
+
>;
|
|
58
|
+
const contactId =
|
|
59
|
+
typeof result.id === "string"
|
|
60
|
+
? result.id
|
|
61
|
+
: ((result.fields as Record<string, { value?: string }> | undefined)?.Id?.value ?? null);
|
|
62
|
+
|
|
63
|
+
return contactId;
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error("Failed to create Contact for user:", error);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
13
69
|
|
|
14
70
|
function ApplicationSkeleton() {
|
|
15
71
|
return (
|
|
@@ -45,6 +101,14 @@ export default function Application() {
|
|
|
45
101
|
const [searchParams] = useSearchParams();
|
|
46
102
|
const propertyId = searchParams.get("propertyId") ?? "";
|
|
47
103
|
|
|
104
|
+
const { data: contactId } = useAsyncData(async () => {
|
|
105
|
+
if (!user?.id) return null;
|
|
106
|
+
const contactData = await fetchUserContact<{ ContactId?: string }>(user.id);
|
|
107
|
+
if (contactData?.ContactId) return contactData.ContactId;
|
|
108
|
+
// No Contact found — create one from current user details (internal/admin users)
|
|
109
|
+
return createContactForUser();
|
|
110
|
+
}, [user?.id]);
|
|
111
|
+
|
|
48
112
|
const {
|
|
49
113
|
data: property,
|
|
50
114
|
loading,
|
|
@@ -78,10 +142,14 @@ export default function Application() {
|
|
|
78
142
|
setSubmitError(null);
|
|
79
143
|
setSubmitting(true);
|
|
80
144
|
try {
|
|
145
|
+
if (!contactId) {
|
|
146
|
+
throw new Error("No Contact ID available for application.");
|
|
147
|
+
}
|
|
148
|
+
|
|
81
149
|
const result = await createApplicationRecord({
|
|
82
150
|
Property__c: propertyId || null,
|
|
83
151
|
Status__c: "Submitted",
|
|
84
|
-
User__c:
|
|
152
|
+
User__c: contactId,
|
|
85
153
|
Start_Date__c: moveInDate.trim() || null,
|
|
86
154
|
Employment__c: employment.trim() || null,
|
|
87
155
|
References__c: references.trim() || null,
|
|
@@ -93,7 +161,7 @@ export default function Application() {
|
|
|
93
161
|
setSubmitting(false);
|
|
94
162
|
}
|
|
95
163
|
},
|
|
96
|
-
[propertyId, moveInDate, employment, references, user],
|
|
164
|
+
[propertyId, contactId, moveInDate, employment, references, user?.id],
|
|
97
165
|
);
|
|
98
166
|
|
|
99
167
|
if (loading) {
|
package/dist/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-base-sfdx-project-experimental",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.12.0",
|
|
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": "10.
|
|
9
|
+
"version": "10.12.0",
|
|
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