@peers-app/peers-ui 0.34.4 → 0.34.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import { type IDoc, type IUser } from "@peers-app/peers-sdk";
|
|
1
2
|
interface IProps {
|
|
2
3
|
userId: string;
|
|
3
4
|
}
|
|
4
5
|
/** Edit a contact's signed profile fields and personal-context trust assignment. */
|
|
5
6
|
export declare const ContactDetails: (props: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* Forgets a contact: the trust level given to them, then their contact row, both in Personal so
|
|
9
|
+
* every one of the user's devices forgets them. Without the first, a person who stays in a group's
|
|
10
|
+
* records (a former member) would keep the trust they had as a contact.
|
|
11
|
+
*/
|
|
12
|
+
export declare function deleteContact(contact: IDoc<IUser>): Promise<void>;
|
|
6
13
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ContactDetails = void 0;
|
|
4
|
+
exports.deleteContact = deleteContact;
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
6
7
|
const input_1 = require("../../components/input");
|
|
@@ -22,7 +23,7 @@ const ContactDetails = (props) => {
|
|
|
22
23
|
if (!contact) {
|
|
23
24
|
return (0, jsx_runtime_1.jsx)(loading_indicator_1.LoadingIndicator, {});
|
|
24
25
|
}
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "container-xxl p-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h4", { children: (0, jsx_runtime_1.jsx)("i", { className: "bi-person-fill-check me-2" }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow-1", children: (0, jsx_runtime_1.jsx)("h4", { children: (0, jsx_runtime_1.jsx)(input_1.Input, { className: "border border-0", style: { width: "100%", outline: "none", backgroundColor: "transparent" }, value: contact.qs.name }, contact.userId) }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(save_button_1.SaveButton, { doc: contact }, contact.userId) })] }), (0, jsx_runtime_1.jsx)(tabs_1.Tabs, { tabs: [
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "container-xxl p-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h4", { children: (0, jsx_runtime_1.jsx)("i", { className: "bi-person-fill-check me-2" }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow-1", children: (0, jsx_runtime_1.jsx)("h4", { children: (0, jsx_runtime_1.jsx)(input_1.Input, { className: "border border-0", style: { width: "100%", outline: "none", backgroundColor: "transparent" }, value: contact.qs.name }, contact.userId) }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(save_button_1.SaveButton, { doc: contact, onDelete: () => deleteContact(contact) }, contact.userId) })] }), (0, jsx_runtime_1.jsx)(tabs_1.Tabs, { tabs: [
|
|
26
27
|
{
|
|
27
28
|
name: "Info",
|
|
28
29
|
content: ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(ContactInfo, { contact: contact }) })),
|
|
@@ -30,6 +31,19 @@ const ContactDetails = (props) => {
|
|
|
30
31
|
] }, contact.userId)] }));
|
|
31
32
|
};
|
|
32
33
|
exports.ContactDetails = ContactDetails;
|
|
34
|
+
/**
|
|
35
|
+
* Forgets a contact: the trust level given to them, then their contact row, both in Personal so
|
|
36
|
+
* every one of the user's devices forgets them. Without the first, a person who stays in a group's
|
|
37
|
+
* records (a former member) would keep the trust they had as a contact.
|
|
38
|
+
*/
|
|
39
|
+
async function deleteContact(contact) {
|
|
40
|
+
const userContext = await (0, peers_sdk_1.getUserContext)();
|
|
41
|
+
const trust = (0, peers_sdk_1.UserTrustLevels)(userContext.userDataContext);
|
|
42
|
+
if (await trust.get(contact.userId)) {
|
|
43
|
+
await trust.delete(contact.userId);
|
|
44
|
+
}
|
|
45
|
+
await contact.delete();
|
|
46
|
+
}
|
|
33
47
|
const ContactInfo = (props) => {
|
|
34
48
|
const { contact } = props;
|
|
35
49
|
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-grow-1", children: [(0, jsx_runtime_1.jsx)("small", { className: "text-muted d-block mb-1", children: "Name" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: contact.qs.name, className: "form-control mb-3 ps-2", placeholder: "Contact name", title: "Contact name" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-start ps-3", children: [(0, jsx_runtime_1.jsx)("small", { className: "text-muted d-block mb-1", children: "User ID" }), (0, jsx_runtime_1.jsx)("code", { className: "small", children: contact.userId })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-start ps-3", children: [(0, jsx_runtime_1.jsx)("small", { className: "text-muted d-block mb-1", children: "Trust Level" }), (0, jsx_runtime_1.jsx)(trust_level_dropdown_1.TrustLevelDropdown, { userId: contact.userId }), (0, jsx_runtime_1.jsx)("small", { className: "text-muted d-block mt-1", children: "Self grants this user full remote contract access." })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-3", children: [(0, jsx_runtime_1.jsx)("small", { children: "Public Key:" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: contact.qs.publicKey, className: "form-control mb-3 p-0 ps-2", placeholder: "Public key", title: "Public key" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-3", children: [(0, jsx_runtime_1.jsx)("small", { children: "Public Box Key:" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: contact.qs.publicBoxKey, className: "form-control mb-3 p-0 ps-2", placeholder: "Public box key", title: "Public box key" })] })] }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peers-app/peers-ui",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/peers-app/peers-ui.git"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"lint:fix": "biome check --write ."
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@peers-app/peers-sdk": "^0.34.
|
|
39
|
+
"@peers-app/peers-sdk": "^0.34.5",
|
|
40
40
|
"bootstrap": "^5.3.3",
|
|
41
41
|
"react": "^18.0.0",
|
|
42
42
|
"react-dom": "^18.0.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@babel/preset-react": "^7.24.1",
|
|
48
48
|
"@babel/preset-typescript": "^7.27.1",
|
|
49
49
|
"@biomejs/biome": "2.3.11",
|
|
50
|
-
"@peers-app/peers-sdk": "0.34.
|
|
50
|
+
"@peers-app/peers-sdk": "0.34.5",
|
|
51
51
|
"@testing-library/dom": "^10.4.0",
|
|
52
52
|
"@testing-library/jest-dom": "^6.6.3",
|
|
53
53
|
"@testing-library/react": "^16.3.0",
|