@tehw0lf/contact-form 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # contact-form
2
+
3
+ This provides a simple way to let your users contact you.
4
+ The component takes as input an API-URL.
5
+
6
+ Default is 'https://forwardmethis.com/tehwolf@pm.me' - please change it, as you will need to confirm the API access for the first email you will receive.
7
+
8
+ ```html
9
+ <contact-form [apiURL]="emailBackendURL"></contact-form>
10
+ ```
11
+
12
+ In your component, set the `emailBackendURL` property. The naming of this variable is arbitrary:
13
+
14
+ ```ts
15
+ emailBackendURL = 'https://forwardmethis.com/my@email.com';
16
+ ```
17
+
18
+ This contact form will send a POST request to the API, containing the following data structure:
19
+
20
+ ```json
21
+ {
22
+ "name": "your entered name",
23
+ "email": "your entered email address",
24
+ "message": "your entered message"
25
+ }
26
+ ```
27
+
28
+ You can of course use your own backend with this data structure, as the API-URL can be overridden as shown above.
@@ -0,0 +1,136 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/common/http'), require('@angular/core'), require('@angular/forms'), require('rxjs'), require('rxjs/operators')) :
3
+ typeof define === 'function' && define.amd ? define('@tehw0lf/contact-form', ['exports', '@angular/common', '@angular/common/http', '@angular/core', '@angular/forms', 'rxjs', 'rxjs/operators'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.tehw0lf = global.tehw0lf || {}, global.tehw0lf['contact-form'] = {}), global.ng.common, global.ng.common.http, global.ng.core, global.ng.forms, global.rxjs, global.rxjs.operators));
5
+ }(this, (function (exports, i3, i1, i0, i1$1, rxjs, operators) { 'use strict';
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () {
17
+ return e[k];
18
+ }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n['default'] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
28
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
31
+
32
+ var EmailApiService = /** @class */ (function () {
33
+ function EmailApiService(http) {
34
+ this.http = http;
35
+ this.httpOptions = {
36
+ headers: new i1.HttpHeaders({
37
+ 'Content-Type': 'application/json'
38
+ })
39
+ };
40
+ }
41
+ EmailApiService.prototype.sendEmail = function (apiURL, data) {
42
+ return this.http.post(apiURL, JSON.stringify(data), this.httpOptions).pipe(operators.map(function (response) {
43
+ return response;
44
+ }), operators.catchError(function (error) {
45
+ return rxjs.of(error.statusText);
46
+ }));
47
+ };
48
+ return EmailApiService;
49
+ }());
50
+ EmailApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: EmailApiService, deps: [{ token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
51
+ EmailApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: EmailApiService, providedIn: 'root' });
52
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: EmailApiService, decorators: [{
53
+ type: i0.Injectable,
54
+ args: [{
55
+ providedIn: 'root'
56
+ }]
57
+ }], ctorParameters: function () { return [{ type: i1__namespace.HttpClient }]; } });
58
+
59
+ var ContactFormComponent = /** @class */ (function () {
60
+ function ContactFormComponent(builder, emailService) {
61
+ this.builder = builder;
62
+ this.emailService = emailService;
63
+ this.apiURL = 'https://forwardmethis.com/tehwolf@pm.me';
64
+ this.emailSent = new rxjs.Subject();
65
+ this.emailSent$ = this.emailSent.asObservable();
66
+ this.unsubscribe$ = new rxjs.Subject();
67
+ this.emailSent.next(null);
68
+ this.formGroup = this.builder.group({
69
+ name: new i1$1.FormControl('', [i1$1.Validators.required]),
70
+ email: new i1$1.FormControl('', [i1$1.Validators.required, i1$1.Validators.email]),
71
+ message: new i1$1.FormControl('', [i1$1.Validators.required])
72
+ });
73
+ }
74
+ ContactFormComponent.prototype.ngOnDestroy = function () {
75
+ this.unsubscribe$.next();
76
+ this.unsubscribe$.complete();
77
+ };
78
+ ContactFormComponent.prototype.submitFormData = function (formData) {
79
+ var _this = this;
80
+ this.emailService
81
+ .sendEmail(this.apiURL, formData.value)
82
+ .pipe(operators.tap(function (response) {
83
+ if (response === 'OK') {
84
+ _this.emailSent.next(true);
85
+ }
86
+ else {
87
+ _this.emailSent.next(false);
88
+ }
89
+ }), operators.takeUntil(this.unsubscribe$))
90
+ .subscribe();
91
+ };
92
+ return ContactFormComponent;
93
+ }());
94
+ ContactFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: ContactFormComponent, deps: [{ token: i1__namespace$1.FormBuilder }, { token: EmailApiService }], target: i0__namespace.ɵɵFactoryTarget.Component });
95
+ ContactFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: ContactFormComponent, selector: "contact-form", inputs: { apiURL: "apiURL" }, ngImport: i0__namespace, template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"], directives: [{ type: i1__namespace$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1__namespace$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1__namespace$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3__namespace.AsyncPipe } });
96
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: ContactFormComponent, decorators: [{
97
+ type: i0.Component,
98
+ args: [{
99
+ // eslint-disable-next-line @angular-eslint/component-selector
100
+ selector: 'contact-form',
101
+ templateUrl: './contact-form.component.html',
102
+ styleUrls: ['./contact-form.component.scss']
103
+ }]
104
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.FormBuilder }, { type: EmailApiService }]; }, propDecorators: { apiURL: [{
105
+ type: i0.Input
106
+ }] } });
107
+
108
+ var ContactFormModule = /** @class */ (function () {
109
+ function ContactFormModule() {
110
+ }
111
+ return ContactFormModule;
112
+ }());
113
+ ContactFormModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: ContactFormModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
114
+ ContactFormModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: ContactFormModule, declarations: [ContactFormComponent], imports: [i3.CommonModule, i1.HttpClientModule, i1$1.ReactiveFormsModule], exports: [ContactFormComponent] });
115
+ ContactFormModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: ContactFormModule, providers: [EmailApiService], imports: [[i3.CommonModule, i1.HttpClientModule, i1$1.ReactiveFormsModule]] });
116
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: ContactFormModule, decorators: [{
117
+ type: i0.NgModule,
118
+ args: [{
119
+ imports: [i3.CommonModule, i1.HttpClientModule, i1$1.ReactiveFormsModule],
120
+ declarations: [ContactFormComponent],
121
+ exports: [ContactFormComponent],
122
+ providers: [EmailApiService],
123
+ }]
124
+ }] });
125
+
126
+ /**
127
+ * Generated bundle index. Do not edit.
128
+ */
129
+
130
+ exports.ContactFormComponent = ContactFormComponent;
131
+ exports.ContactFormModule = ContactFormModule;
132
+
133
+ Object.defineProperty(exports, '__esModule', { value: true });
134
+
135
+ })));
136
+ //# sourceMappingURL=tehw0lf-contact-form.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tehw0lf-contact-form.umd.js","sources":["../../../../libs/contact-form/src/lib/email-api.service.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.html","../../../../libs/contact-form/src/lib/contact-form.module.ts","../../../../libs/contact-form/src/tehw0lf-contact-form.ts"],"sourcesContent":["import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class EmailApiService {\n httpOptions = {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n })\n };\n constructor(private http: HttpClient) {}\n\n sendEmail(apiURL: string, data: any): Observable<any> {\n return this.http.post(apiURL, JSON.stringify(data), this.httpOptions).pipe(\n map((response: any) => {\n return response;\n }),\n catchError((error: any) => {\n return of(error.statusText);\n })\n );\n }\n}\n","import { Component, Input, OnDestroy } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { takeUntil, tap } from 'rxjs/operators';\n\nimport { EmailApiService } from '../email-api.service';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'contact-form',\n templateUrl: './contact-form.component.html',\n styleUrls: ['./contact-form.component.scss']\n})\nexport class ContactFormComponent implements OnDestroy {\n @Input() apiURL = 'https://forwardmethis.com/tehwolf@pm.me';\n\n formGroup: FormGroup;\n emailSent: Subject<boolean | null> = new Subject();\n emailSent$ = this.emailSent.asObservable();\n\n private unsubscribe$: Subject<void> = new Subject();\n\n constructor(\n private builder: FormBuilder,\n private emailService: EmailApiService\n ) {\n this.emailSent.next(null);\n this.formGroup = this.builder.group({\n name: new FormControl('', [Validators.required]),\n email: new FormControl('', [Validators.required, Validators.email]),\n message: new FormControl('', [Validators.required])\n });\n }\n\n ngOnDestroy(): void {\n this.unsubscribe$.next();\n this.unsubscribe$.complete();\n }\n\n submitFormData(formData: FormGroup) {\n this.emailService\n .sendEmail(this.apiURL, formData.value)\n .pipe(\n tap((response: string) => {\n if (response === 'OK') {\n this.emailSent.next(true);\n } else {\n this.emailSent.next(false);\n }\n }),\n takeUntil(this.unsubscribe$)\n )\n .subscribe();\n }\n}\n","<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n","import { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { ContactFormComponent } from './contact-form/contact-form.component';\nimport { EmailApiService } from './email-api.service';\n\n@NgModule({\n imports: [CommonModule, HttpClientModule, ReactiveFormsModule],\n declarations: [ContactFormComponent],\n exports: [ContactFormComponent],\n providers: [EmailApiService],\n})\nexport class ContactFormModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["HttpHeaders","map","catchError","of","Injectable","Subject","FormControl","Validators","tap","takeUntil","Component","Input","CommonModule","HttpClientModule","ReactiveFormsModule","NgModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQA;QAME,yBAAoB,IAAgB;YAAhB,SAAI,GAAJ,IAAI,CAAY;YALpC,gBAAW,GAAG;gBACZ,OAAO,EAAE,IAAIA,cAAW,CAAC;oBACvB,cAAc,EAAE,kBAAkB;iBACnC,CAAC;aACH,CAAC;SACsC;QAExC,mCAAS,GAAT,UAAU,MAAc,EAAE,IAAS;YACjC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CACxEC,aAAG,CAAC,UAAC,QAAa;gBAChB,OAAO,QAAQ,CAAC;aACjB,CAAC,EACFC,oBAAU,CAAC,UAAC,KAAU;gBACpB,OAAOC,OAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;aAC7B,CAAC,CACH,CAAC;SACH;;;uIAjBU,eAAe;2IAAf,eAAe,cAFd,MAAM;sHAEP,eAAe;sBAH3BC,aAAU;uBAAC;wBACV,UAAU,EAAE,MAAM;qBACnB;;;;QCeC,8BACU,OAAoB,EACpB,YAA6B;YAD7B,YAAO,GAAP,OAAO,CAAa;YACpB,iBAAY,GAAZ,YAAY,CAAiB;YAV9B,WAAM,GAAG,yCAAyC,CAAC;YAG5D,cAAS,GAA4B,IAAIC,YAAO,EAAE,CAAC;YACnD,eAA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AAc;wBACxB,WAAW,EAAE,+BAA+B;wBAC5C,SAAS,EAAE,CAAC,+BAA+B,CAAC;qBAC7C;8IAEU,MAAM;0BAAdC,QAAK;;;;QEAR;;;;yIAAa,iBAAiB;0IAAjB,iBAAiB,iBAJb,oBAAoB,aADzBC,eAAY,EAAEC,mBAAgB,EAAEC,wBAAmB,aAEnD,oBAAoB;0IAGnB,iBAAiB,aAFjB,CAAC,eAAe,CAAC,YAHnB,CAACF,eAAY,EAAEC,mBAAgB,EAAEC,wBAAmB,CAAC;sHAKnD,iBAAiB;sBAN7BC,WAAQ;uBAAC;wBACR,OAAO,EAAE,CAACH,eAAY,EAAEC,mBAAgB,EAAEC,wBAAmB,CAAC;wBAC9D,YAAY,EAAE,CAAC,oBAAoB,CAAC;wBACpC,OAAO,EAAE,CAAC,oBAAoB,CAAC;wBAC/B,SAAS,EAAE,CAAC,eAAe,CAAC;qBAC7B;;;ICbD;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ export * from './lib/contact-form.module';
2
+ export * from './lib/contact-form/contact-form.component';
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL2NvbnRhY3QtZm9ybS9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYywyQkFBMkIsQ0FBQztBQUMxQyxjQUFjLDJDQUEyQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9saWIvY29udGFjdC1mb3JtLm1vZHVsZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9jb250YWN0LWZvcm0vY29udGFjdC1mb3JtLmNvbXBvbmVudCc7XG4iXX0=
@@ -0,0 +1,56 @@
1
+ import { Component, Input } from '@angular/core';
2
+ import { FormBuilder, FormControl, Validators } from '@angular/forms';
3
+ import { Subject } from 'rxjs';
4
+ import { takeUntil, tap } from 'rxjs/operators';
5
+ import { EmailApiService } from '../email-api.service';
6
+ import * as i0 from "@angular/core";
7
+ import * as i1 from "@angular/forms";
8
+ import * as i2 from "../email-api.service";
9
+ import * as i3 from "@angular/common";
10
+ export class ContactFormComponent {
11
+ constructor(builder, emailService) {
12
+ this.builder = builder;
13
+ this.emailService = emailService;
14
+ this.apiURL = 'https://forwardmethis.com/tehwolf@pm.me';
15
+ this.emailSent = new Subject();
16
+ this.emailSent$ = this.emailSent.asObservable();
17
+ this.unsubscribe$ = new Subject();
18
+ this.emailSent.next(null);
19
+ this.formGroup = this.builder.group({
20
+ name: new FormControl('', [Validators.required]),
21
+ email: new FormControl('', [Validators.required, Validators.email]),
22
+ message: new FormControl('', [Validators.required])
23
+ });
24
+ }
25
+ ngOnDestroy() {
26
+ this.unsubscribe$.next();
27
+ this.unsubscribe$.complete();
28
+ }
29
+ submitFormData(formData) {
30
+ this.emailService
31
+ .sendEmail(this.apiURL, formData.value)
32
+ .pipe(tap((response) => {
33
+ if (response === 'OK') {
34
+ this.emailSent.next(true);
35
+ }
36
+ else {
37
+ this.emailSent.next(false);
38
+ }
39
+ }), takeUntil(this.unsubscribe$))
40
+ .subscribe();
41
+ }
42
+ }
43
+ ContactFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormComponent, deps: [{ token: i1.FormBuilder }, { token: i2.EmailApiService }], target: i0.ɵɵFactoryTarget.Component });
44
+ ContactFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: ContactFormComponent, selector: "contact-form", inputs: { apiURL: "apiURL" }, ngImport: i0, template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"], directives: [{ type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe } });
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormComponent, decorators: [{
46
+ type: Component,
47
+ args: [{
48
+ // eslint-disable-next-line @angular-eslint/component-selector
49
+ selector: 'contact-form',
50
+ templateUrl: './contact-form.component.html',
51
+ styleUrls: ['./contact-form.component.scss']
52
+ }]
53
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.EmailApiService }]; }, propDecorators: { apiURL: [{
54
+ type: Input
55
+ }] } });
56
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGFjdC1mb3JtLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29udGFjdC1mb3JtL3NyYy9saWIvY29udGFjdC1mb3JtL2NvbnRhY3QtZm9ybS5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvbnRhY3QtZm9ybS9zcmMvbGliL2NvbnRhY3QtZm9ybS9jb250YWN0LWZvcm0uY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQWEsTUFBTSxlQUFlLENBQUM7QUFDNUQsT0FBTyxFQUFFLFdBQVcsRUFBRSxXQUFXLEVBQWEsVUFBVSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDakYsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUMvQixPQUFPLEVBQUUsU0FBUyxFQUFF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NzPVwiZm9ybS1zdGF0dXNcIiAqbmdJZj1cIihlbWFpbFNlbnQkIHwgYXN5bmMpID09PSB0cnVlXCI+XG4gICAgRS1NYWlsIGVyZm9sZ3JlaWNoIHZlcnNlbmRldCFcbiAgPC9kaXY+XG4gIDxkaXYgY2xhc3M9XCJmb3JtLXN0YXR1c1wiICpuZ0lmPVwiKGVtYWlsU2VudCQgfCBhc3luYykgPT09IGZhbHNlXCI+XG4gICAgRmVobGVyOiBFLU1haWwga29ubnRlIG5pY2h0IHZlcnNlbmRldCB3ZXJkZW5cbiAgPC9kaXY+XG48L2Zvcm0+XG4iXX0=
@@ -0,0 +1,22 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { HttpClientModule } from '@angular/common/http';
3
+ import { NgModule } from '@angular/core';
4
+ import { ReactiveFormsModule } from '@angular/forms';
5
+ import { ContactFormComponent } from './contact-form/contact-form.component';
6
+ import { EmailApiService } from './email-api.service';
7
+ import * as i0 from "@angular/core";
8
+ export class ContactFormModule {
9
+ }
10
+ ContactFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
11
+ ContactFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormModule, declarations: [ContactFormComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule], exports: [ContactFormComponent] });
12
+ ContactFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormModule, providers: [EmailApiService], imports: [[CommonModule, HttpClientModule, ReactiveFormsModule]] });
13
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormModule, decorators: [{
14
+ type: NgModule,
15
+ args: [{
16
+ imports: [CommonModule, HttpClientModule, ReactiveFormsModule],
17
+ declarations: [ContactFormComponent],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LENBQUM7b0JBQ3BDLE9BQU8sRUFBRSxDQUFDLG9CQUFvQixDQUFDO29CQUMvQixTQUFTLEVBQUUsQ0FBQyxlQUFlLENBQUM7aUJBQzdCIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQ29tbW9uTW9kdWxlIH0gZnJvbSAnQGFuZ3VsYXIvY29tbW9uJztcbmltcG9ydCB7IEh0dHBDbGllbnRNb2R1bGUgfSBmcm9tICdAYW5ndWxhci9jb21tb24vaHR0cCc7XG5pbXBvcnQgeyBOZ01vZHVsZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgUmVhY3RpdmVGb3Jtc01vZHVsZSB9IGZyb20gJ0Bhbmd1bGFyL2Zvcm1zJztcblxuaW1wb3J0IHsgQ29udGFjdEZvcm1Db21wb25lbnQgfSBmcm9tICcuL2NvbnRhY3QtZm9ybS9jb250YWN0LWZvcm0uY29tcG9uZW50JztcbmltcG9ydCB7IEVtYWlsQXBpU2VydmljZSB9IGZyb20gJy4vZW1haWwtYXBpLnNlcnZpY2UnO1xuXG5ATmdNb2R1bGUoe1xuICBpbXBvcnRzOiBbQ29tbW9uTW9kdWxlLCBIdHRwQ2xpZW50TW9kdWxlLCBSZWFjdGl2ZUZvcm1zTW9kdWxlXSxcbiAgZGVjbGFyYXRpb25zOiBbQ29udGFjdEZvcm1Db21wb25lbnRdLFxuICBleHBvcnRzOiBbQ29udGFjdEZvcm1Db21wb25lbnRdLFxuICBwcm92aWRlcnM6IFtFbWFpbEFwaVNlcnZpY2VdLFxufSlcbmV4cG9ydCBjbGFzcyBDb250YWN0Rm9ybU1vZHVsZSB7fVxuIl19
@@ -0,0 +1,32 @@
1
+ import { HttpClient, HttpHeaders } from '@angular/common/http';
2
+ import { Injectable } from '@angular/core';
3
+ import { of } from 'rxjs';
4
+ import { catchError, map } from 'rxjs/operators';
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "@angular/common/http";
7
+ export class EmailApiService {
8
+ constructor(http) {
9
+ this.http = http;
10
+ this.httpOptions = {
11
+ headers: new HttpHeaders({
12
+ 'Content-Type': 'application/json'
13
+ })
14
+ };
15
+ }
16
+ sendEmail(apiURL, data) {
17
+ return this.http.post(apiURL, JSON.stringify(data), this.httpOptions).pipe(map((response) => {
18
+ return response;
19
+ }), catchError((error) => {
20
+ return of(error.statusText);
21
+ }));
22
+ }
23
+ }
24
+ EmailApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: EmailApiService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
25
+ EmailApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: EmailApiService, providedIn: 'root' });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: EmailApiService, decorators: [{
27
+ type: Injectable,
28
+ args: [{
29
+ providedIn: 'root'
30
+ }]
31
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
32
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1haWwtYXBpLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2NvbnRhY3QtZm9ybS9zcmMvbGliL2VtYWlsLWFwaS5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsV0FBVyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDL0QsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMzQyxPQUFPLEVBQWMsRUFBRSxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBQ3RDLE9BQU8sRUFBRSxVQUFVLEVBQUUsR0FBRyxFQUFFLE1BQU0sZ0JBQ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FcnJvciwgbWFwIH0gZnJvbSAncnhqcy9vcGVyYXRvcnMnO1xuXG5ASW5qZWN0YWJsZSh7XG4gIHByb3ZpZGVkSW46ICdyb290J1xufSlcbmV4cG9ydCBjbGFzcyBFbWFpbEFwaVNlcnZpY2Uge1xuICBodHRwT3B0aW9ucyA9IHtcbiAgICBoZWFkZXJzOiBuZXcgSHR0cEhlYWRlcnMoe1xuICAgICAgJ0NvbnRlbnQtVHlwZSc6ICdhcHBsaWNhdGlvbi9qc29uJ1xuICAgIH0pXG4gIH07XG4gIGNvbnN0cnVjdG9yKHByaXZhdGUgaHR0cDogSHR0cENsaWVudCkge31cblxuICBzZW5kRW1haWwoYXBpVVJMOiBzdHJpbmcsIGRhdGE6IGFueSk6IE9ic2VydmFibGU8YW55PiB7XG4gICAgcmV0dXJuIHRoaXMuaHR0cC5wb3N0KGFwaVVSTCwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIHRoaXMuaHR0cE9wdGlvbnMpLnBpcGUoXG4gICAgICBtYXAoKHJlc3BvbnNlOiBhbnkpID0+IHtcbiAgICAgICAgcmV0dXJuIHJlc3BvbnNlO1xuICAgICAgfSksXG4gICAgICBjYXRjaEVycm9yKChlcnJvcjogYW55KSA9PiB7XG4gICAgICAgIHJldHVybiBvZihlcnJvci5zdGF0dXNUZXh0KTtcbiAgICAgIH0pXG4gICAgKTtcbiAgfVxufVxuIl19
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVodzBsZi1jb250YWN0LWZvcm0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL2NvbnRhY3QtZm9ybS9zcmMvdGVodzBsZi1jb250YWN0LWZvcm0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLFNBQVMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9pbmRleCc7XG4iXX0=
@@ -0,0 +1,105 @@
1
+ import * as i3 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
3
+ import * as i1 from '@angular/common/http';
4
+ import { HttpHeaders, HttpClientModule } from '@angular/common/http';
5
+ import * as i0 from '@angular/core';
6
+ import { Injectable, Component, Input, NgModule } from '@angular/core';
7
+ import * as i1$1 from '@angular/forms';
8
+ import { FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
9
+ import { of, Subject } from 'rxjs';
10
+ import { map, catchError, tap, takeUntil } from 'rxjs/operators';
11
+
12
+ class EmailApiService {
13
+ constructor(http) {
14
+ this.http = http;
15
+ this.httpOptions = {
16
+ headers: new HttpHeaders({
17
+ 'Content-Type': 'application/json'
18
+ })
19
+ };
20
+ }
21
+ sendEmail(apiURL, data) {
22
+ return this.http.post(apiURL, JSON.stringify(data), this.httpOptions).pipe(map((response) => {
23
+ return response;
24
+ }), catchError((error) => {
25
+ return of(error.statusText);
26
+ }));
27
+ }
28
+ }
29
+ EmailApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: EmailApiService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
30
+ EmailApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: EmailApiService, providedIn: 'root' });
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: EmailApiService, decorators: [{
32
+ type: Injectable,
33
+ args: [{
34
+ providedIn: 'root'
35
+ }]
36
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
37
+
38
+ class ContactFormComponent {
39
+ constructor(builder, emailService) {
40
+ this.builder = builder;
41
+ this.emailService = emailService;
42
+ this.apiURL = 'https://forwardmethis.com/tehwolf@pm.me';
43
+ this.emailSent = new Subject();
44
+ this.emailSent$ = this.emailSent.asObservable();
45
+ this.unsubscribe$ = new Subject();
46
+ this.emailSent.next(null);
47
+ this.formGroup = this.builder.group({
48
+ name: new FormControl('', [Validators.required]),
49
+ email: new FormControl('', [Validators.required, Validators.email]),
50
+ message: new FormControl('', [Validators.required])
51
+ });
52
+ }
53
+ ngOnDestroy() {
54
+ this.unsubscribe$.next();
55
+ this.unsubscribe$.complete();
56
+ }
57
+ submitFormData(formData) {
58
+ this.emailService
59
+ .sendEmail(this.apiURL, formData.value)
60
+ .pipe(tap((response) => {
61
+ if (response === 'OK') {
62
+ this.emailSent.next(true);
63
+ }
64
+ else {
65
+ this.emailSent.next(false);
66
+ }
67
+ }), takeUntil(this.unsubscribe$))
68
+ .subscribe();
69
+ }
70
+ }
71
+ ContactFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormComponent, deps: [{ token: i1$1.FormBuilder }, { token: EmailApiService }], target: i0.ɵɵFactoryTarget.Component });
72
+ ContactFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: ContactFormComponent, selector: "contact-form", inputs: { apiURL: "apiURL" }, ngImport: i0, template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"], directives: [{ type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe } });
73
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormComponent, decorators: [{
74
+ type: Component,
75
+ args: [{
76
+ // eslint-disable-next-line @angular-eslint/component-selector
77
+ selector: 'contact-form',
78
+ templateUrl: './contact-form.component.html',
79
+ styleUrls: ['./contact-form.component.scss']
80
+ }]
81
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: EmailApiService }]; }, propDecorators: { apiURL: [{
82
+ type: Input
83
+ }] } });
84
+
85
+ class ContactFormModule {
86
+ }
87
+ ContactFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
88
+ ContactFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormModule, declarations: [ContactFormComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule], exports: [ContactFormComponent] });
89
+ ContactFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormModule, providers: [EmailApiService], imports: [[CommonModule, HttpClientModule, ReactiveFormsModule]] });
90
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ContactFormModule, decorators: [{
91
+ type: NgModule,
92
+ args: [{
93
+ imports: [CommonModule, HttpClientModule, ReactiveFormsModule],
94
+ declarations: [ContactFormComponent],
95
+ exports: [ContactFormComponent],
96
+ providers: [EmailApiService],
97
+ }]
98
+ }] });
99
+
100
+ /**
101
+ * Generated bundle index. Do not edit.
102
+ */
103
+
104
+ export { ContactFormComponent, ContactFormModule };
105
+ //# sourceMappingURL=tehw0lf-contact-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tehw0lf-contact-form.js","sources":["../../../../libs/contact-form/src/lib/email-api.service.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.html","../../../../libs/contact-form/src/lib/contact-form.module.ts","../../../../libs/contact-form/src/tehw0lf-contact-form.ts"],"sourcesContent":["import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class EmailApiService {\n httpOptions = {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n })\n };\n constructor(private http: HttpClient) {}\n\n sendEmail(apiURL: string, data: any): Observable<any> {\n return this.http.post(apiURL, JSON.stringify(data), this.httpOptions).pipe(\n map((response: any) => {\n return response;\n }),\n catchError((error: any) => {\n return of(error.statusText);\n })\n );\n }\n}\n","import { Component, Input, OnDestroy } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { takeUntil, tap } from 'rxjs/operators';\n\nimport { EmailApiService } from '../email-api.service';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'contact-form',\n templateUrl: './contact-form.component.html',\n styleUrls: ['./contact-form.component.scss']\n})\nexport class ContactFormComponent implements OnDestroy {\n @Input() apiURL = 'https://forwardmethis.com/tehwolf@pm.me';\n\n formGroup: FormGroup;\n emailSent: Subject<boolean | null> = new Subject();\n emailSent$ = this.emailSent.asObservable();\n\n private unsubscribe$: Subject<void> = new Subject();\n\n constructor(\n private builder: FormBuilder,\n private emailService: EmailApiService\n ) {\n this.emailSent.next(null);\n this.formGroup = this.builder.group({\n name: new FormControl('', [Validators.required]),\n email: new FormControl('', [Validators.required, Validators.email]),\n message: new FormControl('', [Validators.required])\n });\n }\n\n ngOnDestroy(): void {\n this.unsubscribe$.next();\n this.unsubscribe$.complete();\n }\n\n submitFormData(formData: FormGroup) {\n this.emailService\n .sendEmail(this.apiURL, formData.value)\n .pipe(\n tap((response: string) => {\n if (response === 'OK') {\n this.emailSent.next(true);\n } else {\n this.emailSent.next(false);\n }\n }),\n takeUntil(this.unsubscribe$)\n )\n .subscribe();\n }\n}\n","<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n","import { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { ContactFormComponent } from './contact-form/contact-form.component';\nimport { EmailApiService } from './email-api.service';\n\n@NgModule({\n imports: [CommonModule, HttpClientModule, ReactiveFormsModule],\n declarations: [ContactFormComponent],\n exports: [ContactFormComponent],\n providers: [EmailApiService],\n})\nexport class ContactFormModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAQa,eAAe;IAM1B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QALpC,gBAAW,GAAG;YACZ,OAAO,EAAE,IAAI,WAAW,CAAC;gBACvB,cAAc,EAAE,kBAAkB;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
@@ -0,0 +1,2 @@
1
+ export * from './lib/contact-form.module';
2
+ export * from './lib/contact-form/contact-form.component';
@@ -0,0 +1,19 @@
1
+ import { OnDestroy } from '@angular/core';
2
+ import { FormBuilder, FormGroup } from '@angular/forms';
3
+ import { Subject } from 'rxjs';
4
+ import { EmailApiService } from '../email-api.service';
5
+ import * as i0 from "@angular/core";
6
+ export declare class ContactFormComponent implements OnDestroy {
7
+ private builder;
8
+ private emailService;
9
+ apiURL: string;
10
+ formGroup: FormGroup;
11
+ emailSent: Subject<boolean | null>;
12
+ emailSent$: import("rxjs").Observable<boolean | null>;
13
+ private unsubscribe$;
14
+ constructor(builder: FormBuilder, emailService: EmailApiService);
15
+ ngOnDestroy(): void;
16
+ submitFormData(formData: FormGroup): void;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContactFormComponent, never>;
18
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContactFormComponent, "contact-form", never, { "apiURL": "apiURL"; }, {}, never, never>;
19
+ }
@@ -0,0 +1,10 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./contact-form/contact-form.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@angular/common/http";
5
+ import * as i4 from "@angular/forms";
6
+ export declare class ContactFormModule {
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContactFormModule, never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ContactFormModule, [typeof i1.ContactFormComponent], [typeof i2.CommonModule, typeof i3.HttpClientModule, typeof i4.ReactiveFormsModule], [typeof i1.ContactFormComponent]>;
9
+ static ɵinj: i0.ɵɵInjectorDeclaration<ContactFormModule>;
10
+ }
@@ -0,0 +1,13 @@
1
+ import { HttpClient, HttpHeaders } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import * as i0 from "@angular/core";
4
+ export declare class EmailApiService {
5
+ private http;
6
+ httpOptions: {
7
+ headers: HttpHeaders;
8
+ };
9
+ constructor(http: HttpClient);
10
+ sendEmail(apiURL: string, data: any): Observable<any>;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<EmailApiService, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<EmailApiService>;
13
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@tehw0lf/contact-form",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@angular/common": "^12.2.11",
6
+ "@angular/core": "^12.2.11",
7
+ "@angular/forms": "^12.2.11",
8
+ "rxjs": "~7.4.0"
9
+ },
10
+ "dependencies": {
11
+ "tslib": "^2.2.0"
12
+ },
13
+ "main": "bundles/tehw0lf-contact-form.umd.js",
14
+ "module": "fesm2015/tehw0lf-contact-form.js",
15
+ "es2015": "fesm2015/tehw0lf-contact-form.js",
16
+ "esm2015": "esm2015/tehw0lf-contact-form.js",
17
+ "fesm2015": "fesm2015/tehw0lf-contact-form.js",
18
+ "typings": "tehw0lf-contact-form.d.ts",
19
+ "sideEffects": false
20
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@tehw0lf/contact-form" />
5
+ export * from './index';