Files
Oleg Isonen 5318d4f7a6 fix: Make WebHook forms work on Brave browser (#5590)
Brave Shields blocks our bot protection mechanism (matchMedia
fingerprinting detection), causing form submissions to silently fail.

- Added getBraveErrorHtml() in SDK that returns error message HTML
- Form component renders the error when Brave is detected

See: https://github.com/brave/brave-browser/issues/46541
2026-01-28 00:30:48 +01:00

23 lines
702 B
TypeScript

/**
* Used to identify form inside server handler
*/
export const formIdFieldName = `ws--form-id`;
/**
* Used for simlpe protection against non js bots
*/
export const formBotFieldName = `ws--form-bot`;
/**
* Detects if the browser is Brave.
* Brave Shields blocks our bot protection mechanism (matchMedia fingerprinting detection),
* causing form submissions to silently fail.
* @see https://github.com/brave/brave-browser/issues/46541
*/
export const isBraveBrowser = (): boolean => {
if (typeof navigator === "undefined") {
return false;
}
// @ts-expect-error - brave is a non-standard property
return navigator.brave?.isBrave?.() === true || navigator.brave !== undefined;
};