-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- update deps - added nft services - minor fixes
- Loading branch information
1 parent
4631406
commit 9599a4c
Showing
13 changed files
with
14,078 additions
and
17,213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
VITE_APP_NFT_CHECKOUT_HOST=https://develop-nft-checkout.web3auth.io | ||
VITE_APP_NFT_CHECKOUT_API_KEY=pk_test_4ca499b1f017c2a96bac63493dca4ac2eb08d1e91de0a796d87137dc7278e0af |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import Button from "./Button"; | ||
import Card from "./Card"; | ||
import nftSample from "../assets/nftSample.svg"; | ||
import { useEffect, useState } from "react"; | ||
import config from "../config"; | ||
import { usePlayground } from "../services/playground"; | ||
|
||
const FREE_MINT_CONTRACT_ID = "b5b4de3f-0212-11ef-a08f-0242ac190003"; | ||
const PAID_MINT_CONTRACT_ID = "d1145a8b-98ae-44e0-ab63-2c9c8371caff"; | ||
|
||
const DocsDetails = () => { | ||
const [showNftMinting, setShowNftMinting] = useState(false); | ||
const [showNftPurchase, setShowNftPurchase] = useState(false); | ||
const { address: receiverAddress } = usePlayground(); | ||
|
||
const demoNftMintingUrl = `${config.nftCheckoutHost}/?contract_id=${FREE_MINT_CONTRACT_ID}&receiver_address=${receiverAddress}&api_key=${config.nftCheckoutApiKey}`; | ||
|
||
const demoNftPurchaseUrl = `${config.nftCheckoutHost}/?contract_id=${PAID_MINT_CONTRACT_ID}&receiver_address=${receiverAddress}&api_key=${config.nftCheckoutApiKey}`; | ||
|
||
const openNftMinting = () => { | ||
setShowNftMinting(true); | ||
}; | ||
|
||
const openNftPurchase = () => { | ||
setShowNftPurchase(true); | ||
}; | ||
|
||
function closeFromFrame(event: MessageEvent) { | ||
if (event.origin === config.nftCheckoutHost && event.data === "close-nft-checkout") { | ||
setShowNftMinting(false); | ||
setShowNftPurchase(false); | ||
} | ||
} | ||
|
||
useEffect(() => { | ||
window.addEventListener("message", closeFromFrame); | ||
return () => { | ||
window.removeEventListener("message", closeFromFrame); | ||
}; | ||
}); | ||
|
||
return ( | ||
<Card> | ||
<div className="mb-4 text-center"> | ||
<h3 className="font-semibold text-app-gray-900 mb-1">NFT Services</h3> | ||
<p className="text-xs text-app-gray-500 ">Let your users to claim or buy NFT in seconds</p> | ||
</div> | ||
|
||
<img src={nftSample} className="w-full max-w-xs mx-auto h-auto mb-6" alt="" /> | ||
|
||
<div className="space-y-2 mb-4"> | ||
<Button className="w-full" onClick={openNftMinting}> | ||
Mint free NFT airdrop | ||
</Button> | ||
<Button className="w-full" onClick={openNftPurchase}> | ||
NFT Checkout | ||
</Button> | ||
</div> | ||
|
||
<div className="text-center"> | ||
<a | ||
className="text-sm text-app-primary-600 hover:underline" | ||
href="https://docs.stripe.com/testing#cards" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Try with our test credit cards | ||
</a> | ||
</div> | ||
{showNftMinting && ( | ||
<iframe | ||
id="nftCheckoutIFrame" | ||
title="nft_minting" | ||
src={demoNftMintingUrl} | ||
name="nft_minting" | ||
allow="clipboard-write" | ||
style={{ | ||
position: "fixed", | ||
top: 0, | ||
right: 0, | ||
width: "100%", | ||
height: "100%", | ||
border: "none", | ||
borderRadius: 0, | ||
zIndex: 99999, | ||
}} | ||
/> | ||
)} | ||
|
||
{showNftPurchase && ( | ||
<iframe | ||
id="nftCheckoutIFrame" | ||
src={demoNftPurchaseUrl} | ||
title="nft_purchase" | ||
name="nft_purchase" | ||
style={{ | ||
position: "fixed", | ||
top: 0, | ||
right: 0, | ||
width: "100%", | ||
height: "100%", | ||
border: "none", | ||
borderRadius: 0, | ||
zIndex: 99999, | ||
}} | ||
allow="clipboard-write" | ||
/> | ||
)} | ||
</Card> | ||
); | ||
}; | ||
export default DocsDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const config = { | ||
nftCheckoutHost: import.meta.env.VITE_APP_NFT_CHECKOUT_HOST, | ||
nftCheckoutApiKey: import.meta.env.VITE_APP_NFT_CHECKOUT_API_KEY, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.