@salesforce/ui-bundle-template-app-angular-template-b2x 12.4.1 → 12.4.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.
- package/dist/CHANGELOG.md +9 -0
- package/dist/force-app/main/default/uiBundles/angularextapp/package.json +3 -3
- package/dist/force-app/main/default/uiBundles/angularextapp/src/app/features/authentication/auth/auth.service.ts +53 -21
- package/dist/package-lock.json +2 -2
- package/dist/package.json +1 -1
- package/dist/scripts/org-setup-config-schema.mjs +2 -2
- package/dist/scripts/org-setup.mjs +3 -3
- package/package.json +1 -1
package/dist/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
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
|
+
## [12.4.2](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.4.1...v12.4.2) (2026-09-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-bundle:** use UI API GraphQL instead of Chatter for current-user lookup ([#951](https://github.com/salesforce-experience-platform-emu/webapps/issues/951)) ([47c28c1](https://github.com/salesforce-experience-platform-emu/webapps/commit/47c28c10a0b838eacef6c4a3e45e3a4fe587d20a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [12.4.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v12.4.0...v12.4.1) (2026-09-02)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @salesforce/ui-bundle-template-base-sfdx-project
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@angular/router": "^21.2.0",
|
|
29
29
|
"@ng-icons/core": "^32.2.0",
|
|
30
30
|
"@ng-icons/lucide": "^32.2.0",
|
|
31
|
-
"@salesforce/angular-plugin-ui-bundle": "^12.4.
|
|
32
|
-
"@salesforce/platform-sdk": "^12.4.
|
|
31
|
+
"@salesforce/angular-plugin-ui-bundle": "^12.4.2",
|
|
32
|
+
"@salesforce/platform-sdk": "^12.4.2",
|
|
33
33
|
"@spartan-ng/brain": "^1.3.1",
|
|
34
34
|
"class-variance-authority": "^0.7.1",
|
|
35
35
|
"clsx": "^2.1.1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"typescript": "~5.9.2",
|
|
62
62
|
"typescript-eslint": "^8.0.0",
|
|
63
63
|
"vitest": "^4.1.0",
|
|
64
|
-
"@salesforce/graphiti": "^12.4.
|
|
64
|
+
"@salesforce/graphiti": "^12.4.2"
|
|
65
65
|
},
|
|
66
66
|
"overrides": {
|
|
67
67
|
"undici": "^7.28.0"
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
6
|
import { computed, inject, Injectable, signal } from "@angular/core";
|
|
7
|
+
import { gql } from "@salesforce/platform-sdk";
|
|
7
8
|
import { DataClient } from "../../../api/data-client.service";
|
|
8
9
|
import { API_ROUTES } from "../config/authentication.config";
|
|
9
10
|
|
|
@@ -13,9 +14,31 @@ export interface AuthUser {
|
|
|
13
14
|
readonly name: string;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const CURRENT_USER_QUERY = gql`
|
|
18
|
+
query GetCurrentUser {
|
|
19
|
+
uiapi {
|
|
20
|
+
currentUser {
|
|
21
|
+
Id
|
|
22
|
+
Name @optional {
|
|
23
|
+
value
|
|
24
|
+
}
|
|
25
|
+
UserType {
|
|
26
|
+
value
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
interface CurrentUserGraphQLResult {
|
|
34
|
+
uiapi?: {
|
|
35
|
+
currentUser?: {
|
|
36
|
+
Id?: string;
|
|
37
|
+
Name?: { value?: string };
|
|
38
|
+
UserType?: { value?: string | null } | null;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}
|
|
19
42
|
|
|
20
43
|
/**
|
|
21
44
|
* Angular signal-based replacement for the React `AuthProvider` / `useAuth`.
|
|
@@ -28,8 +51,8 @@ const API_VERSION = "65.0";
|
|
|
28
51
|
* Authentication is checked on construction (equivalent to the React mount
|
|
29
52
|
* `useEffect`). `checkAuth()` re-runs the lookup on demand.
|
|
30
53
|
*
|
|
31
|
-
* The current-user lookup goes through the base app's `DataClient.
|
|
32
|
-
*
|
|
54
|
+
* The current-user lookup goes through the base app's `DataClient.execute` to
|
|
55
|
+
* UI API GraphQL (`uiapi.currentUser`) — the same call `@salesforce/ui-bundle`'s
|
|
33
56
|
* `getCurrentUser` makes — so the feature reuses the base app's existing
|
|
34
57
|
* `@salesforce/platform-sdk` dependency and adds no new package.
|
|
35
58
|
*/
|
|
@@ -102,25 +125,34 @@ export class AuthService {
|
|
|
102
125
|
}
|
|
103
126
|
|
|
104
127
|
/**
|
|
105
|
-
* Fetches the current user via
|
|
128
|
+
* Fetches the current user via UI API GraphQL. Reproduces
|
|
106
129
|
* `@salesforce/ui-bundle`'s `getCurrentUser` so we don't add ui-bundle as a
|
|
107
|
-
* dependency (base app only ships @salesforce/platform-sdk).
|
|
130
|
+
* dependency (base app only ships @salesforce/platform-sdk). Guest sessions
|
|
131
|
+
* also resolve to a running user record, so they're filtered out via
|
|
132
|
+
* `UserType` rather than relying on a fetch failure — a confirmed guest
|
|
133
|
+
* resolves to `null` rather than throwing, so `checkAuth` doesn't record it
|
|
134
|
+
* as an error the guard would retry on the next navigation. A missing/null/
|
|
135
|
+
* empty UserType is treated as an error rather than assumed non-guest, since
|
|
136
|
+
* that's an unexpected shape we can't safely authenticate against.
|
|
108
137
|
*/
|
|
109
|
-
private async getCurrentUser(): Promise<AuthUser> {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
);
|
|
117
|
-
if (!response.ok) {
|
|
118
|
-
throw new Error(`Failed to fetch current user: HTTP ${response.status}`);
|
|
138
|
+
private async getCurrentUser(): Promise<AuthUser | null> {
|
|
139
|
+
const data = await this.dataClient.execute<CurrentUserGraphQLResult>(CURRENT_USER_QUERY);
|
|
140
|
+
const currentUser = data.uiapi?.currentUser;
|
|
141
|
+
|
|
142
|
+
if (!currentUser?.Id) {
|
|
143
|
+
return null;
|
|
119
144
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
145
|
+
|
|
146
|
+
const userType = currentUser.UserType?.value;
|
|
147
|
+
|
|
148
|
+
if (!userType) {
|
|
149
|
+
throw new Error("Current user response missing UserType");
|
|
123
150
|
}
|
|
124
|
-
|
|
151
|
+
|
|
152
|
+
if (userType === "Guest") {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return { id: currentUser.Id, name: currentUser.Name?.value || "User" };
|
|
125
157
|
}
|
|
126
158
|
}
|
package/dist/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/ui-bundle-template-base-sfdx-project",
|
|
3
|
-
"version": "12.4.
|
|
3
|
+
"version": "12.4.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@salesforce/ui-bundle-template-base-sfdx-project",
|
|
9
|
-
"version": "12.4.
|
|
9
|
+
"version": "12.4.2",
|
|
10
10
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"fast-xml-parser": "^5.9.3",
|
package/dist/package.json
CHANGED
|
@@ -72,8 +72,8 @@ export const ConfigSchema = z
|
|
|
72
72
|
// Required because React (Site Container) sites hide SSO config in Admin UI.
|
|
73
73
|
authProviderNames: z.array(z.string().min(1)).min(1),
|
|
74
74
|
// Permission set to assign to community users created via SSO.
|
|
75
|
-
// Required because getCurrentUser() calls
|
|
76
|
-
// API access (PermissionsApiEnabled) that the community profile lacks.
|
|
75
|
+
// Required because getCurrentUser() calls UI API GraphQL (uiapi.currentUser)
|
|
76
|
+
// which needs API access (PermissionsApiEnabled) that the community profile lacks.
|
|
77
77
|
// Typically the app's "*_Guest_User_Api_Access" permset.
|
|
78
78
|
communityUserPermset: z.string().min(1).optional(),
|
|
79
79
|
})
|
|
@@ -546,7 +546,7 @@ function loadSelfRegConfig(config) {
|
|
|
546
546
|
* - communityMemberProfile: profile added to NetworkMemberGroup (required for access)
|
|
547
547
|
* - authProviderNames: DeveloperNames of AuthProvider (OAuth) or SamlSsoConfig (SAML) records to link to site
|
|
548
548
|
* - communityUserPermset: permset assigned to community users so getCurrentUser()
|
|
549
|
-
* works (requires PermissionsApiEnabled for
|
|
549
|
+
* works (requires PermissionsApiEnabled for UI API GraphQL via /sf/api/)
|
|
550
550
|
*
|
|
551
551
|
* Returns null if no "socialLogin" section exists in config (the step is hidden).
|
|
552
552
|
*/
|
|
@@ -937,7 +937,7 @@ function addCommunityMemberProfile(profileName, siteName, targetOrg) {
|
|
|
937
937
|
* Assign a permission set to all existing community users with a given profile.
|
|
938
938
|
*
|
|
939
939
|
* After SSO login, community users need the app's API-enabled permset so that
|
|
940
|
-
* getCurrentUser() (which calls
|
|
940
|
+
* getCurrentUser() (which calls UI API GraphQL via the /sf/api/ proxy) works.
|
|
941
941
|
* Without PermissionsApiEnabled the proxy returns API_DISABLED_FOR_ORG and the
|
|
942
942
|
* React app treats the user as unauthenticated.
|
|
943
943
|
*
|
|
@@ -2309,7 +2309,7 @@ async function main() {
|
|
|
2309
2309
|
addCommunityMemberProfile(socialLoginConfig.communityMemberProfile, siteName, targetOrg);
|
|
2310
2310
|
|
|
2311
2311
|
// Sub-step 4 (optional): Assign API-enabled permset to community users.
|
|
2312
|
-
// Without this, getCurrentUser() fails because
|
|
2312
|
+
// Without this, getCurrentUser() fails because UI API GraphQL requires
|
|
2313
2313
|
// PermissionsApiEnabled which the standard community profile lacks.
|
|
2314
2314
|
if (socialLoginConfig.communityUserPermset) {
|
|
2315
2315
|
console.log(` [4/${totalSubSteps}] Assigning API permset to community users...`);
|