From 11f5c9d499cd83daeec90bc0cafe327af22d754f Mon Sep 17 00:00:00 2001 From: Soam Desai Date: Tue, 21 Jul 2026 15:47:32 -0700 Subject: [PATCH] Remove unused MiniKiosk from action settings --- .../Settings/TryAction/MiniKiosk/index.tsx | 197 ------------------ .../ActionId/Settings/TryAction/index.tsx | 80 +------ .../Actions/ActionId/Settings/page/index.tsx | 6 +- .../ActionId/Settings/page/index.tsx | 2 - .../Settings/TryAction/MiniKiosk/index.tsx | 197 ------------------ .../ActionId/Settings/TryAction/index.tsx | 80 +------ .../Actions/ActionId/Settings/page/index.tsx | 6 +- 7 files changed, 20 insertions(+), 548 deletions(-) delete mode 100644 web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/MiniKiosk/index.tsx delete mode 100644 web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/MiniKiosk/index.tsx diff --git a/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/MiniKiosk/index.tsx b/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/MiniKiosk/index.tsx deleted file mode 100644 index 87469fb016..0000000000 --- a/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/MiniKiosk/index.tsx +++ /dev/null @@ -1,197 +0,0 @@ -import { LegacyVerificationLevel } from "@/lib/idkit"; -import { KioskScreen } from "@/lib/types"; -import type { IDKitResult } from "@worldcoin/idkit"; -import clsx from "clsx"; -import { useCallback, useEffect, useState } from "react"; -import { Connected } from "../../../Components/Kiosk/Connected"; -import { KioskError } from "../../../Components/Kiosk/KioskError"; -import { Success } from "../../../Components/Kiosk/Success"; -import { Waiting } from "../../../Components/Kiosk/Waiting"; -import { - submitKioskProof, - useLegacyKioskRequest, - type KioskProofResponse, -} from "../../../Components/Kiosk/useLegacyKioskRequest"; - -type MiniKioskProps = { - action: { - name: string; - description: string; - action: string; - app_id: string; - app: { is_staging: boolean }; - }; - is_v4_action: boolean; -}; -export const MiniKiosk = (props: MiniKioskProps) => { - const [screen, setScreen] = useState(KioskScreen.Waiting); - const [kioskVerificationLevel, setKioskVerificationLevel] = - useState(LegacyVerificationLevel.Device); - - const { action, is_v4_action } = props; - const appId = action.app_id as `app_${string}`; - const { connectorURI, proofResult, requestScreen, restartRequest } = - useLegacyKioskRequest({ - appId, - action: action.action, - actionDescription: action.description, - verificationLevel: kioskVerificationLevel, - enabled: Boolean(action), - }); - - const resetKiosk = useCallback(() => { - setScreen(KioskScreen.Waiting); - restartRequest(); - }, [restartRequest]); - - const resetKioskAndUpdateVerificationLevel = useCallback( - (newVerificationLevel: LegacyVerificationLevel) => { - setKioskVerificationLevel(newVerificationLevel); - setScreen(KioskScreen.Waiting); - restartRequest(); - }, - [restartRequest], - ); - - // Reset kiosk if the action changes - useEffect(() => { - if (!action) { - setScreen(KioskScreen.InvalidRequest); - } - }, [action, setScreen]); - - useEffect(() => { - if (action) { - setScreen(requestScreen); - } - }, [action, requestScreen]); - - const verifyProof = useCallback( - async (result: IDKitResult) => { - if (!result) { - return; - } - - let response: KioskProofResponse = { - success: false, - code: "unknown", - }; - try { - response = await submitKioskProof(appId, result, is_v4_action); - } catch (e) { - console.warn("Error verifying proof. Please check network logs."); - try { - if ((e as Record).code) { - response = { - success: false, - code: (e as Record).code, - }; - } - } catch { - response = { success: false, code: "unknown" }; - } - } - - if (response.success) { - setScreen(KioskScreen.Success); - } else { - if (response.code === "max_verifications_reached") { - setScreen(KioskScreen.AlreadyVerified); - } else if (response.code === "invalid_merkle_root") { - setScreen(KioskScreen.InvalidIdentity); - } else { - setScreen(KioskScreen.VerificationError); - } - } - }, - [appId], - ); - - useEffect(() => { - if (proofResult) { - void verifyProof(proofResult); - } - }, [proofResult, verifyProof]); - - return ( -
-
- {!action && ( - - )} - - {screen === KioskScreen.Waiting && ( - - )} - {screen === KioskScreen.Connected && } - {screen === KioskScreen.Success && } - - {screen === KioskScreen.ConnectionError && ( - - )} - - {screen === KioskScreen.AlreadyVerified && ( - - )} - - {screen === KioskScreen.VerificationRejected && ( - - )} - - {screen === KioskScreen.InvalidIdentity && ( - - )} - - {screen === KioskScreen.VerificationError && ( - - )} -
-
- ); -}; diff --git a/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/index.tsx b/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/index.tsx index 8c0f8dadb2..69b64b0e23 100644 --- a/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/index.tsx +++ b/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/index.tsx @@ -1,14 +1,7 @@ "use client"; -import { Button } from "@/components/Button"; -import { CodeIcon } from "@/components/Icons/CodeIcon"; -import { QRIcon } from "@/components/Icons/QRIcon"; import { TYPOGRAPHY, Typography } from "@/components/Typography"; -import { EngineType } from "@/lib/types"; -import clsx from "clsx"; -import { useState } from "react"; import { CodeBlock } from "./CodeBlock"; -import { MiniKiosk } from "./MiniKiosk"; type TryActionProps = { action: { @@ -22,77 +15,22 @@ type TryActionProps = { app_metadata: { app_mode: string }[]; }; }; - is_v4_action: boolean; - enableKiosk?: boolean; }; export const TryAction = (props: TryActionProps) => { - const { action, is_v4_action, enableKiosk = true } = props; - const canShowKiosk = enableKiosk && action.app.engine !== EngineType.OnChain; - // World ID verification for Mini Apps is implemented with @worldcoin/idkit - // (MiniKit 2.x no longer proxies verification), so the IDKit CodeBlock is the - // correct integration path for every app type — show it for all apps. - const canShowCode = true; - const [showCode, setShowCode] = useState( - action.app.engine === EngineType.OnChain || !canShowKiosk, - ); - const showCodeView = canShowCode && (showCode || !canShowKiosk); - const showKioskView = canShowKiosk && !showCodeView; + const { action } = props; return (
-
- - Try it out - -
- {canShowKiosk && ( - - )} - {canShowCode && ( - - )} -
-
+ + Try it out +
- {showCodeView && ( - - )} - {showKioskView && ( - - )} +
); diff --git a/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/page/index.tsx b/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/page/index.tsx index 5e11994924..43f4b13bdd 100644 --- a/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/page/index.tsx +++ b/web/scenes/Portal/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/page/index.tsx @@ -52,11 +52,7 @@ export const ActionIdSettingsPage = (props: ActionIdSettingsPageProps) => { {loading ? ( ) : ( - + )} diff --git a/web/scenes/Portal/Teams/TeamId/Apps/AppId/WorldIdActions/ActionId/Settings/page/index.tsx b/web/scenes/Portal/Teams/TeamId/Apps/AppId/WorldIdActions/ActionId/Settings/page/index.tsx index 8fc2262562..b678953022 100644 --- a/web/scenes/Portal/Teams/TeamId/Apps/AppId/WorldIdActions/ActionId/Settings/page/index.tsx +++ b/web/scenes/Portal/Teams/TeamId/Apps/AppId/WorldIdActions/ActionId/Settings/page/index.tsx @@ -64,8 +64,6 @@ export const WorldIdActionIdSettingsPage = ( app_id: action!.rp_registration.app_id, }, })} - is_v4_action={true} - enableKiosk={false} /> )} diff --git a/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/MiniKiosk/index.tsx b/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/MiniKiosk/index.tsx deleted file mode 100644 index 87469fb016..0000000000 --- a/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/MiniKiosk/index.tsx +++ /dev/null @@ -1,197 +0,0 @@ -import { LegacyVerificationLevel } from "@/lib/idkit"; -import { KioskScreen } from "@/lib/types"; -import type { IDKitResult } from "@worldcoin/idkit"; -import clsx from "clsx"; -import { useCallback, useEffect, useState } from "react"; -import { Connected } from "../../../Components/Kiosk/Connected"; -import { KioskError } from "../../../Components/Kiosk/KioskError"; -import { Success } from "../../../Components/Kiosk/Success"; -import { Waiting } from "../../../Components/Kiosk/Waiting"; -import { - submitKioskProof, - useLegacyKioskRequest, - type KioskProofResponse, -} from "../../../Components/Kiosk/useLegacyKioskRequest"; - -type MiniKioskProps = { - action: { - name: string; - description: string; - action: string; - app_id: string; - app: { is_staging: boolean }; - }; - is_v4_action: boolean; -}; -export const MiniKiosk = (props: MiniKioskProps) => { - const [screen, setScreen] = useState(KioskScreen.Waiting); - const [kioskVerificationLevel, setKioskVerificationLevel] = - useState(LegacyVerificationLevel.Device); - - const { action, is_v4_action } = props; - const appId = action.app_id as `app_${string}`; - const { connectorURI, proofResult, requestScreen, restartRequest } = - useLegacyKioskRequest({ - appId, - action: action.action, - actionDescription: action.description, - verificationLevel: kioskVerificationLevel, - enabled: Boolean(action), - }); - - const resetKiosk = useCallback(() => { - setScreen(KioskScreen.Waiting); - restartRequest(); - }, [restartRequest]); - - const resetKioskAndUpdateVerificationLevel = useCallback( - (newVerificationLevel: LegacyVerificationLevel) => { - setKioskVerificationLevel(newVerificationLevel); - setScreen(KioskScreen.Waiting); - restartRequest(); - }, - [restartRequest], - ); - - // Reset kiosk if the action changes - useEffect(() => { - if (!action) { - setScreen(KioskScreen.InvalidRequest); - } - }, [action, setScreen]); - - useEffect(() => { - if (action) { - setScreen(requestScreen); - } - }, [action, requestScreen]); - - const verifyProof = useCallback( - async (result: IDKitResult) => { - if (!result) { - return; - } - - let response: KioskProofResponse = { - success: false, - code: "unknown", - }; - try { - response = await submitKioskProof(appId, result, is_v4_action); - } catch (e) { - console.warn("Error verifying proof. Please check network logs."); - try { - if ((e as Record).code) { - response = { - success: false, - code: (e as Record).code, - }; - } - } catch { - response = { success: false, code: "unknown" }; - } - } - - if (response.success) { - setScreen(KioskScreen.Success); - } else { - if (response.code === "max_verifications_reached") { - setScreen(KioskScreen.AlreadyVerified); - } else if (response.code === "invalid_merkle_root") { - setScreen(KioskScreen.InvalidIdentity); - } else { - setScreen(KioskScreen.VerificationError); - } - } - }, - [appId], - ); - - useEffect(() => { - if (proofResult) { - void verifyProof(proofResult); - } - }, [proofResult, verifyProof]); - - return ( -
-
- {!action && ( - - )} - - {screen === KioskScreen.Waiting && ( - - )} - {screen === KioskScreen.Connected && } - {screen === KioskScreen.Success && } - - {screen === KioskScreen.ConnectionError && ( - - )} - - {screen === KioskScreen.AlreadyVerified && ( - - )} - - {screen === KioskScreen.VerificationRejected && ( - - )} - - {screen === KioskScreen.InvalidIdentity && ( - - )} - - {screen === KioskScreen.VerificationError && ( - - )} -
-
- ); -}; diff --git a/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/index.tsx b/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/index.tsx index 8c0f8dadb2..69b64b0e23 100644 --- a/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/index.tsx +++ b/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/TryAction/index.tsx @@ -1,14 +1,7 @@ "use client"; -import { Button } from "@/components/Button"; -import { CodeIcon } from "@/components/Icons/CodeIcon"; -import { QRIcon } from "@/components/Icons/QRIcon"; import { TYPOGRAPHY, Typography } from "@/components/Typography"; -import { EngineType } from "@/lib/types"; -import clsx from "clsx"; -import { useState } from "react"; import { CodeBlock } from "./CodeBlock"; -import { MiniKiosk } from "./MiniKiosk"; type TryActionProps = { action: { @@ -22,77 +15,22 @@ type TryActionProps = { app_metadata: { app_mode: string }[]; }; }; - is_v4_action: boolean; - enableKiosk?: boolean; }; export const TryAction = (props: TryActionProps) => { - const { action, is_v4_action, enableKiosk = true } = props; - const canShowKiosk = enableKiosk && action.app.engine !== EngineType.OnChain; - // World ID verification for Mini Apps is implemented with @worldcoin/idkit - // (MiniKit 2.x no longer proxies verification), so the IDKit CodeBlock is the - // correct integration path for every app type — show it for all apps. - const canShowCode = true; - const [showCode, setShowCode] = useState( - action.app.engine === EngineType.OnChain || !canShowKiosk, - ); - const showCodeView = canShowCode && (showCode || !canShowKiosk); - const showKioskView = canShowKiosk && !showCodeView; + const { action } = props; return (
-
- - Try it out - -
- {canShowKiosk && ( - - )} - {canShowCode && ( - - )} -
-
+ + Try it out +
- {showCodeView && ( - - )} - {showKioskView && ( - - )} +
); diff --git a/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/page/index.tsx b/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/page/index.tsx index 5e11994924..43f4b13bdd 100644 --- a/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/page/index.tsx +++ b/web/scenes/PortalV3/Teams/TeamId/Apps/AppId/Actions/ActionId/Settings/page/index.tsx @@ -52,11 +52,7 @@ export const ActionIdSettingsPage = (props: ActionIdSettingsPageProps) => { {loading ? ( ) : ( - + )}