diff --git a/.env b/.env index d466608671..83e442f22f 100644 --- a/.env +++ b/.env @@ -11,5 +11,4 @@ NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=d851f25304d67fc8e2dd3b354223e4fa NEXT_PUBLIC_EDGE_CONFIG_ID=ecfg_buc5l6124c4koymyvseasbd1k3hs NEXT_PUBLIC_EDGE_CONFIG_READ_ACCESS_TOKEN=8b337e65-3aa6-4949-97b8-c7eab7151128 NEXT_PUBLIC_RECAPTCHA_SITE_KEY=6LcQm4onAAAAAOcoqkw9A5txg5SbuddONchMZKrF -NEXT_PUBLIC_POLYGONID_API=https://guild-privacy.s.guild.xyz NEXT_PUBLIC_BUGSNAG_KEY=4bd5799ac2cb4a34887513b80b845554 \ No newline at end of file diff --git a/public/requirementLogos/polygonId.svg b/public/requirementLogos/polygonId.svg deleted file mode 100644 index 55330eb3cd..0000000000 --- a/public/requirementLogos/polygonId.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/public/requirementLogos/polygonId_white.svg b/public/requirementLogos/polygonId_white.svg deleted file mode 100644 index 7d1250116a..0000000000 --- a/public/requirementLogos/polygonId_white.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/public/solutions/polygon-bg.jpg b/public/solutions/polygon-bg.jpg deleted file mode 100644 index 771ca28cb6..0000000000 Binary files a/public/solutions/polygon-bg.jpg and /dev/null differ diff --git a/src/app/globals.css b/src/app/globals.css index 56cc700e65..024afcaabd 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -117,9 +117,6 @@ --github: 0 0% 20%; --github-hover: 0 0% 18%; --github-active: 0 0% 15%; - --polygonid: 259 59% 59%; - --polygonid-hover: 258 50% 52%; - --polygonid-active: 256 44% 42%; --farcaster: 261 55% 61%; --farcaster-hover: 261 55% 55%; @@ -235,8 +232,6 @@ --google-active: 212 96% 78%; --github-hover: 0 0% 44%; --github-active: 0 0% 68%; - --polygonid-hover: 260 73% 70%; - --polygonid-active: 262 81% 77%; --farcaster-hover: 239 75% 75%; --farcaster-active: 238 76% 81%; } diff --git a/src/components/[guild]/AddRewardButton/SelectRolePanel.tsx b/src/components/[guild]/AddRewardButton/SelectRolePanel.tsx index da7c5336a8..065a484c0f 100644 --- a/src/components/[guild]/AddRewardButton/SelectRolePanel.tsx +++ b/src/components/[guild]/AddRewardButton/SelectRolePanel.tsx @@ -80,7 +80,7 @@ const SelectRolePanel = ({ const goBack = () => { if (!rewards[selection].autoRewardSetup) methods.reset(ADD_REWARD_FORM_DEFAULT_VALUES) - setStep(selection === "POLYGON_ID" ? "HOME" : "REWARD_SETUP") + setStep("REWARD_SETUP") } return ( diff --git a/src/components/[guild]/JoinModal/JoinModal.tsx b/src/components/[guild]/JoinModal/JoinModal.tsx index 6c18d6b796..1264afaead 100644 --- a/src/components/[guild]/JoinModal/JoinModal.tsx +++ b/src/components/[guild]/JoinModal/JoinModal.tsx @@ -31,7 +31,6 @@ import { useJoin } from "./hooks/useJoin" import { JoinForm, Joinable } from "./types" const customJoinStep: Partial>> = { - POLYGON: dynamic(() => import("./components/ConnectPolygonIDJoinStep")), CAPTCHA: dynamic(() => import("./components/CompleteCaptchaJoinStep")), EMAIL: dynamic(() => import("./components/ConnectEmailJoinStep")), } diff --git a/src/components/[guild]/JoinModal/components/ConnectPolygonIDJoinStep.tsx b/src/components/[guild]/JoinModal/components/ConnectPolygonIDJoinStep.tsx deleted file mode 100644 index d5672bdfbe..0000000000 --- a/src/components/[guild]/JoinModal/components/ConnectPolygonIDJoinStep.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager" -import { useDisclosure } from "@/hooks/useDisclosure" -import useSWRWithOptionalAuth from "hooks/useSWRWithOptionalAuth" -import { ConnectPolygonIDModal } from "requirements/PolygonID/components/ConnectPolygonID" -import { JoinStep } from "./JoinStep" - -const ConnectPolygonIDJoinStep = (): JSX.Element => { - const { isWeb3Connected } = useWeb3ConnectionManager() - - const { data: isDone, isLoading } = useSWRWithOptionalAuth( - `/v2/util/gate-proof-existence/POLYGON_ID_BASIC_MAIN` - ) - - const { onOpen, onClose, isOpen } = useDisclosure() - - return ( - <> - - ), - disabled: !isWeb3Connected, - isLoading, - // TODO: extract it to a constant, just like we did with PLATFORM_COLORS - className: - "bg-purple-500 hover:bg-purple-600 hover:dark:bg-purple-400 active:bg-purple-700 active:dark:bg-purple-300 text-white", - onClick: onOpen, - children: isDone ? "Connected" : "Connect", - }} - /> - - - - ) -} - -// biome-ignore lint/style/noDefaultExport: we only load this component dynamically, so it's much more convenient to use a default export here -export default ConnectPolygonIDJoinStep diff --git a/src/components/[guild]/Requirements/components/RequirementAccessIndicator.tsx b/src/components/[guild]/Requirements/components/RequirementAccessIndicator.tsx index e0928d38d4..aadf77b5b9 100644 --- a/src/components/[guild]/Requirements/components/RequirementAccessIndicator.tsx +++ b/src/components/[guild]/Requirements/components/RequirementAccessIndicator.tsx @@ -16,9 +16,6 @@ import dynamic from "next/dynamic" import RequirementAccessIndicatorUI from "./RequirementAccessIndicatorUI" import { useRequirementContext } from "./RequirementContext" -const DynamicConnectPolygonID = dynamic( - () => import("requirements/PolygonID/components/ConnectPolygonID") -) const DynamicCompleteCaptcha = dynamic( () => import("requirements/Captcha/components/CompleteCaptcha") ) @@ -80,9 +77,7 @@ const RequirementAccessIndicator = () => { : "Connect account to check access"} - {type === "POLYGON_ID_QUERY" || type === "POLYGON_ID_BASIC" ? ( - - ) : type === "CAPTCHA" ? ( + {type === "CAPTCHA" ? ( ) : type.startsWith("GITCOIN_") ? ( diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPolygonIDPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPolygonIDPanel.tsx deleted file mode 100644 index 69aba6f522..0000000000 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPolygonIDPanel.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import useGuild from "components/[guild]/hooks/useGuild" -import { useEffect } from "react" -import { AddRewardPanelProps } from "rewards" -import { PlatformType } from "types" - -const AddPolygonIDPanel = ({ onAdd }: AddRewardPanelProps) => { - const { id: guildId } = useGuild() - - useEffect( - () => - onAdd({ - guildPlatform: { - platformName: "POLYGON_ID", - platformId: PlatformType.POLYGON_ID, - platformGuildId: `polygonid-${guildId}`, - }, - isNew: true, - }), - // eslint-disable-next-line react-hooks/exhaustive-deps - [] - ) - - return null -} - -export default AddPolygonIDPanel diff --git a/src/components/create-guild/PlatformsGrid/PlatformsGrid.tsx b/src/components/create-guild/PlatformsGrid/PlatformsGrid.tsx index 0aba17dfd6..944d149ce8 100644 --- a/src/components/create-guild/PlatformsGrid/PlatformsGrid.tsx +++ b/src/components/create-guild/PlatformsGrid/PlatformsGrid.tsx @@ -1,7 +1,7 @@ import { Box, Heading, SimpleGrid, Stack, StackProps } from "@chakra-ui/react" import useGuild from "components/[guild]/hooks/useGuild" import rewards from "rewards" -import { PlatformName, PlatformType } from "types" +import { PlatformName } from "types" import PlatformSelectButton from "./components/PlatformSelectButton" type Props = { @@ -44,16 +44,6 @@ const PlatformsGrid = ({ onSelection, disabledRewards, ...rest }: Props) => { platform: "GATHER_TOWN", description: "Manage spaces", }, - ...(!guildPlatforms.find( - (platform) => platform.platformId === PlatformType.POLYGON_ID - ) - ? [ - { - platform: "POLYGON_ID", - description: "Prove role membership", - } as PlatformsGridData, - ] - : []), { platform: "TEXT", description: "Gate special content, links, etc", @@ -69,7 +59,7 @@ const PlatformsGrid = ({ onSelection, disabledRewards, ...rest }: Props) => { description: "Gamification utility", isGeneral: true, }, - ...(featureFlags.includes("ERC20") + ...(featureFlags?.includes("ERC20") ? [ { platform: "ERC20", diff --git a/src/env.js b/src/env.js index e52a2e0398..56695eea03 100644 --- a/src/env.js +++ b/src/env.js @@ -43,7 +43,6 @@ export const env = createEnv({ // Guild APIs NEXT_PUBLIC_API: z.string(), NEXT_PUBLIC_BALANCY_API: z.string(), - NEXT_PUBLIC_POLYGONID_API: z.string(), // Captcha NEXT_PUBLIC_RECAPTCHA_SITE_KEY: z.string(), @@ -70,7 +69,6 @@ export const env = createEnv({ runtimeEnv: { NEXT_PUBLIC_API: process.env.NEXT_PUBLIC_API, NEXT_PUBLIC_BALANCY_API: process.env.NEXT_PUBLIC_BALANCY_API, - NEXT_PUBLIC_POLYGONID_API: process.env.NEXT_PUBLIC_POLYGONID_API, NEXT_PUBLIC_RECAPTCHA_SITE_KEY: process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY, diff --git a/src/pages/[guild]/[group].tsx b/src/pages/[guild]/[group].tsx index 5082c67eef..3c6d3c8b55 100644 --- a/src/pages/[guild]/[group].tsx +++ b/src/pages/[guild]/[group].tsx @@ -25,7 +25,6 @@ import useMembership from "components/explorer/hooks/useMembership" import { GetStaticPaths, GetStaticProps } from "next" import dynamic from "next/dynamic" import Head from "next/head" -import { MintPolygonIDProofProvider } from "rewards/PolygonID/components/MintPolygonIDProofProvider" import { SWRConfig } from "swr" import { Guild } from "types" import fetcher from "utils/fetcher" @@ -150,11 +149,9 @@ const GroupPageWrapper = ({ fallback }: Props): JSX.Element => { - - - - - + + + diff --git a/src/pages/[guild]/index.tsx b/src/pages/[guild]/index.tsx index ddaabe2884..0439835769 100644 --- a/src/pages/[guild]/index.tsx +++ b/src/pages/[guild]/index.tsx @@ -32,7 +32,6 @@ import dynamic from "next/dynamic" import Head from "next/head" import ErrorPage from "pages/_error" import { useEffect } from "react" -import { MintPolygonIDProofProvider } from "rewards/PolygonID/components/MintPolygonIDProofProvider" import { SWRConfig } from "swr" import { Guild, SocialLinkKey } from "types" import fetcher from "utils/fetcher" @@ -231,11 +230,9 @@ const GuildPageWrapper = ({ fallback }: Props): JSX.Element => { - - - - - + + + diff --git a/src/requirements/PolygonID/PolygonIDForm.tsx b/src/requirements/PolygonID/PolygonIDForm.tsx deleted file mode 100644 index aa86a13c6b..0000000000 --- a/src/requirements/PolygonID/PolygonIDForm.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import { Divider, FormControl, FormLabel, Stack } from "@chakra-ui/react" -import ControlledSelect from "components/common/ControlledSelect" -import FormErrorMessage from "components/common/FormErrorMessage" -import { useFormContext, useWatch } from "react-hook-form" -import ChainPicker from "requirements/common/ChainPicker" -import { RequirementFormProps } from "requirements/types" -import parseFromObject from "utils/parseFromObject" -import PolygonIDBasic from "./components/PolygonIDBasic" -import PolygonIDQuery from "./components/PolygonIDQuery" - -const polygonIDRequirementTypes = [ - { - label: "Authenticate with PolygonID", - value: "POLYGON_ID_BASIC", - PolygonIDRequirement: PolygonIDBasic, - }, - { - label: "Satisfy query", - value: "POLYGON_ID_QUERY", - PolygonIDRequirement: PolygonIDQuery, - }, -] - -const PolygonIDForm = ({ - baseFieldPath, - field, -}: RequirementFormProps): JSX.Element => { - const { - setValue, - formState: { errors }, - } = useFormContext() - - const type = useWatch({ name: `${baseFieldPath}.type` }) - const isEditMode = !!field?.id - - const selected = polygonIDRequirementTypes.find( - (reqType) => reqType.value === type - ) - - const resetFields = () => { - setValue(`${baseFieldPath}.data.maxAmount`, undefined, { - shouldValidate: true, - }) - setValue(`${baseFieldPath}.data.query`, "", { - shouldValidate: true, - }) - } - - return ( - - - - Type - - - - - {parseFromObject(errors, baseFieldPath)?.type?.message} - - - - {selected?.PolygonIDRequirement && ( - <> - - - - )} - - ) -} - -export default PolygonIDForm diff --git a/src/requirements/PolygonID/PolygonIDRequirement.tsx b/src/requirements/PolygonID/PolygonIDRequirement.tsx deleted file mode 100644 index f1f9782a28..0000000000 --- a/src/requirements/PolygonID/PolygonIDRequirement.tsx +++ /dev/null @@ -1,90 +0,0 @@ -import { - Box, - Button, - Icon, - Popover, - PopoverArrow, - PopoverBody, - PopoverContent, - PopoverTrigger, - Portal, - Text, - useColorModeValue, -} from "@chakra-ui/react" -import { CaretDown } from "@phosphor-icons/react" -import Requirement, { - RequirementProps, -} from "components/[guild]/Requirements/components/Requirement" -import { useRequirementContext } from "components/[guild]/Requirements/components/RequirementContext" -import DataBlock from "components/common/DataBlock" -import formatRelativeTimeFromNow from "utils/formatRelativeTimeFromNow" -import ConnectPolygonID from "./components/ConnectPolygonID" - -const PolygonIDRequirement = (props: RequirementProps) => { - const bg = useColorModeValue("blackAlpha.100", "blackAlpha.300") - const requirement = useRequirementContext() - - const proofAge = - requirement.data?.maxAmount > 0 && - formatRelativeTimeFromNow(requirement.data.maxAmount) - - if (requirement?.data?.query) - return ( - } - {...props} - > - {`Satisfy the `} - {requirement.data.query[0]?.query?.type} - {` PolygonID `} - - - - - - - - - - {JSON.stringify(requirement.data.query, null, 2)} - - - - - - - ) - - return ( - } - {...props} - > - {`Authenticate with PolygonID`} - {requirement.chain !== "POLYGON" && " (on Mumbai)"} - {proofAge && ( - <> - {` (valid until `} - {proofAge} - {`)`} - - )} - - ) -} - -export default PolygonIDRequirement diff --git a/src/requirements/PolygonID/components/ConnectPolygonID.tsx b/src/requirements/PolygonID/components/ConnectPolygonID.tsx deleted file mode 100644 index 5975c832a0..0000000000 --- a/src/requirements/PolygonID/components/ConnectPolygonID.tsx +++ /dev/null @@ -1,196 +0,0 @@ -import { - Box, - ButtonProps, - Center, - Img, - ModalBody, - ModalCloseButton, - ModalContent, - ModalHeader, - ModalOverlay, - Spinner, - Text, - useBreakpointValue, - useDisclosure, -} from "@chakra-ui/react" -import { ArrowsClockwise } from "@phosphor-icons/react" -import { useMembershipUpdate } from "components/[guild]/JoinModal/hooks/useMembershipUpdate" -import { useRequirementContext } from "components/[guild]/Requirements/components/RequirementContext" -import useUser from "components/[guild]/hooks/useUser" -import Button from "components/common/Button" -import ErrorAlert from "components/common/ErrorAlert" -import { Modal } from "components/common/Modal" -import { useRoleMembership } from "components/explorer/hooks/useMembership" -import { useFetcherWithSign } from "hooks/useFetcherWithSign" -import useShowErrorToast from "hooks/useShowErrorToast" -import { QRCodeSVG } from "qrcode.react" -import { useEffect } from "react" -import useSWRImmutable from "swr/immutable" - -const ConnectPolygonID = (props: ButtonProps) => { - const { id: userId } = useUser() - const { id, roleId, type, data, chain } = useRequirementContext() - const { onOpen, onClose, isOpen } = useDisclosure() - - const { reqAccesses } = useRoleMembership(roleId) - - const reqAccess = reqAccesses?.find((err) => err.requirementId === id) - const errorType = reqAccess?.errorType - - // close modal (and stop revalidating access) on successful connect - useEffect(() => { - if (!errorType) onClose() - }, [errorType, onClose]) - - if (!userId || (!!reqAccess?.access && !errorType)) return null - - return ( - <> - - - - - ) -} - -type ConnectPolygonIDModalProps = { - isOpen: boolean - onClose: () => void - type: - | "POLYGON_ID_QUERY" - | "POLYGON_ID_BASIC" - | "POLYGON_ID_QUERY_MAIN" - | "POLYGON_ID_BASIC_MAIN" - data: { - maxAmount?: number - query?: Record - } -} - -const ConnectPolygonIDModal = ({ - isOpen, - onClose, - type, - data, -}: ConnectPolygonIDModalProps) => { - const fetcherWithSign = useFetcherWithSign() - const { - data: response, - isValidating, - error, - mutate, - } = useSWRImmutable( - isOpen - ? [ - `/v2/util/gate-callbacks/session?requirementType=${type}`, - { body: { query: data?.query } }, - ] - : null, - fetcherWithSign - ) - - const qrSize = useBreakpointValue({ base: 300, md: 400 }) - - return ( - - - - Connect PolygonID - - -
- {error ? ( - - ) : !response && isValidating ? ( - <> - - - Generating QR code - - - ) : ( - <> - - - - - - Scan with your Polygon ID app, then re-check access below! The - modal will automatically close on successful connect - - - - )} -
-
-
-
- ) -} - -const RecheckConnectionButton = (): JSX.Element => { - const showErrorToast = useShowErrorToast() - - const { triggerMembershipUpdate, isLoading } = useMembershipUpdate({ - onError: (error) => { - const errorMsg = "Couldn't check access" - const correlationId = error.correlationId - showErrorToast( - correlationId - ? { - error: errorMsg, - correlationId, - } - : errorMsg - ) - }, - }) - - return ( - - ) -} - -export default ConnectPolygonID -export { ConnectPolygonIDModal } diff --git a/src/requirements/PolygonID/components/PolygonIDBasic.tsx b/src/requirements/PolygonID/components/PolygonIDBasic.tsx deleted file mode 100644 index a55ea732f3..0000000000 --- a/src/requirements/PolygonID/components/PolygonIDBasic.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { RequirementFormProps } from "requirements/types" -import PolygonIDProofAge from "./PolygonIDProofAge" - -const PolygonIDBasic = ({ baseFieldPath }: RequirementFormProps) => ( - -) - -export default PolygonIDBasic diff --git a/src/requirements/PolygonID/components/PolygonIDProofAge.tsx b/src/requirements/PolygonID/components/PolygonIDProofAge.tsx deleted file mode 100644 index df8e5d59cc..0000000000 --- a/src/requirements/PolygonID/components/PolygonIDProofAge.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { FormControl, FormLabel } from "@chakra-ui/react" -import FormErrorMessage from "components/common/FormErrorMessage" -import { ControlledRelativeTimeInput } from "components/common/RelativeTimeInput" -import { useFormState } from "react-hook-form" -import { RequirementFormProps } from "requirements/types" -import parseFromObject from "utils/parseFromObject" - -const PolygonIDProofAge = ({ baseFieldPath }: RequirementFormProps) => { - const { errors } = useFormState() - - return ( - - Maximum proof age - - - - - {parseFromObject(errors, baseFieldPath).data?.maxAmount?.message} - - - ) -} - -export default PolygonIDProofAge diff --git a/src/requirements/PolygonID/components/PolygonIDQuery.tsx b/src/requirements/PolygonID/components/PolygonIDQuery.tsx deleted file mode 100644 index 068a95bf3a..0000000000 --- a/src/requirements/PolygonID/components/PolygonIDQuery.tsx +++ /dev/null @@ -1,111 +0,0 @@ -import { - FormControl, - FormHelperText, - FormLabel, - Icon, - Link, - Stack, - Text, - Textarea, -} from "@chakra-ui/react" -import { ArrowSquareOut } from "@phosphor-icons/react" -import FormErrorMessage from "components/common/FormErrorMessage" -import { Controller, useFormContext } from "react-hook-form" -import { RequirementFormProps } from "requirements/types" -import parseFromObject from "utils/parseFromObject" -import PolygonIDProofAge from "./PolygonIDProofAge" - -const PolygonIDQuery = ({ baseFieldPath }: RequirementFormProps) => { - const { - control, - formState: { errors }, - } = useFormContext() - - return ( - - - Query: - - - typeof value === "object" || - "Invalid JSON. Please paste it to a validator to find out more!", - isArray: (value) => - Array.isArray(value) || - "The value should be an array of request objects. You should probably just wrap it in a []", - }, - }} - render={({ field: { onChange, onBlur, value: textareaValue, ref } }) => ( -