@salesforcedevs/dx-components 1.2.6-avatar-button-4 → 1.2.6-avatar-button-6
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/package.json
CHANGED
|
@@ -311,38 +311,43 @@ export default class AvatarButton extends LightningElement {
|
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
? `${
|
|
324
|
-
:
|
|
314
|
+
const uncleanNextUserInfo: UserInfo = {};
|
|
315
|
+
uncleanNextUserInfo.avatarImgSrc = userInfo.photos?.thumbnail;
|
|
316
|
+
uncleanNextUserInfo.firstName = userInfo.given_name;
|
|
317
|
+
uncleanNextUserInfo.lastName = userInfo.family_name;
|
|
318
|
+
uncleanNextUserInfo.username = userInfo.preferred_username;
|
|
319
|
+
uncleanNextUserInfo.id = userInfo.user_id;
|
|
320
|
+
uncleanNextUserInfo.orgId = userInfo.organization_id;
|
|
321
|
+
uncleanNextUserInfo.fullName =
|
|
322
|
+
uncleanNextUserInfo.firstName && uncleanNextUserInfo.lastName
|
|
323
|
+
? `${uncleanNextUserInfo.firstName} ${uncleanNextUserInfo.lastName}`
|
|
324
|
+
: uncleanNextUserInfo.firstName ||
|
|
325
|
+
uncleanNextUserInfo.lastName ||
|
|
326
|
+
"";
|
|
325
327
|
|
|
326
328
|
if (userInfo.custom_attributes) {
|
|
327
329
|
// ProfilePictureUrl updates earlier than photos.thumbnail, so we prefer it if it's available here.
|
|
328
|
-
|
|
330
|
+
uncleanNextUserInfo.avatarImgSrc =
|
|
329
331
|
userInfo.custom_attributes.ProfilePictureUrl ||
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
332
|
+
uncleanNextUserInfo.avatarImgSrc;
|
|
333
|
+
uncleanNextUserInfo.company =
|
|
334
|
+
userInfo.custom_attributes.CompanyName;
|
|
335
|
+
uncleanNextUserInfo.relationship =
|
|
333
336
|
userInfo.custom_attributes.RelationshipToSalesforce;
|
|
334
|
-
|
|
337
|
+
uncleanNextUserInfo.role = userInfo.custom_attributes.Role;
|
|
335
338
|
}
|
|
336
339
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
340
|
+
const cleanUserInfo: UserInfo = {};
|
|
341
|
+
Object.entries(uncleanNextUserInfo).forEach(([key, val]) => {
|
|
342
|
+
// uncleanUserInfo may have undefined values which we don't want in the final product
|
|
343
|
+
if (val && val !== "undefined") {
|
|
344
|
+
// Also a little extra safety to make sure we aren't injecting anything unsafe...
|
|
345
|
+
cleanUserInfo[key as keyof UserInfo] = escapeHtml(val);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
344
348
|
|
|
345
|
-
|
|
349
|
+
// Keep the old info for any values _not_ defined on `cleanUserInfo`
|
|
350
|
+
this.userInfo = defaults(cleanUserInfo, this.userInfo);
|
|
346
351
|
};
|
|
347
352
|
|
|
348
353
|
private requestUserInfo = async () => {
|