source: trip-planner-front/node_modules/primeng/esm2020/captcha/captcha.mjs@ bdd6491

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

adding photos

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