Skip to content

Commit

Permalink
fix: fixed build for uiweb
Browse files Browse the repository at this point in the history
  • Loading branch information
mishramonalisha76 committed Nov 16, 2023
1 parent b364cee commit af7ff8e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
echo "\nRunning GIT hooks..."
yarn cleanbuild
yarn nx affected --target=lint
#yarn nx affected --target=test
yarn nx affected --target=test
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ChatSupportTest = () => {
<SupportChat

signer={librarySigner}
supportAddress="0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666"
supportAddress="0x6269C363695c5E14447a1b3873d7Ae4Ddf6E6eF7"
apiKey="tAWEnggQ9Z.UaDBNjrvlJZx3giBTIQDcT8bKQo1O1518uF1Tea7rPwfzXv2ouV5rX9ViwgJUrXm"
env={env}
greetingMsg="How can i help you?"
Expand Down
2 changes: 0 additions & 2 deletions packages/uiweb/src/lib/components/supportChat/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import { SupportChatMainStateContext, SupportChatPropsContext } from '../../cont
import { Chats } from './Chats';
import {
createUserIfNecessary,
decryptChat,
getChats,
walletToPCAIP10,
pCAIP10ToWallet
} from '../../helpers';
import type { IMessageIPFS } from '../../types';
import { useChatScroll } from '../../hooks';
Expand Down
25 changes: 9 additions & 16 deletions packages/uiweb/src/lib/helpers/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ export const handleOnChatIconClick = ({

export const createUserIfNecessary = async (
options: AccountEnvOptionsType
): Promise<IConnectedUser> => {
const { account, signer, env = Constants.ENV.PROD, pushUser } = options || {};
let connectedUser;
): Promise<IConnectedUser | undefined> => {
const { pushUser } = options || {};
let connectedUser:IUser;
if(pushUser){
connectedUser = await pushUser.info();
return { ...connectedUser,
privateKey: connectedUser!.encryptedPrivateKey,
};
}
return;

return { ...connectedUser, privateKey: connectedUser!.encryptedPrivateKey };

};

type GetChatsResponseType = {
Expand Down Expand Up @@ -85,18 +89,7 @@ type DecrypteChatType = {
connectedUser: IConnectedUser;
env: ENV;
};
export const decryptChat = async (
options: DecrypteChatType
): Promise<IMessageIPFS> => {
const { message, connectedUser, env = Constants.ENV.PROD } = options || {};
const decryptedChat: IMessageIPFS[] = await PushAPI.chat.decryptConversation({
messages: [message],
connectedUser,
pgpPrivateKey: connectedUser.privateKey!,
env,
});
return decryptedChat[0];
};


export const copyToClipboard = (address: string): void => {
if (navigator && navigator.clipboard) {
Expand Down
4 changes: 3 additions & 1 deletion packages/uiweb/src/lib/hooks/useSDKSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export const useSDKSocket =({ account, env = ENV.PROD, socketType = 'chat',apiKe
setStream(newstream);
// setEpnsSDKSocket(connectionObject);
};
main().catch((err) => console.error(err));
main().catch((err) =>
console.log('')
);
}

// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit af7ff8e

Please sign in to comment.