Socket
Socket
Sign inDemoInstall

ngx-captcha

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-captcha - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

ngx-dist/node_modules/@types/strip-bom/index.ngsummary.json

13

ngx-dist/src/recaptcha/base-recaptcha.component.d.ts

@@ -19,5 +19,5 @@ import { ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, OnInit, Renderer2, SimpleChanges } from '@angular/core';

/**
* Name of the global property holding captcha element
* Id of the captcha
*/
protected readonly globalCaptchaElemName: string;
protected readonly captchaId: string;
/**

@@ -68,6 +68,2 @@ * Google's site key.

/**
* Id of the captcha
*/
protected captchaId: number;
/**
* If enabled, captcha will reset after receiving success response. This is useful

@@ -99,2 +95,3 @@ * when invisible captcha need to be resolved multiple times on same page

ngOnInit(): void;
private getGlobalSiteKey();
ngOnChanges(changes: SimpleChanges): void;

@@ -109,3 +106,3 @@ ngOnDestroy(): void;

*/
getCaptchaId(): number;
getCaptchaId(): string;
/**

@@ -156,4 +153,2 @@ * Resets captcha

private createAndSetCaptchaElem();
private setGlobalCaptchaElem(elem);
private getGlobalCaptchaElem();
}

@@ -15,3 +15,3 @@ "use strict";

*/
this.windowOnLoadCallbackProperty = 'ngx_onload_callback';
this.windowOnLoadCallbackProperty = 'ngx_onload_callback' + this.getPseudoUniqueNumber();
/**

@@ -22,5 +22,5 @@ * Name of the global reCaptcha property

/**
* Name of the global property holding captcha element
* Id of the captcha
*/
this.globalCaptchaElemName = 'ngx_onload_captcha_elem';
this.captchaId = 'ngx_captcha_id' + this.getPseudoUniqueNumber();
/**

@@ -58,3 +58,5 @@ * Type

BaseReCaptchaComponent.prototype.ngOnInit = function () {
if (this.globalConfig && !this._siteKey) {
};
BaseReCaptchaComponent.prototype.getGlobalSiteKey = function () {
if (this.globalConfig) {
// Invisible captcha

@@ -66,6 +68,6 @@ if (this.recaptchaType === recaptcha_type_enum_1.ReCaptchaType.InvisibleReCaptcha) {

if (this.globalConfig.invisibleCaptchaSiteKey instanceof Function) {
this._siteKey = this.globalConfig.invisibleCaptchaSiteKey();
return this.globalConfig.invisibleCaptchaSiteKey();
}
else {
this._siteKey = this.globalConfig.invisibleCaptchaSiteKey;
return this.globalConfig.invisibleCaptchaSiteKey;
}

@@ -79,6 +81,6 @@ // recaptcha 2

if (this.globalConfig.reCaptcha2SiteKey instanceof Function) {
this._siteKey = this.globalConfig.reCaptcha2SiteKey();
return this.globalConfig.reCaptcha2SiteKey();
}
else {
this._siteKey = this.globalConfig.reCaptcha2SiteKey;
return this.globalConfig.reCaptcha2SiteKey;
}

@@ -89,8 +91,11 @@ }

}
this.setupComponent();
}
};
BaseReCaptchaComponent.prototype.ngOnChanges = function (changes) {
if (this.siteKey) {
// use new sitekey
if (!this.siteKey) {
// use global site key if key is not available
this._siteKey = this.getGlobalSiteKey();
}
else {
// use comnponent site key
if (this.siteKey instanceof Function) {

@@ -102,8 +107,7 @@ this._siteKey = this.siteKey();

}
this.setupComponent();
}
this.setupComponent();
};
BaseReCaptchaComponent.prototype.ngOnDestroy = function () {
window[this.windowOnLoadCallbackProperty] = {};
window[this.globalCaptchaElemName] = {};
window[this.globalReCaptchaProperty] = {};

@@ -178,4 +182,2 @@ };

this.captchaElem = captchaElem;
// set global captcha elem
this.setGlobalCaptchaElem(this.captchaElem);
};

@@ -192,3 +194,3 @@ /**

function () {
this.captchaId = this.reCaptchaApi.render(this.getGlobalCaptchaElem(), this.getCaptchaProperties());
this.reCaptchaApi.render(this.captchaId, this.getCaptchaProperties());
this.ready.next();

@@ -257,3 +259,3 @@ };

BaseReCaptchaComponent.prototype.getPseudoUniqueNumber = function () {
return new Date().getUTCMilliseconds();
return new Date().getUTCMilliseconds() + Math.floor(Math.random() * 9999);
};

@@ -282,7 +284,9 @@ /**

this.captchaSpecificSetup();
// create captcha wrapper and set it to global namespace
// create captcha wrapper
this.createAndSetCaptchaElem();
// we need to patch the callback through global variable, otherwise callback is not accessible
// note: https://github.com/Enngage/ngx-captcha/issues/2
window[this.windowOnLoadCallbackProperty] = (function () { return _this.zone.run(_this.onloadCallback.bind(_this)); });
window[this.windowOnLoadCallbackProperty] = (function () {
return _this.zone.run(_this.onloadCallback.bind(_this));
});
// create and put reCaptcha script to page

@@ -322,5 +326,3 @@ this.ensureReCaptchaScript();

BaseReCaptchaComponent.prototype.createAndSetCaptchaElem = function () {
// generate new elem id
this.captchaElemId = this.generateNewElemId();
if (!this.captchaElemId) {
if (!this.captchaId) {
throw Error("Captcha elem Id is not set");

@@ -332,13 +334,7 @@ }

var newElem = this.renderer.createElement('div');
newElem.id = this.captchaElemId;
newElem.id = this.captchaId;
this.renderer.appendChild(this.captchaWrapperElem.nativeElement, newElem);
// update captcha elem
this.ensureCaptchaElem(this.captchaElemId);
this.ensureCaptchaElem(this.captchaId);
};
BaseReCaptchaComponent.prototype.setGlobalCaptchaElem = function (elem) {
window[this.globalCaptchaElemName] = elem;
};
BaseReCaptchaComponent.prototype.getGlobalCaptchaElem = function () {
return window[this.globalCaptchaElemName];
};
BaseReCaptchaComponent.propDecorators = {

@@ -345,0 +341,0 @@ "siteKey": [{ type: core_1.Input },],

@@ -1,1 +0,1 @@

[{"__symbolic":"module","version":4,"metadata":{"BaseReCaptchaComponent":{"__symbolic":"class","members":{"siteKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":47,"character":5}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":52,"character":5}}]}],"hl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":57,"character":5}}]}],"tabIndex":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":62,"character":5}}]}],"success":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":68,"character":5}}]}],"load":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":73,"character":5}}]}],"ready":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":78,"character":5}}]}],"captchaWrapperElem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":80,"character":5},"arguments":["captchaWrapperElem"]}]}],"captchaScriptElem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":81,"character":5},"arguments":["captchaScriptElem"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":120,"character":28},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":121,"character":24},{"__symbolic":"reference","module":"./recaptcha-type.enum","name":"ReCaptchaType","line":122,"character":33},{"__symbolic":"reference","module":"./recaptcha.config","name":"NgxCaptchaConfig","line":123,"character":33}]}],"getCaptchaProperties":[{"__symbolic":"method"}],"captchaSpecificSetup":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"getResponse":[{"__symbolic":"method"}],"getCaptchaId":[{"__symbolic":"method"}],"resetCaptcha":[{"__symbolic":"method"}],"getCurrentResponse":[{"__symbolic":"method"}],"reloadCaptcha":[{"__symbolic":"method"}],"ensureCaptchaElem":[{"__symbolic":"method"}],"renderReCaptcha":[{"__symbolic":"method"}],"handleCallback":[{"__symbolic":"method"}],"ensureReCaptchaScript":[{"__symbolic":"method"}],"registerReCaptchaScript":[{"__symbolic":"method"}],"getLanguageParam":[{"__symbolic":"method"}],"getPseudoUniqueNumber":[{"__symbolic":"method"}],"isReCaptchaApiDefined":[{"__symbolic":"method"}],"setupComponent":[{"__symbolic":"method"}],"onloadCallback":[{"__symbolic":"method"}],"generateNewElemId":[{"__symbolic":"method"}],"createAndSetCaptchaElem":[{"__symbolic":"method"}],"setGlobalCaptchaElem":[{"__symbolic":"method"}],"getGlobalCaptchaElem":[{"__symbolic":"method"}]}}}}]
[{"__symbolic":"module","version":4,"metadata":{"BaseReCaptchaComponent":{"__symbolic":"class","members":{"siteKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":47,"character":5}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":52,"character":5}}]}],"hl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":57,"character":5}}]}],"tabIndex":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":62,"character":5}}]}],"success":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":68,"character":5}}]}],"load":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":73,"character":5}}]}],"ready":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":78,"character":5}}]}],"captchaWrapperElem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":80,"character":5},"arguments":["captchaWrapperElem"]}]}],"captchaScriptElem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":81,"character":5},"arguments":["captchaScriptElem"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":115,"character":28},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":116,"character":24},{"__symbolic":"reference","module":"./recaptcha-type.enum","name":"ReCaptchaType","line":117,"character":33},{"__symbolic":"reference","module":"./recaptcha.config","name":"NgxCaptchaConfig","line":118,"character":33}]}],"getCaptchaProperties":[{"__symbolic":"method"}],"captchaSpecificSetup":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"getGlobalSiteKey":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"getResponse":[{"__symbolic":"method"}],"getCaptchaId":[{"__symbolic":"method"}],"resetCaptcha":[{"__symbolic":"method"}],"getCurrentResponse":[{"__symbolic":"method"}],"reloadCaptcha":[{"__symbolic":"method"}],"ensureCaptchaElem":[{"__symbolic":"method"}],"renderReCaptcha":[{"__symbolic":"method"}],"handleCallback":[{"__symbolic":"method"}],"ensureReCaptchaScript":[{"__symbolic":"method"}],"registerReCaptchaScript":[{"__symbolic":"method"}],"getLanguageParam":[{"__symbolic":"method"}],"getPseudoUniqueNumber":[{"__symbolic":"method"}],"isReCaptchaApiDefined":[{"__symbolic":"method"}],"setupComponent":[{"__symbolic":"method"}],"onloadCallback":[{"__symbolic":"method"}],"generateNewElemId":[{"__symbolic":"method"}],"createAndSetCaptchaElem":[{"__symbolic":"method"}]}}}}]

@@ -1,1 +0,1 @@

{"moduleName":null,"summaries":[{"symbol":{"__symbol":0,"members":[]},"metadata":{"__symbolic":"class","members":{"siteKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":1,"members":[]}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":1,"members":[]}}]}],"hl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":1,"members":[]}}]}],"tabIndex":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":1,"members":[]}}]}],"success":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":2,"members":[]}}]}],"load":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":2,"members":[]}}]}],"ready":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":2,"members":[]}}]}],"captchaWrapperElem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":3,"members":[]},"arguments":["captchaWrapperElem"]}]}],"captchaScriptElem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":3,"members":[]},"arguments":["captchaScriptElem"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbol":4,"members":[]},{"__symbol":5,"members":[]},{"__symbol":6,"members":[]},{"__symbol":7,"members":[]}]}],"getCaptchaProperties":[{"__symbolic":"method"}],"captchaSpecificSetup":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"getResponse":[{"__symbolic":"method"}],"getCaptchaId":[{"__symbolic":"method"}],"resetCaptcha":[{"__symbolic":"method"}],"getCurrentResponse":[{"__symbolic":"method"}],"reloadCaptcha":[{"__symbolic":"method"}],"ensureCaptchaElem":[{"__symbolic":"method"}],"renderReCaptcha":[{"__symbolic":"method"}],"handleCallback":[{"__symbolic":"method"}],"ensureReCaptchaScript":[{"__symbolic":"method"}],"registerReCaptchaScript":[{"__symbolic":"method"}],"getLanguageParam":[{"__symbolic":"method"}],"getPseudoUniqueNumber":[{"__symbolic":"method"}],"isReCaptchaApiDefined":[{"__symbolic":"method"}],"setupComponent":[{"__symbolic":"method"}],"onloadCallback":[{"__symbolic":"method"}],"generateNewElemId":[{"__symbolic":"method"}],"createAndSetCaptchaElem":[{"__symbolic":"method"}],"setGlobalCaptchaElem":[{"__symbolic":"method"}],"getGlobalCaptchaElem":[{"__symbolic":"method"}]}}}],"symbols":[{"__symbol":0,"name":"BaseReCaptchaComponent","filePath":"./base-recaptcha.component"},{"__symbol":1,"name":"Input","filePath":"@angular/core"},{"__symbol":2,"name":"Output","filePath":"@angular/core"},{"__symbol":3,"name":"ViewChild","filePath":"@angular/core"},{"__symbol":4,"name":"Renderer2","filePath":"@angular/core"},{"__symbol":5,"name":"NgZone","filePath":"@angular/core"},{"__symbol":6,"name":"ReCaptchaType","filePath":"./recaptcha-type.enum"},{"__symbol":7,"name":"NgxCaptchaConfig","filePath":"./recaptcha.config"}]}
{"moduleName":null,"summaries":[{"symbol":{"__symbol":0,"members":[]},"metadata":{"__symbolic":"class","members":{"siteKey":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":1,"members":[]}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":1,"members":[]}}]}],"hl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":1,"members":[]}}]}],"tabIndex":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":1,"members":[]}}]}],"success":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":2,"members":[]}}]}],"load":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":2,"members":[]}}]}],"ready":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":2,"members":[]}}]}],"captchaWrapperElem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":3,"members":[]},"arguments":["captchaWrapperElem"]}]}],"captchaScriptElem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbol":3,"members":[]},"arguments":["captchaScriptElem"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbol":4,"members":[]},{"__symbol":5,"members":[]},{"__symbol":6,"members":[]},{"__symbol":7,"members":[]}]}],"getCaptchaProperties":[{"__symbolic":"method"}],"captchaSpecificSetup":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"getGlobalSiteKey":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"getResponse":[{"__symbolic":"method"}],"getCaptchaId":[{"__symbolic":"method"}],"resetCaptcha":[{"__symbolic":"method"}],"getCurrentResponse":[{"__symbolic":"method"}],"reloadCaptcha":[{"__symbolic":"method"}],"ensureCaptchaElem":[{"__symbolic":"method"}],"renderReCaptcha":[{"__symbolic":"method"}],"handleCallback":[{"__symbolic":"method"}],"ensureReCaptchaScript":[{"__symbolic":"method"}],"registerReCaptchaScript":[{"__symbolic":"method"}],"getLanguageParam":[{"__symbolic":"method"}],"getPseudoUniqueNumber":[{"__symbolic":"method"}],"isReCaptchaApiDefined":[{"__symbolic":"method"}],"setupComponent":[{"__symbolic":"method"}],"onloadCallback":[{"__symbolic":"method"}],"generateNewElemId":[{"__symbolic":"method"}],"createAndSetCaptchaElem":[{"__symbolic":"method"}]}}}],"symbols":[{"__symbol":0,"name":"BaseReCaptchaComponent","filePath":"./base-recaptcha.component"},{"__symbol":1,"name":"Input","filePath":"@angular/core"},{"__symbol":2,"name":"Output","filePath":"@angular/core"},{"__symbol":3,"name":"ViewChild","filePath":"@angular/core"},{"__symbol":4,"name":"Renderer2","filePath":"@angular/core"},{"__symbol":5,"name":"NgZone","filePath":"@angular/core"},{"__symbol":6,"name":"ReCaptchaType","filePath":"./recaptcha-type.enum"},{"__symbol":7,"name":"NgxCaptchaConfig","filePath":"./recaptcha.config"}]}
{
"name": "ngx-captcha",
"version": "2.1.0",
"version": "2.2.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "scripts": {

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