mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
add new functions for recaptcha v3 (#38948)
* add new functions for recaptcha v3 * formatting * test file updated * Update index.d.ts
This commit is contained in:
committed by
Armando Aguirre
parent
a9f16891bd
commit
fb5531f301
@@ -41,3 +41,7 @@ grecaptcha.reset(id1);
|
||||
|
||||
grecaptcha.execute();
|
||||
grecaptcha.execute(id1);
|
||||
|
||||
grecaptcha.execute('foo', { action: 'bar' }).then((token: string) => {});
|
||||
|
||||
grecaptcha.ready(() => {});
|
||||
|
||||
Vendored
+22
-1
@@ -1,9 +1,10 @@
|
||||
// Type definitions for Google Recaptcha 2.0
|
||||
// Type definitions for Google Recaptcha 3.0
|
||||
// Project: https://www.google.com/recaptcha
|
||||
// Definitions by: Kristof Mattei <http://kristofmattei.be>
|
||||
// Martin Costello <https://martincostello.com/>
|
||||
// Ruslan Arkhipau <https://github.com/DethAriel>
|
||||
// Rafael Tavares <https://github.com/rafaeltavares>
|
||||
// Florian Rohrer <https://github.com/RohrerF>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var grecaptcha: ReCaptchaV2.ReCaptcha;
|
||||
@@ -35,6 +36,19 @@ declare namespace ReCaptchaV2 {
|
||||
* @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified.
|
||||
*/
|
||||
execute(opt_widget_id?: number): void;
|
||||
/**
|
||||
* Programatically invoke the reCAPTCHA check. Used if the invisible reCAPTCHA is on a div instead of a button.
|
||||
* @param siteKey the key of your site
|
||||
* @param action the action
|
||||
*
|
||||
* @return a promise containing the token
|
||||
*/
|
||||
execute(siteKey: string, action: Action): Promise<string>;
|
||||
/**
|
||||
* will run the given function as soon as the reCAPTCHA library has loaded
|
||||
* @param callback the function to coll
|
||||
*/
|
||||
ready(callback: () => void): void;
|
||||
}
|
||||
|
||||
type Theme = "light" | "dark";
|
||||
@@ -42,6 +56,13 @@ declare namespace ReCaptchaV2 {
|
||||
type Size = "normal" | "compact" | "invisible";
|
||||
type Badge = "bottomright" | "bottomleft" | "inline";
|
||||
|
||||
interface Action {
|
||||
/**
|
||||
* the name of the action. Actions may only contain alphanumeric characters and slashes, and must not be user-specific.
|
||||
*/
|
||||
action: string;
|
||||
}
|
||||
|
||||
interface Parameters {
|
||||
/**
|
||||
* Your sitekey.
|
||||
|
||||
Reference in New Issue
Block a user