ngx-captcha
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -79,2 +79,6 @@ import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, Renderer2, SimpleChanges } from '@angular/core'; | ||
protected abstract getCaptchaProperties(): any; | ||
/** | ||
* Used for captcha specific setup | ||
*/ | ||
protected abstract captchaSpecificSetup(): void; | ||
ngOnInit(): void; | ||
@@ -81,0 +85,0 @@ ngOnChanges(changes: SimpleChanges): void; |
@@ -188,2 +188,4 @@ "use strict"; | ||
BaseReCaptchaComponent.prototype.setupComponent = function () { | ||
// captcha specific setup | ||
this.captchaSpecificSetup(); | ||
// create captcha wrapper and set it to global namespace | ||
@@ -190,0 +192,0 @@ this.createAndSetCaptchaElem(); |
@@ -25,2 +25,3 @@ import { OnChanges, Renderer2, SimpleChanges } from '@angular/core'; | ||
execute(): string | undefined; | ||
protected captchaSpecificSetup(): void; | ||
/** | ||
@@ -27,0 +28,0 @@ * Gets reCaptcha properties |
@@ -56,2 +56,4 @@ "use strict"; | ||
}; | ||
InvisibleReCaptchaComponent.prototype.captchaSpecificSetup = function () { | ||
}; | ||
/** | ||
@@ -58,0 +60,0 @@ * Gets reCaptcha properties |
@@ -1,8 +0,16 @@ | ||
import { EventEmitter, OnChanges, Renderer2, SimpleChanges } from '@angular/core'; | ||
import { EventEmitter, OnChanges, OnDestroy, Renderer2, SimpleChanges } from '@angular/core'; | ||
import { BaseReCaptchaComponent } from './base-recaptcha.component'; | ||
import { NgxCaptchaConfig } from './recaptcha.config'; | ||
export declare class ReCaptcha2Component extends BaseReCaptchaComponent implements OnChanges { | ||
export declare class ReCaptcha2Component extends BaseReCaptchaComponent implements OnChanges, OnDestroy { | ||
protected renderer: Renderer2; | ||
protected config: NgxCaptchaConfig; | ||
/** | ||
* Name of the global expire callback | ||
*/ | ||
protected readonly windowOnErrorCallbackProperty: string; | ||
/** | ||
* Name of the global error callback | ||
*/ | ||
protected readonly windowOnExpireCallbackProperty: string; | ||
/** | ||
* Theme | ||
@@ -29,2 +37,4 @@ */ | ||
ngOnChanges(changes: SimpleChanges): void; | ||
ngOnDestroy(): void; | ||
protected captchaSpecificSetup(): void; | ||
/** | ||
@@ -35,2 +45,6 @@ * Gets reCaptcha properties | ||
/** | ||
* Registers global callbacks | ||
*/ | ||
private registerCallbacks(); | ||
/** | ||
* Handles error callback | ||
@@ -37,0 +51,0 @@ */ |
@@ -36,2 +36,10 @@ "use strict"; | ||
/** | ||
* Name of the global expire callback | ||
*/ | ||
_this.windowOnErrorCallbackProperty = 'ngx_captcha_error_callback'; | ||
/** | ||
* Name of the global error callback | ||
*/ | ||
_this.windowOnExpireCallbackProperty = 'ngx_captcha_expire_callback'; | ||
/** | ||
* Theme | ||
@@ -57,2 +65,10 @@ */ | ||
}; | ||
ReCaptcha2Component.prototype.ngOnDestroy = function () { | ||
_super.prototype.ngOnDestroy.call(this); | ||
window[this.windowOnErrorCallbackProperty] = {}; | ||
window[this.windowOnExpireCallbackProperty] = {}; | ||
}; | ||
ReCaptcha2Component.prototype.captchaSpecificSetup = function () { | ||
this.registerCallbacks(); | ||
}; | ||
/** | ||
@@ -75,2 +91,9 @@ * Gets reCaptcha properties | ||
/** | ||
* Registers global callbacks | ||
*/ | ||
ReCaptcha2Component.prototype.registerCallbacks = function () { | ||
window[this.windowOnErrorCallbackProperty] = this.handleErrorCallback.bind(this); | ||
window[this.windowOnExpireCallbackProperty] = this.handleExpireCallback.bind(this); | ||
}; | ||
/** | ||
* Handles error callback | ||
@@ -85,5 +108,5 @@ */ | ||
ReCaptcha2Component.prototype.handleExpireCallback = function () { | ||
this.expire.next(); | ||
// reset captcha on expire callback | ||
this.resetCaptcha(); | ||
this.expire.next(); | ||
}; | ||
@@ -103,7 +126,7 @@ __decorate([ | ||
__decorate([ | ||
core_1.Input(), | ||
core_1.Output(), | ||
__metadata("design:type", Object) | ||
], ReCaptcha2Component.prototype, "expire", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
core_1.Output(), | ||
__metadata("design:type", Object) | ||
@@ -110,0 +133,0 @@ ], ReCaptcha2Component.prototype, "error", void 0); |
{ | ||
"name": "ngx-captcha", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "scripts": { |
35045
819