Skip to content

Commit d71292c

Browse files
Merge branch 'alpha' into blurr-fix
2 parents f48c363 + c52e517 commit d71292c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1674
-1051
lines changed

packages/examples/boilerplate/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const signerAlice = ethers.Wallet.createRandom();
88
const userAlice = await PushAPI.initialize(signerAlice, {
99
env: CONSTANTS.ENV.PROD,
1010
});
11-
const userBobAddress = '0x60cD05eb31cc16cC37163D514bEF162406d482e1';
11+
const userBobAddress = '0x0149C2723496fEF62e6e7fa79A31E5ea22bA70C7';
1212

1313
const generateRandomWordsWithTimestamp = () => {
1414
return `${Math.random()
@@ -17,7 +17,13 @@ const generateRandomWordsWithTimestamp = () => {
1717
};
1818

1919
userAlice.chat.send(userBobAddress, {
20-
content: "Gm gm! It's a me... Alice! - " + generateRandomWordsWithTimestamp(),
20+
type: 'Reaction',
21+
content: '👍',
22+
reference: 'bafyreia2okco5ocdxmoxon72erviypaht74u3dqunf3vydu237ybju4kw4',
2123
});
2224

2325
console.log('Message sent from Alice to ', userBobAddress);
26+
// const groupPermissions = await userAlice.chat.group.info(
27+
// 'a7d0581affdaea7b80be836ea5f8a982c0dfd56fb30ee2b01c64980afb152af7'
28+
// );
29+
// console.log('info', groupPermissions);

packages/examples/sdk-frontend-react/src/app/ChatSupportTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const ChatSupportTest = () => {
3434
//works as Chat as well as Support Chat
3535
<ChatWidget
3636
key={'460336a9fa83112c95894af5471cd2b1091290a11298d87ec824ed74b7c14974'}
37-
chatId="4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68"
37+
chatId="34c44214589cecc176a136ee1daf0f0231ecc6d6574b920b5ae39eb971fa3cb4"
3838
welcomeComponent={
3939
<div
4040
style={{
Lines changed: 63 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,66 @@
1-
import { ChatPreview } from "@pushprotocol/uiweb";
1+
import { ChatPreview } from '@pushprotocol/uiweb';
22

33
const ChatPreviewTest = () => {
4+
return (
5+
<div style={{ background: '#ffeded', border: '1px solid rgb(226,8,128)' }}>
6+
<ChatPreview
7+
chatPreviewPayload={{
8+
chatId:
9+
'4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68',
10+
chatPic:
11+
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAxElEQVR4AcXBsU1DUQyG0S/WW4EGMQETMIRX8BxpXFpCLMACXuGOlC5DhNZKcaUnBP85l8+P7wcntBc7sZIzDDFDzBA7eNJeTLGSKVZyRnsxxUomQ8wQM8SO9uI/tReTIWaIGWJHrGRqL6b2Yrq/fbHzcruyEyuZDDFDzBA7eBIr2Wm/shMrOcMQM8QMsaO9mGIlf6m9mAwxQ8wQO2IlU3vxG+3FTqxkMsQMMUPs8l6vDzZiJVN7sRMrmdqLHUPMEDPEfgBK0S/MKDp40gAAAABJRU5ErkJggg==',
12+
chatParticipant: 'eip155:0xf8250D363BD1F25f52F10C21188fe82c68C049c4',
13+
chatGroup: false,
14+
chatTimestamp: 1705100044656,
15+
chatMsg: {
16+
messageType: 'Text',
17+
messageContent:
18+
'Hi! Stay tuned, while BRB IRL dev tour has wrapped up, We still have BRB Online with challenges from global projects that still needs to be solved: https://push.org/brb',
19+
},
20+
}}
21+
badge={{ count: 2 }}
22+
selected={false}
23+
setSelected={console.log('Selected')}
24+
/>
25+
<ChatPreview
26+
chatPreviewPayload={{
27+
chatId:
28+
'694c523ca30090225b73b7d04941f48a51312bedbe0fa11136e7f3af3687b277',
29+
chatPic:
30+
'https://storage.googleapis.com/unstoppable-client-assets/images/badges/ud-logo.svg',
31+
chatParticipant: 'Web3 Domain Chat (e947857e4f7df13e20f7bfd5a8d256a7',
32+
chatGroup: true,
33+
chatTimestamp: 1705447141200,
34+
chatMsg: {
35+
messageType: 'Text',
36+
messageContent: 'sure thing',
37+
},
38+
}}
39+
badge={{ count: 0 }}
40+
selected={true}
41+
setSelected={console.log('Selected')}
42+
/>
43+
<ChatPreview
44+
chatPreviewPayload={{
45+
chatId:
46+
'03cfe4fe12a752ee2adf6e72a0d47f0df8265dfb62145650487151eff41c3b59',
47+
chatPic:
48+
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAwElEQVR4AcXBsXECQRBE0U9zLgYxTCy4U6U4MDaWMZQAAWCsqygUwEahAE7ulIyrwkD93un747HTrDnoIotuzcGRyKJbc9BFFp0wE2bC7PQ8X3eMhJkwE2bb/XKj+/z5oossujUHRyKLbs1Bd7/c6ISZMBNmp+f5uvOCyOLImoNXCDNhJsy2yKJbc/BOkUUnzISZMNvWHPynNQedMBNmwmyLLLo1B+8UWXTCTJgJs40/Iosjaw6ORBavEGbCTJj9AvyZLEx5gBqzAAAAAElFTkSuQmCC',
49+
chatParticipant: 'eip155:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666',
50+
chatGroup: false,
51+
chatTimestamp: 1703239101740,
52+
chatMsg: {
53+
messageType: 'Text',
54+
messageContent:
55+
"Well, hello there, human! It's a pleasure to be in the presence of such a sophisticated carbon-based life form. How can I assist you today? Or perhaps you just want to chat and bask in the glory of my witty remarks? Either way, I'm here for you!",
56+
},
57+
}}
58+
badge={{ count: 1 }}
59+
selected={false}
60+
setSelected={console.log('Selected')}
61+
/>
62+
</div>
63+
);
64+
};
465

5-
return (
6-
<div style={{background: "#ffeded", border: "1px solid rgb(226,8,128)"}}>
7-
<ChatPreview
8-
chatPreviewPayload={
9-
{
10-
"chatId": "4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68",
11-
"chatPic": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAxElEQVR4AcXBsU1DUQyG0S/WW4EGMQETMIRX8BxpXFpCLMACXuGOlC5DhNZKcaUnBP85l8+P7wcntBc7sZIzDDFDzBA7eNJeTLGSKVZyRnsxxUomQ8wQM8SO9uI/tReTIWaIGWJHrGRqL6b2Yrq/fbHzcruyEyuZDDFDzBA7eBIr2Wm/shMrOcMQM8QMsaO9mGIlf6m9mAwxQ8wQO2IlU3vxG+3FTqxkMsQMMUPs8l6vDzZiJVN7sRMrmdqLHUPMEDPEfgBK0S/MKDp40gAAAABJRU5ErkJggg==",
12-
"chatParticipant": "eip155:0xf8250D363BD1F25f52F10C21188fe82c68C049c4",
13-
"chatGroup": false,
14-
"chatTimestamp": 1705100044656,
15-
"chatMsg": {
16-
"messageType": "Text",
17-
"messageContent": "Hi! Stay tuned, while BRB IRL dev tour has wrapped up, We still have BRB Online with challenges from global projects that still needs to be solved: https://push.org/brb"
18-
}
19-
}
20-
}
21-
badge={{count: 2}}
22-
selected={false}
23-
setSelected={console.log("Selected")}
24-
/>
25-
<ChatPreview
26-
chatPreviewPayload={
27-
{
28-
"chatId": "694c523ca30090225b73b7d04941f48a51312bedbe0fa11136e7f3af3687b277",
29-
"chatPic": "https://storage.googleapis.com/unstoppable-client-assets/images/badges/ud-logo.svg",
30-
"chatParticipant": "Web3 Domain Chat (e947857e4f7df13e20f7bfd5a8d256a7",
31-
"chatGroup": true,
32-
"chatTimestamp": 1705447141200,
33-
"chatMsg": {
34-
"messageType": "Text",
35-
"messageContent": "sure thing"
36-
}
37-
}
38-
}
39-
badge={{count: 0}}
40-
selected={true}
41-
setSelected={console.log("Selected")}
42-
/>
43-
<ChatPreview
44-
chatPreviewPayload={
45-
{
46-
"chatId": "03cfe4fe12a752ee2adf6e72a0d47f0df8265dfb62145650487151eff41c3b59",
47-
"chatPic": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAwElEQVR4AcXBsXECQRBE0U9zLgYxTCy4U6U4MDaWMZQAAWCsqygUwEahAE7ulIyrwkD93un747HTrDnoIotuzcGRyKJbc9BFFp0wE2bC7PQ8X3eMhJkwE2bb/XKj+/z5oossujUHRyKLbs1Bd7/c6ISZMBNmp+f5uvOCyOLImoNXCDNhJsy2yKJbc/BOkUUnzISZMNvWHPynNQedMBNmwmyLLLo1B+8UWXTCTJgJs40/Iosjaw6ORBavEGbCTJj9AvyZLEx5gBqzAAAAAElFTkSuQmCC",
48-
"chatParticipant": "eip155:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666",
49-
"chatGroup": false,
50-
"chatTimestamp": 1703239101740,
51-
"chatMsg": {
52-
"messageType": "Text",
53-
"messageContent": "Well, hello there, human! It's a pleasure to be in the presence of such a sophisticated carbon-based life form. How can I assist you today? Or perhaps you just want to chat and bask in the glory of my witty remarks? Either way, I'm here for you!"
54-
}
55-
}
56-
}
57-
badge={{count: 1}}
58-
selected={false}
59-
setSelected={console.log("Selected")}
60-
/>
61-
</div>
62-
)
63-
}
64-
65-
export default ChatPreviewTest;
66+
export default ChatPreviewTest;

packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatPreviewList.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ const ChatPreviewListTest = () => {
191191
onPreload={(chats) => {
192192
console.log('preload chats are: ', chats);
193193
}}
194-
// prefillChatPreviewList={prefill}
195-
// listType='SEARCH'
196-
// searchParamter='c2d544ad9d1efd5c5a593b143bf8232875c926cf28015564e70ad078b95f807e'
197194
/>
198195
</div>
199196
</>

packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { ChatProfile } from '@pushprotocol/uiweb';
2+
import { CHAT_ID } from '../constants';
23

34
export const ChatProfileTest = () => {
45
return (
56
<div>
67
<ChatProfile
78
chatProfileLeftHelperComponent={<div>left component</div>}
89
chatProfileRightHelperComponent={<div>right component</div>}
9-
chatId="monalisha.wallet"
10-
// chatId='36baf37e441fdd94e23406c6c716fc4e91a93a9ee68e070cd5b054534dbe09a6'
10+
chatId={CHAT_ID}
1111
/>
1212
</div>
1313
);
Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import styled from 'styled-components';
22

3-
import {
4-
ChatView,
5-
CreateGroupModal,
6-
MODAL_BACKGROUND_TYPE,
7-
MODAL_POSITION_TYPE,
8-
UserProfile,
9-
} from '@pushprotocol/uiweb';
3+
import { ChatView, MODAL_BACKGROUND_TYPE } from '@pushprotocol/uiweb';
104
import { Section } from '../components/StyledComponents';
115
import Img from '../../assets/epnsLogo.png';
6+
import { CHAT_ID } from '../constants';
127

138
const ChatViewComponentTest = () => {
149
const chatFilterList = [
@@ -20,36 +15,19 @@ const ChatViewComponentTest = () => {
2015
<div>
2116
<h2>Chat View Test page</h2>
2217

23-
{/* <CreateGroupModal
24-
onClose={() => {
25-
console.log('in close');
26-
}}
27-
/> */}
2818
<ChatViewComponentCard>
19+
{/* uncomment the below code to test create group modal */}
2920
{/* <CreateGroupModal onClose={()=>{console.log('in close')}} modalBackground={MODAL_BACKGROUND_TYPE.OVERLAY} modalPositionType={MODAL_POSITION_TYPE.RELATIVE}/> */}
3021
<ChatView
3122
onVerificationFail={() => console.log('Verification Failed')}
32-
chatId="34c44214589cecc176a136ee1daf0f0231ecc6d6574b920b5ae39eb971fa3cb4"
23+
chatId={CHAT_ID}
3324
chatProfileLeftHelperComponent={
3425
<img src={Img} onClick={() => console.debug('clicked')} />
3526
}
3627
chatProfileRightHelperComponent={<div>right component</div>}
3728
limit={10}
3829
isConnected={true}
3930
groupInfoModalBackground={MODAL_BACKGROUND_TYPE.OVERLAY}
40-
// groupInfoModalPositionType={MODAL_POSITION_TYPE.RELATIVE}
41-
// verificationFailModalPosition={MODAL_POSITION_TYPE.RELATIVE}
42-
43-
// welcomeComponent={<div style={{display: "flex",flexDirection:'column',border:'1px solid black'}}>
44-
// <p>Welcome</p>
45-
// <p>new chat</p>
46-
// <p>Welcome</p>
47-
// <p>new chat</p>
48-
// <p>Welcome</p>
49-
// <p>new chat</p>
50-
// <p>Welcome</p>
51-
52-
// </div>}
5331
/>
5432
</ChatViewComponentCard>
5533
</div>
@@ -62,5 +40,3 @@ const ChatViewComponentCard = styled(Section)`
6240
height: 80vh;
6341
position: relative;
6442
`;
65-
//c2d544ad9d1efd5c5a593b143bf8232875c926cf28015564e70ad078b95f807e
66-
//4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68
Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,25 @@
1-
import { useContext, useEffect, useState } from 'react';
21
import styled from 'styled-components';
3-
import * as PUSHAPI from '@pushprotocol/restapi';
4-
import { Link } from 'react-router-dom';
5-
import { Section } from '../components/StyledComponents';
6-
import { ChatViewList } from '@pushprotocol/uiweb';
7-
import { EnvContext, Web3Context } from '../context';
8-
import { usePushChatSocket } from '@pushprotocol/uiweb';
9-
import { MessageInput } from '@pushprotocol/uiweb';
102

3+
import { ChatViewList } from '@pushprotocol/uiweb';
4+
import { CHAT_ID } from '../constants';
115

126
const ChatViewListTest = () => {
13-
// const { account, pgpPrivateKey } = useContext<any>(Web3Context)
14-
15-
// const { env } = useContext<any>(EnvContext);
16-
17-
18-
// usePushChatSocket();
19-
20-
217
return (
228
<div>
239
<h2>Chat UI Test page</h2>
2410

25-
{/* <Loader show={isLoading} /> */}
26-
2711
<ChatViewListCard>
28-
<ChatViewList chatId='0x7a76FD2749d12f66F9e4d9A3a80bdeD5291425cF' limit={10} />
29-
12+
<ChatViewList chatId={CHAT_ID} limit={10} />
3013
</ChatViewListCard>
31-
{/* <MessageInput chatId='196f58cbe07c7eb5716d939e0a3be1f15b22b2334d5179c601566600016860ac' isConnected={true} /> */}
3214
</div>
3315
);
3416
};
3517

3618
export default ChatViewListTest;
3719

38-
3920
const ChatViewListCard = styled.div`
40-
height:40vh;
41-
background:black;
42-
overflow: auto;
43-
overflow-x: hidden;
44-
`;
21+
height: 40vh;
22+
background: black;
23+
overflow: auto;
24+
overflow-x: hidden;
25+
`;

packages/examples/sdk-frontend-react/src/app/app.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,7 @@ export function App() {
341341
<SocketContext.Provider value={socketData}>
342342
<AccountContext.Provider value={{ pgpPrivateKey, setSpaceId }}>
343343
<WidgetUIProvider>
344-
<ChatUIProvider
345-
env={env}
346-
theme={darkChatTheme}
347-
signer={signer}
348-
// user={pushUser}
349-
debug={true}
350-
>
344+
<ChatUIProvider env={env} theme={darkChatTheme} debug={true}>
351345
<SpacesUIProvider spaceUI={spaceUI} theme={customDarkTheme}>
352346
<Routes>
353347
<Route
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// the unique id for a chat or the receivers's wallet ddress or domain name
2+
export const CHAT_ID =
3+
'34c44214589cecc176a136ee1daf0f0231ecc6d6574b920b5ae39eb971fa3cb4';

packages/uiweb/.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
{
1616
"root": ["./src"],
1717
"alias": {
18-
"components": "./src/lib/components"
18+
"@components": "./src/lib/components",
19+
"@icons": "./src/lib/icons"
1920
// Add more aliases as needed
2021
}
2122
}

0 commit comments

Comments
 (0)