From 2365925fb8c260bc89b076911e3564131320d1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Sibiril?= <81782+aureliensibiril@users.noreply.github.com> Date: Sat, 11 Jul 2026 17:55:43 +0200 Subject: [PATCH] Fix Crisp connect dialog error and copy feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two honest-feedback fixes in the API-key connect dialog. The connection-failure toast told managed providers (Crisp) to check their API key, but Crisp shows no key field; it now points them to the settings and verification code instead. The verification-code copy button showed a success toast before the clipboard write resolved; it now confirms the write and reports a failure with a manual-copy hint, matching how other copy buttons behave. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com> --- .../_components/APIKeyConnectorDialog.tsx | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/apps/console/src/pages/organizations/access-reviews/dialogs/_components/APIKeyConnectorDialog.tsx b/apps/console/src/pages/organizations/access-reviews/dialogs/_components/APIKeyConnectorDialog.tsx index 16ec87da1..3a230c305 100644 --- a/apps/console/src/pages/organizations/access-reviews/dialogs/_components/APIKeyConnectorDialog.tsx +++ b/apps/console/src/pages/organizations/access-reviews/dialogs/_components/APIKeyConnectorDialog.tsx @@ -227,7 +227,12 @@ export function APIKeyConnectorDialog({ setIsConnectingAPIKey(false); toast({ title: __("Connection failed"), - description: __("Failed to connect provider. Please check your API key and try again."), + // Managed providers (e.g. Crisp) never show an API key field, so + // pointing the user at their key would be misleading; send them to + // the settings and verification step instead. + description: provider.apiKeyManaged + ? __("Failed to connect provider. Please check your settings and verification code, then try again.") + : __("Failed to connect provider. Please check your API key and try again."), variant: "error", }); }, @@ -344,12 +349,22 @@ export function APIKeyConnectorDialog({ type="button" variant="secondary" onClick={() => { - void navigator.clipboard.writeText(crispCodeState.code); - toast({ - title: __("Copied to clipboard"), - description: __("Verification code"), - variant: "success", - }); + // Copying feeds the Crisp connect flow, so only + // claim success once the write actually resolves. + navigator.clipboard.writeText(crispCodeState.code).then( + () => + toast({ + title: __("Copied to clipboard"), + description: __("Verification code"), + variant: "success", + }), + () => + toast({ + title: __("Copy failed"), + description: __("Copy the verification code manually."), + variant: "error", + }), + ); }} > {__("Copy")}