profile-pane 3.1.4 → 3.2.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/README.md +16 -0
- package/lib/04567ff683933c35c465.png +0 -0
- package/lib/10163fd9b5a0e00d63a0.png +0 -0
- package/lib/1234dcb2eec2e45f252b.png +0 -0
- package/lib/20899934157df4db56cb.png +0 -0
- package/lib/33760bf79f097f449da5.png +0 -0
- package/lib/578d2b6ed32e7624164e.png +0 -0
- package/lib/5f62a5b2b7e99b9640c7.png +0 -0
- package/lib/6525766ecd288ec60129.png +0 -0
- package/lib/7800be6f6c4b5b0f4f20.png +0 -0
- package/lib/976473cf5fe24d657d4b.png +0 -0
- package/lib/ChatWithMe.d.ts +2 -1
- package/lib/ChatWithMe.d.ts.map +1 -1
- package/lib/ChatWithMe.js +3 -3
- package/lib/ProfileView.d.ts +1 -1
- package/lib/ProfileView.d.ts.map +1 -1
- package/lib/ProfileView.js +71 -131
- package/lib/ProfileViewModelPresenter.d.ts +23 -0
- package/lib/ProfileViewModelPresenter.d.ts.map +1 -0
- package/lib/ProfileViewModelPresenter.js +37 -0
- package/lib/QRCodeCard.d.ts +3 -1
- package/lib/QRCodeCard.d.ts.map +1 -1
- package/lib/QRCodeCard.js +86 -66
- package/lib/addMeToYourFriends.d.ts +3 -3
- package/lib/addMeToYourFriends.d.ts.map +1 -1
- package/lib/addMeToYourFriends.js +14 -30
- package/lib/bda84f59e7216675a208.png +0 -0
- package/lib/buttonsHelper.js +1 -1
- package/lib/cd68e8f3990ba8b2139e.png +0 -0
- package/lib/e7074a7e2cb69e51cfd3.png +0 -0
- package/lib/editProfilePane/EditCVCard.d.ts +1 -0
- package/lib/editProfilePane/EditCVCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditCVCard.js +2 -1
- package/lib/editProfilePane/EditCommunitiesCard.d.ts +1 -1
- package/lib/editProfilePane/EditCommunitiesCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditCommunitiesCard.js +2 -1
- package/lib/editProfilePane/EditContactsCard.d.ts +1 -0
- package/lib/editProfilePane/EditContactsCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditContactsCard.js +2 -0
- package/lib/editProfilePane/EditFriendsCard.d.ts +1 -1
- package/lib/editProfilePane/EditFriendsCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditFriendsCard.js +2 -1
- package/lib/editProfilePane/EditOtherPreferences.d.ts +1 -0
- package/lib/editProfilePane/EditOtherPreferences.d.ts.map +1 -1
- package/lib/editProfilePane/EditOtherPreferences.js +1 -0
- package/lib/editProfilePane/EditProfileView.d.ts +1 -1
- package/lib/editProfilePane/EditProfileView.d.ts.map +1 -1
- package/lib/editProfilePane/EditProfileView.js +1 -1
- package/lib/editProfilePane/EditSocialCard.d.ts +1 -0
- package/lib/editProfilePane/EditSocialCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditSocialCard.js +2 -1
- package/lib/editProfilePane/editProfilePresenter.d.ts +1 -0
- package/lib/editProfilePane/editProfilePresenter.d.ts.map +1 -1
- package/lib/editProfilePane/editProfilePresenter.js +2 -0
- package/lib/f3772696fb7ee53c23d8.png +0 -0
- package/lib/icons-svg/contactIcons.d.ts +3 -0
- package/lib/icons-svg/contactIcons.d.ts.map +1 -0
- package/lib/icons-svg/contactIcons.js +32 -0
- package/lib/icons-svg/profileIcons.d.ts +22 -0
- package/lib/icons-svg/profileIcons.d.ts.map +1 -0
- package/lib/icons-svg/profileIcons.js +309 -0
- package/lib/index.d.ts +1 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +42 -19
- package/lib/profile-pane.js +15629 -5666
- package/lib/profile-pane.js.map +1 -1
- package/lib/profile-pane.min.js +2171 -230
- package/lib/profile-pane.min.js.map +1 -1
- package/lib/rdfFormsHelper.d.ts +1 -0
- package/lib/rdfFormsHelper.d.ts.map +1 -1
- package/lib/rdfFormsHelper.js +2 -0
- package/lib/sections/bio/BioEditDialog.d.ts +6 -0
- package/lib/sections/bio/BioEditDialog.d.ts.map +1 -0
- package/lib/sections/bio/BioEditDialog.js +119 -0
- package/lib/sections/bio/BioSection.d.ts +7 -0
- package/lib/sections/bio/BioSection.d.ts.map +1 -0
- package/lib/sections/bio/BioSection.js +131 -0
- package/lib/sections/bio/mutations.d.ts +4 -0
- package/lib/sections/bio/mutations.d.ts.map +1 -0
- package/lib/sections/bio/mutations.js +43 -0
- package/lib/sections/bio/selectors.d.ts +4 -0
- package/lib/sections/bio/selectors.d.ts.map +1 -0
- package/lib/sections/bio/selectors.js +15 -0
- package/lib/sections/bio/types.d.ts +15 -0
- package/lib/sections/bio/types.d.ts.map +1 -0
- package/lib/sections/bio/types.js +5 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts +7 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts.map +1 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.js +658 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts +5 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts.map +1 -0
- package/lib/sections/contactInfo/ContactInfoSection.js +229 -0
- package/lib/sections/contactInfo/mutations.d.ts +4 -0
- package/lib/sections/contactInfo/mutations.d.ts.map +1 -0
- package/lib/sections/contactInfo/mutations.js +150 -0
- package/lib/sections/contactInfo/selectors.d.ts +4 -0
- package/lib/sections/contactInfo/selectors.d.ts.map +1 -0
- package/lib/sections/contactInfo/selectors.js +104 -0
- package/lib/sections/contactInfo/types.d.ts +44 -0
- package/lib/sections/contactInfo/types.d.ts.map +1 -0
- package/lib/sections/contactInfo/types.js +5 -0
- package/lib/sections/education/EducationEditDialog.d.ts +7 -0
- package/lib/sections/education/EducationEditDialog.d.ts.map +1 -0
- package/lib/sections/education/EducationEditDialog.js +459 -0
- package/lib/sections/education/EducationSection.d.ts +7 -0
- package/lib/sections/education/EducationSection.d.ts.map +1 -0
- package/lib/sections/education/EducationSection.js +126 -0
- package/lib/sections/education/mutations.d.ts +4 -0
- package/lib/sections/education/mutations.d.ts.map +1 -0
- package/lib/sections/education/mutations.js +60 -0
- package/lib/sections/education/selectors.d.ts +4 -0
- package/lib/sections/education/selectors.d.ts.map +1 -0
- package/lib/sections/education/selectors.js +64 -0
- package/lib/sections/education/types.d.ts +20 -0
- package/lib/sections/education/types.d.ts.map +1 -0
- package/lib/sections/education/types.js +5 -0
- package/lib/sections/heading/HeadingEditDialog.d.ts +6 -0
- package/lib/sections/heading/HeadingEditDialog.d.ts.map +1 -0
- package/lib/sections/heading/HeadingEditDialog.js +742 -0
- package/lib/sections/heading/HeadingSection.d.ts +9 -0
- package/lib/sections/heading/HeadingSection.d.ts.map +1 -0
- package/lib/sections/heading/HeadingSection.js +97 -0
- package/lib/sections/heading/camera.d.ts +19 -0
- package/lib/sections/heading/camera.d.ts.map +1 -0
- package/lib/sections/heading/camera.js +199 -0
- package/lib/sections/heading/dateHelpers.d.ts +4 -0
- package/lib/sections/heading/dateHelpers.d.ts.map +1 -0
- package/lib/sections/heading/dateHelpers.js +48 -0
- package/lib/sections/heading/imageHelpers.d.ts +4 -0
- package/lib/sections/heading/imageHelpers.d.ts.map +1 -0
- package/lib/sections/heading/imageHelpers.js +81 -0
- package/lib/sections/heading/mutations.d.ts +4 -0
- package/lib/sections/heading/mutations.d.ts.map +1 -0
- package/lib/sections/heading/mutations.js +190 -0
- package/lib/sections/heading/selectors.d.ts +5 -0
- package/lib/sections/heading/selectors.d.ts.map +1 -0
- package/lib/sections/heading/selectors.js +157 -0
- package/lib/sections/heading/types.d.ts +36 -0
- package/lib/sections/heading/types.d.ts.map +1 -0
- package/lib/sections/heading/types.js +5 -0
- package/lib/sections/languages/LanguageEditDialog.d.ts +7 -0
- package/lib/sections/languages/LanguageEditDialog.d.ts.map +1 -0
- package/lib/sections/languages/LanguageEditDialog.js +457 -0
- package/lib/sections/languages/LanguageSection.d.ts +5 -0
- package/lib/sections/languages/LanguageSection.d.ts.map +1 -0
- package/lib/sections/languages/LanguageSection.js +137 -0
- package/lib/sections/languages/mutations.d.ts +6 -0
- package/lib/sections/languages/mutations.d.ts.map +1 -0
- package/lib/sections/languages/mutations.js +296 -0
- package/lib/sections/languages/selectors.d.ts +5 -0
- package/lib/sections/languages/selectors.d.ts.map +1 -0
- package/lib/sections/languages/selectors.js +146 -0
- package/lib/sections/languages/types.d.ts +15 -0
- package/lib/sections/languages/types.d.ts.map +1 -0
- package/lib/sections/languages/types.js +5 -0
- package/lib/sections/projects/ProjectEditDialog.d.ts +7 -0
- package/lib/sections/projects/ProjectEditDialog.d.ts.map +1 -0
- package/lib/sections/projects/ProjectEditDialog.js +182 -0
- package/lib/sections/projects/ProjectSection.d.ts +6 -0
- package/lib/sections/projects/ProjectSection.d.ts.map +1 -0
- package/lib/sections/projects/ProjectSection.js +220 -0
- package/lib/sections/projects/mutations.d.ts +4 -0
- package/lib/sections/projects/mutations.d.ts.map +1 -0
- package/lib/sections/projects/mutations.js +188 -0
- package/lib/sections/projects/selectors.d.ts +5 -0
- package/lib/sections/projects/selectors.d.ts.map +1 -0
- package/lib/sections/projects/selectors.js +163 -0
- package/lib/sections/projects/types.d.ts +28 -0
- package/lib/sections/projects/types.d.ts.map +1 -0
- package/lib/sections/projects/types.js +8 -0
- package/lib/sections/resume/ResumeEditDialog.d.ts +7 -0
- package/lib/sections/resume/ResumeEditDialog.d.ts.map +1 -0
- package/lib/sections/resume/ResumeEditDialog.js +629 -0
- package/lib/sections/resume/ResumeSection.d.ts +7 -0
- package/lib/sections/resume/ResumeSection.d.ts.map +1 -0
- package/lib/sections/resume/ResumeSection.js +160 -0
- package/lib/sections/resume/mutations.d.ts +6 -0
- package/lib/sections/resume/mutations.d.ts.map +1 -0
- package/lib/sections/resume/mutations.js +172 -0
- package/lib/sections/resume/selectors.d.ts +4 -0
- package/lib/sections/resume/selectors.d.ts.map +1 -0
- package/lib/sections/resume/selectors.js +142 -0
- package/lib/sections/resume/types.d.ts +33 -0
- package/lib/sections/resume/types.d.ts.map +1 -0
- package/lib/sections/resume/types.js +8 -0
- package/lib/sections/shared/collapsibleSection.d.ts +2 -0
- package/lib/sections/shared/collapsibleSection.d.ts.map +1 -0
- package/lib/sections/shared/collapsibleSection.js +24 -0
- package/lib/sections/shared/contactTypeUtils.d.ts +7 -0
- package/lib/sections/shared/contactTypeUtils.d.ts.map +1 -0
- package/lib/sections/shared/contactTypeUtils.js +48 -0
- package/lib/sections/shared/idNodeFactory.d.ts +3 -0
- package/lib/sections/shared/idNodeFactory.d.ts.map +1 -0
- package/lib/sections/shared/idNodeFactory.js +14 -0
- package/lib/sections/shared/phoneCountries.d.ts +20 -0
- package/lib/sections/shared/phoneCountries.d.ts.map +1 -0
- package/lib/sections/shared/phoneCountries.js +1080 -0
- package/lib/sections/shared/rdfList.d.ts +3 -0
- package/lib/sections/shared/rdfList.d.ts.map +1 -0
- package/lib/sections/shared/rdfList.js +34 -0
- package/lib/sections/shared/rdfMutationHelpers.d.ts +12 -0
- package/lib/sections/shared/rdfMutationHelpers.d.ts.map +1 -0
- package/lib/sections/shared/rdfMutationHelpers.js +82 -0
- package/lib/sections/shared/rowState.d.ts +21 -0
- package/lib/sections/shared/rowState.d.ts.map +1 -0
- package/lib/sections/shared/rowState.js +52 -0
- package/lib/sections/shared/sanitizeUtils.d.ts +5 -0
- package/lib/sections/shared/sanitizeUtils.d.ts.map +1 -0
- package/lib/sections/shared/sanitizeUtils.js +22 -0
- package/lib/sections/shared/sectionCardHelpers.d.ts +11 -0
- package/lib/sections/shared/sectionCardHelpers.d.ts.map +1 -0
- package/lib/sections/shared/sectionCardHelpers.js +105 -0
- package/lib/sections/shared/types.d.ts +7 -0
- package/lib/sections/shared/types.d.ts.map +1 -0
- package/lib/sections/shared/types.js +5 -0
- package/lib/sections/skills/SkillsEditDialog.d.ts +7 -0
- package/lib/sections/skills/SkillsEditDialog.d.ts.map +1 -0
- package/lib/sections/skills/SkillsEditDialog.js +340 -0
- package/lib/sections/skills/SkillsSection.d.ts +5 -0
- package/lib/sections/skills/SkillsSection.d.ts.map +1 -0
- package/lib/sections/skills/SkillsSection.js +169 -0
- package/lib/sections/skills/mutations.d.ts +6 -0
- package/lib/sections/skills/mutations.d.ts.map +1 -0
- package/lib/sections/skills/mutations.js +110 -0
- package/lib/sections/skills/selectors.d.ts +6 -0
- package/lib/sections/skills/selectors.d.ts.map +1 -0
- package/lib/sections/skills/selectors.js +37 -0
- package/lib/sections/skills/types.d.ts +14 -0
- package/lib/sections/skills/types.d.ts.map +1 -0
- package/lib/sections/skills/types.js +5 -0
- package/lib/sections/social/SocialEditDialog.d.ts +7 -0
- package/lib/sections/social/SocialEditDialog.d.ts.map +1 -0
- package/lib/sections/social/SocialEditDialog.js +362 -0
- package/lib/sections/social/SocialSection.d.ts +8 -0
- package/lib/sections/social/SocialSection.d.ts.map +1 -0
- package/lib/sections/social/SocialSection.js +201 -0
- package/lib/sections/social/constants.d.ts +3 -0
- package/lib/sections/social/constants.d.ts.map +1 -0
- package/lib/sections/social/constants.js +16 -0
- package/lib/sections/social/helpers.d.ts +15 -0
- package/lib/sections/social/helpers.d.ts.map +1 -0
- package/lib/sections/social/helpers.js +316 -0
- package/lib/sections/social/mutations.d.ts +4 -0
- package/lib/sections/social/mutations.d.ts.map +1 -0
- package/lib/sections/social/mutations.js +298 -0
- package/lib/sections/social/selectors.d.ts +4 -0
- package/lib/sections/social/selectors.d.ts.map +1 -0
- package/lib/sections/social/selectors.js +43 -0
- package/lib/sections/social/types.d.ts +19 -0
- package/lib/sections/social/types.d.ts.map +1 -0
- package/lib/sections/social/types.js +5 -0
- package/lib/styles/BioSection.css +77 -0
- package/lib/styles/CVCard.css +107 -2
- package/lib/styles/ContactInfoEditDialog.css +153 -0
- package/lib/styles/EditDialogs.css +1028 -0
- package/lib/styles/EducationCard.css +103 -0
- package/lib/styles/HeadingSection.css +309 -0
- package/lib/styles/ProfileCard.css +10 -42
- package/lib/styles/ProfileView.css +53 -8
- package/lib/styles/ProjectsCard.css +206 -0
- package/lib/styles/QRCodeCard.css +29 -10
- package/lib/styles/SocialCard.css +41 -13
- package/lib/styles/dialog.css +209 -0
- package/lib/styles/utilities.css +638 -256
- package/lib/textUtils.d.ts +6 -0
- package/lib/textUtils.d.ts.map +1 -0
- package/lib/textUtils.js +44 -0
- package/lib/texts.d.ts +45 -4
- package/lib/texts.d.ts.map +1 -1
- package/lib/texts.js +46 -5
- package/lib/types.d.ts +2 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +5 -0
- package/lib/ui/dialog.d.ts +29 -0
- package/lib/ui/dialog.d.ts.map +1 -0
- package/lib/ui/dialog.js +269 -0
- package/lib/ui/errors.d.ts +2 -0
- package/lib/ui/errors.d.ts.map +1 -0
- package/lib/ui/errors.js +10 -0
- package/package.json +8 -6
- package/lib/CVCard.d.ts +0 -4
- package/lib/CVCard.d.ts.map +0 -1
- package/lib/CVCard.js +0 -114
- package/lib/CVPresenter.d.ts +0 -25
- package/lib/CVPresenter.d.ts.map +0 -1
- package/lib/CVPresenter.js +0 -119
- package/lib/FriendList.d.ts +0 -6
- package/lib/FriendList.d.ts.map +0 -1
- package/lib/FriendList.js +0 -27
- package/lib/ProfileCard.d.ts +0 -6
- package/lib/ProfileCard.d.ts.map +0 -1
- package/lib/ProfileCard.js +0 -62
- package/lib/SocialCard.d.ts +0 -5
- package/lib/SocialCard.d.ts.map +0 -1
- package/lib/SocialCard.js +0 -51
- package/lib/SocialPresenter.d.ts +0 -11
- package/lib/SocialPresenter.d.ts.map +0 -1
- package/lib/SocialPresenter.js +0 -117
- package/lib/StuffCard.d.ts +0 -10
- package/lib/StuffCard.d.ts.map +0 -1
- package/lib/StuffCard.js +0 -52
- package/lib/StuffPresenter.d.ts +0 -14
- package/lib/StuffPresenter.d.ts.map +0 -1
- package/lib/StuffPresenter.js +0 -53
- package/lib/presenter.d.ts +0 -14
- package/lib/presenter.d.ts.map +0 -1
- package/lib/presenter.js +0 -68
- package/lib/styles/FriendList.css +0 -12
- package/lib/styles/StuffCard.css +0 -23
- package/lib/styles/editProfile.css +0 -62
- package/lib/styles/profileRDFFormsEnforced.css +0 -427
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createHeadingEditDialog = createHeadingEditDialog;
|
|
7
|
+
var _dialog = require("../../ui/dialog");
|
|
8
|
+
var _litHtml = require("lit-html");
|
|
9
|
+
var _HeadingSection = require("./HeadingSection");
|
|
10
|
+
require("../../styles/EditDialogs.css");
|
|
11
|
+
var _rdflib = require("rdflib");
|
|
12
|
+
var _mutations = require("./mutations");
|
|
13
|
+
var _phoneCountries = require("../shared/phoneCountries");
|
|
14
|
+
var _contactTypeUtils = require("../shared/contactTypeUtils");
|
|
15
|
+
var _rowState = require("../shared/rowState");
|
|
16
|
+
var _textUtils = require("../../textUtils");
|
|
17
|
+
var _texts = require("../../texts");
|
|
18
|
+
var _profileIcons = require("../../icons-svg/profileIcons");
|
|
19
|
+
var _sanitizeUtils = require("../shared/sanitizeUtils");
|
|
20
|
+
var _dateHelpers = require("./dateHelpers");
|
|
21
|
+
var _imageHelpers = require("./imageHelpers");
|
|
22
|
+
var _camera = require("./camera");
|
|
23
|
+
/* Note: new design - has address type in More Edit Contacts for now we will leave
|
|
24
|
+
out Address Type, but a ticket will be created to add type later
|
|
25
|
+
so I will keep the code and just comment it out for now.
|
|
26
|
+
new design - has country code, will comment out code for now and create a ticket to add later. */
|
|
27
|
+
|
|
28
|
+
function isContactPointRow(row) {
|
|
29
|
+
return 'value' in row;
|
|
30
|
+
}
|
|
31
|
+
function isAddressRow(row) {
|
|
32
|
+
return 'streetAddress' in row;
|
|
33
|
+
}
|
|
34
|
+
function isProfileBasicRow(row) {
|
|
35
|
+
return 'name' in row;
|
|
36
|
+
}
|
|
37
|
+
function rowHasContent(row) {
|
|
38
|
+
if (isContactPointRow(row)) {
|
|
39
|
+
return (0, _textUtils.hasNonEmptyText)(row.value);
|
|
40
|
+
}
|
|
41
|
+
if (isAddressRow(row)) {
|
|
42
|
+
return [row.streetAddress, row.locality, row.region, row.postalCode, row.countryName].some(_textUtils.hasNonEmptyText);
|
|
43
|
+
}
|
|
44
|
+
if (isProfileBasicRow(row)) {
|
|
45
|
+
return [row.name, row.nickname, row.imageSrc, row.location, row.pronouns, row.dateOfBirth, row.jobTitle, row.orgName].some(_textUtils.hasNonEmptyText);
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
function normalizePronounsValue(value) {
|
|
50
|
+
const normalized = (0, _textUtils.sanitizeTextValue)(value || '').toLowerCase().replace(/\s+/g, '');
|
|
51
|
+
if (!normalized) return '';
|
|
52
|
+
if (normalized === 'he' || normalized === 'he/him') return 'He/Him';
|
|
53
|
+
if (normalized === 'she' || normalized === 'she/her') return 'She/Her';
|
|
54
|
+
if (normalized === 'they' || normalized === 'they/them') return 'They/Them';
|
|
55
|
+
return value || '';
|
|
56
|
+
}
|
|
57
|
+
function toFormState(profileData) {
|
|
58
|
+
const basicInfo = {
|
|
59
|
+
name: (0, _textUtils.sanitizeTextValue)((0, _textUtils.toText)(profileData.name)),
|
|
60
|
+
nickname: (0, _textUtils.sanitizeTextValue)((0, _textUtils.toText)(profileData.nickname || '')),
|
|
61
|
+
imageSrc: (0, _textUtils.sanitizeTextValue)((0, _textUtils.toText)(profileData.imageSrc || '')),
|
|
62
|
+
location: (0, _textUtils.sanitizeTextValue)((0, _textUtils.toText)(profileData.location || '')),
|
|
63
|
+
pronouns: normalizePronounsValue((0, _textUtils.toText)(profileData.pronouns || '')),
|
|
64
|
+
dateOfBirth: (0, _textUtils.sanitizeTextValue)((0, _textUtils.toText)(profileData.dateOfBirth || '')),
|
|
65
|
+
jobTitle: (0, _textUtils.sanitizeTextValue)((0, _textUtils.toText)(profileData.jobTitle || '')),
|
|
66
|
+
orgName: (0, _textUtils.sanitizeTextValue)((0, _textUtils.toText)(profileData.orgName || '')),
|
|
67
|
+
entryNode: (0, _textUtils.toText)(profileData.entryNode),
|
|
68
|
+
status: (0, _textUtils.toText)(profileData.entryNode) ? 'existing' : 'new'
|
|
69
|
+
};
|
|
70
|
+
const primaryEmail = profileData.primaryEmail;
|
|
71
|
+
const primaryPhone = profileData.primaryPhone;
|
|
72
|
+
const primaryAddress = profileData.primaryAddress;
|
|
73
|
+
const normalizedEmailType = (0, _contactTypeUtils.normalizeEmailTypeForEdit)(primaryEmail?.type);
|
|
74
|
+
const normalizedPhoneType = (0, _contactTypeUtils.normalizePhoneTypeForEdit)(primaryPhone?.type);
|
|
75
|
+
const email = {
|
|
76
|
+
value: (0, _sanitizeUtils.sanitizeEmailValue)((0, _textUtils.toText)(primaryEmail?.valueNode).replace(/^mailto:/i, '')),
|
|
77
|
+
type: normalizedEmailType,
|
|
78
|
+
entryNode: (0, _textUtils.toText)(primaryEmail?.entryNode),
|
|
79
|
+
status: (0, _textUtils.toText)(primaryEmail?.entryNode) ? 'existing' : 'new'
|
|
80
|
+
};
|
|
81
|
+
const phone = {
|
|
82
|
+
value: (0, _textUtils.sanitizeTextValue)((0, _textUtils.toText)(primaryPhone?.valueNode || primaryPhone?.entryNode || '').replace(/^tel:/i, '')),
|
|
83
|
+
type: normalizedPhoneType,
|
|
84
|
+
entryNode: (0, _textUtils.toText)(primaryPhone?.entryNode || ''),
|
|
85
|
+
status: (0, _textUtils.toText)(primaryPhone?.entryNode || '') ? 'existing' : 'new'
|
|
86
|
+
};
|
|
87
|
+
const address = {
|
|
88
|
+
streetAddress: (0, _sanitizeUtils.sanitizeAddressFieldValue)((0, _textUtils.toText)(primaryAddress?.streetAddress)),
|
|
89
|
+
locality: (0, _sanitizeUtils.sanitizeAddressFieldValue)((0, _textUtils.toText)(primaryAddress?.locality)),
|
|
90
|
+
region: (0, _sanitizeUtils.sanitizeAddressFieldValue)((0, _textUtils.toText)(primaryAddress?.region)),
|
|
91
|
+
postalCode: (0, _sanitizeUtils.sanitizeAddressFieldValue)((0, _textUtils.toText)(primaryAddress?.postalCode)),
|
|
92
|
+
countryName: (0, _sanitizeUtils.sanitizeAddressFieldValue)((0, _textUtils.toText)(primaryAddress?.countryName)),
|
|
93
|
+
type: (0, _textUtils.toTypeLabel)(primaryAddress?.type),
|
|
94
|
+
entryNode: (0, _textUtils.toText)(primaryAddress?.entryNode),
|
|
95
|
+
status: (0, _textUtils.toText)(primaryAddress?.entryNode) ? 'existing' : 'new'
|
|
96
|
+
};
|
|
97
|
+
return {
|
|
98
|
+
basicInfo: basicInfo ? basicInfo : {
|
|
99
|
+
name: '',
|
|
100
|
+
nickname: '',
|
|
101
|
+
imageSrc: '',
|
|
102
|
+
location: '',
|
|
103
|
+
pronouns: '',
|
|
104
|
+
dateOfBirth: '',
|
|
105
|
+
jobTitle: '',
|
|
106
|
+
orgName: '',
|
|
107
|
+
entryNode: '',
|
|
108
|
+
status: 'new'
|
|
109
|
+
},
|
|
110
|
+
email: email ? email : {
|
|
111
|
+
value: '',
|
|
112
|
+
type: '',
|
|
113
|
+
entryNode: '',
|
|
114
|
+
status: 'new'
|
|
115
|
+
},
|
|
116
|
+
phone: phone ? phone : {
|
|
117
|
+
value: '',
|
|
118
|
+
type: '',
|
|
119
|
+
entryNode: '',
|
|
120
|
+
status: 'new'
|
|
121
|
+
},
|
|
122
|
+
address: address ? address : {
|
|
123
|
+
streetAddress: '',
|
|
124
|
+
locality: '',
|
|
125
|
+
region: '',
|
|
126
|
+
postalCode: '',
|
|
127
|
+
countryName: '',
|
|
128
|
+
type: '',
|
|
129
|
+
entryNode: '',
|
|
130
|
+
status: 'new'
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function mapEmailOpsForSave(ops) {
|
|
135
|
+
const mapRow = row => ({
|
|
136
|
+
...row,
|
|
137
|
+
type: (0, _contactTypeUtils.toSavedHeadingEmailType)(row.type)
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
create: ops.create.map(mapRow),
|
|
141
|
+
update: ops.update.map(mapRow),
|
|
142
|
+
remove: ops.remove.map(mapRow)
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function mapPhoneOpsForSave(ops) {
|
|
146
|
+
const mapRow = row => ({
|
|
147
|
+
...row,
|
|
148
|
+
type: (0, _contactTypeUtils.toSavedHeadingPhoneType)(row.type)
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
create: ops.create.map(mapRow),
|
|
152
|
+
update: ops.update.map(mapRow),
|
|
153
|
+
remove: ops.remove.map(mapRow)
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* Will use later function renderCountryPrefixSelect(
|
|
158
|
+
name: string,
|
|
159
|
+
value: string,
|
|
160
|
+
label: string,
|
|
161
|
+
onChange: (event: Event) => void
|
|
162
|
+
) {
|
|
163
|
+
return html`
|
|
164
|
+
<label class="label profile-edit-dialog__phone-prefix-field" aria-label=${label}>
|
|
165
|
+
<select class="phonePrefixSelect" name=${name} .value=${value} @change=${onChange}>
|
|
166
|
+
${COUNTRY_PREFIX_OPTIONS.map((option) => html`
|
|
167
|
+
<option value=${option.dialCode}>
|
|
168
|
+
${countryCodeToFlag(option.iso2)} ${option.dialCode}
|
|
169
|
+
</option>
|
|
170
|
+
`)}
|
|
171
|
+
</select>
|
|
172
|
+
</label>
|
|
173
|
+
`
|
|
174
|
+
} */
|
|
175
|
+
|
|
176
|
+
function renderContactPhoneInput({
|
|
177
|
+
phone
|
|
178
|
+
}) {
|
|
179
|
+
const label = 'Phone Number';
|
|
180
|
+
/* const countryCodeLabel = 'Country Calling Code' */
|
|
181
|
+
/* const prefixInputName = 'phone-prefix' */
|
|
182
|
+
const typeLabel = 'Phone Type';
|
|
183
|
+
const inputName = 'phone-value';
|
|
184
|
+
const typeInputName = 'phone-type';
|
|
185
|
+
const splitValue = (0, _phoneCountries.splitPhoneValue)(phone?.value || '');
|
|
186
|
+
let selectedDialCode = splitValue.dialCode;
|
|
187
|
+
const handleValueInput = e => {
|
|
188
|
+
const target = e.target;
|
|
189
|
+
const nextValue = (0, _sanitizeUtils.sanitizePhoneLocalValue)(target.value);
|
|
190
|
+
if (phone) {
|
|
191
|
+
(0, _rowState.applyRowFieldChange)(phone, 'value', (0, _phoneCountries.combinePhoneValue)(selectedDialCode, nextValue), rowHasContent);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
/* Leaving here for when we add country code back in
|
|
195
|
+
const handleCountryCodeInput = (e: Event) => {
|
|
196
|
+
const target = e.target as HTMLSelectElement
|
|
197
|
+
selectedDialCode = target.value
|
|
198
|
+
if (phone) {
|
|
199
|
+
const localNumber = splitPhoneValue(phone.value).localNumber
|
|
200
|
+
applyRowFieldChange(phone, 'value', combinePhoneValue(selectedDialCode, localNumber), rowHasContent)
|
|
201
|
+
}
|
|
202
|
+
} */
|
|
203
|
+
|
|
204
|
+
const handleTypeInput = e => {
|
|
205
|
+
const target = e.target;
|
|
206
|
+
const nextType = target.value;
|
|
207
|
+
if (phone) {
|
|
208
|
+
(0, _rowState.applyRowSelectChange)(phone, 'type', nextType);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
return (0, _litHtml.html)`
|
|
212
|
+
<div class="profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--contact-point">
|
|
213
|
+
<div class="profile-edit-dialog__field">
|
|
214
|
+
<label aria-label=${label} class="label">
|
|
215
|
+
<input
|
|
216
|
+
class="input"
|
|
217
|
+
type="tel"
|
|
218
|
+
name=${inputName}
|
|
219
|
+
.value=${splitValue.localNumber}
|
|
220
|
+
required
|
|
221
|
+
data-contact-field="value"
|
|
222
|
+
data-entry-node=${phone?.entryNode || ''}
|
|
223
|
+
data-row-status=${phone?.status || 'n/a'}
|
|
224
|
+
placeholder="Phone Number"
|
|
225
|
+
autocomplete="tel-national"
|
|
226
|
+
inputmode="tel"
|
|
227
|
+
@input=${handleValueInput}
|
|
228
|
+
/>
|
|
229
|
+
</label>
|
|
230
|
+
</div>
|
|
231
|
+
<label aria-label=${typeLabel} class="label profile-edit-dialog__field-type profile-edit-dialog__field-type--contact-point">
|
|
232
|
+
<select class="input" name=${typeInputName} id="phone-type-select-${inputName}" @change=${handleTypeInput} .value=${phone?.type || ''}>
|
|
233
|
+
<option value="Mobile">Mobile</option>
|
|
234
|
+
<option value="Home">Home</option>
|
|
235
|
+
<option value="Work">Work</option>
|
|
236
|
+
</select>
|
|
237
|
+
</label>
|
|
238
|
+
</div>
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
function renderContactEmailInputRow({
|
|
242
|
+
email
|
|
243
|
+
}) {
|
|
244
|
+
const label = 'Email Address';
|
|
245
|
+
const typeLabel = 'Email Type';
|
|
246
|
+
const inputName = 'email-value';
|
|
247
|
+
const typeInputName = 'email-type';
|
|
248
|
+
const handleValueInput = e => {
|
|
249
|
+
const target = e.target;
|
|
250
|
+
const nextValue = (0, _sanitizeUtils.sanitizeEmailValue)(target.value);
|
|
251
|
+
if (email) {
|
|
252
|
+
(0, _rowState.applyRowFieldChange)(email, 'value', nextValue, rowHasContent);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
const handleTypeInput = e => {
|
|
256
|
+
const target = e.target;
|
|
257
|
+
const nextType = target.value;
|
|
258
|
+
if (email) {
|
|
259
|
+
(0, _rowState.applyRowSelectChange)(email, 'type', nextType);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
return (0, _litHtml.html)`
|
|
263
|
+
<div class="profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--contact-point">
|
|
264
|
+
<label aria-label=${label} class="label profile-edit-dialog__field">
|
|
265
|
+
<input
|
|
266
|
+
class="input"
|
|
267
|
+
type="email"
|
|
268
|
+
name=${inputName}
|
|
269
|
+
.value=${email?.value || ''}
|
|
270
|
+
required
|
|
271
|
+
data-contact-field="value"
|
|
272
|
+
data-entry-node=${email?.entryNode || ''}
|
|
273
|
+
data-row-status=${email?.status || 'n/a'}
|
|
274
|
+
placeholder="Email Address"
|
|
275
|
+
autocomplete="email"
|
|
276
|
+
inputmode="email"
|
|
277
|
+
@input=${handleValueInput}
|
|
278
|
+
/>
|
|
279
|
+
</label>
|
|
280
|
+
<label aria-label=${typeLabel} class="label profile-edit-dialog__field-type profile-edit-dialog__field-type--contact-point">
|
|
281
|
+
<select class="input" name=${typeInputName} id="email-type-select-${inputName}" @change=${handleTypeInput} .value=${email?.type || ''}>
|
|
282
|
+
<option value="Personal">Personal</option>
|
|
283
|
+
<option value="Office">Office</option>
|
|
284
|
+
</select>
|
|
285
|
+
</label>
|
|
286
|
+
</div>
|
|
287
|
+
`;
|
|
288
|
+
}
|
|
289
|
+
function renderContactAddressInput({
|
|
290
|
+
address
|
|
291
|
+
}) {
|
|
292
|
+
const label = 'Address';
|
|
293
|
+
/* const typeLabel = 'Address Type' */
|
|
294
|
+
/* const typeInputName = 'address-type' */
|
|
295
|
+
/* const addressTypeSelectId = 'address-type-select' */
|
|
296
|
+
const streetAddressName = 'address-street';
|
|
297
|
+
const localityName = 'address-locality';
|
|
298
|
+
const regionName = 'address-region';
|
|
299
|
+
const postalCodeName = 'address-postal';
|
|
300
|
+
const countryName = 'address-country';
|
|
301
|
+
const handleAddressInput = field => e => {
|
|
302
|
+
const target = e.target;
|
|
303
|
+
const nextValue = (0, _sanitizeUtils.sanitizeAddressFieldValue)(target.value);
|
|
304
|
+
if (address) {
|
|
305
|
+
(0, _rowState.applyRowFieldChange)(address, field, nextValue, rowHasContent);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
/* const handleTypeInput = (e: Event) => {
|
|
310
|
+
const target = e.target as HTMLInputElement
|
|
311
|
+
const nextType = target.value
|
|
312
|
+
if (address) {
|
|
313
|
+
applyRowSelectChange(address, 'type', nextType)
|
|
314
|
+
}
|
|
315
|
+
} */
|
|
316
|
+
|
|
317
|
+
return (0, _litHtml.html)`
|
|
318
|
+
<label aria-label=${`${label} Street`} class="label profile-edit-dialog__field profile-edit-dialog__field--row-width">
|
|
319
|
+
Street Address
|
|
320
|
+
<input
|
|
321
|
+
class="input"
|
|
322
|
+
type="text"
|
|
323
|
+
name=${streetAddressName}
|
|
324
|
+
.value=${address?.streetAddress || ''}
|
|
325
|
+
required
|
|
326
|
+
data-contact-field="streetAddress"
|
|
327
|
+
data-entry-node=${address?.entryNode || ''}
|
|
328
|
+
data-row-status=${address?.status || 'n/a'}
|
|
329
|
+
placeholder="Street Address"
|
|
330
|
+
autocomplete="street-address"
|
|
331
|
+
inputmode="text"
|
|
332
|
+
@change=${handleAddressInput('streetAddress')}
|
|
333
|
+
/>
|
|
334
|
+
</label>
|
|
335
|
+
|
|
336
|
+
<div class="profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--full">
|
|
337
|
+
<label aria-label=${`${label} Locality`} class="label profile-edit-dialog__field">
|
|
338
|
+
Locality
|
|
339
|
+
<input
|
|
340
|
+
class="input"
|
|
341
|
+
type="text"
|
|
342
|
+
name=${localityName}
|
|
343
|
+
.value=${address?.locality || ''}
|
|
344
|
+
data-contact-field="locality"
|
|
345
|
+
data-entry-node=${address?.entryNode || ''}
|
|
346
|
+
data-row-status=${address?.status || 'n/a'}
|
|
347
|
+
placeholder="City / Locality"
|
|
348
|
+
autocomplete="address-level2"
|
|
349
|
+
inputmode="text"
|
|
350
|
+
@change=${handleAddressInput('locality')}
|
|
351
|
+
/>
|
|
352
|
+
</label>
|
|
353
|
+
<label aria-label=${`${label} Postal Code`} class="label profile-edit-dialog__field">
|
|
354
|
+
Postal Code
|
|
355
|
+
<input
|
|
356
|
+
class="input"
|
|
357
|
+
type="text"
|
|
358
|
+
name=${postalCodeName}
|
|
359
|
+
.value=${address?.postalCode || ''}
|
|
360
|
+
data-contact-field="postalCode"
|
|
361
|
+
data-entry-node=${address?.entryNode || ''}
|
|
362
|
+
data-row-status=${address?.status || 'n/a'}
|
|
363
|
+
placeholder="Postal Code"
|
|
364
|
+
autocomplete="postal-code"
|
|
365
|
+
inputmode="text"
|
|
366
|
+
@change=${handleAddressInput('postalCode')}
|
|
367
|
+
/>
|
|
368
|
+
</label>
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
<div class="profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--full">
|
|
372
|
+
<label aria-label=${`${label} Region`} class="label profile-edit-dialog__field">
|
|
373
|
+
Region
|
|
374
|
+
<input
|
|
375
|
+
class="input"
|
|
376
|
+
type="text"
|
|
377
|
+
name=${regionName}
|
|
378
|
+
.value=${address?.region || ''}
|
|
379
|
+
data-contact-field="region"
|
|
380
|
+
data-entry-node=${address?.entryNode || ''}
|
|
381
|
+
data-row-status=${address?.status || 'n/a'}
|
|
382
|
+
placeholder="State / Region"
|
|
383
|
+
inputmode="text"
|
|
384
|
+
@change=${handleAddressInput('region')}
|
|
385
|
+
/>
|
|
386
|
+
</label>
|
|
387
|
+
<label aria-label=${`${label} Country`} class="label profile-edit-dialog__field">
|
|
388
|
+
Country
|
|
389
|
+
<input
|
|
390
|
+
class="input"
|
|
391
|
+
type="text"
|
|
392
|
+
name=${countryName}
|
|
393
|
+
.value=${address?.countryName || ''}
|
|
394
|
+
data-contact-field="countryName"
|
|
395
|
+
data-entry-node=${address?.entryNode || ''}
|
|
396
|
+
data-row-status=${address?.status || 'n/a'}
|
|
397
|
+
placeholder="Country"
|
|
398
|
+
autocomplete="country-name"
|
|
399
|
+
inputmode="text"
|
|
400
|
+
@change=${handleAddressInput('countryName')}
|
|
401
|
+
/>
|
|
402
|
+
</label>
|
|
403
|
+
</div>
|
|
404
|
+
`;
|
|
405
|
+
}
|
|
406
|
+
function renderHeadingInfoInput(store, subject, basicInfo, phone, email, rerender) {
|
|
407
|
+
const imageSrcLabel = 'Profile Photo';
|
|
408
|
+
const recommendedImageToLoad = 'Recommended: Square JPG, PNG. Max 2MB.';
|
|
409
|
+
const nameLabel = 'Full Name';
|
|
410
|
+
const nicknameLabel = 'Nickname';
|
|
411
|
+
const pronounsLabel = 'Pronouns';
|
|
412
|
+
const dateOfBirthLabel = 'DOB';
|
|
413
|
+
const jobTitleLabel = 'Job Title';
|
|
414
|
+
const orgNameLabel = 'Organization Name';
|
|
415
|
+
const handleBasicInfoInput = field => e => {
|
|
416
|
+
const target = e.target;
|
|
417
|
+
const nextValue = (0, _sanitizeUtils.sanitizeBasicInputFieldValue)(target.value);
|
|
418
|
+
if (basicInfo) {
|
|
419
|
+
(0, _rowState.applyRowFieldChange)(basicInfo, field, nextValue, rowHasContent);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
const handleDateOfBirthInput = e => {
|
|
423
|
+
const target = e.target;
|
|
424
|
+
const nextValue = (0, _sanitizeUtils.sanitizeBasicInputFieldValue)(target.value);
|
|
425
|
+
if (basicInfo) {
|
|
426
|
+
(0, _rowState.applyRowFieldChange)(basicInfo, 'dateOfBirth', (0, _dateHelpers.toStorageDateISO)(nextValue), rowHasContent);
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
const handlePronounsInput = e => {
|
|
430
|
+
const target = e.target;
|
|
431
|
+
const nextType = target.value;
|
|
432
|
+
if (basicInfo) {
|
|
433
|
+
(0, _rowState.applyRowSelectChange)(basicInfo, 'pronouns', nextType);
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
const handleUpload = async e => {
|
|
437
|
+
const button = e.currentTarget;
|
|
438
|
+
const dom = button?.ownerDocument || document;
|
|
439
|
+
const fileInput = dom.createElement('input');
|
|
440
|
+
fileInput.type = 'file';
|
|
441
|
+
fileInput.accept = 'image/*';
|
|
442
|
+
fileInput.addEventListener('change', async () => {
|
|
443
|
+
const file = fileInput.files?.[0];
|
|
444
|
+
if (!file || !basicInfo) return;
|
|
445
|
+
try {
|
|
446
|
+
const uploadedUri = await (0, _imageHelpers.uploadPhotoFile)(store, subject, file);
|
|
447
|
+
(0, _rowState.applyRowFieldChange)(basicInfo, 'imageSrc', uploadedUri, rowHasContent);
|
|
448
|
+
rerender();
|
|
449
|
+
} catch (error) {
|
|
450
|
+
console.error('Profile image upload failed', error);
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
fileInput.click();
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
/* The handleCameraClick function was generated by AI Model: GPT-5.3-Codex */
|
|
457
|
+
/* Prompt: Write a function handleCameraClick that uses the cameraCaptureControl to
|
|
458
|
+
capture an image and update the profile photo in the heading section. */
|
|
459
|
+
const handleCameraClick = async e => {
|
|
460
|
+
e.preventDefault();
|
|
461
|
+
const button = e.currentTarget;
|
|
462
|
+
const dom = button?.ownerDocument || document;
|
|
463
|
+
const headingPhotoRow = button?.closest('.profile-edit-dialog__row--heading-photo');
|
|
464
|
+
const hostRow = headingPhotoRow?.nextElementSibling;
|
|
465
|
+
const frame = hostRow?.querySelector('.profile-edit-dialog__image-camera-capture-frame');
|
|
466
|
+
if (!frame || frame.dataset.active === 'true') return;
|
|
467
|
+
frame.hidden = false;
|
|
468
|
+
frame.dataset.active = 'true';
|
|
469
|
+
frame.replaceChildren();
|
|
470
|
+
const getImageDoc = () => {
|
|
471
|
+
const docUri = subject.doc().uri;
|
|
472
|
+
const lastSlash = docUri.lastIndexOf('/');
|
|
473
|
+
const directoryUri = lastSlash >= 0 ? docUri.slice(0, lastSlash + 1) : docUri;
|
|
474
|
+
const randomSuffix = typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function' ? crypto.randomUUID() : `${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
|
|
475
|
+
return (0, _rdflib.sym)(`${directoryUri}camera_${randomSuffix}.png`);
|
|
476
|
+
};
|
|
477
|
+
const onCameraDone = async imageDoc => {
|
|
478
|
+
frame.replaceChildren();
|
|
479
|
+
frame.hidden = true;
|
|
480
|
+
frame.dataset.active = 'false';
|
|
481
|
+
if (imageDoc?.uri && basicInfo) {
|
|
482
|
+
(0, _rowState.applyRowFieldChange)(basicInfo, 'imageSrc', imageDoc.uri, rowHasContent);
|
|
483
|
+
rerender();
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
try {
|
|
487
|
+
const control = (0, _camera.cameraCaptureControl)(dom, store, getImageDoc, onCameraDone);
|
|
488
|
+
frame.appendChild(control);
|
|
489
|
+
} catch (error) {
|
|
490
|
+
frame.hidden = true;
|
|
491
|
+
frame.dataset.active = 'false';
|
|
492
|
+
frame.replaceChildren();
|
|
493
|
+
console.error('Camera control failed to initialize', error);
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
const handleDelete = async _e => {
|
|
497
|
+
if (!basicInfo) return;
|
|
498
|
+
(0, _rowState.applyRowFieldChange)(basicInfo, 'imageSrc', '', rowHasContent);
|
|
499
|
+
rerender();
|
|
500
|
+
};
|
|
501
|
+
return (0, _litHtml.html)`
|
|
502
|
+
<div class="profile-edit-dialog__row profile-edit-dialog__row--heading-photo">
|
|
503
|
+
<header class="mb-md" aria-label="Profile Image">
|
|
504
|
+
<div class="profile-edit-dialog__image-frame">
|
|
505
|
+
${(0, _HeadingSection.Image)(basicInfo.imageSrc, basicInfo.name)}
|
|
506
|
+
<button
|
|
507
|
+
type="button"
|
|
508
|
+
class="profile-edit-dialog__image-camera-button flex-center"
|
|
509
|
+
aria-label="Take a photo"
|
|
510
|
+
title="Take a photo"
|
|
511
|
+
@click=${handleCameraClick}
|
|
512
|
+
>
|
|
513
|
+
${_profileIcons.cameraIcon}
|
|
514
|
+
</button>
|
|
515
|
+
</div>
|
|
516
|
+
</header>
|
|
517
|
+
|
|
518
|
+
<div class="profile-edit-dialog__image-preview" aria-label="Profile Photo Preview">
|
|
519
|
+
<p class="profile-edit-dialog__image-preview-label"><strong>${imageSrcLabel}</strong></p>
|
|
520
|
+
<p class="profile-edit-dialog__image-preview-description">${recommendedImageToLoad}</p>
|
|
521
|
+
|
|
522
|
+
<div class="profile-edit-dialog__image-preview-actions">
|
|
523
|
+
<button
|
|
524
|
+
type="button"
|
|
525
|
+
class="profile-edit-dialog__image-button profile-edit-dialog__image-upload-button flex-center"
|
|
526
|
+
aria-label="Upload new profile photo"
|
|
527
|
+
title="Upload New"
|
|
528
|
+
@click=${handleUpload}
|
|
529
|
+
>
|
|
530
|
+
Upload New
|
|
531
|
+
</button>
|
|
532
|
+
<button
|
|
533
|
+
type="button"
|
|
534
|
+
class="profile-edit-dialog__image-button profile-edit-dialog__image-remove-button flex-center"
|
|
535
|
+
aria-label="Delete profile photo"
|
|
536
|
+
title="Remove"
|
|
537
|
+
@click=${handleDelete}
|
|
538
|
+
>
|
|
539
|
+
Remove
|
|
540
|
+
</button>
|
|
541
|
+
</div>
|
|
542
|
+
</div>
|
|
543
|
+
</div>
|
|
544
|
+
<div class="profile-edit-dialog__image-camera-capture-row">
|
|
545
|
+
<div class="profile-edit-dialog__image-camera-capture-frame" hidden></div>
|
|
546
|
+
</div>
|
|
547
|
+
<div class="profile-edit flex-column gap-lg">
|
|
548
|
+
<div class="profile-edit-dialog__row profile-edit-dialog__row--equal">
|
|
549
|
+
<label aria-label=${nameLabel} class="label profile-edit-dialog__field">
|
|
550
|
+
${nameLabel}
|
|
551
|
+
<input
|
|
552
|
+
class="input"
|
|
553
|
+
type="text"
|
|
554
|
+
name="name"
|
|
555
|
+
.value=${basicInfo?.name || ''}
|
|
556
|
+
required
|
|
557
|
+
data-contact-field="name"
|
|
558
|
+
data-entry-node=${basicInfo?.entryNode || ''}
|
|
559
|
+
data-row-status=${basicInfo?.status || 'n/a'}
|
|
560
|
+
placeholder="Full Name"
|
|
561
|
+
autocomplete="name"
|
|
562
|
+
inputmode="text"
|
|
563
|
+
@change=${handleBasicInfoInput('name')}
|
|
564
|
+
/>
|
|
565
|
+
</label>
|
|
566
|
+
<label aria-label=${nicknameLabel} class="label profile-edit-dialog__field">
|
|
567
|
+
${nicknameLabel}
|
|
568
|
+
<input
|
|
569
|
+
class="input"
|
|
570
|
+
type="text"
|
|
571
|
+
name="nickname"
|
|
572
|
+
.value=${basicInfo?.nickname || ''}
|
|
573
|
+
data-contact-field="nickname"
|
|
574
|
+
data-entry-node=${basicInfo?.entryNode || ''}
|
|
575
|
+
data-row-status=${basicInfo?.status || 'n/a'}
|
|
576
|
+
placeholder="Nickname"
|
|
577
|
+
autocomplete="nickname"
|
|
578
|
+
inputmode="text"
|
|
579
|
+
@change=${handleBasicInfoInput('nickname')}
|
|
580
|
+
/>
|
|
581
|
+
</label>
|
|
582
|
+
</div>
|
|
583
|
+
<div class="profile-edit-dialog__row profile-edit-dialog__row--equal">
|
|
584
|
+
<label aria-label=${pronounsLabel} class="label profile-edit-dialog__field-type profile-edit-dialog__field--stack">
|
|
585
|
+
${pronounsLabel}
|
|
586
|
+
<select class="input" name="pronouns" @change=${handlePronounsInput} .value=${basicInfo?.pronouns || ''}>
|
|
587
|
+
<option value="He/Him">He/Him</option>
|
|
588
|
+
<option value="She/Her">She/Her</option>
|
|
589
|
+
<option value="They/Them">They/Them</option>
|
|
590
|
+
</select>
|
|
591
|
+
</label>
|
|
592
|
+
<label aria-label=${dateOfBirthLabel} class="label profile-edit-dialog__field">
|
|
593
|
+
${dateOfBirthLabel}
|
|
594
|
+
<input
|
|
595
|
+
class="input"
|
|
596
|
+
type="date"
|
|
597
|
+
name="profile-date-of-birth"
|
|
598
|
+
.value=${(0, _dateHelpers.toStorageDateISO)(basicInfo?.dateOfBirth)}
|
|
599
|
+
data-contact-field="dateOfBirth"
|
|
600
|
+
data-entry-node=${basicInfo?.entryNode || ''}
|
|
601
|
+
data-row-status=${basicInfo?.status || 'n/a'}
|
|
602
|
+
autocomplete="off"
|
|
603
|
+
data-lpignore="true"
|
|
604
|
+
data-1p-ignore="true"
|
|
605
|
+
data-bwignore="true"
|
|
606
|
+
@change=${handleDateOfBirthInput}
|
|
607
|
+
/>
|
|
608
|
+
</label>
|
|
609
|
+
</div>
|
|
610
|
+
<div class="profile-edit-dialog__row profile-edit-dialog__row--equal">
|
|
611
|
+
<label aria-label=${jobTitleLabel} class="label profile-edit-dialog__field">
|
|
612
|
+
${jobTitleLabel}
|
|
613
|
+
<input
|
|
614
|
+
class="input"
|
|
615
|
+
type="text"
|
|
616
|
+
name="jobTitle"
|
|
617
|
+
.value=${basicInfo?.jobTitle || ''}
|
|
618
|
+
data-contact-field="jobTitle"
|
|
619
|
+
data-entry-node=${basicInfo?.entryNode || ''}
|
|
620
|
+
data-row-status=${basicInfo?.status || 'n/a'}
|
|
621
|
+
placeholder="Job Title"
|
|
622
|
+
autocomplete="organization-title"
|
|
623
|
+
inputmode="text"
|
|
624
|
+
@change=${handleBasicInfoInput('jobTitle')}
|
|
625
|
+
/>
|
|
626
|
+
</label>
|
|
627
|
+
<label aria-label=${orgNameLabel} class="label profile-edit-dialog__field">
|
|
628
|
+
${orgNameLabel}
|
|
629
|
+
<input
|
|
630
|
+
class="input"
|
|
631
|
+
type="text"
|
|
632
|
+
name="orgName"
|
|
633
|
+
.value=${basicInfo?.orgName || ''}
|
|
634
|
+
data-contact-field="orgName"
|
|
635
|
+
data-entry-node=${basicInfo?.entryNode || ''}
|
|
636
|
+
data-row-status=${basicInfo?.status || 'n/a'}
|
|
637
|
+
placeholder="Organization Name"
|
|
638
|
+
autocomplete="organization-name"
|
|
639
|
+
inputmode="text"
|
|
640
|
+
@change=${handleBasicInfoInput('orgName')}
|
|
641
|
+
/>
|
|
642
|
+
</label>
|
|
643
|
+
</div>
|
|
644
|
+
<div class="profile-edit-dialog__row profile-edit-dialog__row--equal">
|
|
645
|
+
<div class="profile-edit-dialog__field profile-edit-dialog__field--full">
|
|
646
|
+
${renderContactPhoneInput({
|
|
647
|
+
phone
|
|
648
|
+
})}
|
|
649
|
+
</div>
|
|
650
|
+
<div class="profile-edit-dialog__field profile-edit-dialog__field--full">
|
|
651
|
+
${renderContactEmailInputRow({
|
|
652
|
+
email
|
|
653
|
+
})}
|
|
654
|
+
</div>
|
|
655
|
+
</div>
|
|
656
|
+
</div>
|
|
657
|
+
`;
|
|
658
|
+
}
|
|
659
|
+
function renderHeadingEditTemplate(form, formState, store, subject, viewerMode) {
|
|
660
|
+
const rerender = () => renderHeadingEditTemplate(form, formState, store, subject, viewerMode);
|
|
661
|
+
(0, _litHtml.render)((0, _litHtml.html)`
|
|
662
|
+
${renderHeadingInfoInput(store, subject, formState.basicInfo, formState.phone, formState.email, rerender)}
|
|
663
|
+
${renderContactAddressInput({
|
|
664
|
+
address: formState.address
|
|
665
|
+
})}
|
|
666
|
+
${viewerMode !== 'owner' ? (0, _litHtml.html)`<p class="profile-edit-dialog__login-message">${_texts.ownerLoginRequiredDialogMessageText}</p>` : null}
|
|
667
|
+
`, form);
|
|
668
|
+
}
|
|
669
|
+
function createHeadingEditForm(store, subject, profileData, viewerMode) {
|
|
670
|
+
const form = document.createElement('form');
|
|
671
|
+
form.classList.add('profile__edit-form', 'profile-edit-dialog--heading', 'flex-column', 'gap-sm');
|
|
672
|
+
form.autocomplete = 'off';
|
|
673
|
+
form.setAttribute('data-lpignore', 'true');
|
|
674
|
+
form.setAttribute('data-1p-ignore', 'true');
|
|
675
|
+
form.setAttribute('data-bwignore', 'true');
|
|
676
|
+
const formState = toFormState(profileData);
|
|
677
|
+
renderHeadingEditTemplate(form, formState, store, subject, viewerMode);
|
|
678
|
+
return {
|
|
679
|
+
form,
|
|
680
|
+
formState
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
function validateHeadingDataBeforeSave(formState) {
|
|
684
|
+
const basicInfoOps = (0, _rowState.summarizeRowOps)([formState.basicInfo], rowHasContent);
|
|
685
|
+
const phoneOps = (0, _rowState.summarizeRowOps)([formState.phone], rowHasContent);
|
|
686
|
+
const emailOps = (0, _rowState.summarizeRowOps)([formState.email], rowHasContent);
|
|
687
|
+
const addressOps = (0, _rowState.summarizeRowOps)([formState.address], rowHasContent);
|
|
688
|
+
const hasChanges = basicInfoOps.create.length > 0 || basicInfoOps.update.length > 0 || basicInfoOps.remove.length > 0 || phoneOps.create.length > 0 || phoneOps.update.length > 0 || phoneOps.remove.length > 0 || emailOps.create.length > 0 || emailOps.update.length > 0 || emailOps.remove.length > 0 || addressOps.create.length > 0 || addressOps.update.length > 0 || addressOps.remove.length > 0;
|
|
689
|
+
if (!hasChanges) return 'No intro changes detected.';
|
|
690
|
+
return null;
|
|
691
|
+
}
|
|
692
|
+
async function createHeadingEditDialog(event, store, subject, profileData, viewerMode, onSaved) {
|
|
693
|
+
const dom = document;
|
|
694
|
+
const originalPhotoUri = (0, _textUtils.sanitizeTextValue)((0, _textUtils.toText)(profileData.imageSrc || ''));
|
|
695
|
+
const {
|
|
696
|
+
form,
|
|
697
|
+
formState
|
|
698
|
+
} = createHeadingEditForm(store, subject, profileData, viewerMode);
|
|
699
|
+
const result = await (0, _dialog.openInputDialog)({
|
|
700
|
+
title: _texts.editHeadingDialogTitleText,
|
|
701
|
+
dom,
|
|
702
|
+
form,
|
|
703
|
+
headerAction: {
|
|
704
|
+
type: 'close'
|
|
705
|
+
},
|
|
706
|
+
submitLabel: _texts.dialogSubmitLabelText,
|
|
707
|
+
cancelLabel: _texts.dialogCancelLabelText,
|
|
708
|
+
validate: () => {
|
|
709
|
+
if (viewerMode !== 'owner') {
|
|
710
|
+
return _texts.ownerLoginRequiredDialogMessageText;
|
|
711
|
+
}
|
|
712
|
+
return validateHeadingDataBeforeSave(formState);
|
|
713
|
+
},
|
|
714
|
+
onSave: async () => {
|
|
715
|
+
const phoneOps = (0, _rowState.summarizeRowOps)([formState.phone], rowHasContent);
|
|
716
|
+
const emailOps = (0, _rowState.summarizeRowOps)([formState.email], rowHasContent);
|
|
717
|
+
const plan = {
|
|
718
|
+
basicOps: (0, _rowState.summarizeRowOps)([formState.basicInfo], rowHasContent),
|
|
719
|
+
phoneOps: mapPhoneOpsForSave(phoneOps),
|
|
720
|
+
emailOps: mapEmailOpsForSave(emailOps),
|
|
721
|
+
addressOps: (0, _rowState.summarizeRowOps)([formState.address], rowHasContent)
|
|
722
|
+
};
|
|
723
|
+
await (0, _mutations.processHeadingMutations)(store, subject, plan);
|
|
724
|
+
const nextPhotoUri = (0, _textUtils.sanitizeTextValue)(formState.basicInfo.imageSrc || '');
|
|
725
|
+
if (originalPhotoUri && originalPhotoUri !== nextPhotoUri) {
|
|
726
|
+
try {
|
|
727
|
+
await (0, _imageHelpers.deletePhotoFile)(store, subject, originalPhotoUri);
|
|
728
|
+
} catch (error) {
|
|
729
|
+
console.warn('Profile image file delete failed', error);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
formatSaveError: error => {
|
|
734
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
735
|
+
return `${_texts.saveHeadingUpdatesFailedPrefixText} ${message}`;
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
if (!result) return;
|
|
739
|
+
if (onSaved) {
|
|
740
|
+
await onSaved();
|
|
741
|
+
}
|
|
742
|
+
}
|