I got this working somehow:
import "./styles.css";
import { useMoralisWeb3Api } from "react-moralis";
import { Moralis } from "moralis";
const { useMoralis } = require("react-moralis");
const appId = "ID";
const serverUrl = "SERVER";
Moralis.initialize(appId);
Moralis.serverURL = serverUrl;
const handleBuy = async () => {
console.log("before initPlugins");
await Moralis.initPlugins();
console.log("before fiat.buy");
Moralis.Plugins.fiat.buy();
console.log("after fiat.buy();");
};
const handlePress = async () => {
// Am I missing something here?
console.log("FiatBridgeButton");
console.log("Moralis:", Moralis);
console.log("Moralis.initPlugins()...");
await Moralis.initPlugins();
console.log("Moralis.Plugins.fiat.buy()...");
//Moralis.Plugins.fiat.buy();
let result = await Moralis.Plugins.fiat.buy(undefined, {
disableTriggers: true
});
document.getElementById("myIframe").style.display = "block";
console.log(result);
document.getElementById("myIframe").src = result.data;
console.log("...end of process?...");
};
export default function App() {
return (
<div className="App">
<button onClick={handleBuy}>Start buy plugin in new window</button>
<button onClick={handlePress}>Start buy plugin in iframe</button>
<br />
<iframe id="myIframe" src="" width="350" height="650"></iframe>
</div>
);
}
it looks like handleBuy doesnāt do anything on latest Moralis SDK version (0.0.50), it works fine with 0.0.44
but in a iframe something still works on latest SDK