From a206b5c782fee4f1cac28b607081bf59d5f43cf7 Mon Sep 17 00:00:00 2001 From: Tarrence van As Date: Fri, 20 Dec 2024 14:28:20 -0500 Subject: [PATCH 1/2] Configure slot consent (#1202) --- packages/keychain/src/components/app.tsx | 3 ++- packages/keychain/src/components/slot/consent.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/keychain/src/components/app.tsx b/packages/keychain/src/components/app.tsx index e8e112fd2..f5e24c1c2 100644 --- a/packages/keychain/src/components/app.tsx +++ b/packages/keychain/src/components/app.tsx @@ -5,7 +5,7 @@ import { Session } from "./session"; import { Failure } from "./failure"; import { Success } from "./success"; import { Pending } from "./pending"; -import { Slot } from "./slot"; +import { Consent, Slot } from "./slot"; export function App() { return ( @@ -14,6 +14,7 @@ export function App() { } /> } /> } /> + } /> } /> } /> } /> diff --git a/packages/keychain/src/components/slot/consent.tsx b/packages/keychain/src/components/slot/consent.tsx index 5db4db27f..1ff4d90e5 100644 --- a/packages/keychain/src/components/slot/consent.tsx +++ b/packages/keychain/src/components/slot/consent.tsx @@ -25,7 +25,7 @@ export function Consent() { useEffect(() => { if (!Controller.fromStore(import.meta.env.VITE_ORIGIN!)) { - navigate("/slot", { replace: true }); + navigate("/slot/auth", { replace: true }); } }, [navigate]); From 69f5a1c003e545aa13ef1326349d00302ef9cbff Mon Sep 17 00:00:00 2001 From: Tarrence van As Date: Fri, 20 Dec 2024 17:12:38 -0500 Subject: [PATCH 2/2] Fix RegisterSession redirection (#1203) --- packages/keychain/src/components/ExecutionContainer.tsx | 6 ++++-- .../keychain/src/components/connect/RegisterSession.tsx | 2 +- packages/keychain/src/components/session.tsx | 7 +++++-- .../src/components/session/UnverifiedSessionSummary.tsx | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/keychain/src/components/ExecutionContainer.tsx b/packages/keychain/src/components/ExecutionContainer.tsx index f81426a62..35483f3ae 100644 --- a/packages/keychain/src/components/ExecutionContainer.tsx +++ b/packages/keychain/src/components/ExecutionContainer.tsx @@ -72,7 +72,7 @@ export function ExecutionContainer({ ); useEffect(() => { - if (!!ctrlError || maxFee !== null || !transactions.length) { + if (!!ctrlError || maxFee !== null || !transactions?.length) { return; } @@ -200,7 +200,9 @@ export function ExecutionContainer({ colorScheme="colorful" onClick={handleSubmit} isLoading={isLoading} - isDisabled={maxFee === null && transactions.length} + isDisabled={ + !transactions || (maxFee === null && transactions?.length) + } > {buttonText} diff --git a/packages/keychain/src/components/connect/RegisterSession.tsx b/packages/keychain/src/components/connect/RegisterSession.tsx index 56d34cce0..2832dd6d6 100644 --- a/packages/keychain/src/components/connect/RegisterSession.tsx +++ b/packages/keychain/src/components/connect/RegisterSession.tsx @@ -52,7 +52,7 @@ export function RegisterSession({ const onRegisterSession = useCallback( async (maxFee?: bigint) => { - if (!maxFee || !publicKey || !controller) { + if (maxFee == undefined || !publicKey || !controller) { return; } diff --git a/packages/keychain/src/components/session.tsx b/packages/keychain/src/components/session.tsx index 79a0f218d..221a9e49b 100644 --- a/packages/keychain/src/components/session.tsx +++ b/packages/keychain/src/components/session.tsx @@ -71,7 +71,10 @@ export function Session() { const url = sanitizeCallbackUrl( decodeURIComponent(queries.callback_uri), ); - if (!url) return; + if (!url) { + return; + } + const res = await fetch(url, { body: encodedResponse, headers, @@ -99,7 +102,7 @@ export function Session() { if (queries.redirect_uri) { const url = decodeURIComponent(queries.redirect_uri); const query_name = queries.redirect_query_name ?? "session"; - navigate(`${url}?${query_name}=${encodedResponse}`, { replace: true }); + window.location.href = `${url}?${query_name}=${encodedResponse}`; } }, [navigate, queries], diff --git a/packages/keychain/src/components/session/UnverifiedSessionSummary.tsx b/packages/keychain/src/components/session/UnverifiedSessionSummary.tsx index f65f1695d..d4cb31bb2 100644 --- a/packages/keychain/src/components/session/UnverifiedSessionSummary.tsx +++ b/packages/keychain/src/components/session/UnverifiedSessionSummary.tsx @@ -27,7 +27,7 @@ export function UnverifiedSessionSummary({ ); })} - {policies.messages?.length && ( + {policies.messages && policies.messages.length > 0 && ( )}