From b434927ca8f75dd46962e694dc0680fa6670c398 Mon Sep 17 00:00:00 2001 From: David Suh Date: Wed, 5 Jul 2023 10:55:22 -0500 Subject: [PATCH 01/11] adding routine to clear local storage of avatar data --- src/jitsi/conference-page.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/jitsi/conference-page.ts b/src/jitsi/conference-page.ts index 0d9599c4..c9beeb3c 100644 --- a/src/jitsi/conference-page.ts +++ b/src/jitsi/conference-page.ts @@ -17,6 +17,29 @@ import { * @param {JitsiOptions} options - Configuration options for the conference room * @returns {IJitsiMeetApi} The Jitsi API instance for the conference room */ + +function clearAvatarInfoFromLocalStorage() { + //window.sessionStorage.removeItem("avatar_url"); + const jitsiLocalStorageSettings = + window.localStorage.getItem("jitsiLocalStorage"); + console.log("HELLO"); + console.log(jitsiLocalStorageSettings); + if (jitsiLocalStorageSettings) { + const jitsiLocalStorageSettingsObj = JSON.parse(jitsiLocalStorageSettings); + let baseSettings = jitsiLocalStorageSettingsObj["features/base/settings"]; + if (baseSettings) { + baseSettings = JSON.parse(baseSettings); + baseSettings["avatarURL"] = ""; + jitsiLocalStorageSettingsObj["features/base/settings"] = + JSON.stringify(baseSettings); + } + window.localStorage.setItem( + "jitsiLocalStorage", + JSON.stringify(jitsiLocalStorageSettingsObj) + ); + } +} + export const renderConferencePage = async ( jitsiEventHandlers: JitsiEventHandler[], options: JitsiOptions, @@ -26,7 +49,6 @@ export const renderConferencePage = async ( const { roomName, jwt } = options; reportMethod("renderConferencePage", { roomName, jwt }); reportMethod("JitsiMeetExternalAPI", options); - const JitsiMeetJS = new JitsiMeetExternalAPI(config.webrtc_domain, options); reportAction("JitsiMeetExternalAPI", { status: "activated!" }); updateSubject(JitsiMeetJS, options); From 94cab75cdad1427ad4da09125771447f4f8c4934 Mon Sep 17 00:00:00 2001 From: David Suh Date: Wed, 5 Jul 2023 15:46:59 -0500 Subject: [PATCH 02/11] first localStorage clear --- src/jitsi/conference-page.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jitsi/conference-page.ts b/src/jitsi/conference-page.ts index c9beeb3c..a37952b6 100644 --- a/src/jitsi/conference-page.ts +++ b/src/jitsi/conference-page.ts @@ -22,8 +22,6 @@ function clearAvatarInfoFromLocalStorage() { //window.sessionStorage.removeItem("avatar_url"); const jitsiLocalStorageSettings = window.localStorage.getItem("jitsiLocalStorage"); - console.log("HELLO"); - console.log(jitsiLocalStorageSettings); if (jitsiLocalStorageSettings) { const jitsiLocalStorageSettingsObj = JSON.parse(jitsiLocalStorageSettings); let baseSettings = jitsiLocalStorageSettingsObj["features/base/settings"]; @@ -49,6 +47,8 @@ export const renderConferencePage = async ( const { roomName, jwt } = options; reportMethod("renderConferencePage", { roomName, jwt }); reportMethod("JitsiMeetExternalAPI", options); + + clearAvatarInfoFromLocalStorage(); const JitsiMeetJS = new JitsiMeetExternalAPI(config.webrtc_domain, options); reportAction("JitsiMeetExternalAPI", { status: "activated!" }); updateSubject(JitsiMeetJS, options); From a1d291b44e25bdbdc686329f09148219c9900510 Mon Sep 17 00:00:00 2001 From: David Suh Date: Wed, 5 Jul 2023 15:58:06 -0500 Subject: [PATCH 03/11] adding removal of session storage --- src/jitsi/conference-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jitsi/conference-page.ts b/src/jitsi/conference-page.ts index a37952b6..dc449ba1 100644 --- a/src/jitsi/conference-page.ts +++ b/src/jitsi/conference-page.ts @@ -19,7 +19,7 @@ import { */ function clearAvatarInfoFromLocalStorage() { - //window.sessionStorage.removeItem("avatar_url"); + window.sessionStorage.removeItem("avatar_url"); const jitsiLocalStorageSettings = window.localStorage.getItem("jitsiLocalStorage"); if (jitsiLocalStorageSettings) { From 3b05162575028fc5dbdd1fef0290d54aa6e4f354 Mon Sep 17 00:00:00 2001 From: David Suh Date: Wed, 5 Jul 2023 17:23:04 -0500 Subject: [PATCH 04/11] change storage clear timing --- src/jitsi/conference-page.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/jitsi/conference-page.ts b/src/jitsi/conference-page.ts index dc449ba1..30103e48 100644 --- a/src/jitsi/conference-page.ts +++ b/src/jitsi/conference-page.ts @@ -48,7 +48,6 @@ export const renderConferencePage = async ( reportMethod("renderConferencePage", { roomName, jwt }); reportMethod("JitsiMeetExternalAPI", options); - clearAvatarInfoFromLocalStorage(); const JitsiMeetJS = new JitsiMeetExternalAPI(config.webrtc_domain, options); reportAction("JitsiMeetExternalAPI", { status: "activated!" }); updateSubject(JitsiMeetJS, options); @@ -64,7 +63,7 @@ export const renderConferencePage = async ( if (avatarUrl) { JitsiMeetJS.executeCommand("avatarUrl", avatarUrl); } - + clearAvatarInfoFromLocalStorage(); jitsiEventHandlers.forEach(({ name, fn }: JitsiEventHandler) => { JitsiMeetJS.on(name, fn(JitsiMeetJS, context, options)); }); From 5cd6f6b8c77e848d818dd88e0b8678ba9ed17977 Mon Sep 17 00:00:00 2001 From: David Suh Date: Wed, 5 Jul 2023 17:30:06 -0500 Subject: [PATCH 05/11] localstorage and session storage clear at different times --- src/jitsi/conference-page.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/jitsi/conference-page.ts b/src/jitsi/conference-page.ts index 30103e48..8a78d649 100644 --- a/src/jitsi/conference-page.ts +++ b/src/jitsi/conference-page.ts @@ -19,7 +19,6 @@ import { */ function clearAvatarInfoFromLocalStorage() { - window.sessionStorage.removeItem("avatar_url"); const jitsiLocalStorageSettings = window.localStorage.getItem("jitsiLocalStorage"); if (jitsiLocalStorageSettings) { @@ -47,7 +46,7 @@ export const renderConferencePage = async ( const { roomName, jwt } = options; reportMethod("renderConferencePage", { roomName, jwt }); reportMethod("JitsiMeetExternalAPI", options); - + clearAvatarInfoFromLocalStorage(); const JitsiMeetJS = new JitsiMeetExternalAPI(config.webrtc_domain, options); reportAction("JitsiMeetExternalAPI", { status: "activated!" }); updateSubject(JitsiMeetJS, options); @@ -63,7 +62,7 @@ export const renderConferencePage = async ( if (avatarUrl) { JitsiMeetJS.executeCommand("avatarUrl", avatarUrl); } - clearAvatarInfoFromLocalStorage(); + window.sessionStorage.removeItem("avatar_url"); jitsiEventHandlers.forEach(({ name, fn }: JitsiEventHandler) => { JitsiMeetJS.on(name, fn(JitsiMeetJS, context, options)); }); From 83ed0e66f4c2a5293589e80379e5c0393f13677a Mon Sep 17 00:00:00 2001 From: David Suh Date: Wed, 5 Jul 2023 17:44:32 -0500 Subject: [PATCH 06/11] testing multiple deletes --- src/jitsi/conference-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jitsi/conference-page.ts b/src/jitsi/conference-page.ts index 8a78d649..2e381883 100644 --- a/src/jitsi/conference-page.ts +++ b/src/jitsi/conference-page.ts @@ -66,6 +66,6 @@ export const renderConferencePage = async ( jitsiEventHandlers.forEach(({ name, fn }: JitsiEventHandler) => { JitsiMeetJS.on(name, fn(JitsiMeetJS, context, options)); }); - + clearAvatarInfoFromLocalStorage(); return JitsiMeetJS; }; From 0ad86eb2f69737337cb7cbadf95605ec71924f65 Mon Sep 17 00:00:00 2001 From: David Suh Date: Thu, 6 Jul 2023 21:54:40 -0500 Subject: [PATCH 07/11] experiment: clear at the end of conference-page call --- src/jitsi/conference-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jitsi/conference-page.ts b/src/jitsi/conference-page.ts index 2e381883..b8a0bf72 100644 --- a/src/jitsi/conference-page.ts +++ b/src/jitsi/conference-page.ts @@ -46,7 +46,7 @@ export const renderConferencePage = async ( const { roomName, jwt } = options; reportMethod("renderConferencePage", { roomName, jwt }); reportMethod("JitsiMeetExternalAPI", options); - clearAvatarInfoFromLocalStorage(); + const JitsiMeetJS = new JitsiMeetExternalAPI(config.webrtc_domain, options); reportAction("JitsiMeetExternalAPI", { status: "activated!" }); updateSubject(JitsiMeetJS, options); From 5a5abeea7964eaa56f69b57e470e6b4b172fc1b1 Mon Sep 17 00:00:00 2001 From: David Suh Date: Thu, 6 Jul 2023 22:01:22 -0500 Subject: [PATCH 08/11] experiment 2: clear only before jitsi load --- src/jitsi/conference-page.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jitsi/conference-page.ts b/src/jitsi/conference-page.ts index b8a0bf72..8a78d649 100644 --- a/src/jitsi/conference-page.ts +++ b/src/jitsi/conference-page.ts @@ -46,7 +46,7 @@ export const renderConferencePage = async ( const { roomName, jwt } = options; reportMethod("renderConferencePage", { roomName, jwt }); reportMethod("JitsiMeetExternalAPI", options); - + clearAvatarInfoFromLocalStorage(); const JitsiMeetJS = new JitsiMeetExternalAPI(config.webrtc_domain, options); reportAction("JitsiMeetExternalAPI", { status: "activated!" }); updateSubject(JitsiMeetJS, options); @@ -66,6 +66,6 @@ export const renderConferencePage = async ( jitsiEventHandlers.forEach(({ name, fn }: JitsiEventHandler) => { JitsiMeetJS.on(name, fn(JitsiMeetJS, context, options)); }); - clearAvatarInfoFromLocalStorage(); + return JitsiMeetJS; }; From 7d0ddca5e214134642015ad6c326e7f22d53420a Mon Sep 17 00:00:00 2001 From: David Suh Date: Tue, 11 Jul 2023 15:55:41 -0500 Subject: [PATCH 09/11] adding jwt avatar url access --- src/components/web3/core.ts | 5 +++-- src/jitsi/conference-page.ts | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/web3/core.ts b/src/components/web3/core.ts index 2f6c7df9..d9a94b13 100644 --- a/src/components/web3/core.ts +++ b/src/components/web3/core.ts @@ -49,6 +49,7 @@ export function rememberAvatarUrl(url: string | undefined | null) { * Gets the currently set avatar url, if any * @returns {string|null} - The avatar url value or a null value */ -export function getAvatarUrl(): string | null { - return window.sessionStorage.getItem(AVATAR_URL_SESSION_KEY); +export function getAvatarUrl(jwt: string): string | null { + const sessionAvatar = window.sessionStorage.getItem(AVATAR_URL_SESSION_KEY); + return sessionAvatar || jwt_decode(jwt).avatar_url || null; } diff --git a/src/jitsi/conference-page.ts b/src/jitsi/conference-page.ts index 8a78d649..dbbbae9a 100644 --- a/src/jitsi/conference-page.ts +++ b/src/jitsi/conference-page.ts @@ -57,8 +57,7 @@ export const renderConferencePage = async ( context.inactiveInterval ); } - - const avatarUrl = getAvatarUrl(); + const avatarUrl = getAvatarUrl(jwt); if (avatarUrl) { JitsiMeetJS.executeCommand("avatarUrl", avatarUrl); } From f2a389b03c0d541d9c791794dc2c1ed6c1b2a712 Mon Sep 17 00:00:00 2001 From: David Suh Date: Wed, 12 Jul 2023 15:06:05 -0500 Subject: [PATCH 10/11] delete-me: commit for the sake of dev2 compat --- src/components/web3/NonExpandablePanel.tsx | 55 +++++++++++++++++++ src/components/web3/OptionalSettings.tsx | 12 +++- .../web3/PermissionTypeSelector.tsx | 9 ++- src/components/web3/SelectableImageList.tsx | 6 +- src/components/web3/api.ts | 14 +++++ src/hooks/use-web3-call-state.ts | 20 ++++++- src/i18n/locales/en/translation.json | 2 + 7 files changed, 111 insertions(+), 7 deletions(-) create mode 100644 src/components/web3/NonExpandablePanel.tsx diff --git a/src/components/web3/NonExpandablePanel.tsx b/src/components/web3/NonExpandablePanel.tsx new file mode 100644 index 00000000..a6209b39 --- /dev/null +++ b/src/components/web3/NonExpandablePanel.tsx @@ -0,0 +1,55 @@ +import { css } from "@emotion/react"; +import React, { ReactNode, useState } from "react"; +import { baseText } from "./styles"; +import PlusImage from "../../images/plus.svg"; +import MinusImage from "../../images/minus.svg"; +import SpinnerImage from "../../images/spinner.svg"; + +interface Props { + header: string; + subhead: string; + loading?: boolean; + children?: ReactNode; +} + +export const NonExapandablePanel: React.FC = ({ + header, + subhead, + loading = false, + children, +}) => { + return ( +
+
+
+
+ {header} +
+
{subhead}
+
+ {loading && ( + spinner + )} +
+
+ ); +}; diff --git a/src/components/web3/OptionalSettings.tsx b/src/components/web3/OptionalSettings.tsx index b70e90c0..b2b6a520 100644 --- a/src/components/web3/OptionalSettings.tsx +++ b/src/components/web3/OptionalSettings.tsx @@ -2,11 +2,13 @@ import React from "react"; import { useTranslation } from "react-i18next"; import { POAP, NFTcollection, NFT } from "./core"; import { ExapandablePanel } from "./ExpandablePanel"; +import { NonExapandablePanel } from "./NonExpandablePanel"; import { SelectableImageList } from "./SelectableImageList"; import { SelectablePoapList } from "./SelectablePoapList"; import { SelectableNFTCollectionList } from "./SelectableNFTCollectionList"; import { PermissionTypeSelector } from "./PermissionTypeSelector"; import noNftImage from "../../images/no-nft-image.png"; +import { Web3PermissionType } from "./api"; interface Props { startCall: boolean; @@ -16,7 +18,7 @@ interface Props { nft: string | null; setNft: (nft: string) => void; permissionType: string; - setPermissionType: (permissionType: string) => void; + setPermissionType: (permissionType: Web3PermissionType) => void; participantPoaps: POAP[]; setParticipantPoaps: (participantPoaps: POAP[]) => void; moderatorPoaps: POAP[]; @@ -157,6 +159,14 @@ export const OptionalSettings: React.FC = ({ )} + {startCall && permissionType === "balance" && ( + + + + )} ); }; diff --git a/src/components/web3/PermissionTypeSelector.tsx b/src/components/web3/PermissionTypeSelector.tsx index 9f6c0861..492ae950 100644 --- a/src/components/web3/PermissionTypeSelector.tsx +++ b/src/components/web3/PermissionTypeSelector.tsx @@ -1,10 +1,11 @@ import React from "react"; import { css } from "@emotion/react"; import { useTranslation } from "react-i18next"; +import { Web3PermissionType } from "./api"; type Props = { permissionType: string; - setPermissionType: (permissionType: string) => void; + setPermissionType: (permissionType: Web3PermissionType) => void; }; const styles = { @@ -53,6 +54,12 @@ export const PermissionTypeSelector: React.FC = ({ > {t("nft_collection_permission_type")} + ); }; diff --git a/src/components/web3/SelectableImageList.tsx b/src/components/web3/SelectableImageList.tsx index 3eb14d69..0feda7cb 100644 --- a/src/components/web3/SelectableImageList.tsx +++ b/src/components/web3/SelectableImageList.tsx @@ -53,7 +53,9 @@ export const SelectableImageList: React.FC = ({ checked={showSpamItems} onChange={onToggleSpamItems} /> - {showSpamItems ? "Show all NFTs" : "Show all NFTs (not all being shown)"} + {showSpamItems + ? "Show all NFTs" + : "Show all NFTs (not all being shown)"} )} @@ -82,4 +84,4 @@ export const SelectableImageList: React.FC = ({ ); -}; \ No newline at end of file +}; diff --git a/src/components/web3/api.ts b/src/components/web3/api.ts index 12c9807a..a169cc30 100644 --- a/src/components/web3/api.ts +++ b/src/components/web3/api.ts @@ -9,6 +9,8 @@ declare let window: any; // making a cross domain call - see https://github.com/brave/devops/issues/5445. const SIMPLEHASH_PROXY_ROOT_URL = "/api/v1/simplehash"; +export type Web3PermissionType = "POAP" | "NFT-collection" | "balance"; + export interface Web3Authentication { method: string; proof: { @@ -22,6 +24,18 @@ export interface Web3Authorization { method: string; POAPs: Web3AuthList; Collections: Web3AuthList; + Balances: Web3BalancesList; +} + +export interface Web3BalancesList { + participants: Web3BalancesRequireList; + moderators: Web3BalancesRequireList; +} + +export interface Web3BalancesRequireList { + network: "ETH"; // "ETH" | "SOL" in the future probably + token?: string; + minimum: string; // in wei, e.g. 10e-18 } export interface Web3AuthList { diff --git a/src/hooks/use-web3-call-state.ts b/src/hooks/use-web3-call-state.ts index d64fa142..c2efe516 100644 --- a/src/hooks/use-web3-call-state.ts +++ b/src/hooks/use-web3-call-state.ts @@ -4,6 +4,7 @@ import { Web3RequestBody, Web3Authentication, web3Prove, + Web3PermissionType, } from "../components/web3/api"; import { POAP, NFTcollection } from "../components/web3/core"; import { generateRoomName } from "../lib"; @@ -11,14 +12,14 @@ import { fetchJWT } from "../rooms"; interface Web3CallState { web3Address?: string; - permissionType: string; + permissionType: Web3PermissionType; nft: string | null; participantPoaps: POAP[]; moderatorPoaps: POAP[]; participantNFTCollections: NFTcollection[]; moderatorNFTCollections: NFTcollection[]; setWeb3Address: (web3Address: string, event: string) => void; - setPermissionType: (permissionType: string) => void; + setPermissionType: (permissionType: Web3PermissionType) => void; setNft: (nft: string) => void; setParticipantPoaps: (participanPoaps: POAP[]) => void; setModeratorPoaps: (moderatorPoaps: POAP[]) => void; @@ -38,7 +39,8 @@ export function useWeb3CallState( setFeedbackMessage: (message: TranslationKeys) => void ): Web3CallState { const [web3Address, _setWeb3Address] = useState(); - const [permissionType, setPermissionType] = useState("POAP"); + const [permissionType, setPermissionType] = + useState("POAP"); const [nft, setNft] = useState(null); const [participantPoaps, setParticipantPoaps] = useState([]); const [moderatorPoaps, setModeratorPoaps] = useState([]); @@ -151,6 +153,18 @@ export function useWeb3CallState( deny: [], }, }, + Balances: { + participants: { + network: "ETH" as const, + token: "BAT", + minimum: "1", + }, + moderators: { + network: "ETH" as const, + token: "BAT", + minimum: "1", + }, + }, }, avatarURL: nft, }; diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 0a7fc74a..4e6d178d 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -1,6 +1,8 @@ { "avatar_fetch_error": "Failed to fetch avatar NFTs", "avatar_nft_subhead": "Currently supports Ethereum ERC-721 NFTs", + "bat_gating_panel_header": "Non Zero BAT gating will be applied.", + "bat_gating_panel_subheader": "Users will need to have a non-zero balance of BAT in their wallet to join this call.", "call_permission_type": "Call permission type:", "check_subscription": "Checking subscription status...", "create_link": "Create link", From 826e8cab95e88275abceea8836c96a2ed24b99b5 Mon Sep 17 00:00:00 2001 From: David Suh Date: Fri, 14 Jul 2023 11:46:22 -0500 Subject: [PATCH 11/11] Revert "delete-me: commit for the sake of dev2 compat" This reverts commit f2a389b03c0d541d9c791794dc2c1ed6c1b2a712. --- src/components/web3/NonExpandablePanel.tsx | 55 ------------------- src/components/web3/OptionalSettings.tsx | 12 +--- .../web3/PermissionTypeSelector.tsx | 9 +-- src/components/web3/SelectableImageList.tsx | 6 +- src/components/web3/api.ts | 14 ----- src/hooks/use-web3-call-state.ts | 20 +------ src/i18n/locales/en/translation.json | 2 - 7 files changed, 7 insertions(+), 111 deletions(-) delete mode 100644 src/components/web3/NonExpandablePanel.tsx diff --git a/src/components/web3/NonExpandablePanel.tsx b/src/components/web3/NonExpandablePanel.tsx deleted file mode 100644 index a6209b39..00000000 --- a/src/components/web3/NonExpandablePanel.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { css } from "@emotion/react"; -import React, { ReactNode, useState } from "react"; -import { baseText } from "./styles"; -import PlusImage from "../../images/plus.svg"; -import MinusImage from "../../images/minus.svg"; -import SpinnerImage from "../../images/spinner.svg"; - -interface Props { - header: string; - subhead: string; - loading?: boolean; - children?: ReactNode; -} - -export const NonExapandablePanel: React.FC = ({ - header, - subhead, - loading = false, - children, -}) => { - return ( -
-
-
-
- {header} -
-
{subhead}
-
- {loading && ( - spinner - )} -
-
- ); -}; diff --git a/src/components/web3/OptionalSettings.tsx b/src/components/web3/OptionalSettings.tsx index b2b6a520..b70e90c0 100644 --- a/src/components/web3/OptionalSettings.tsx +++ b/src/components/web3/OptionalSettings.tsx @@ -2,13 +2,11 @@ import React from "react"; import { useTranslation } from "react-i18next"; import { POAP, NFTcollection, NFT } from "./core"; import { ExapandablePanel } from "./ExpandablePanel"; -import { NonExapandablePanel } from "./NonExpandablePanel"; import { SelectableImageList } from "./SelectableImageList"; import { SelectablePoapList } from "./SelectablePoapList"; import { SelectableNFTCollectionList } from "./SelectableNFTCollectionList"; import { PermissionTypeSelector } from "./PermissionTypeSelector"; import noNftImage from "../../images/no-nft-image.png"; -import { Web3PermissionType } from "./api"; interface Props { startCall: boolean; @@ -18,7 +16,7 @@ interface Props { nft: string | null; setNft: (nft: string) => void; permissionType: string; - setPermissionType: (permissionType: Web3PermissionType) => void; + setPermissionType: (permissionType: string) => void; participantPoaps: POAP[]; setParticipantPoaps: (participantPoaps: POAP[]) => void; moderatorPoaps: POAP[]; @@ -159,14 +157,6 @@ export const OptionalSettings: React.FC = ({ )} - {startCall && permissionType === "balance" && ( - - - - )} ); }; diff --git a/src/components/web3/PermissionTypeSelector.tsx b/src/components/web3/PermissionTypeSelector.tsx index 492ae950..9f6c0861 100644 --- a/src/components/web3/PermissionTypeSelector.tsx +++ b/src/components/web3/PermissionTypeSelector.tsx @@ -1,11 +1,10 @@ import React from "react"; import { css } from "@emotion/react"; import { useTranslation } from "react-i18next"; -import { Web3PermissionType } from "./api"; type Props = { permissionType: string; - setPermissionType: (permissionType: Web3PermissionType) => void; + setPermissionType: (permissionType: string) => void; }; const styles = { @@ -54,12 +53,6 @@ export const PermissionTypeSelector: React.FC = ({ > {t("nft_collection_permission_type")} - ); }; diff --git a/src/components/web3/SelectableImageList.tsx b/src/components/web3/SelectableImageList.tsx index 0feda7cb..3eb14d69 100644 --- a/src/components/web3/SelectableImageList.tsx +++ b/src/components/web3/SelectableImageList.tsx @@ -53,9 +53,7 @@ export const SelectableImageList: React.FC = ({ checked={showSpamItems} onChange={onToggleSpamItems} /> - {showSpamItems - ? "Show all NFTs" - : "Show all NFTs (not all being shown)"} + {showSpamItems ? "Show all NFTs" : "Show all NFTs (not all being shown)"} )} @@ -84,4 +82,4 @@ export const SelectableImageList: React.FC = ({ ); -}; +}; \ No newline at end of file diff --git a/src/components/web3/api.ts b/src/components/web3/api.ts index a169cc30..12c9807a 100644 --- a/src/components/web3/api.ts +++ b/src/components/web3/api.ts @@ -9,8 +9,6 @@ declare let window: any; // making a cross domain call - see https://github.com/brave/devops/issues/5445. const SIMPLEHASH_PROXY_ROOT_URL = "/api/v1/simplehash"; -export type Web3PermissionType = "POAP" | "NFT-collection" | "balance"; - export interface Web3Authentication { method: string; proof: { @@ -24,18 +22,6 @@ export interface Web3Authorization { method: string; POAPs: Web3AuthList; Collections: Web3AuthList; - Balances: Web3BalancesList; -} - -export interface Web3BalancesList { - participants: Web3BalancesRequireList; - moderators: Web3BalancesRequireList; -} - -export interface Web3BalancesRequireList { - network: "ETH"; // "ETH" | "SOL" in the future probably - token?: string; - minimum: string; // in wei, e.g. 10e-18 } export interface Web3AuthList { diff --git a/src/hooks/use-web3-call-state.ts b/src/hooks/use-web3-call-state.ts index c2efe516..d64fa142 100644 --- a/src/hooks/use-web3-call-state.ts +++ b/src/hooks/use-web3-call-state.ts @@ -4,7 +4,6 @@ import { Web3RequestBody, Web3Authentication, web3Prove, - Web3PermissionType, } from "../components/web3/api"; import { POAP, NFTcollection } from "../components/web3/core"; import { generateRoomName } from "../lib"; @@ -12,14 +11,14 @@ import { fetchJWT } from "../rooms"; interface Web3CallState { web3Address?: string; - permissionType: Web3PermissionType; + permissionType: string; nft: string | null; participantPoaps: POAP[]; moderatorPoaps: POAP[]; participantNFTCollections: NFTcollection[]; moderatorNFTCollections: NFTcollection[]; setWeb3Address: (web3Address: string, event: string) => void; - setPermissionType: (permissionType: Web3PermissionType) => void; + setPermissionType: (permissionType: string) => void; setNft: (nft: string) => void; setParticipantPoaps: (participanPoaps: POAP[]) => void; setModeratorPoaps: (moderatorPoaps: POAP[]) => void; @@ -39,8 +38,7 @@ export function useWeb3CallState( setFeedbackMessage: (message: TranslationKeys) => void ): Web3CallState { const [web3Address, _setWeb3Address] = useState(); - const [permissionType, setPermissionType] = - useState("POAP"); + const [permissionType, setPermissionType] = useState("POAP"); const [nft, setNft] = useState(null); const [participantPoaps, setParticipantPoaps] = useState([]); const [moderatorPoaps, setModeratorPoaps] = useState([]); @@ -153,18 +151,6 @@ export function useWeb3CallState( deny: [], }, }, - Balances: { - participants: { - network: "ETH" as const, - token: "BAT", - minimum: "1", - }, - moderators: { - network: "ETH" as const, - token: "BAT", - minimum: "1", - }, - }, }, avatarURL: nft, }; diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 4e6d178d..0a7fc74a 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -1,8 +1,6 @@ { "avatar_fetch_error": "Failed to fetch avatar NFTs", "avatar_nft_subhead": "Currently supports Ethereum ERC-721 NFTs", - "bat_gating_panel_header": "Non Zero BAT gating will be applied.", - "bat_gating_panel_subheader": "Users will need to have a non-zero balance of BAT in their wallet to join this call.", "call_permission_type": "Call permission type:", "check_subscription": "Checking subscription status...", "create_link": "Create link",