Fix Crisp connect dialog error and copy feedback
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>
This commit is contained in:
@@ -227,7 +227,12 @@ export function APIKeyConnectorDialog({
|
|||||||
setIsConnectingAPIKey(false);
|
setIsConnectingAPIKey(false);
|
||||||
toast({
|
toast({
|
||||||
title: __("Connection failed"),
|
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",
|
variant: "error",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -344,12 +349,22 @@ export function APIKeyConnectorDialog({
|
|||||||
type="button"
|
type="button"
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
void navigator.clipboard.writeText(crispCodeState.code);
|
// Copying feeds the Crisp connect flow, so only
|
||||||
toast({
|
// claim success once the write actually resolves.
|
||||||
title: __("Copied to clipboard"),
|
navigator.clipboard.writeText(crispCodeState.code).then(
|
||||||
description: __("Verification code"),
|
() =>
|
||||||
variant: "success",
|
toast({
|
||||||
});
|
title: __("Copied to clipboard"),
|
||||||
|
description: __("Verification code"),
|
||||||
|
variant: "success",
|
||||||
|
}),
|
||||||
|
() =>
|
||||||
|
toast({
|
||||||
|
title: __("Copy failed"),
|
||||||
|
description: __("Copy the verification code manually."),
|
||||||
|
variant: "error",
|
||||||
|
}),
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{__("Copy")}
|
{__("Copy")}
|
||||||
|
|||||||
Reference in New Issue
Block a user