Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed build for uiweb #854

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading