@salesforcedevs/dx-components 1.2.6-avatar-button-4 → 1.2.6-avatar-button-5
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,44 @@ 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
|
+
if (val === "undefined") {
|
|
343
|
+
// Clean away bad JSON string data by skipping these.
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
// Also just a little extra safety to make sure we aren't injecting anything unsafe...
|
|
347
|
+
cleanUserInfo[key as keyof UserInfo] = escapeHtml(val);
|
|
348
|
+
});
|
|
344
349
|
|
|
345
|
-
|
|
350
|
+
// Keep the old info for any values not defined on `cleanUserInfo`
|
|
351
|
+
this.userInfo = defaults(cleanUserInfo, this.userInfo);
|
|
346
352
|
};
|
|
347
353
|
|
|
348
354
|
private requestUserInfo = async () => {
|