source: trip-planner-front/node_modules/primeng/fesm2020/primeng-captcha.mjs@ 1ad8e64

Last change on this file since 1ad8e64 was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

  • Property mode set to 100644
File size: 5.2 KB
Line 
1import * as i0 from '@angular/core';
2import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, NgModule } from '@angular/core';
3import { CommonModule } from '@angular/common';
4
5class Captcha {
6 constructor(el, _zone, cd) {
7 this.el = el;
8 this._zone = _zone;
9 this.cd = cd;
10 this.siteKey = null;
11 this.theme = 'light';
12 this.type = 'image';
13 this.size = 'normal';
14 this.tabindex = 0;
15 this.initCallback = "initRecaptcha";
16 this.onResponse = new EventEmitter();
17 this.onExpire = new EventEmitter();
18 this._instance = null;
19 this._language = null;
20 }
21 get language() {
22 return this._language;
23 }
24 set language(language) {
25 this._language = language;
26 this.init();
27 }
28 ngAfterViewInit() {
29 if (window.grecaptcha) {
30 if (!window.grecaptcha.render) {
31 setTimeout(() => {
32 this.init();
33 }, 100);
34 }
35 else {
36 this.init();
37 }
38 }
39 else {
40 window[this.initCallback] = () => {
41 this.init();
42 };
43 }
44 }
45 init() {
46 this._instance = window.grecaptcha.render(this.el.nativeElement.children[0], {
47 'sitekey': this.siteKey,
48 'theme': this.theme,
49 'type': this.type,
50 'size': this.size,
51 'tabindex': this.tabindex,
52 'hl': this.language,
53 'callback': (response) => { this._zone.run(() => this.recaptchaCallback(response)); },
54 'expired-callback': () => { this._zone.run(() => this.recaptchaExpiredCallback()); }
55 });
56 }
57 reset() {
58 if (this._instance === null)
59 return;
60 window.grecaptcha.reset(this._instance);
61 this.cd.markForCheck();
62 }
63 getResponse() {
64 if (this._instance === null)
65 return null;
66 return window.grecaptcha.getResponse(this._instance);
67 }
68 recaptchaCallback(response) {
69 this.onResponse.emit({
70 response: response
71 });
72 }
73 recaptchaExpiredCallback() {
74 this.onExpire.emit();
75 }
76 ngOnDestroy() {
77 if (this._instance != null) {
78 window.grecaptcha.reset(this._instance);
79 }
80 }
81}
82Captcha.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Captcha, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
83Captcha.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Captcha, selector: "p-captcha", inputs: { siteKey: "siteKey", theme: "theme", type: "type", size: "size", tabindex: "tabindex", initCallback: "initCallback", language: "language" }, outputs: { onResponse: "onResponse", onExpire: "onExpire" }, host: { classAttribute: "p-element" }, ngImport: i0, template: `<div></div>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
84i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Captcha, decorators: [{
85 type: Component,
86 args: [{
87 selector: 'p-captcha',
88 template: `<div></div>`,
89 changeDetection: ChangeDetectionStrategy.OnPush,
90 encapsulation: ViewEncapsulation.None,
91 host: {
92 'class': 'p-element'
93 }
94 }]
95 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { siteKey: [{
96 type: Input
97 }], theme: [{
98 type: Input
99 }], type: [{
100 type: Input
101 }], size: [{
102 type: Input
103 }], tabindex: [{
104 type: Input
105 }], initCallback: [{
106 type: Input
107 }], onResponse: [{
108 type: Output
109 }], onExpire: [{
110 type: Output
111 }], language: [{
112 type: Input
113 }] } });
114class CaptchaModule {
115}
116CaptchaModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CaptchaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
117CaptchaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CaptchaModule, declarations: [Captcha], imports: [CommonModule], exports: [Captcha] });
118CaptchaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CaptchaModule, imports: [[CommonModule]] });
119i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CaptchaModule, decorators: [{
120 type: NgModule,
121 args: [{
122 imports: [CommonModule],
123 exports: [Captcha],
124 declarations: [Captcha]
125 }]
126 }] });
127
128/**
129 * Generated bundle index. Do not edit.
130 */
131
132export { Captcha, CaptchaModule };
Note: See TracBrowser for help on using the repository browser.