diff --git a/app/client/web/src/contacts/Contacts.tsx b/app/client/web/src/contacts/Contacts.tsx
new file mode 100644
index 00000000..ba7d9484
--- /dev/null
+++ b/app/client/web/src/contacts/Contacts.tsx
@@ -0,0 +1,8 @@
+import { Text } from '@mantine/core'
+import { useContacts } from './useContacts.hook';
+
+export function Contacts() {
+ const { state, actions } = useContacts();
+
+ return CONTACTS
+}
diff --git a/app/client/web/src/contacts/useContacts.hook.ts b/app/client/web/src/contacts/useContacts.hook.ts
new file mode 100644
index 00000000..b97c1502
--- /dev/null
+++ b/app/client/web/src/contacts/useContacts.hook.ts
@@ -0,0 +1,31 @@
+import { useState, useContext, useEffect } from 'react'
+import { AppContext } from '../context/AppContext'
+import { ContextType } from '../context/ContextType'
+import { Card } from 'databag-client-sdk'
+
+export function useContacts() {
+ const app = useContext(AppContext) as ContextType
+ const [state, setState] = useState({
+ })
+
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const updateState = (value: any) => {
+ setState((s) => ({ ...s, ...value }))
+ }
+
+ useEffect(() => {
+ const contact = app.state.session?.getContact();
+ const setCards = (cards: Card[]) => {
+ console.log("CARDS", cards);
+ };
+ contact.addCardListener(setCards);
+ return () => {
+ contact.removeCardListener(setCards);
+ }
+ }, [])
+
+ const actions = {
+ }
+
+ return { state, actions }
+}
diff --git a/app/client/web/src/session/Session.tsx b/app/client/web/src/session/Session.tsx
index bab943e2..17c0526f 100644
--- a/app/client/web/src/session/Session.tsx
+++ b/app/client/web/src/session/Session.tsx
@@ -10,6 +10,7 @@ import {
} from '@tabler/icons-react'
import { Settings } from '../settings/Settings'
import { Identity } from '../identity/Identity'
+import { Contacts } from '../contacts/Contacts'
import { useDisclosure } from '@mantine/hooks'
export function Session() {
@@ -17,11 +18,8 @@ export function Session() {
const display = useContext(DisplayContext) as ContextType
const [settings, { open: openSettings, close: closeSettings }] =
useDisclosure(false)
-
- const click = () => {
- console.log('SESSION DRAWER', openSettings)
- openSettings()
- }
+ const [contacts, { open: openContacts, close: closeContacts }] =
+ useDisclosure(false)
return (
@@ -29,6 +27,7 @@ export function Session() {
<>
{tab === 'settings' && }
+ {tab === 'contacts' && }
{tab === 'channels' && (
@@ -78,9 +77,18 @@ export function Session() {
{display.state.layout === 'large' && (
- {}} />
+
+
+
+
{
+ const endpoint = `http${secure ? 's' : ''}://${node}/contact/cards/${cardId}/detail?agent=${token}`;
+ const detail = await fetchWithTimeout(endpoint, { method: 'GET' })
+ checkResponse(detail.status);
+ return await detail.json();
+}
+
diff --git a/app/sdk/src/net/getCardProfile.ts b/app/sdk/src/net/getCardProfile.ts
new file mode 100644
index 00000000..644a477d
--- /dev/null
+++ b/app/sdk/src/net/getCardProfile.ts
@@ -0,0 +1,10 @@
+import { checkResponse, fetchWithTimeout } from './fetchUtil';
+import { CardProfileEntity } from '../entities';
+
+export async function getCardProfile(node: string, secure: boolean, token: string, cardId: string): Promise {
+ const endpoint = `http${secure ? 's' : ''}://${node}/contact/cards/${cardId}/profile?agent=${token}`;
+ const profile = await fetchWithTimeout(endpoint, { method: 'GET' })
+ checkResponse(profile.status);
+ return await profile.json();
+}
+
diff --git a/app/sdk/src/store.ts b/app/sdk/src/store.ts
index 1260047a..97eb6437 100644
--- a/app/sdk/src/store.ts
+++ b/app/sdk/src/store.ts
@@ -1,5 +1,5 @@
import { Login, ProfileEntity, defaultProfileEntity, ConfigEntity, defaultConfigEntity } from './entities';
-import type { ArticleRevision, ArticleDetail, ArticleItem, ChannelItem, CardItem, CardRevision, CardNotification, CardProfile, CardDetail, ChannelRevision, ChannelSummary, ChannelDetail } from './items';
+import type { ArticleRevision, ArticleDetail, ArticleItem, ChannelItem, CardItem, CardNotification, CardProfile, CardDetail, ChannelRevision, ChannelSummary, ChannelDetail } from './items';
import type { Logging } from './logging';
export interface Store {
@@ -25,7 +25,7 @@ export interface Store {
setContactRevision(guid: string, revision: number): Promise;
getContacts(guid: string): Promise<{ cardId: string, item: CardItem }[]>;
- setContactCardRevision(guid: string, cardId: string, revision: CardRevision): Promise;
+ setContactCardRevision(guid: string, cardId: string, revision: number): Promise;
setContactCardProfile(guid: string, cardId: string, profile: CardProfile): Promise;
setContactCardDetail(guid: string, cardId: string, detail: CardDetail): Promise;
setContactCardBlocked(guid: string, cardId: string, blocked: boolean): Promise;
@@ -170,7 +170,7 @@ export class OfflineStore implements Store {
return [];
}
- public async setContactCardRevision(guid: string, cardId: string, revision: CardRevision): Promise {
+ public async setContactCardRevision(guid: string, cardId: string, revision: number): Promise {
}
public async setContactCardProfile(guid: string, cardId: string, profile: CardProfile): Promise {
@@ -319,7 +319,7 @@ export class OnlineStore implements Store {
return [];
}
- public async setContactCardRevision(guid: string, cardId: string, revision: CardRevision): Promise {
+ public async setContactCardRevision(guid: string, cardId: string, revision: number): Promise {
}
public async setContactCardProfile(guid: string, cardId: string, profile: CardProfile): Promise {
@@ -442,7 +442,7 @@ export class NoStore implements Store {
return [];
}
- public async setContactCardRevision(guid: string, cardId: string, revision: CardRevision): Promise {
+ public async setContactCardRevision(guid: string, cardId: string, revision: number): Promise {
}
public async setContactCardProfile(guid: string, cardId: string, profile: CardProfile): Promise {