diff --git a/apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx b/apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx index eb20ae201d8..a78ab073489 100644 --- a/apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx +++ b/apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx @@ -1,19 +1,22 @@ "use client"; +import { Button } from "@/components/ui/button"; import { useApiKeys, useCreateApiKey } from "@3rdweb-sdk/react/hooks/useApi"; -import { Flex, FormControl, Input, Link, Select } from "@chakra-ui/react"; +import { Flex, FormControl, Input, Select } from "@chakra-ui/react"; +import { LazyCreateAPIKeyDialog } from "components/settings/ApiKeys/Create/LazyCreateAPIKeyDialog"; import { useTrack } from "hooks/analytics/useTrack"; import { useAllChainsData } from "hooks/chains/allChains"; import { useClipboard } from "hooks/useClipboard"; -import { useTxNotifications } from "hooks/useTxNotifications"; import { CheckIcon, CopyIcon } from "lucide-react"; -import { useMemo } from "react"; +import Link from "next/link"; +import { usePathname } from "next/navigation"; +import { useMemo, useState } from "react"; import { useForm } from "react-hook-form"; import type { StoredChain } from "stores/chainStores"; import type { ThirdwebContract } from "thirdweb"; import type { ChainMetadata } from "thirdweb/chains"; +import { useActiveAccount } from "thirdweb/react"; import { - Button, Card, CodeBlock, FormHelperText, @@ -211,10 +214,6 @@ export const EmbedSetup: React.FC = ({ const apiKeys = useApiKeys(); const createKeyMutation = useCreateApiKey(); - const { onSuccess, onError } = useTxNotifications( - "API key created", - "Failed to create API key", - ); const validApiKey = (apiKeys.data || []).find( (apiKey) => @@ -298,14 +297,35 @@ export const EmbedSetup: React.FC = ({ ); const { hasCopied, onCopy } = useClipboard(embedCode, 3000); + const [showCreateAPIKeyModal, setShowCreateAPIKeyModal] = useState(false); + const activeAccount = useActiveAccount(); + const pathname = usePathname(); return ( + { + trackEvent({ + category: "api-keys", + action: "create", + label: "success", + fromEmbed: true, + }); + apiKeys.refetch(); + }} + /> + - - - Configuration - + + Configuration + {ercOrMarketplace === "marketplace" ? ( Listing ID @@ -315,6 +335,7 @@ export const EmbedSetup: React.FC = ({ ) : null} + {ercOrMarketplace === "marketplace-v3" ? ( Listing type @@ -327,6 +348,7 @@ export const EmbedSetup: React.FC = ({ ) : null} + {ercOrMarketplace === "marketplace-v3" && watch("listingType") === "direct-listing" ? ( @@ -337,6 +359,7 @@ export const EmbedSetup: React.FC = ({ ) : null} + {ercOrMarketplace === "marketplace-v3" && watch("listingType") === "english-auction" ? ( @@ -347,6 +370,7 @@ export const EmbedSetup: React.FC = ({ ) : null} + {ercOrMarketplace === "erc1155" ? ( Token ID @@ -356,9 +380,20 @@ export const EmbedSetup: React.FC = ({ ) : null} + Client ID - {validApiKey ? ( + {!activeAccount ? ( + + ) : validApiKey ? ( = ({ /> ) : (