Integrate wallet IFrame for payments #42
@ -224,6 +224,7 @@ const Configure = () => {
|
||||
onDismiss: dismiss,
|
||||
});
|
||||
setIsFrameVisible(false);
|
||||
setIsPaymentLoading(false);
|
||||
throw new Error('Transaction rejected');
|
||||
}
|
||||
|
||||
@ -301,10 +302,6 @@ const Configure = () => {
|
||||
[client, createProject, dismiss, toast],
|
||||
);
|
||||
|
||||
const toggleModal = () => {
|
||||
setIsFrameVisible((prev) => !prev);
|
||||
};
|
||||
|
||||
const fetchDeployers = useCallback(async () => {
|
||||
const res = await client.getDeployers();
|
||||
setDeployers(res.deployers);
|
||||
@ -586,7 +583,6 @@ const Configure = () => {
|
||||
setAccounts={setAccounts}
|
||||
setIsDataReceived={setIsAccountsDataReceived}
|
||||
isVisible={isFrameVisible}
|
||||
toggleModal={toggleModal}
|
||||
/>
|
||||
{accounts.length > 0 && (
|
||||
<div>
|
||||
|
@ -11,16 +11,13 @@ const IFrameModal = ({
|
||||
setAccounts,
|
||||
setIsDataReceived,
|
||||
isVisible,
|
||||
toggleModal,
|
||||
}: {
|
||||
setAccounts: (accounts: string[]) => void;
|
||||
setIsDataReceived: (isReceived: boolean) => void;
|
||||
isVisible: boolean;
|
||||
toggleModal: () => void;
|
||||
}) => {
|
||||
useEffect(() => {
|
||||
const handleMessage = (event: MessageEvent) => {
|
||||
// TODO: Use env for origin URL
|
||||
if (event.origin !== VITE_WALLET_IFRAME_URL) return;
|
||||
|
||||
setIsDataReceived(true);
|
||||
@ -56,7 +53,7 @@ const IFrameModal = ({
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Modal open={isVisible} onClose={toggleModal} keepMounted>
|
||||
<Modal open={isVisible} disableEscapeKeyDown keepMounted>
|
||||
<Box
|
||||
sx={{
|
||||
position: 'absolute',
|
||||
|
Loading…
Reference in New Issue
Block a user