profile-pane 3.2.1 → 3.2.2-test.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 +50 -0
- package/lib/303.profile-pane.js +1362 -0
- package/lib/303.profile-pane.js.map +1 -0
- package/lib/303.profile-pane.min.js +2 -0
- package/lib/303.profile-pane.min.js.map +1 -0
- package/lib/ProfileView.css +1090 -0
- package/lib/ProfileView.d.ts +2 -1
- package/lib/ProfileView.d.ts.map +1 -1
- package/lib/ProfileView.js +64 -36
- package/lib/buttonsHelper.d.ts +1 -1
- package/lib/buttonsHelper.d.ts.map +1 -1
- package/lib/buttonsHelper.js +2 -1
- package/lib/editProfilePane/EditCVCard.js +1 -1
- package/lib/editProfilePane/EditCommunitiesCard.js +1 -1
- package/lib/editProfilePane/EditFriendsCard.js +1 -1
- package/lib/editProfilePane/EditProfileView.d.ts +1 -1
- package/lib/editProfilePane/EditProfileView.d.ts.map +1 -1
- package/lib/editProfilePane/EditProfileView.js +4 -5
- package/lib/editProfilePane/editProfilePresenter.d.ts.map +1 -1
- package/lib/editProfilePane/editProfilePresenter.js +5 -4
- package/lib/icons-svg/profileIcons.d.ts +1 -1
- package/lib/icons-svg/profileIcons.d.ts.map +1 -1
- package/lib/icons-svg/profileIcons.js +9 -17
- package/lib/index.d.ts +1 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +74 -40
- package/lib/ontology/otherPreferencesForm.ttl +32 -0
- package/lib/ontology/resumeForm.ttl +349 -0
- package/lib/ontology/socialMedia.ttl +433 -0
- package/lib/profile-pane.js +32266 -13247
- package/lib/profile-pane.js.map +1 -1
- package/lib/profile-pane.min.js +2315 -935
- package/lib/profile-pane.min.js.map +1 -1
- package/lib/rdfFormsHelper.d.ts +13 -1
- package/lib/rdfFormsHelper.d.ts.map +1 -1
- package/lib/rdfFormsHelper.js +13 -1
- package/lib/sections/bio/BioEditDialog.d.ts.map +1 -1
- package/lib/sections/bio/BioEditDialog.js +7 -7
- package/lib/sections/bio/BioSection.css +300 -0
- package/lib/sections/bio/BioSection.d.ts +3 -2
- package/lib/sections/bio/BioSection.d.ts.map +1 -1
- package/lib/sections/bio/BioSection.js +26 -19
- package/lib/sections/bio/mutations.d.ts.map +1 -1
- package/lib/sections/bio/mutations.js +14 -3
- package/lib/sections/contactInfo/ContactInfoEditDialog.css +354 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts +3 -1
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts.map +1 -1
- package/lib/sections/contactInfo/ContactInfoEditDialog.js +183 -98
- package/lib/sections/contactInfo/ContactInfoSection.css +125 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts +2 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts.map +1 -1
- package/lib/sections/contactInfo/ContactInfoSection.js +64 -41
- package/lib/sections/contactInfo/mutations.d.ts.map +1 -1
- package/lib/sections/contactInfo/mutations.js +51 -16
- package/lib/sections/education/EducationEditDialog.d.ts +3 -1
- package/lib/sections/education/EducationEditDialog.d.ts.map +1 -1
- package/lib/sections/education/EducationEditDialog.js +170 -92
- package/lib/sections/education/EducationSection.css +133 -0
- package/lib/sections/education/EducationSection.d.ts +3 -2
- package/lib/sections/education/EducationSection.d.ts.map +1 -1
- package/lib/sections/education/EducationSection.js +32 -25
- package/lib/sections/education/mutations.d.ts.map +1 -1
- package/lib/sections/education/mutations.js +14 -3
- package/lib/sections/heading/HeadingEditDialog.d.ts +4 -1
- package/lib/sections/heading/HeadingEditDialog.d.ts.map +1 -1
- package/lib/sections/heading/HeadingEditDialog.js +287 -162
- package/lib/sections/heading/HeadingSection.css +862 -0
- package/lib/sections/heading/HeadingSection.d.ts +3 -2
- package/lib/sections/heading/HeadingSection.d.ts.map +1 -1
- package/lib/sections/heading/HeadingSection.js +63 -32
- package/lib/sections/heading/imageHelpers.d.ts +1 -0
- package/lib/sections/heading/imageHelpers.d.ts.map +1 -1
- package/lib/sections/heading/imageHelpers.js +40 -1
- package/lib/sections/heading/mutations.d.ts.map +1 -1
- package/lib/sections/heading/mutations.js +86 -23
- package/lib/sections/heading/selectors.d.ts.map +1 -1
- package/lib/sections/heading/selectors.js +14 -3
- package/lib/sections/heading/types.d.ts +1 -2
- package/lib/sections/heading/types.d.ts.map +1 -1
- package/lib/sections/languages/LanguageEditDialog.d.ts +3 -1
- package/lib/sections/languages/LanguageEditDialog.d.ts.map +1 -1
- package/lib/sections/languages/LanguageEditDialog.js +202 -119
- package/lib/sections/languages/LanguageSection.css +53 -0
- package/lib/sections/languages/LanguageSection.d.ts +2 -0
- package/lib/sections/languages/LanguageSection.d.ts.map +1 -1
- package/lib/sections/languages/LanguageSection.js +42 -31
- package/lib/sections/languages/mutations.d.ts.map +1 -1
- package/lib/sections/languages/mutations.js +60 -161
- package/lib/sections/languages/selectors.d.ts.map +1 -1
- package/lib/sections/languages/selectors.js +1 -2
- package/lib/sections/projects/ProjectEditDialog.d.ts +2 -1
- package/lib/sections/projects/ProjectEditDialog.d.ts.map +1 -1
- package/lib/sections/projects/ProjectEditDialog.js +13 -24
- package/lib/sections/projects/ProjectSection.css +368 -0
- package/lib/sections/projects/ProjectSection.d.ts +2 -1
- package/lib/sections/projects/ProjectSection.d.ts.map +1 -1
- package/lib/sections/projects/ProjectSection.js +116 -34
- package/lib/sections/projects/mutations.d.ts.map +1 -1
- package/lib/sections/projects/mutations.js +109 -132
- package/lib/sections/projects/selectors.d.ts.map +1 -1
- package/lib/sections/projects/selectors.js +4 -45
- package/lib/{QRCodeCard.d.ts → sections/qrcode/QRCodeCard.d.ts} +2 -1
- package/lib/sections/qrcode/QRCodeCard.d.ts.map +1 -0
- package/lib/{QRCodeCard.js → sections/qrcode/QRCodeCard.js} +59 -11
- package/lib/sections/qrcode/QRCodeSection.css +108 -0
- package/lib/sections/qrcode/QRCodeSection.d.ts +4 -0
- package/lib/sections/qrcode/QRCodeSection.d.ts.map +1 -0
- package/lib/sections/qrcode/QRCodeSection.js +17 -0
- package/lib/sections/resume/ResumeEditDialog.d.ts +10 -1
- package/lib/sections/resume/ResumeEditDialog.d.ts.map +1 -1
- package/lib/sections/resume/ResumeEditDialog.js +531 -149
- package/lib/sections/resume/ResumeSection.css +350 -0
- package/lib/sections/resume/ResumeSection.d.ts +3 -2
- package/lib/sections/resume/ResumeSection.d.ts.map +1 -1
- package/lib/sections/resume/ResumeSection.js +78 -49
- package/lib/sections/resume/mutations.d.ts.map +1 -1
- package/lib/sections/resume/mutations.js +17 -3
- package/lib/sections/resume/selectors.d.ts.map +1 -1
- package/lib/sections/resume/selectors.js +1 -0
- package/lib/sections/resume/types.d.ts +1 -0
- package/lib/sections/resume/types.d.ts.map +1 -1
- package/lib/sections/shared/collapsibleSection.d.ts.map +1 -1
- package/lib/sections/shared/collapsibleSection.js +1 -0
- package/lib/sections/shared/phoneCountries.d.ts +1 -1
- package/lib/sections/shared/phoneCountries.d.ts.map +1 -1
- package/lib/sections/shared/phoneCountries.js +2 -2
- package/lib/sections/shared/projectCommunityNodes.d.ts +6 -0
- package/lib/sections/shared/projectCommunityNodes.d.ts.map +1 -0
- package/lib/sections/shared/projectCommunityNodes.js +56 -0
- package/lib/sections/shared/rdfMutationHelpers.d.ts +35 -2
- package/lib/sections/shared/rdfMutationHelpers.d.ts.map +1 -1
- package/lib/sections/shared/rdfMutationHelpers.js +290 -14
- package/lib/sections/shared/sectionCardHelpers.d.ts.map +1 -1
- package/lib/sections/shared/sectionCardHelpers.js +80 -11
- package/lib/sections/shared/types.d.ts +24 -0
- package/lib/sections/shared/types.d.ts.map +1 -1
- package/lib/sections/skills/SkillsEditDialog.d.ts +3 -1
- package/lib/sections/skills/SkillsEditDialog.d.ts.map +1 -1
- package/lib/sections/skills/SkillsEditDialog.js +136 -115
- package/lib/sections/skills/SkillsSection.css +173 -0
- package/lib/sections/skills/SkillsSection.d.ts +2 -0
- package/lib/sections/skills/SkillsSection.d.ts.map +1 -1
- package/lib/sections/skills/SkillsSection.js +107 -47
- package/lib/sections/skills/mutations.d.ts.map +1 -1
- package/lib/sections/skills/mutations.js +25 -21
- package/lib/sections/skills/selectors.d.ts.map +1 -1
- package/lib/sections/skills/selectors.js +5 -3
- package/lib/sections/social/SocialEditDialog.d.ts +3 -1
- package/lib/sections/social/SocialEditDialog.d.ts.map +1 -1
- package/lib/sections/social/SocialEditDialog.js +170 -62
- package/lib/sections/social/SocialSection.css +194 -0
- package/lib/sections/social/SocialSection.d.ts +4 -3
- package/lib/sections/social/SocialSection.d.ts.map +1 -1
- package/lib/sections/social/SocialSection.js +59 -43
- package/lib/sections/social/mutations.d.ts.map +1 -1
- package/lib/sections/social/mutations.js +23 -132
- package/lib/specialButtons/AddMeToYourFriends.css +54 -0
- package/lib/specialButtons/addContact/AddMeToYourContacts.css +1118 -0
- package/lib/specialButtons/addContact/ContactCreationDialog.d.ts +10 -0
- package/lib/specialButtons/addContact/ContactCreationDialog.d.ts.map +1 -0
- package/lib/specialButtons/addContact/ContactCreationDialog.js +1123 -0
- package/lib/specialButtons/addContact/addMeToYourContacts.d.ts +16 -0
- package/lib/specialButtons/addContact/addMeToYourContacts.d.ts.map +1 -0
- package/lib/specialButtons/addContact/addMeToYourContacts.js +136 -0
- package/lib/specialButtons/addContact/contactsErrors.d.ts +8 -0
- package/lib/specialButtons/addContact/contactsErrors.d.ts.map +1 -0
- package/lib/specialButtons/addContact/contactsErrors.js +106 -0
- package/lib/specialButtons/addContact/contactsTypes.d.ts +43 -0
- package/lib/specialButtons/addContact/contactsTypes.d.ts.map +1 -0
- package/lib/specialButtons/addContact/contactsTypes.js +5 -0
- package/lib/specialButtons/addContact/helpers.d.ts +7 -0
- package/lib/specialButtons/addContact/helpers.d.ts.map +1 -0
- package/lib/specialButtons/addContact/helpers.js +103 -0
- package/lib/specialButtons/addContact/mutations.d.ts +16 -0
- package/lib/specialButtons/addContact/mutations.d.ts.map +1 -0
- package/lib/specialButtons/addContact/mutations.js +300 -0
- package/lib/specialButtons/addContact/selectors.d.ts +10 -0
- package/lib/specialButtons/addContact/selectors.d.ts.map +1 -0
- package/lib/specialButtons/addContact/selectors.js +163 -0
- package/lib/{addMeToYourFriends.d.ts → specialButtons/addMeToYourFriends.d.ts} +6 -4
- package/lib/specialButtons/addMeToYourFriends.d.ts.map +1 -0
- package/lib/{addMeToYourFriends.js → specialButtons/addMeToYourFriends.js} +46 -11
- package/lib/styles/CollapsibleSection.css +519 -0
- package/lib/styles/EditDialogs.css +506 -686
- package/lib/styles/EditDialogs.responsive.css +989 -0
- package/lib/texts/buttonTexts.d.ts +9 -0
- package/lib/texts/buttonTexts.d.ts.map +1 -0
- package/lib/texts/buttonTexts.js +14 -0
- package/lib/texts/dialogTexts.d.ts +14 -0
- package/lib/texts/dialogTexts.d.ts.map +1 -0
- package/lib/texts/dialogTexts.js +19 -0
- package/lib/texts/messageTexts.d.ts +42 -0
- package/lib/texts/messageTexts.d.ts.map +1 -0
- package/lib/texts/messageTexts.js +47 -0
- package/lib/texts/profileTexts.d.ts +14 -0
- package/lib/texts/profileTexts.d.ts.map +1 -0
- package/lib/texts/profileTexts.js +19 -0
- package/lib/texts/qrCodeTexts.d.ts +2 -0
- package/lib/texts/qrCodeTexts.d.ts.map +1 -0
- package/lib/texts/qrCodeTexts.js +7 -0
- package/lib/texts.d.ts +5 -60
- package/lib/texts.d.ts.map +1 -1
- package/lib/texts.js +55 -70
- package/lib/ui/dialog.css +233 -0
- package/lib/ui/dialog.d.ts +15 -1
- package/lib/ui/dialog.d.ts.map +1 -1
- package/lib/ui/dialog.js +245 -45
- package/lib/ui/dialog.responsive.css +195 -0
- package/lib/ui/errors.d.ts.map +1 -1
- package/lib/ui/errors.js +2 -1
- package/lib/ui/spinner.d.ts +3 -0
- package/lib/ui/spinner.d.ts.map +1 -0
- package/lib/ui/spinner.js +13 -0
- package/lib/utils/debug.d.ts +5 -0
- package/lib/utils/debug.d.ts.map +1 -0
- package/lib/utils/debug.js +23 -0
- package/lib/utils/errorDisplay.d.ts +2 -0
- package/lib/utils/errorDisplay.d.ts.map +1 -0
- package/lib/utils/errorDisplay.js +19 -0
- package/package.json +32 -25
- package/lib/ChatWithMe.d.ts +0 -7
- package/lib/ChatWithMe.d.ts.map +0 -1
- package/lib/ChatWithMe.js +0 -90
- package/lib/QRCodeCard.d.ts.map +0 -1
- package/lib/addMeToYourFriends.d.ts.map +0 -1
- package/lib/sections/heading/camera.d.ts +0 -19
- package/lib/sections/heading/camera.d.ts.map +0 -1
- package/lib/sections/heading/camera.js +0 -199
- package/lib/styles/BioSection.css +0 -77
- package/lib/styles/CVCard.css +0 -142
- package/lib/styles/ChatWithMe.css +0 -6
- package/lib/styles/ContactInfoEditDialog.css +0 -153
- package/lib/styles/EducationCard.css +0 -103
- package/lib/styles/HeadingSection.css +0 -309
- package/lib/styles/ProfileCard.css +0 -66
- package/lib/styles/ProfileView.css +0 -65
- package/lib/styles/ProjectsCard.css +0 -206
- package/lib/styles/QRCodeCard.css +0 -43
- package/lib/styles/SocialCard.css +0 -89
- package/lib/styles/dialog.css +0 -209
- package/lib/styles/utilities.css +0 -740
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit-html';
|
|
2
|
+
import 'solid-ui/components/actions/button';
|
|
3
|
+
import type { Button as SolidUIButtonElement } from 'solid-ui/components/actions/button';
|
|
4
|
+
import { DataBrowserContext } from 'pane-registry';
|
|
5
|
+
import { NamedNode } from 'rdflib';
|
|
6
|
+
import { AddressBooksData } from './contactsTypes';
|
|
7
|
+
import './AddMeToYourContacts.css';
|
|
8
|
+
import type ContactsModuleRdfLib from '@solid-data-modules/contacts-rdflib';
|
|
9
|
+
type RefreshableSolidUIButton = SolidUIButtonElement & {
|
|
10
|
+
refresh?: () => void;
|
|
11
|
+
};
|
|
12
|
+
declare const addMeToYourContactsDiv: (subject: NamedNode, context: DataBrowserContext) => Promise<TemplateResult>;
|
|
13
|
+
declare const createAddMeToYourContactsButton: (subject: NamedNode, context: DataBrowserContext) => Promise<RefreshableSolidUIButton>;
|
|
14
|
+
declare function saveNewContact(subject: NamedNode, context: DataBrowserContext, contactsModule: ContactsModuleRdfLib, addressBooksData: AddressBooksData): Promise<void>;
|
|
15
|
+
export { addMeToYourContactsDiv, createAddMeToYourContactsButton, saveNewContact };
|
|
16
|
+
//# sourceMappingURL=addMeToYourContacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addMeToYourContacts.d.ts","sourceRoot":"","sources":["../../../src/specialButtons/addContact/addMeToYourContacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,MAAM,IAAI,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,EAAa,SAAS,EAAE,MAAM,QAAQ,CAAA;AAM7C,OAAO,EAAE,gBAAgB,EAAe,MAAM,iBAAiB,CAAA;AAK/D,OAAO,2BAA2B,CAAA;AAClC,OAAO,KAAK,oBAAoB,MAAM,qCAAqC,CAAA;AAK3E,KAAK,wBAAwB,GAAG,oBAAoB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAA;AAuB/E,QAAA,MAAM,sBAAsB,GAC1B,SAAS,SAAS,EAClB,SAAS,kBAAkB,KAC1B,OAAO,CAAC,cAAc,CAaxB,CAAA;AAED,QAAA,MAAM,+BAA+B,GACnC,SAAS,SAAS,EAClB,SAAS,kBAAkB,KAC1B,OAAO,CAAC,wBAAwB,CAyDlC,CAAA;AAED,iBAAe,cAAc,CAC3B,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,kBAAkB,EAC3B,cAAc,EAAE,oBAAoB,EACpC,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,IAAI,CAAC,CA4Bf;AAED,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAC/B,cAAc,EACf,CAAA"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createAddMeToYourContactsButton = exports.addMeToYourContactsDiv = void 0;
|
|
7
|
+
exports.saveNewContact = saveNewContact;
|
|
8
|
+
var _litHtml = require("lit-html");
|
|
9
|
+
require("solid-ui/components/actions/button");
|
|
10
|
+
var _solidLogic = require("solid-logic");
|
|
11
|
+
var _buttonsHelper = require("../../buttonsHelper");
|
|
12
|
+
var _selectors = require("./selectors");
|
|
13
|
+
var _mutations = require("./mutations");
|
|
14
|
+
var _texts = require("../../texts");
|
|
15
|
+
require("./AddMeToYourContacts.css");
|
|
16
|
+
var _contactsErrors = require("./contactsErrors");
|
|
17
|
+
var _ContactCreationDialog = require("./ContactCreationDialog");
|
|
18
|
+
var _profileIcons = require("../../icons-svg/profileIcons");
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
|
+
function renderAddToContactsButtonLabel(button, label, showIcon = false) {
|
|
21
|
+
const buttonDocument = button.ownerDocument;
|
|
22
|
+
const content = [];
|
|
23
|
+
if (showIcon) {
|
|
24
|
+
const iconWrapper = buttonDocument.createElement('span');
|
|
25
|
+
iconWrapper.className = 'profile__btn-contacts-icon inline-flex-row justify-center';
|
|
26
|
+
iconWrapper.setAttribute('aria-hidden', 'true');
|
|
27
|
+
(0, _litHtml.render)(_profileIcons.plusIcon, iconWrapper);
|
|
28
|
+
content.push(iconWrapper);
|
|
29
|
+
}
|
|
30
|
+
const labelWrapper = buttonDocument.createElement('span');
|
|
31
|
+
labelWrapper.className = 'profile__btn-contacts-label';
|
|
32
|
+
labelWrapper.textContent = label;
|
|
33
|
+
content.push(labelWrapper);
|
|
34
|
+
button.replaceChildren(...content);
|
|
35
|
+
}
|
|
36
|
+
let buttonContainer = document.createElement('section');
|
|
37
|
+
const addMeToYourContactsDiv = async (subject, context) => {
|
|
38
|
+
buttonContainer = context.dom.createElement('section');
|
|
39
|
+
buttonContainer.setAttribute('id', 'add-to-contacts-button-container');
|
|
40
|
+
buttonContainer.setAttribute('class', 'profile-contacts-button__section text-truncate text-center section-centered');
|
|
41
|
+
buttonContainer.setAttribute('aria-label', 'Add me to your contacts actions');
|
|
42
|
+
buttonContainer.setAttribute('data-testid', 'button');
|
|
43
|
+
buttonContainer.hidden = true;
|
|
44
|
+
const button = await createAddMeToYourContactsButton(subject, context);
|
|
45
|
+
button.classList.add('profile__action-button', 'profile__btn-contacts', 'flex-center');
|
|
46
|
+
buttonContainer.appendChild(button);
|
|
47
|
+
return (0, _litHtml.html)`${buttonContainer}`;
|
|
48
|
+
};
|
|
49
|
+
exports.addMeToYourContactsDiv = addMeToYourContactsDiv;
|
|
50
|
+
const createAddMeToYourContactsButton = async (subject, context) => {
|
|
51
|
+
const me = _solidLogic.authn.currentUser();
|
|
52
|
+
let addressBooksData = null;
|
|
53
|
+
let contactData = null;
|
|
54
|
+
const store = context.session.store;
|
|
55
|
+
const fetcher = store.fetcher;
|
|
56
|
+
const updater = store.updater;
|
|
57
|
+
const {
|
|
58
|
+
default: ContactsModuleRdfLib
|
|
59
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require('@solid-data-modules/contacts-rdflib')));
|
|
60
|
+
const contactsModule = new ContactsModuleRdfLib({
|
|
61
|
+
store,
|
|
62
|
+
fetcher,
|
|
63
|
+
updater
|
|
64
|
+
});
|
|
65
|
+
try {
|
|
66
|
+
addressBooksData = await (0, _selectors.getAddressBooksData)(context, contactsModule);
|
|
67
|
+
contactData = await (0, _selectors.getContactData)(store, subject);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
(0, _contactsErrors.addErrorToErrorDisplay)(context, error);
|
|
70
|
+
}
|
|
71
|
+
function setButtonHandler(event) {
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
saveNewContact(subject, context, contactsModule, addressBooksData).catch(error => {
|
|
74
|
+
(0, _buttonsHelper.clearPreviousMessage)(buttonContainer);
|
|
75
|
+
(0, _buttonsHelper.complain)(buttonContainer, context, error);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const label = (0, _buttonsHelper.checkIfAnyUserLoggedIn)(me) ? _texts.addMeToYourContactsButtonText : _texts.logInAddMeToYourContactsButtonText;
|
|
79
|
+
const button = context.dom.createElement('solid-ui-button');
|
|
80
|
+
button.setAttribute('type', 'button');
|
|
81
|
+
button.setAttribute('variant', 'secondary');
|
|
82
|
+
button.setAttribute('size', 'sm');
|
|
83
|
+
button.addEventListener('click', setButtonHandler);
|
|
84
|
+
button.setAttribute('id', 'add-to-contacts-button');
|
|
85
|
+
renderAddToContactsButtonLabel(button, label, (0, _buttonsHelper.checkIfAnyUserLoggedIn)(me));
|
|
86
|
+
button.refresh = refreshButton;
|
|
87
|
+
refreshButton();
|
|
88
|
+
function refreshButton() {
|
|
89
|
+
if ((0, _buttonsHelper.checkIfAnyUserLoggedIn)(me)) {
|
|
90
|
+
button.disabled = false;
|
|
91
|
+
button.removeAttribute('disabled');
|
|
92
|
+
const contactExistsByWebID = contactData ? (0, _selectors.checkIfContactExistsByWebID)(addressBooksData, contactData.webID) : false;
|
|
93
|
+
const contactExistsByName = contactData ? (0, _selectors.checkIfContactExistsByName)(addressBooksData, contactData.name) : false;
|
|
94
|
+
if (contactExistsByWebID) {
|
|
95
|
+
renderAddToContactsButtonLabel(button, _texts.contactExistsAlreadyButtonText);
|
|
96
|
+
button.disabled = true;
|
|
97
|
+
button.setAttribute('disabled', 'true');
|
|
98
|
+
} else if (contactExistsByName) {
|
|
99
|
+
renderAddToContactsButtonLabel(button, _texts.contactExistsAlreadyByNameButtonText);
|
|
100
|
+
} else {
|
|
101
|
+
renderAddToContactsButtonLabel(button, _texts.addMeToYourContactsButtonText, true);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
renderAddToContactsButtonLabel(button, _texts.logInAddMeToYourContactsButtonText);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return button;
|
|
108
|
+
};
|
|
109
|
+
exports.createAddMeToYourContactsButton = createAddMeToYourContactsButton;
|
|
110
|
+
async function saveNewContact(subject, context, contactsModule, addressBooksData) {
|
|
111
|
+
const me = _solidLogic.authn.currentUser();
|
|
112
|
+
const store = context.session.store;
|
|
113
|
+
|
|
114
|
+
// need to find out where the user wants to add the Contact
|
|
115
|
+
if ((0, _buttonsHelper.checkIfAnyUserLoggedIn)(me)) {
|
|
116
|
+
if (!(0, _selectors.checkIfContactExistsByWebID)(addressBooksData, subject.value)) {
|
|
117
|
+
//if contact does not exist, we add her/him
|
|
118
|
+
await store.fetcher.load(me);
|
|
119
|
+
try {
|
|
120
|
+
const contactData = await (0, _selectors.getContactData)(store, subject);
|
|
121
|
+
const contactExistsByNameUri = (0, _selectors.checkIfContactExistsByName)(addressBooksData, contactData.name);
|
|
122
|
+
if (contactExistsByNameUri) {
|
|
123
|
+
const fromRegisteredAddressBook = true;
|
|
124
|
+
const handled = (0, _ContactCreationDialog.handleContactExistsByName)(context, addressBooksData, contactData, contactExistsByNameUri, fromRegisteredAddressBook);
|
|
125
|
+
if (!handled) (0, _contactsErrors.addErrorToErrorDisplay)(context, _texts.errorAddingContactWebIDToAddressBook);
|
|
126
|
+
} else {
|
|
127
|
+
await (0, _mutations.addContactToAddressBook)(context, contactsModule, contactData, addressBooksData, buttonContainer);
|
|
128
|
+
}
|
|
129
|
+
} catch (error) {
|
|
130
|
+
let errorMessage = error;
|
|
131
|
+
if (errorMessage.toString().includes('Unauthenticated')) errorMessage = _texts.userNotLoggedInErrorMessage;
|
|
132
|
+
throw new Error(errorMessage);
|
|
133
|
+
}
|
|
134
|
+
} else throw new Error(_texts.contactExistsMessage);
|
|
135
|
+
} else throw new Error(_texts.userNotLoggedInErrorMessage);
|
|
136
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataBrowserContext } from 'pane-registry';
|
|
2
|
+
declare function formatContactsDialogError(prefix: string, error: unknown): string;
|
|
3
|
+
declare const addErrorToErrorDisplay: (context: DataBrowserContext, message: string) => void;
|
|
4
|
+
declare const checkAndAddErrorToDisplay: (context: DataBrowserContext, message: string) => void;
|
|
5
|
+
declare const createErrorDisplaySection: (context: DataBrowserContext) => HTMLElement;
|
|
6
|
+
declare const checkAndRemoveErrorDisplay: (context: DataBrowserContext) => void;
|
|
7
|
+
export { createErrorDisplaySection, checkAndRemoveErrorDisplay, addErrorToErrorDisplay, checkAndAddErrorToDisplay, formatContactsDialogError };
|
|
8
|
+
//# sourceMappingURL=contactsErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contactsErrors.d.ts","sourceRoot":"","sources":["../../../src/specialButtons/addContact/contactsErrors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAO,eAAe,CAAA;AAOnD,iBAAS,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAGzE;AAMD,QAAA,MAAM,sBAAsB,GAC1B,SAAS,kBAAkB,EAC3B,SAAS,MAAM,SA4BhB,CAAA;AAED,QAAA,MAAM,yBAAyB,GAC7B,SAAS,kBAAkB,EAC3B,SAAS,MAAM,SAWhB,CAAA;AAED,QAAA,MAAM,yBAAyB,GAC7B,SAAS,kBAAkB,KAC1B,WAmCF,CAAA;AAED,QAAA,MAAM,0BAA0B,GAC9B,SAAS,kBAAkB,SAiB5B,CAAA;AAED,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,CAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createErrorDisplaySection = exports.checkAndRemoveErrorDisplay = exports.checkAndAddErrorToDisplay = exports.addErrorToErrorDisplay = void 0;
|
|
7
|
+
exports.formatContactsDialogError = formatContactsDialogError;
|
|
8
|
+
var _buttonsHelper = require("../../buttonsHelper");
|
|
9
|
+
function toErrorMessage(error) {
|
|
10
|
+
return error instanceof Error ? error.message : String(error);
|
|
11
|
+
}
|
|
12
|
+
function formatContactsDialogError(prefix, error) {
|
|
13
|
+
const message = toErrorMessage(error);
|
|
14
|
+
return message.startsWith(prefix) ? message : `${prefix}\n${message}`;
|
|
15
|
+
}
|
|
16
|
+
function getSharedDialogErrorSection(context) {
|
|
17
|
+
return context.dom.querySelector('#profile-modal #modal-error');
|
|
18
|
+
}
|
|
19
|
+
const addErrorToErrorDisplay = (context, message) => {
|
|
20
|
+
const sharedDialogErrorSection = getSharedDialogErrorSection(context);
|
|
21
|
+
if (sharedDialogErrorSection && context.dom.getElementById('contacts-addressbook-picker-dialog')) {
|
|
22
|
+
sharedDialogErrorSection.textContent = message;
|
|
23
|
+
sharedDialogErrorSection.setAttribute('aria-hidden', 'false');
|
|
24
|
+
sharedDialogErrorSection.hidden = false;
|
|
25
|
+
sharedDialogErrorSection.focus();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const errorDisplaySection = context.dom.getElementById('error-display-section');
|
|
29
|
+
if (errorDisplaySection) {
|
|
30
|
+
const errorMessage = context.dom.getElementById('error-display-message');
|
|
31
|
+
errorDisplaySection.classList.add('contacts-dialog__error--visible');
|
|
32
|
+
errorDisplaySection.setAttribute('aria-hidden', 'false');
|
|
33
|
+
if (errorMessage) {
|
|
34
|
+
errorMessage.textContent = message;
|
|
35
|
+
} else {
|
|
36
|
+
errorDisplaySection.textContent = message;
|
|
37
|
+
}
|
|
38
|
+
if (errorDisplaySection instanceof HTMLElement) {
|
|
39
|
+
errorDisplaySection.focus();
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
const buttonContainer = context.dom.getElementById('add-to-contacts-button-container');
|
|
43
|
+
(0, _buttonsHelper.complain)(buttonContainer, context, message);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.addErrorToErrorDisplay = addErrorToErrorDisplay;
|
|
47
|
+
const checkAndAddErrorToDisplay = (context, message) => {
|
|
48
|
+
const selectedGroupElements = context.dom.querySelectorAll('#group-list .contacts-dialog__list-button[selected]');
|
|
49
|
+
const groupNameField = context.dom.querySelector('#groupNameInput');
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
const enteredGroupName = groupNameField.value;
|
|
52
|
+
if (selectedGroupElements.length === 0 && !enteredGroupName) {
|
|
53
|
+
addErrorToErrorDisplay(context, message);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.checkAndAddErrorToDisplay = checkAndAddErrorToDisplay;
|
|
57
|
+
const createErrorDisplaySection = context => {
|
|
58
|
+
const setButtonOnClickHandler = event => {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
errorDisplaySection.classList.remove('contacts-dialog__error--visible');
|
|
61
|
+
errorDisplaySection.setAttribute('aria-hidden', 'true');
|
|
62
|
+
const errorMessage = context.dom.getElementById('error-display-message');
|
|
63
|
+
if (errorMessage) errorMessage.textContent = '';
|
|
64
|
+
};
|
|
65
|
+
const errorDisplaySection = context.dom.createElement('section');
|
|
66
|
+
errorDisplaySection.setAttribute('role', 'alert');
|
|
67
|
+
errorDisplaySection.setAttribute('aria-live', 'assertive');
|
|
68
|
+
errorDisplaySection.setAttribute('aria-atomic', 'true');
|
|
69
|
+
errorDisplaySection.setAttribute('aria-hidden', 'true');
|
|
70
|
+
errorDisplaySection.setAttribute('aria-label', 'Section to display error messages related to contact creation');
|
|
71
|
+
errorDisplaySection.setAttribute('id', 'error-display-section');
|
|
72
|
+
errorDisplaySection.setAttribute('tabindex', '-1');
|
|
73
|
+
errorDisplaySection.classList.add('contacts-dialog__error');
|
|
74
|
+
const closeButton = context.dom.createElement('solid-ui-button');
|
|
75
|
+
closeButton.setAttribute('type', 'button');
|
|
76
|
+
closeButton.setAttribute('variant', 'icon');
|
|
77
|
+
closeButton.setAttribute('size', 'sm');
|
|
78
|
+
closeButton.setAttribute('aria-label', 'Close error');
|
|
79
|
+
closeButton.setAttribute('label', 'Close error');
|
|
80
|
+
closeButton.classList.add('contacts-dialog__error-close');
|
|
81
|
+
closeButton.textContent = 'x';
|
|
82
|
+
closeButton.addEventListener('click', setButtonOnClickHandler);
|
|
83
|
+
const errorMessage = context.dom.createElement('p');
|
|
84
|
+
errorMessage.setAttribute('id', 'error-display-message');
|
|
85
|
+
errorDisplaySection.appendChild(closeButton);
|
|
86
|
+
errorDisplaySection.appendChild(errorMessage);
|
|
87
|
+
return errorDisplaySection;
|
|
88
|
+
};
|
|
89
|
+
exports.createErrorDisplaySection = createErrorDisplaySection;
|
|
90
|
+
const checkAndRemoveErrorDisplay = context => {
|
|
91
|
+
const sharedDialogErrorSection = getSharedDialogErrorSection(context);
|
|
92
|
+
if (sharedDialogErrorSection && context.dom.getElementById('contacts-addressbook-picker-dialog')) {
|
|
93
|
+
sharedDialogErrorSection.textContent = '';
|
|
94
|
+
sharedDialogErrorSection.setAttribute('aria-hidden', 'true');
|
|
95
|
+
sharedDialogErrorSection.hidden = true;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const errorDisplaySection = context.dom.getElementById('error-display-section');
|
|
99
|
+
if (errorDisplaySection && errorDisplaySection.classList.contains('contacts-dialog__error--visible')) {
|
|
100
|
+
errorDisplaySection.classList.remove('contacts-dialog__error--visible');
|
|
101
|
+
errorDisplaySection.setAttribute('aria-hidden', 'true');
|
|
102
|
+
const errorMessage = context.dom.getElementById('error-display-message');
|
|
103
|
+
if (errorMessage) errorMessage.textContent = '';
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
exports.checkAndRemoveErrorDisplay = checkAndRemoveErrorDisplay;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { NamedNode } from 'rdflib';
|
|
2
|
+
export interface SelectedAddressBookUris {
|
|
3
|
+
addressBookUri: string;
|
|
4
|
+
groupUris: string[];
|
|
5
|
+
}
|
|
6
|
+
export type GroupData = {
|
|
7
|
+
name: string;
|
|
8
|
+
uri: string;
|
|
9
|
+
};
|
|
10
|
+
export type ContactDataFromAddressBook = {
|
|
11
|
+
name: string;
|
|
12
|
+
uri: string;
|
|
13
|
+
};
|
|
14
|
+
export interface AddressBookDetails {
|
|
15
|
+
name: string;
|
|
16
|
+
groups: GroupData[];
|
|
17
|
+
contacts: ContactDataFromAddressBook[];
|
|
18
|
+
}
|
|
19
|
+
export interface AddressBooksData {
|
|
20
|
+
public: Map<string, AddressBookDetails>;
|
|
21
|
+
private: Map<string, AddressBookDetails>;
|
|
22
|
+
contactWebIDs: Map<string, string>;
|
|
23
|
+
contactNames: Map<string, string>;
|
|
24
|
+
}
|
|
25
|
+
export interface EmailDetails {
|
|
26
|
+
type: NamedNode;
|
|
27
|
+
email: NamedNode;
|
|
28
|
+
}
|
|
29
|
+
export interface PhoneDetails {
|
|
30
|
+
type: NamedNode;
|
|
31
|
+
phoneNumber: NamedNode;
|
|
32
|
+
}
|
|
33
|
+
export interface ContactData {
|
|
34
|
+
name: string;
|
|
35
|
+
nickname?: string;
|
|
36
|
+
preferredSubjectPronoun?: string;
|
|
37
|
+
preferredObjectPronoun?: string;
|
|
38
|
+
preferredRelativePronoun?: string;
|
|
39
|
+
emails?: EmailDetails[];
|
|
40
|
+
phoneNumbers?: PhoneDetails[];
|
|
41
|
+
webID: string;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=contactsTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contactsTypes.d.ts","sourceRoot":"","sources":["../../../src/specialButtons/addContact/contactsTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAElC,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,EAAG,CAAA;CACrB;AACD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AACD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,EAAE,CAAA;IACnB,QAAQ,EAAE,0BAA0B,EAAE,CAAA;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACxC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACzC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,CAAA;IACjC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,CAAA;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,SAAS,CAAA;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,SAAS,CAAA;CACvB;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAA;CACd"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataBrowserContext } from 'pane-registry';
|
|
2
|
+
import { AddressBookDetails, AddressBooksData, ContactData, GroupData } from './contactsTypes';
|
|
3
|
+
declare function refreshButton(context: DataBrowserContext, addressBooksData: AddressBooksData, contactData: ContactData): void;
|
|
4
|
+
declare function addGroupToAddressBookData(addressBooksData: AddressBooksData, addressBookUri: string, group: GroupData): boolean;
|
|
5
|
+
declare function addAddressBookToAddressBooksData(addressBooksData: AddressBooksData, addressBookUri: string, addressBook: AddressBookDetails, visibility?: 'public' | 'private'): AddressBooksData;
|
|
6
|
+
export { refreshButton, addGroupToAddressBookData, addAddressBookToAddressBooksData };
|
|
7
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/specialButtons/addContact/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAQlD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAmC9F,iBAAS,aAAa,CACpB,OAAO,EAAE,kBAAkB,EAC3B,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,QAoBzB;AAED,iBAAS,yBAAyB,CAChC,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,SAAS,GACf,OAAO,CA0BT;AAED,iBAAS,gCAAgC,CACvC,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,kBAAkB,EAC/B,UAAU,GAAE,QAAQ,GAAG,SAAqB,GAC3C,gBAAgB,CAuBlB;AAED,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,gCAAgC,EACjC,CAAA"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.addAddressBookToAddressBooksData = addAddressBookToAddressBooksData;
|
|
7
|
+
exports.addGroupToAddressBookData = addGroupToAddressBookData;
|
|
8
|
+
exports.refreshButton = refreshButton;
|
|
9
|
+
var _solidLogic = require("solid-logic");
|
|
10
|
+
var _texts = require("../../texts");
|
|
11
|
+
var _buttonsHelper = require("../../buttonsHelper");
|
|
12
|
+
var _selectors = require("./selectors");
|
|
13
|
+
var _profileIcons = require("../../icons-svg/profileIcons");
|
|
14
|
+
const addAsContactButtonText = 'Add as Contact';
|
|
15
|
+
function setAddToContactsButtonContent(button, label, showIcon = false) {
|
|
16
|
+
if (!button) return;
|
|
17
|
+
const {
|
|
18
|
+
ownerDocument
|
|
19
|
+
} = button;
|
|
20
|
+
const content = [];
|
|
21
|
+
if (showIcon) {
|
|
22
|
+
const iconWrapper = ownerDocument.createElement('span');
|
|
23
|
+
iconWrapper.className = 'profile__btn-contacts-icon inline-flex-row justify-center';
|
|
24
|
+
iconWrapper.setAttribute('aria-hidden', 'true');
|
|
25
|
+
renderIconIntoElement(iconWrapper);
|
|
26
|
+
content.push(iconWrapper);
|
|
27
|
+
}
|
|
28
|
+
const labelWrapper = ownerDocument.createElement('span');
|
|
29
|
+
labelWrapper.className = 'profile__btn-contacts-label';
|
|
30
|
+
labelWrapper.textContent = label;
|
|
31
|
+
content.push(labelWrapper);
|
|
32
|
+
button.replaceChildren(...content);
|
|
33
|
+
}
|
|
34
|
+
function renderIconIntoElement(element) {
|
|
35
|
+
const svgTemplate = _profileIcons.plusIcon;
|
|
36
|
+
if ('innerHTML' in element && svgTemplate && Array.isArray(svgTemplate.strings)) {
|
|
37
|
+
element.innerHTML = svgTemplate.strings.join('');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function refreshButton(context, addressBooksData, contactData) {
|
|
41
|
+
const me = _solidLogic.authn.currentUser();
|
|
42
|
+
const button = context.dom.getElementById('add-to-contacts-button');
|
|
43
|
+
if ((0, _buttonsHelper.checkIfAnyUserLoggedIn)(me)) {
|
|
44
|
+
const contactExistsByWebID = (0, _selectors.checkIfContactExistsByWebID)(addressBooksData, contactData.webID);
|
|
45
|
+
const contactExistsByName = (0, _selectors.checkIfContactExistsByName)(addressBooksData, contactData.name);
|
|
46
|
+
if (contactExistsByWebID) {
|
|
47
|
+
setAddToContactsButtonContent(button, _texts.contactExistsAlreadyButtonText);
|
|
48
|
+
button.onclick = null;
|
|
49
|
+
button.setAttribute('disabled', '');
|
|
50
|
+
} else if (contactExistsByName) {
|
|
51
|
+
setAddToContactsButtonContent(button, _texts.contactExistsAlreadyByNameButtonText);
|
|
52
|
+
button.removeAttribute('disabled');
|
|
53
|
+
} else {
|
|
54
|
+
setAddToContactsButtonContent(button, addAsContactButtonText, true);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
setAddToContactsButtonContent(button, _texts.logInAddMeToYourContactsButtonText);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function addGroupToAddressBookData(addressBooksData, addressBookUri, group) {
|
|
61
|
+
const publicAddressBook = addressBooksData.public.get(addressBookUri);
|
|
62
|
+
if (publicAddressBook) {
|
|
63
|
+
const groupExists = publicAddressBook.groups.some(existingGroup => existingGroup.uri === group.uri);
|
|
64
|
+
if (!groupExists) {
|
|
65
|
+
addressBooksData.public.set(addressBookUri, {
|
|
66
|
+
...publicAddressBook,
|
|
67
|
+
groups: [...publicAddressBook.groups, group]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
const privateAddressBook = addressBooksData.private.get(addressBookUri);
|
|
73
|
+
if (privateAddressBook) {
|
|
74
|
+
const groupExists = privateAddressBook.groups.some(existingGroup => existingGroup.uri === group.uri);
|
|
75
|
+
if (!groupExists) {
|
|
76
|
+
addressBooksData.private.set(addressBookUri, {
|
|
77
|
+
...privateAddressBook,
|
|
78
|
+
groups: [...privateAddressBook.groups, group]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
function addAddressBookToAddressBooksData(addressBooksData, addressBookUri, addressBook, visibility = 'private') {
|
|
86
|
+
const nextAddressBooksData = {
|
|
87
|
+
public: new Map(addressBooksData.public),
|
|
88
|
+
private: new Map(addressBooksData.private),
|
|
89
|
+
contactWebIDs: addressBooksData.contactWebIDs,
|
|
90
|
+
contactNames: addressBooksData.contactNames
|
|
91
|
+
};
|
|
92
|
+
const existingAddressBook = nextAddressBooksData.public.get(addressBookUri) || nextAddressBooksData.private.get(addressBookUri);
|
|
93
|
+
const nextAddressBook = existingAddressBook ? {
|
|
94
|
+
...existingAddressBook,
|
|
95
|
+
...addressBook,
|
|
96
|
+
groups: addressBook.groups.length ? addressBook.groups : existingAddressBook.groups,
|
|
97
|
+
contacts: addressBook.contacts.length ? addressBook.contacts : existingAddressBook.contacts
|
|
98
|
+
} : addressBook;
|
|
99
|
+
nextAddressBooksData.public.delete(addressBookUri);
|
|
100
|
+
nextAddressBooksData.private.delete(addressBookUri);
|
|
101
|
+
nextAddressBooksData[visibility].set(addressBookUri, nextAddressBook);
|
|
102
|
+
return nextAddressBooksData;
|
|
103
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ContactsModuleRdfLib from '@solid-data-modules/contacts-rdflib';
|
|
2
|
+
import { DataBrowserContext } from 'pane-registry';
|
|
3
|
+
import { AddressBookDetails, AddressBooksData, ContactData, SelectedAddressBookUris } from './contactsTypes';
|
|
4
|
+
declare function addContactToAddressBook(context: DataBrowserContext, contactsModule: ContactsModuleRdfLib, contactData: ContactData, addressBooksData: AddressBooksData, container: HTMLDivElement): Promise<void>;
|
|
5
|
+
declare function addANewAddressBookUriToAddressBooks(context: DataBrowserContext, contactsModule: ContactsModuleRdfLib, _addressBooksData: AddressBooksData, enteredAddressBookUri: string): Promise<{
|
|
6
|
+
addressBooksData: AddressBooksData;
|
|
7
|
+
addressBook: AddressBookDetails;
|
|
8
|
+
addressBookUri: string | null;
|
|
9
|
+
}>;
|
|
10
|
+
declare function createContactInAddressBook(context: DataBrowserContext, contactsModule: ContactsModuleRdfLib, contactData: ContactData, selectedAddressBookUris: SelectedAddressBookUris): Promise<string>;
|
|
11
|
+
declare function addAddressToTypeIndex(context: DataBrowserContext, typeOfIndex: string, addressBookUri: string): Promise<boolean>;
|
|
12
|
+
declare function addWebIDToExistingContact(context: DataBrowserContext, contactData: ContactData, contactUri: string): Promise<void>;
|
|
13
|
+
declare function updateAddressBookName(context: DataBrowserContext, addressBookUri: string, newName: string): Promise<void>;
|
|
14
|
+
declare function handleAddressBookCreation(dataBrowserContext: DataBrowserContext, containerName: string, enteredAddressName: string): Promise<string>;
|
|
15
|
+
export { addContactToAddressBook, createContactInAddressBook, addAddressToTypeIndex, addWebIDToExistingContact, addANewAddressBookUriToAddressBooks, updateAddressBookName, handleAddressBookCreation };
|
|
16
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/specialButtons/addContact/mutations.ts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,MAAM,qCAAqC,CAAA;AAEtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAclD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAK5G,iBAAe,uBAAuB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,cAAc,EAAE,oBAAoB,EACpC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,cAAc,iBAgC1B;AAqDD,iBAAe,mCAAmC,CAChD,OAAO,EAAE,kBAAkB,EAC3B,cAAc,EAAE,oBAAoB,EACpC,iBAAiB,EAAE,gBAAgB,EACnC,qBAAqB,EAAE,MAAM,GAC5B,OAAO,CAAC;IAAE,gBAAgB,EAAE,gBAAgB,CAAC;IAAC,WAAW,EAAE,kBAAkB,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAUjH;AAqDD,iBAAe,0BAA0B,CACvC,OAAO,EAAE,kBAAkB,EAC3B,cAAc,EAAE,oBAAoB,EACpC,WAAW,EAAE,WAAW,EACxB,uBAAuB,EAAE,uBAAuB,GAC/C,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAED,iBAAe,qBAAqB,CAClC,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED,iBAAe,yBAAyB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,iBAYnB;AAkED,iBAAe,qBAAqB,CAClC,OAAO,EAAE,kBAAkB,EAC3B,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,iBA0BhB;AAED,iBAAe,yBAAyB,CACtC,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,CAAC,CA6CjB;AAED,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,mCAAmC,EACnC,qBAAqB,EACrB,yBAAyB,EAC1B,CAAA"}
|