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,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderContactInfoSection = renderContactInfoSection;
|
|
7
|
+
var _litHtml = require("lit-html");
|
|
8
|
+
var _ContactInfoEditDialog = require("./ContactInfoEditDialog");
|
|
9
|
+
var _solidUi = require("solid-ui");
|
|
10
|
+
var _texts = require("../../texts");
|
|
11
|
+
var _collapsibleSection = require("../shared/collapsibleSection");
|
|
12
|
+
var _contactTypeUtils = require("../shared/contactTypeUtils");
|
|
13
|
+
var _profileIcons = require("../../icons-svg/profileIcons");
|
|
14
|
+
var _contactIcons = require("../../icons-svg/contactIcons");
|
|
15
|
+
function toText(value) {
|
|
16
|
+
if (!value) return '';
|
|
17
|
+
if (typeof value === 'string') return value;
|
|
18
|
+
if (typeof value === 'object' && 'value' in value) {
|
|
19
|
+
const v = value.value;
|
|
20
|
+
return typeof v === 'string' ? v : '';
|
|
21
|
+
}
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
function normalizeContactValue(rawValue, kind) {
|
|
25
|
+
if (!rawValue) return '';
|
|
26
|
+
return kind === 'email' ? rawValue.replace(/^mailto:/i, '') : rawValue.replace(/^tel:/i, '');
|
|
27
|
+
}
|
|
28
|
+
function resolveContactValue(store, point, kind) {
|
|
29
|
+
if (!point) return '';
|
|
30
|
+
const directValue = toText(point.valueNode || point.entryNode).trim();
|
|
31
|
+
const looksLikeExpectedValue = kind === 'email' ? /^mailto:/i.test(directValue) || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(directValue) : /^tel:/i.test(directValue) || /^[+()\-\s\d]{5,}$/.test(directValue);
|
|
32
|
+
if (looksLikeExpectedValue) {
|
|
33
|
+
return normalizeContactValue(directValue, kind);
|
|
34
|
+
}
|
|
35
|
+
const entryNode = point.entryNode || point.valueNode;
|
|
36
|
+
if (entryNode) {
|
|
37
|
+
const storedValueNode = store.any(entryNode, _solidUi.ns.vcard('value'));
|
|
38
|
+
const storedValue = toText(storedValueNode).trim();
|
|
39
|
+
if (storedValue) return normalizeContactValue(storedValue, kind);
|
|
40
|
+
}
|
|
41
|
+
return normalizeContactValue(directValue, kind);
|
|
42
|
+
}
|
|
43
|
+
function renderPhone(phone, store) {
|
|
44
|
+
if (!phone) return (0, _litHtml.html)``;
|
|
45
|
+
const phoneValue = resolveContactValue(store, phone, 'phone');
|
|
46
|
+
const phoneType = (0, _contactTypeUtils.normalizePhoneTypeForEdit)(phone.type);
|
|
47
|
+
return (0, _litHtml.html)`<li class="contact-info__item flex gap-2xs" role="listitem">
|
|
48
|
+
<div class="contact-info__icon-wrapper flex-center">
|
|
49
|
+
<span class="contact-info__icon" aria-hidden="true">${_contactIcons.phoneIcon}</span>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="flex-column">
|
|
52
|
+
<span class="contact-info__contact-point-value">${phoneValue}</span>
|
|
53
|
+
${phoneType ? (0, _litHtml.html)`<span class="contact-info__contact-point-type"> ${phoneType}</span>` : (0, _litHtml.html)``}
|
|
54
|
+
</div>
|
|
55
|
+
</li>`;
|
|
56
|
+
}
|
|
57
|
+
function renderPhones(phones, store) {
|
|
58
|
+
if (!phones || !phones.length || !phones[0]) return (0, _litHtml.html)``;
|
|
59
|
+
return (0, _litHtml.html)`${renderPhone(phones[0], store)}${phones.length > 1 ? renderPhones(phones.slice(1), store) : (0, _litHtml.html)``}`;
|
|
60
|
+
}
|
|
61
|
+
function renderEmail(email, store) {
|
|
62
|
+
if (!email) return (0, _litHtml.html)``;
|
|
63
|
+
const emailValue = resolveContactValue(store, email, 'email');
|
|
64
|
+
const emailType = (0, _contactTypeUtils.normalizeEmailTypeForEdit)(email.type);
|
|
65
|
+
return (0, _litHtml.html)`<li class="contact-info__item flex gap-2xs" role="listitem">
|
|
66
|
+
<div class="contact-info__icon-wrapper flex-center">
|
|
67
|
+
<span class="contact-info__icon" aria-hidden="true">${_contactIcons.emailIcon}</span>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="flex-column">
|
|
70
|
+
<span class="contact-info__contact-point-value">${emailValue}</span>
|
|
71
|
+
${emailType ? (0, _litHtml.html)`<span class="contact-info__contact-point-type">${emailType}</span>` : (0, _litHtml.html)``}
|
|
72
|
+
</div>
|
|
73
|
+
</li>`;
|
|
74
|
+
}
|
|
75
|
+
function renderEmails(emails, store) {
|
|
76
|
+
if (!emails || !emails.length || !emails[0]) return (0, _litHtml.html)``;
|
|
77
|
+
return (0, _litHtml.html)`${renderEmail(emails[0], store)}${emails.length > 1 ? renderEmails(emails.slice(1), store) : (0, _litHtml.html)``}`;
|
|
78
|
+
}
|
|
79
|
+
function renderAddress(address) {
|
|
80
|
+
if (!address) return (0, _litHtml.html)``;
|
|
81
|
+
const streetAddress = toText(address.streetAddress || address.fullAddress).trim();
|
|
82
|
+
const locality = toText(address.locality).trim();
|
|
83
|
+
const region = toText(address.region).trim();
|
|
84
|
+
const postalCode = toText(address.postalCode).trim();
|
|
85
|
+
const countryName = toText(address.countryName).trim();
|
|
86
|
+
const localityRegion = [locality, region].filter(Boolean).join(', ');
|
|
87
|
+
const localityRegionPostal = [localityRegion, postalCode].filter(Boolean).join(' ');
|
|
88
|
+
return (0, _litHtml.html)`
|
|
89
|
+
<li class="contact-info__item flex gap-2xs" role="listitem">
|
|
90
|
+
<div class="contact-info__icon-wrapper flex-center">
|
|
91
|
+
<span class="contact-info__icon" aria-hidden="true">${_profileIcons.locationIcon}</span>
|
|
92
|
+
</div>
|
|
93
|
+
<span class="contact-info__address">
|
|
94
|
+
${streetAddress ? (0, _litHtml.html)`${streetAddress}<br />` : (0, _litHtml.html)``}
|
|
95
|
+
${localityRegionPostal ? (0, _litHtml.html)`${localityRegionPostal}<br />` : (0, _litHtml.html)``}
|
|
96
|
+
${countryName}
|
|
97
|
+
</span>
|
|
98
|
+
</li>`;
|
|
99
|
+
}
|
|
100
|
+
function renderAddresses(addresses) {
|
|
101
|
+
if (!addresses || !addresses.length || !addresses[0]) return (0, _litHtml.html)``;
|
|
102
|
+
return (0, _litHtml.html)`${renderAddress(addresses[0])}${addresses.length > 1 ? renderAddresses(addresses.slice(1)) : (0, _litHtml.html)``}`;
|
|
103
|
+
}
|
|
104
|
+
function renderContactInfoSectionDefault(store, subject, contactInfo, viewerMode, onSaved) {
|
|
105
|
+
const hasAnyContactInfo = contactInfo?.emails.length > 0 || contactInfo?.phones.length > 0 || contactInfo?.addresses.length > 0;
|
|
106
|
+
const isOwner = viewerMode === 'owner';
|
|
107
|
+
return (0, _litHtml.html)`
|
|
108
|
+
<section
|
|
109
|
+
aria-labelledby="contact-details-heading"
|
|
110
|
+
class="profile__section border-lighter profile-section-collapsible profile-section-collapsible--inline-mobile-actions"
|
|
111
|
+
role="region"
|
|
112
|
+
tabindex="-1"
|
|
113
|
+
data-expanded="false"
|
|
114
|
+
>
|
|
115
|
+
<header class="profile__section-header profile-section-collapsible__header">
|
|
116
|
+
<h2 id="contact-details-heading" tabindex="-1">${_texts.contactInfoHeadingText}</h2>
|
|
117
|
+
<div class="profile-section-collapsible__actions flex-column">
|
|
118
|
+
${isOwner ? (0, _litHtml.html)`
|
|
119
|
+
<button
|
|
120
|
+
type="button"
|
|
121
|
+
class="profile__action-button profile-action-text flex-center profile-section-collapsible__edit-button"
|
|
122
|
+
aria-label="Edit contact information"
|
|
123
|
+
@click=${event => {
|
|
124
|
+
return (0, _ContactInfoEditDialog.createContactInfoEditDialog)(event, store, subject, contactInfo, viewerMode, onSaved);
|
|
125
|
+
}}>
|
|
126
|
+
<span class="profile-section-collapsible__edit-label">${_profileIcons.editIcon} Edit</span>
|
|
127
|
+
<span class="profile-section-collapsible__edit-icon" aria-hidden="true">${_profileIcons.editIcon}</span>
|
|
128
|
+
</button>
|
|
129
|
+
` : (0, _litHtml.html)``}
|
|
130
|
+
<button
|
|
131
|
+
type="button"
|
|
132
|
+
class="inline-flex-row"
|
|
133
|
+
aria-label="Toggle contact information section"
|
|
134
|
+
aria-controls="contact-details-panel"
|
|
135
|
+
aria-expanded="false"
|
|
136
|
+
@click=${_collapsibleSection.toggleCollapsibleSection}
|
|
137
|
+
>
|
|
138
|
+
<span class="profile-section-collapsible__chevron" aria-hidden="true">⌄</span>
|
|
139
|
+
</button>
|
|
140
|
+
</div>
|
|
141
|
+
</header>
|
|
142
|
+
<div id="contact-details-panel" class="profile-section-collapsible__content" aria-hidden="true">
|
|
143
|
+
${contactInfo.phones.length > 0 ? (0, _litHtml.html)`
|
|
144
|
+
<ul class="contact-info__list flex-column" role="list" aria-label="Phone numbers">
|
|
145
|
+
${renderPhones(contactInfo.phones, store)}
|
|
146
|
+
</ul>
|
|
147
|
+
` : (0, _litHtml.html)``}
|
|
148
|
+
${contactInfo.emails.length > 0 ? (0, _litHtml.html)`
|
|
149
|
+
<ul class="contact-info__list flex-column" role="list" aria-label="Email addresses">
|
|
150
|
+
${renderEmails(contactInfo.emails, store)}
|
|
151
|
+
</ul>
|
|
152
|
+
` : (0, _litHtml.html)``}
|
|
153
|
+
${contactInfo.addresses.length > 0 ? (0, _litHtml.html)`
|
|
154
|
+
<ul class="contact-info__list flex-column" role="list" aria-label="Postal addresses">
|
|
155
|
+
${renderAddresses(contactInfo.addresses)}
|
|
156
|
+
</ul>
|
|
157
|
+
` : (0, _litHtml.html)``}
|
|
158
|
+
${hasAnyContactInfo ? (0, _litHtml.html)`` : (0, _litHtml.html)`<p>No contact details added yet.</p>`}
|
|
159
|
+
</div>
|
|
160
|
+
</section>
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
function renderOwnerEmptyContactInfoContent(_store, _subject, _contactInfo, _viewerMode, _onSaved) {
|
|
164
|
+
return (0, _litHtml.html)`
|
|
165
|
+
<div class="profile__empty-state-content flex-column-center" role="group" aria-label="Empty contact information section">
|
|
166
|
+
<div class="contact-info__empty-icon-wrapper">
|
|
167
|
+
<span class="contact-info__empty-icon inline-flex-row">${_profileIcons.envelopeIcon}</span>
|
|
168
|
+
</div>
|
|
169
|
+
<p class="profile__empty-state-message contact-info__empty-message">
|
|
170
|
+
No additional contact info added yet.
|
|
171
|
+
</p>
|
|
172
|
+
</div>
|
|
173
|
+
`;
|
|
174
|
+
}
|
|
175
|
+
function renderOwnerEmptyContactInfoSection(store, subject, contactInfo, viewerMode, onSaved) {
|
|
176
|
+
return (0, _litHtml.html)`
|
|
177
|
+
<section
|
|
178
|
+
aria-labelledby="contact-details-heading"
|
|
179
|
+
data-profile-section="contact-info"
|
|
180
|
+
class="profile__section--empty border-lighter rounded-md gap-lg profile-section-collapsible profile-section-collapsible--inline-mobile-actions"
|
|
181
|
+
role="region"
|
|
182
|
+
tabindex="-1"
|
|
183
|
+
data-expanded="false"
|
|
184
|
+
>
|
|
185
|
+
<header class="profile__section-header profile-section-collapsible__header">
|
|
186
|
+
<h2 id="contact-details-heading" tabindex="-1">${_texts.contactInfoEmptyHeadingText}</h2>
|
|
187
|
+
<div class="profile-section-collapsible__actions flex-column">
|
|
188
|
+
<button
|
|
189
|
+
type="button"
|
|
190
|
+
class="profile__action-button profile-action-text flex-center profile-section-collapsible__edit-button"
|
|
191
|
+
aria-label="Add contact information"
|
|
192
|
+
@click=${event => {
|
|
193
|
+
return (0, _ContactInfoEditDialog.createContactInfoEditDialog)(event, store, subject, contactInfo, viewerMode, onSaved);
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
<span class="profile-section-collapsible__edit-label">${_profileIcons.addIcon} Add Contact</span>
|
|
197
|
+
<span class="profile-section-collapsible__edit-icon profile-section-collapsible__edit-icon--add" aria-hidden="true">${_profileIcons.plusIcon}</span>
|
|
198
|
+
</button>
|
|
199
|
+
<button
|
|
200
|
+
type="button"
|
|
201
|
+
class="inline-flex-row"
|
|
202
|
+
aria-label="Toggle contact information section"
|
|
203
|
+
aria-controls="contact-details-panel"
|
|
204
|
+
aria-expanded="false"
|
|
205
|
+
@click=${_collapsibleSection.toggleCollapsibleSection}
|
|
206
|
+
>
|
|
207
|
+
<span class="profile-section-collapsible__chevron" aria-hidden="true">⌄</span>
|
|
208
|
+
</button>
|
|
209
|
+
</div>
|
|
210
|
+
</header>
|
|
211
|
+
<div id="contact-details-panel" class="profile-section-collapsible__content" aria-hidden="true">
|
|
212
|
+
${renderOwnerEmptyContactInfoContent(store, subject, contactInfo, viewerMode, onSaved)}
|
|
213
|
+
</div>
|
|
214
|
+
</section>
|
|
215
|
+
`;
|
|
216
|
+
}
|
|
217
|
+
function renderContactInfoSection(store, subject, contactInfo, viewerMode, onSaved) {
|
|
218
|
+
const safeContactInfo = {
|
|
219
|
+
emails: contactInfo?.emails || [],
|
|
220
|
+
phones: contactInfo?.phones || [],
|
|
221
|
+
addresses: contactInfo?.addresses || []
|
|
222
|
+
};
|
|
223
|
+
const hasAnyContactInfo = safeContactInfo.emails.length > 0 || safeContactInfo.phones.length > 0 || safeContactInfo.addresses.length > 0;
|
|
224
|
+
const showOwnerEmptyContactInfo = !hasAnyContactInfo && viewerMode === 'owner';
|
|
225
|
+
const showSection = true;
|
|
226
|
+
return showSection ? (0, _litHtml.html)`
|
|
227
|
+
${showOwnerEmptyContactInfo ? renderOwnerEmptyContactInfoSection(store, subject, safeContactInfo, viewerMode, onSaved) : renderContactInfoSectionDefault(store, subject, safeContactInfo, viewerMode, onSaved)}
|
|
228
|
+
` : '';
|
|
229
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LiveStore, NamedNode } from 'rdflib';
|
|
2
|
+
import { ContactMutationPlan } from './types';
|
|
3
|
+
export declare function processContactInfoMutations(store: LiveStore, subject: NamedNode, mutationPlan: ContactMutationPlan): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/sections/contactInfo/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAiB,MAAM,QAAQ,CAAA;AAE5D,OAAO,EAAqB,mBAAmB,EAAmB,MAAM,SAAS,CAAA;AAqKjF,wBAAsB,2BAA2B,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,iBASxH"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.processContactInfoMutations = processContactInfoMutations;
|
|
7
|
+
var _rdflib = require("rdflib");
|
|
8
|
+
var _solidUi = require("solid-ui");
|
|
9
|
+
var _rdfMutationHelpers = require("../shared/rdfMutationHelpers");
|
|
10
|
+
var _idNodeFactory = require("../shared/idNodeFactory");
|
|
11
|
+
var _texts = require("../../texts");
|
|
12
|
+
function buildPhoneStatements(subject, doc, node, phone) {
|
|
13
|
+
const normalizedValue = phone.value.startsWith('tel:') ? phone.value : `tel:${phone.value}`;
|
|
14
|
+
const valueNode = (0, _rdflib.sym)(normalizedValue);
|
|
15
|
+
const inserts = [(0, _rdflib.st)(subject, _solidUi.ns.vcard('hasTelephone'), node, doc), (0, _rdflib.st)(node, _solidUi.ns.vcard('value'), valueNode, doc)];
|
|
16
|
+
if (phone.type) {
|
|
17
|
+
inserts.push((0, _rdflib.st)(node, _solidUi.ns.rdf('type'), _solidUi.ns.vcard(phone.type), doc));
|
|
18
|
+
}
|
|
19
|
+
return inserts;
|
|
20
|
+
}
|
|
21
|
+
function buildEmailStatements(subject, doc, node, email) {
|
|
22
|
+
const normalizedValue = email.value.startsWith('mailto:') ? email.value : `mailto:${email.value}`;
|
|
23
|
+
const valueNode = (0, _rdflib.sym)(normalizedValue);
|
|
24
|
+
const inserts = [(0, _rdflib.st)(subject, _solidUi.ns.vcard('hasEmail'), node, doc), (0, _rdflib.st)(node, _solidUi.ns.vcard('value'), valueNode, doc)];
|
|
25
|
+
if (email.type) {
|
|
26
|
+
inserts.push((0, _rdflib.st)(node, _solidUi.ns.rdf('type'), _solidUi.ns.vcard(email.type), doc));
|
|
27
|
+
}
|
|
28
|
+
return inserts;
|
|
29
|
+
}
|
|
30
|
+
function buildAddressStatements(subject, doc, node, address) {
|
|
31
|
+
const inserts = [(0, _rdflib.st)(subject, _solidUi.ns.vcard('hasAddress'), node, doc)];
|
|
32
|
+
if (address.type) inserts.push((0, _rdflib.st)(node, _solidUi.ns.rdf('type'), _solidUi.ns.vcard(address.type), doc));
|
|
33
|
+
if (address.streetAddress) inserts.push((0, _rdflib.st)(node, _solidUi.ns.vcard('street-address'), address.streetAddress, doc));
|
|
34
|
+
if (address.locality) inserts.push((0, _rdflib.st)(node, _solidUi.ns.vcard('locality'), address.locality, doc));
|
|
35
|
+
if (address.region) inserts.push((0, _rdflib.st)(node, _solidUi.ns.vcard('region'), address.region, doc));
|
|
36
|
+
if (address.postalCode) inserts.push((0, _rdflib.st)(node, _solidUi.ns.vcard('postal-code'), address.postalCode, doc));
|
|
37
|
+
if (address.countryName) inserts.push((0, _rdflib.st)(node, _solidUi.ns.vcard('country-name'), address.countryName, doc));
|
|
38
|
+
return inserts;
|
|
39
|
+
}
|
|
40
|
+
async function mutatePhoneEntries(store, subject, phoneOps) {
|
|
41
|
+
const doc = subject.doc();
|
|
42
|
+
const existingPhoneNodes = store.each(subject, _solidUi.ns.vcard('hasTelephone'), null, doc);
|
|
43
|
+
const deletions = [];
|
|
44
|
+
const insertions = [];
|
|
45
|
+
phoneOps.remove.forEach(phone => {
|
|
46
|
+
if (!phone.entryNode) return;
|
|
47
|
+
const existingNode = (0, _rdfMutationHelpers.findExistingNode)(existingPhoneNodes, phone.entryNode);
|
|
48
|
+
if (existingNode) {
|
|
49
|
+
const linkedPhoneStatements = (0, _rdfMutationHelpers.collectLinkedNodeStatements)(store, subject, _solidUi.ns.vcard('hasTelephone'), doc);
|
|
50
|
+
const matchingLinkStatement = linkedPhoneStatements.linkStatements.find(statement => statement.object?.value === existingNode.value);
|
|
51
|
+
if (matchingLinkStatement) {
|
|
52
|
+
deletions.push(matchingLinkStatement);
|
|
53
|
+
}
|
|
54
|
+
deletions.push(...(0, _rdfMutationHelpers.collectNodeStatements)(store, existingNode, doc));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
phoneOps.update.forEach(phone => {
|
|
58
|
+
if (!phone.entryNode) return;
|
|
59
|
+
const existingNode = (0, _rdfMutationHelpers.findExistingNode)(existingPhoneNodes, phone.entryNode);
|
|
60
|
+
if (!existingNode) {
|
|
61
|
+
insertions.push(...buildPhoneStatements(subject, doc, (0, _idNodeFactory.createIdNode)(doc), phone));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const linkedPhoneStatements = (0, _rdfMutationHelpers.collectLinkedNodeStatements)(store, subject, _solidUi.ns.vcard('hasTelephone'), doc);
|
|
65
|
+
const matchingLinkStatement = linkedPhoneStatements.linkStatements.find(statement => statement.object?.value === existingNode.value);
|
|
66
|
+
if (matchingLinkStatement) {
|
|
67
|
+
deletions.push(matchingLinkStatement);
|
|
68
|
+
}
|
|
69
|
+
deletions.push(...(0, _rdfMutationHelpers.collectNodeStatements)(store, existingNode, doc));
|
|
70
|
+
insertions.push(...buildPhoneStatements(subject, doc, existingNode, phone));
|
|
71
|
+
});
|
|
72
|
+
phoneOps.create.forEach(phone => {
|
|
73
|
+
insertions.push(...buildPhoneStatements(subject, doc, (0, _idNodeFactory.createIdNode)(doc), phone));
|
|
74
|
+
});
|
|
75
|
+
await (0, _rdfMutationHelpers.applyUpdaterPatch)(store, deletions, insertions);
|
|
76
|
+
}
|
|
77
|
+
async function mutateEmailEntries(store, subject, emailOps) {
|
|
78
|
+
const doc = subject.doc();
|
|
79
|
+
const existingEmailNodes = store.each(subject, _solidUi.ns.vcard('hasEmail'), null, doc);
|
|
80
|
+
const deletions = [];
|
|
81
|
+
const insertions = [];
|
|
82
|
+
emailOps.remove.forEach(email => {
|
|
83
|
+
if (!email.entryNode) return;
|
|
84
|
+
const existingNode = (0, _rdfMutationHelpers.findExistingNode)(existingEmailNodes, email.entryNode);
|
|
85
|
+
if (existingNode) {
|
|
86
|
+
const linkedEmailStatements = (0, _rdfMutationHelpers.collectLinkedNodeStatements)(store, subject, _solidUi.ns.vcard('hasEmail'), doc);
|
|
87
|
+
const matchingLinkStatement = linkedEmailStatements.linkStatements.find(statement => statement.object?.value === existingNode.value);
|
|
88
|
+
if (matchingLinkStatement) {
|
|
89
|
+
deletions.push(matchingLinkStatement);
|
|
90
|
+
}
|
|
91
|
+
deletions.push(...(0, _rdfMutationHelpers.collectNodeStatements)(store, existingNode, doc));
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
emailOps.update.forEach(email => {
|
|
95
|
+
if (!email.entryNode) return;
|
|
96
|
+
const existingNode = (0, _rdfMutationHelpers.findExistingNode)(existingEmailNodes, email.entryNode);
|
|
97
|
+
if (!existingNode) {
|
|
98
|
+
insertions.push(...buildEmailStatements(subject, doc, (0, _idNodeFactory.createIdNode)(doc), email));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
deletions.push(...(0, _rdfMutationHelpers.collectNodeStatements)(store, existingNode, doc));
|
|
102
|
+
insertions.push(...buildEmailStatements(subject, doc, existingNode, email));
|
|
103
|
+
});
|
|
104
|
+
emailOps.create.forEach(email => {
|
|
105
|
+
insertions.push(...buildEmailStatements(subject, doc, (0, _idNodeFactory.createIdNode)(doc), email));
|
|
106
|
+
});
|
|
107
|
+
await (0, _rdfMutationHelpers.applyUpdaterPatch)(store, deletions, insertions);
|
|
108
|
+
}
|
|
109
|
+
async function mutateAddressEntries(store, subject, addressOps) {
|
|
110
|
+
const doc = subject.doc();
|
|
111
|
+
const existingAddressNodes = store.each(subject, _solidUi.ns.vcard('hasAddress'), null, doc);
|
|
112
|
+
const deletions = [];
|
|
113
|
+
const insertions = [];
|
|
114
|
+
addressOps.remove.forEach(address => {
|
|
115
|
+
if (!address.entryNode) return;
|
|
116
|
+
const existingNode = (0, _rdfMutationHelpers.findExistingNode)(existingAddressNodes, address.entryNode);
|
|
117
|
+
if (existingNode) {
|
|
118
|
+
const linkedAddressStatements = (0, _rdfMutationHelpers.collectLinkedNodeStatements)(store, subject, _solidUi.ns.vcard('hasAddress'), doc);
|
|
119
|
+
const matchingLinkStatement = linkedAddressStatements.linkStatements.find(statement => statement.object?.value === existingNode.value);
|
|
120
|
+
if (matchingLinkStatement) {
|
|
121
|
+
deletions.push(matchingLinkStatement);
|
|
122
|
+
}
|
|
123
|
+
deletions.push(...(0, _rdfMutationHelpers.collectNodeStatements)(store, existingNode, doc));
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
addressOps.update.forEach(address => {
|
|
127
|
+
if (!address.entryNode) return;
|
|
128
|
+
const existingNode = (0, _rdfMutationHelpers.findExistingNode)(existingAddressNodes, address.entryNode);
|
|
129
|
+
if (!existingNode) {
|
|
130
|
+
insertions.push(...buildAddressStatements(subject, doc, (0, _idNodeFactory.createIdNode)(doc), address));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
deletions.push(...(0, _rdfMutationHelpers.collectNodeStatements)(store, existingNode, doc));
|
|
134
|
+
insertions.push(...buildAddressStatements(subject, doc, existingNode, address));
|
|
135
|
+
});
|
|
136
|
+
addressOps.create.forEach(address => {
|
|
137
|
+
insertions.push(...buildAddressStatements(subject, doc, (0, _idNodeFactory.createIdNode)(doc), address));
|
|
138
|
+
});
|
|
139
|
+
await (0, _rdfMutationHelpers.applyUpdaterPatch)(store, deletions, insertions);
|
|
140
|
+
}
|
|
141
|
+
async function processContactInfoMutations(store, subject, mutationPlan) {
|
|
142
|
+
try {
|
|
143
|
+
await mutatePhoneEntries(store, subject, mutationPlan.phoneOps);
|
|
144
|
+
await mutateEmailEntries(store, subject, mutationPlan.emailOps);
|
|
145
|
+
await mutateAddressEntries(store, subject, mutationPlan.addressOps);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
148
|
+
throw new Error(`${_texts.mutationSaveContactInfoFailedPrefixText} ${message}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/sections/contactInfo/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAQ,MAAM,QAAQ,CAAA;AAEnD,OAAO,EAAkB,WAAW,EAAgB,MAAM,SAAS,CAAA;AAiHnE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,WAAW,CAMpF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.presentContactInfo = presentContactInfo;
|
|
7
|
+
var _solidUi = require("solid-ui");
|
|
8
|
+
function termValue(term) {
|
|
9
|
+
if (!term) return '';
|
|
10
|
+
if (typeof term === 'string') return term;
|
|
11
|
+
return term.value || '';
|
|
12
|
+
}
|
|
13
|
+
function isEmailValue(value) {
|
|
14
|
+
const normalized = (value || '').trim();
|
|
15
|
+
if (!normalized) return false;
|
|
16
|
+
if (/^mailto:/i.test(normalized)) return true;
|
|
17
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalized);
|
|
18
|
+
}
|
|
19
|
+
function isPhoneValue(value) {
|
|
20
|
+
const normalized = (value || '').trim();
|
|
21
|
+
if (!normalized) return false;
|
|
22
|
+
if (/^tel:/i.test(normalized)) return true;
|
|
23
|
+
return /^[+()\-\s\d]{5,}$/.test(normalized);
|
|
24
|
+
}
|
|
25
|
+
function resolvePointValueNode(store, entryNode, doc, kind) {
|
|
26
|
+
const expected = kind === 'email' ? isEmailValue : isPhoneValue;
|
|
27
|
+
const entryValue = termValue(entryNode);
|
|
28
|
+
if (expected(entryValue)) return entryNode;
|
|
29
|
+
const inDocStatements = store.statementsMatching(entryNode, _solidUi.ns.vcard('value'), null, doc);
|
|
30
|
+
const anyGraphStatements = store.statementsMatching(entryNode, _solidUi.ns.vcard('value'));
|
|
31
|
+
for (const statement of [...inDocStatements, ...anyGraphStatements]) {
|
|
32
|
+
const objectNode = statement.object;
|
|
33
|
+
if (expected(termValue(objectNode))) {
|
|
34
|
+
return objectNode;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function selectEmails(subject, store) {
|
|
40
|
+
const emails = [];
|
|
41
|
+
const emailNodes = store.each(subject, _solidUi.ns.vcard('hasEmail'), null, subject.doc()) || null;
|
|
42
|
+
emailNodes.forEach(node => {
|
|
43
|
+
const valueNode = resolvePointValueNode(store, node, subject.doc(), 'email');
|
|
44
|
+
if (!valueNode) return;
|
|
45
|
+
const type = store.any(node, _solidUi.ns.rdf('type'), null, subject.doc());
|
|
46
|
+
emails.push({
|
|
47
|
+
entryNode: node,
|
|
48
|
+
type,
|
|
49
|
+
valueNode
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return emails;
|
|
53
|
+
}
|
|
54
|
+
/* SAM need to look at this doesn't seem to be working
|
|
55
|
+
although it was working in add-to-contacts button */
|
|
56
|
+
function selectPhones(subject, store) {
|
|
57
|
+
const phoneNumbers = [];
|
|
58
|
+
const phoneNodes = store.each(subject, _solidUi.ns.vcard('hasTelephone'), null, subject.doc()) || null;
|
|
59
|
+
phoneNodes.forEach(node => {
|
|
60
|
+
const valueNode = resolvePointValueNode(store, node, subject.doc(), 'phone');
|
|
61
|
+
if (!valueNode) return;
|
|
62
|
+
const type = store.any(node, _solidUi.ns.rdf('type'), null, subject.doc());
|
|
63
|
+
phoneNumbers.push({
|
|
64
|
+
entryNode: node,
|
|
65
|
+
type,
|
|
66
|
+
valueNode
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
return phoneNumbers;
|
|
70
|
+
}
|
|
71
|
+
function selectAddresses(subject, store) {
|
|
72
|
+
const addresses = [];
|
|
73
|
+
const addressNodes = store.each(subject, _solidUi.ns.vcard('hasAddress'), null, subject.doc()) || null;
|
|
74
|
+
addressNodes.map(node => {
|
|
75
|
+
const streetAddress = termValue(store.any(node, _solidUi.ns.vcard('street-address'), null, subject.doc()));
|
|
76
|
+
const locality = termValue(store.any(node, _solidUi.ns.vcard('locality'), null, subject.doc()));
|
|
77
|
+
const region = termValue(store.any(node, _solidUi.ns.vcard('region'), null, subject.doc()));
|
|
78
|
+
const postalCode = termValue(store.any(node, _solidUi.ns.vcard('postal-code'), null, subject.doc()));
|
|
79
|
+
const countryName = termValue(store.any(node, _solidUi.ns.vcard('country-name'), null, subject.doc()));
|
|
80
|
+
const type = store.any(node, _solidUi.ns.rdf('type'), null, subject.doc());
|
|
81
|
+
addresses.push({
|
|
82
|
+
entryNode: node,
|
|
83
|
+
...(type ? {
|
|
84
|
+
type
|
|
85
|
+
} : {}),
|
|
86
|
+
streetAddress,
|
|
87
|
+
locality,
|
|
88
|
+
region,
|
|
89
|
+
postalCode,
|
|
90
|
+
countryName
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
return addresses;
|
|
94
|
+
}
|
|
95
|
+
function presentContactInfo(subject, store) {
|
|
96
|
+
const emails = selectEmails(subject, store);
|
|
97
|
+
const phones = selectPhones(subject, store);
|
|
98
|
+
const addresses = selectAddresses(subject, store);
|
|
99
|
+
return {
|
|
100
|
+
emails,
|
|
101
|
+
phones,
|
|
102
|
+
addresses
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Node } from 'rdflib';
|
|
2
|
+
import { MutationOps } from '../shared/types';
|
|
3
|
+
export interface PointDetails {
|
|
4
|
+
entryNode: Node;
|
|
5
|
+
type: Node;
|
|
6
|
+
valueNode: Node;
|
|
7
|
+
}
|
|
8
|
+
export interface AddressDetails {
|
|
9
|
+
entryNode: Node;
|
|
10
|
+
type?: Node;
|
|
11
|
+
streetAddress?: string;
|
|
12
|
+
locality?: string;
|
|
13
|
+
region?: string;
|
|
14
|
+
postalCode?: string;
|
|
15
|
+
countryName?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ContactInfo {
|
|
18
|
+
emails: PointDetails[];
|
|
19
|
+
phones: PointDetails[];
|
|
20
|
+
addresses: AddressDetails[];
|
|
21
|
+
}
|
|
22
|
+
export type ContactRowStatus = 'existing' | 'new' | 'modified' | 'deleted';
|
|
23
|
+
export type ContactPointRow = {
|
|
24
|
+
value: string;
|
|
25
|
+
type: string;
|
|
26
|
+
entryNode: string;
|
|
27
|
+
status: ContactRowStatus;
|
|
28
|
+
};
|
|
29
|
+
export type ContactAddressRow = {
|
|
30
|
+
streetAddress?: string;
|
|
31
|
+
locality?: string;
|
|
32
|
+
region?: string;
|
|
33
|
+
postalCode?: string;
|
|
34
|
+
countryName?: string;
|
|
35
|
+
type: string;
|
|
36
|
+
entryNode: string;
|
|
37
|
+
status: ContactRowStatus;
|
|
38
|
+
};
|
|
39
|
+
export type ContactMutationPlan = {
|
|
40
|
+
phoneOps: MutationOps<ContactPointRow>;
|
|
41
|
+
emailOps: MutationOps<ContactPointRow>;
|
|
42
|
+
addressOps: MutationOps<ContactAddressRow>;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/sections/contactInfo/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7C,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,IAAI,CAAA;CAChB;AACD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,SAAS,EAAE,cAAc,EAAE,CAAA;CAC5B;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,CAAA;AAE1E,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,gBAAgB,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,gBAAgB,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;IACtC,QAAQ,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;IACtC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAA;CAC3C,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EducationDetails } from './types';
|
|
2
|
+
import '../../styles/EditDialogs.css';
|
|
3
|
+
import '../../styles/ContactInfoEditDialog.css';
|
|
4
|
+
import { LiveStore, NamedNode } from 'rdflib';
|
|
5
|
+
import { ViewerMode } from '../../types';
|
|
6
|
+
export declare function createEducationEditDialog(event: Event, store: LiveStore, subject: NamedNode, educationData: EducationDetails[], viewerMode: ViewerMode, onSaved?: () => Promise<void> | void): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=EducationEditDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EducationEditDialog.d.ts","sourceRoot":"","sources":["../../../src/sections/education/EducationEditDialog.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,SAAS,CAAA;AACxD,OAAO,8BAA8B,CAAA;AACrC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AA4bxC,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,SAAS,EAClB,aAAa,EAAE,gBAAgB,EAAE,EACjC,UAAU,EAAE,UAAU,EACtB,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,iBAwDrC"}
|