Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

recaptcha-v3

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recaptcha-v3 - npm Package Compare versions

Comparing version 1.7.2 to 1.8.0

8

dist/grecaptcha/grecaptcha.d.ts

@@ -10,2 +10,4 @@ declare global {

execute(siteKey: string, options: IExecuteOptions): Promise<string>;
render(container: string | Element, parameters: IRenderParameters): string;
render(parameters: IRenderParameters): string;
}

@@ -15,1 +17,7 @@ export declare interface IExecuteOptions {

}
export declare interface IRenderParameters {
sitekey: string;
badge?: 'bottomright' | 'bottomleft' | 'inline';
size?: 'invisible';
tabindex?: number;
}

3

dist/ReCaptchaInstance.d.ts
import { IReCaptchaInstance } from './grecaptcha/grecaptcha';
export declare class ReCaptchaInstance {
private readonly siteKey;
private readonly recaptchaID;
private readonly recaptcha;
private styleContainer;
constructor(siteKey: string, recaptcha: IReCaptchaInstance);
constructor(siteKey: string, recaptchaID: string, recaptcha: IReCaptchaInstance);
execute(action: string): Promise<string>;

@@ -8,0 +9,0 @@ getSiteKey(): string;

@@ -40,4 +40,5 @@ "use strict";

var ReCaptchaInstance = (function () {
function ReCaptchaInstance(siteKey, recaptcha) {
function ReCaptchaInstance(siteKey, recaptchaID, recaptcha) {
this.siteKey = siteKey;
this.recaptchaID = recaptchaID;
this.recaptcha = recaptcha;

@@ -49,3 +50,3 @@ this.styleContainer = null;

return __generator(this, function (_a) {
return [2, this.recaptcha.execute(this.siteKey, { action: action })];
return [2, this.recaptcha.execute(this.recaptchaID, { action: action })];
});

@@ -52,0 +53,0 @@ });

@@ -16,2 +16,3 @@ import { ReCaptchaInstance } from './ReCaptchaInstance';

private waitForScriptToLoad;
private doExplicitRender;
}

@@ -24,6 +25,13 @@ export interface IReCaptchaLoaderOptions {

};
explicitRenderParameters?: IReCaptchaExplicitRenderParameters;
customUrl?: string;
}
export interface IReCaptchaExplicitRenderParameters {
container?: string | Element;
badge?: 'bottomright' | 'bottomleft' | 'inline';
size?: 'invisible';
tabindex?: number;
}
export declare const load: typeof ReCaptchaLoader.load;
export declare const getInstance: typeof ReCaptchaLoader.getInstance;
export {};

@@ -41,3 +41,4 @@ "use strict";

ReCaptchaLoader.setLoadingState(ELoadingState.LOADED);
var instance = new ReCaptchaInstance_1.ReCaptchaInstance(siteKey, grecaptcha);
var widgetID = loader.doExplicitRender(grecaptcha, siteKey, options.explicitRenderParameters ? options.explicitRenderParameters : {});
var instance = new ReCaptchaInstance_1.ReCaptchaInstance(siteKey, widgetID, grecaptcha);
ReCaptchaLoader.successfulLoadingConsumers.forEach(function (v) { return v(instance); });

@@ -85,4 +86,7 @@ ReCaptchaLoader.successfulLoadingConsumers = [];

}
if (renderParameters.render) {
renderParameters.render = undefined;
}
var parametersQuery = this.buildQueryString(renderParameters);
scriptElement.src = scriptBase + '?render=' + siteKey + parametersQuery;
scriptElement.src = scriptBase + '?render=explicit' + parametersQuery;
return new Promise(function (resolve, reject) {

@@ -104,3 +108,7 @@ scriptElement.addEventListener('load', _this.waitForScriptToLoad(function () {

}
return '&' + Object.keys(parameters).map(function (parameterKey) {
return '&' + Object.keys(parameters)
.filter(function (parameterKey) {
return !!parameters[parameterKey];
})
.map(function (parameterKey) {
return parameterKey + '=' + parameters[parameterKey];

@@ -124,2 +132,16 @@ }).join('&');

};
ReCaptchaLoader.prototype.doExplicitRender = function (grecaptcha, siteKey, parameters) {
var augmentedParameters = {
sitekey: siteKey,
badge: parameters.badge,
size: parameters.size,
tabindex: parameters.tabindex
};
if (parameters.container) {
return grecaptcha.render(parameters.container, augmentedParameters);
}
else {
return grecaptcha.render(augmentedParameters);
}
};
ReCaptchaLoader.loadingState = null;

@@ -126,0 +148,0 @@ ReCaptchaLoader.instance = null;

{
"name": "recaptcha-v3",
"version": "1.7.2",
"version": "1.8.0",
"keywords": [

@@ -34,18 +34,18 @@ "captcha",

"@auritylab/tslint-config-base": "^1.0.1",
"@cypress/webpack-preprocessor": "^4.1.1",
"@cypress/webpack-preprocessor": "^4.1.3",
"@typescript-eslint/eslint-plugin": "2",
"cypress": "^3.7.0",
"cypress": "^4.3.0",
"eslint": "6",
"eslint-config-standard-with-typescript": "^11.0.1",
"eslint-plugin-import": "2",
"eslint-plugin-node": "10",
"eslint-plugin-node": "11",
"eslint-plugin-promise": "4",
"eslint-plugin-standard": "4",
"html-webpack-plugin": "^3.2.0",
"ts-loader": "^6.2.1",
"typescript": "^3.7.2",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.9.0"
"html-webpack-plugin": "^4.0.4",
"ts-loader": "^6.2.2",
"typescript": "^3.8.3",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
}
}

@@ -59,7 +59,8 @@ # reCAPTCHA-v3

| Name | Description | Type | Default value |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------- |
| **useRecaptchaNet** | Due to limitations in certain countries it's required to use `recaptcha.net` instead of `google.com`. | _boolean_ | `false` |
| **autoHideBadge** | Will automatically hide the reCAPTCHA badge. Warning: The usage is only allowed if you follow the offical guide for hiding the badge from Google ([see here](https://developers.google.com/recaptcha/docs/faq#id-like-to-hide-the-recaptcha-v3-badge-what-is-allowed)) | _boolean_ | `false` |
| **renderParameters** | Will add the given parameters to the reCAPTCHA script. The given object will be converted into a query string and will then be added to the URL. | Object | `{}` |
| Name | Description | Type | Default value |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------- |
| **useRecaptchaNet** | Due to limitations in certain countries it's required to use `recaptcha.net` instead of `google.com`. | _boolean_ | `false` |
| **autoHideBadge** | Will automatically hide the reCAPTCHA badge. Warning: The usage is only allowed if you follow the offical guide for hiding the badge from Google ([see here](https://developers.google.com/recaptcha/docs/faq#id-like-to-hide-the-recaptcha-v3-badge-what-is-allowed)) | _boolean_ | `false` |
| **renderParameters** | Will add the given parameters to the reCAPTCHA script. The given object will be converted into a query string and will then be added to the URL. | Object | `{}` |
| **explicitRenderParameters** | Will set the parameters to the explicit rendering. [See here](#explicit-render-parameters) | Object | `{}` |

@@ -80,4 +81,14 @@ ### Load options usage

})
```
```
### Explicit render parameters
The ReCaptcha widget will be explicity loaded, which means you can add parameters to the rendering process.
| Name | Description | Type |
| ---- | ----------- | ---- |
| **container** | The container if you want to render the inline widget | `string` or `Element` |
| **badge** | The positioning for the widget | `'bottomright'` or `'bottomleft'` or `'inline'` |
| **size** | The size of the widget | `'invisible'` |
| **tabindex** | The tab index of the widget | `number` |
## Wrapper libraries

@@ -84,0 +95,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc