pwa-auth 3.1.4 → 3.2.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/CHANGELOG.md +5 -0
- package/README.md +5 -3
- package/{transpiled/src-typescript → base}/css/form/button.d.ts +0 -1
- package/{transpiled/src-typescript → base}/css/form/button.js +1 -0
- package/base/css/form/button.js.map +1 -0
- package/{transpiled/src-typescript → base}/css/form/input.d.ts +0 -1
- package/{transpiled/src-typescript → base}/css/form/input.js +1 -0
- package/base/css/form/input.js.map +1 -0
- package/{transpiled/src-typescript → base}/css/form/label.d.ts +0 -1
- package/{transpiled/src-typescript → base}/css/form/label.js +1 -0
- package/base/css/form/label.js.map +1 -0
- package/{transpiled/src-typescript → base}/css/form/list.d.ts +0 -1
- package/{transpiled/src-typescript → base}/css/form/list.js +1 -0
- package/base/css/form/list.js.map +1 -0
- package/{transpiled/src-typescript → base}/css/svg.d.ts +0 -1
- package/{transpiled/src-typescript → base}/css/svg.js +1 -0
- package/base/css/svg.js.map +1 -0
- package/{transpiled/src-typescript → base}/css/toggle.d.ts +0 -1
- package/{transpiled/src-typescript → base}/css/toggle.js +1 -0
- package/base/css/toggle.js.map +1 -0
- package/{src/pwa-helpers.js → base/export/auth-helpers.d.ts} +1 -1
- package/base/export/auth-helpers.js +2 -0
- package/base/export/auth-helpers.js.map +1 -0
- package/base/export/pwa-auth.d.ts +4 -0
- package/base/export/pwa-auth.js +5 -0
- package/base/export/pwa-auth.js.map +1 -0
- package/{transpiled/src-typescript → base}/firebase/authentication.d.ts +1 -2
- package/{transpiled/src-typescript → base}/firebase/authentication.js +1 -0
- package/base/firebase/authentication.js.map +1 -0
- package/{transpiled/src-typescript → base}/firebase/interface.d.ts +0 -1
- package/{transpiled/src-typescript → base}/firebase/interface.js +1 -0
- package/base/firebase/interface.js.map +1 -0
- package/{transpiled/src-typescript → base}/redux/backend.d.ts +0 -1
- package/{transpiled/src-typescript → base}/redux/backend.js +1 -0
- package/base/redux/backend.js.map +1 -0
- package/{transpiled/src-typescript → base}/redux/drawer.d.ts +0 -1
- package/{transpiled/src-typescript → base}/redux/drawer.js +1 -0
- package/base/redux/drawer.js.map +1 -0
- package/{transpiled/src-typescript → base}/redux/frontend.d.ts +0 -1
- package/{transpiled/src-typescript → base}/redux/frontend.js +1 -0
- package/base/redux/frontend.js.map +1 -0
- package/{transpiled/src-typescript → base}/redux/object.d.ts +0 -1
- package/base/redux/object.js +2 -0
- package/base/redux/object.js.map +1 -0
- package/{transpiled/src-typescript → base}/store.d.ts +0 -1
- package/{transpiled/src-typescript → base}/store.js +1 -0
- package/base/store.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/drawer.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/drawer.js +1 -0
- package/base/webcomponents/drawer/css/drawer.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/exit.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/exit.js +1 -0
- package/base/webcomponents/drawer/css/exit.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/link.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/link.js +1 -0
- package/base/webcomponents/drawer/css/link.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/paragraph.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/paragraph.js +1 -0
- package/base/webcomponents/drawer/css/paragraph.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/toggle.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/drawer/css/toggle.js +1 -0
- package/base/webcomponents/drawer/css/toggle.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/drawer/drawer.d.ts +1 -2
- package/{transpiled/src-typescript → base}/webcomponents/drawer/drawer.js +4 -3
- package/base/webcomponents/drawer/drawer.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/drawer/input/login.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/drawer/input/login.js +1 -0
- package/base/webcomponents/drawer/input/login.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/drawer/input/sign-up.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/drawer/input/sign-up.js +1 -0
- package/base/webcomponents/drawer/input/sign-up.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/icon/css/icon.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/icon/css/icon.js +1 -0
- package/base/webcomponents/icon/css/icon.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/icon/icon.d.ts +1 -2
- package/{transpiled/src-typescript → base}/webcomponents/icon/icon.js +4 -3
- package/base/webcomponents/icon/icon.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/settings/css/navigation.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/settings/css/navigation.js +1 -0
- package/base/webcomponents/settings/css/navigation.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/delete.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/delete.js +1 -0
- package/base/webcomponents/settings/input/delete.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/email.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/email.js +1 -0
- package/base/webcomponents/settings/input/email.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/name.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/name.js +1 -0
- package/base/webcomponents/settings/input/name.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/password.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/password.js +1 -0
- package/base/webcomponents/settings/input/password.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/uploader.d.ts +0 -1
- package/{transpiled/src-typescript → base}/webcomponents/settings/input/uploader.js +1 -0
- package/base/webcomponents/settings/input/uploader.js.map +1 -0
- package/{transpiled/src-typescript → base}/webcomponents/settings/settings.d.ts +1 -2
- package/{transpiled/src-typescript → base}/webcomponents/settings/settings.js +4 -3
- package/base/webcomponents/settings/settings.js.map +1 -0
- package/demonstration/index.html +52 -5
- package/{src-export/pwa-helpers.ts → export/auth-helpers.ts} +1 -1
- package/{src-export/tsconfig.production.json → export/export/tsconfigs.production.md} +3 -3
- package/export/pwa-auth.ts +4 -0
- package/package.json +21 -15
- package/demonstration/compiled/pwa-auth.js +0 -881
- package/demonstration/compiled/pwa-auth.js.map +0 -1
- package/demonstration/compiled/pwa-helpers-BN4uXXdl.js +0 -8
- package/demonstration/compiled/pwa-helpers-BN4uXXdl.js.map +0 -1
- package/demonstration/compiled/pwa-helpers.js +0 -8
- package/demonstration/compiled/pwa-helpers.js.map +0 -1
- package/demonstration/css/styles.css +0 -69
- package/images/empty.jpg +0 -0
- package/src/compiled/pwa-auth.js +0 -881
- package/src/compiled/pwa-auth.js.map +0 -1
- package/src/compiled/pwa-helpers-BN4uXXdl.js +0 -8
- package/src/compiled/pwa-helpers-BN4uXXdl.js.map +0 -1
- package/src/compiled/pwa-helpers.js +0 -8
- package/src/compiled/pwa-helpers.js.map +0 -1
- package/src/empty.jpg +0 -0
- package/src/pwa-auth.js +0 -3
- package/src-classes/pwa-auth.js +0 -3
- package/src-compiled/pwa-auth.js +0 -881
- package/src-compiled/pwa-auth.js.map +0 -1
- package/src-compiled/pwa-helpers-BN4uXXdl.js +0 -8
- package/src-compiled/pwa-helpers-BN4uXXdl.js.map +0 -1
- package/src-compiled/pwa-helpers.js +0 -8
- package/src-compiled/pwa-helpers.js.map +0 -1
- package/src-export/pwa-auth.ts +0 -3
- package/src-functions/pwa-helpers.js +0 -1
- package/src-typescript/css/default.ts +0 -111
- package/src-typescript/css/font.ts +0 -17
- package/src-typescript/css/form/button.ts +0 -55
- package/src-typescript/css/form/input.ts +0 -25
- package/src-typescript/css/form/label.ts +0 -23
- package/src-typescript/css/form/list.ts +0 -23
- package/src-typescript/css/svg.ts +0 -5
- package/src-typescript/css/toggle.ts +0 -9
- package/src-typescript/development/helpers-array.ts +0 -0
- package/src-typescript/development/junk/firebase-object.ts +0 -49
- package/src-typescript/development/junk/notes.md +0 -96
- package/src-typescript/development/junk/phone.ts +0 -146
- package/src-typescript/development/junk/photo.ts +0 -440
- package/src-typescript/development/junk/telephone.ts +0 -282
- package/src-typescript/development/login.ts +0 -246
- package/src-typescript/development/utilities-object.ts +0 -214
- package/src-typescript/firebase/authentication.ts +0 -11
- package/src-typescript/firebase/interface.ts +0 -187
- package/src-typescript/lazy-loader.ts +0 -20
- package/src-typescript/redux/backend.ts +0 -94
- package/src-typescript/redux/drawer.ts +0 -37
- package/src-typescript/redux/frontend.ts +0 -134
- package/src-typescript/redux/object.ts +0 -31
- package/src-typescript/store.ts +0 -19
- package/src-typescript/webcomponents/drawer/css/drawer.ts +0 -64
- package/src-typescript/webcomponents/drawer/css/exit.ts +0 -49
- package/src-typescript/webcomponents/drawer/css/link.ts +0 -15
- package/src-typescript/webcomponents/drawer/css/paragraph.ts +0 -11
- package/src-typescript/webcomponents/drawer/css/toggle.ts +0 -19
- package/src-typescript/webcomponents/drawer/drawer.ts +0 -120
- package/src-typescript/webcomponents/drawer/input/forgot.ts +0 -121
- package/src-typescript/webcomponents/drawer/input/login.ts +0 -135
- package/src-typescript/webcomponents/drawer/input/sign-up.ts +0 -159
- package/src-typescript/webcomponents/icon/css/icon.ts +0 -60
- package/src-typescript/webcomponents/icon/icon.ts +0 -71
- package/src-typescript/webcomponents/settings/css/navigation.ts +0 -92
- package/src-typescript/webcomponents/settings/input/delete.ts +0 -83
- package/src-typescript/webcomponents/settings/input/email.ts +0 -135
- package/src-typescript/webcomponents/settings/input/images.ts +0 -57
- package/src-typescript/webcomponents/settings/input/name.ts +0 -99
- package/src-typescript/webcomponents/settings/input/password.ts +0 -156
- package/src-typescript/webcomponents/settings/input/uploader.ts +0 -330
- package/src-typescript/webcomponents/settings/settings.ts +0 -205
- package/transpiled/src-export/pwa-auth.d.ts +0 -4
- package/transpiled/src-export/pwa-auth.d.ts.map +0 -1
- package/transpiled/src-export/pwa-auth.js +0 -3
- package/transpiled/src-export/pwa-helpers.d.ts +0 -2
- package/transpiled/src-export/pwa-helpers.d.ts.map +0 -1
- package/transpiled/src-export/pwa-helpers.js +0 -1
- package/transpiled/src-typescript/css/form/button.d.ts.map +0 -1
- package/transpiled/src-typescript/css/form/input.d.ts.map +0 -1
- package/transpiled/src-typescript/css/form/label.d.ts.map +0 -1
- package/transpiled/src-typescript/css/form/list.d.ts.map +0 -1
- package/transpiled/src-typescript/css/svg.d.ts.map +0 -1
- package/transpiled/src-typescript/css/toggle.d.ts.map +0 -1
- package/transpiled/src-typescript/firebase/authentication.d.ts.map +0 -1
- package/transpiled/src-typescript/firebase/interface.d.ts.map +0 -1
- package/transpiled/src-typescript/redux/backend.d.ts.map +0 -1
- package/transpiled/src-typescript/redux/drawer.d.ts.map +0 -1
- package/transpiled/src-typescript/redux/frontend.d.ts.map +0 -1
- package/transpiled/src-typescript/redux/object.d.ts.map +0 -1
- package/transpiled/src-typescript/redux/object.js +0 -1
- package/transpiled/src-typescript/store.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/drawer/css/drawer.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/drawer/css/exit.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/drawer/css/link.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/drawer/css/paragraph.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/drawer/css/toggle.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/drawer/drawer.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/drawer/input/login.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/drawer/input/sign-up.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/icon/css/icon.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/icon/icon.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/settings/css/navigation.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/settings/input/delete.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/settings/input/email.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/settings/input/name.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/settings/input/password.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/settings/input/uploader.d.ts.map +0 -1
- package/transpiled/src-typescript/webcomponents/settings/settings.d.ts.map +0 -1
- /package/demonstration/{css/pwa-styles.css → pwa-styles.css} +0 -0
- /package/{src → source}/THIRD_PARTY_LICENSES.txt +0 -0
- /package/{demonstration/images → source}/empty.jpg +0 -0
- /package/{src → source}/pwa-styles.css +0 -0
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { html, TemplateResult, } from 'lit';
|
|
4
|
-
import { customElement, state } from "lit/decorators.js"
|
|
5
|
-
import { LazyLoader } from '../../../lazy-loader';
|
|
6
|
-
import { sendPasswordResetEmail/*, verifyPasswordResetCode*/ } from 'firebase/auth';
|
|
7
|
-
import { auth } from '../../../firebase/authentication';
|
|
8
|
-
|
|
9
|
-
@customElement('reset-email')
|
|
10
|
-
export class ResetEmail extends LazyLoader {
|
|
11
|
-
|
|
12
|
-
@state() private userEmail :string = '';
|
|
13
|
-
// @state() private code :string = '';
|
|
14
|
-
|
|
15
|
-
constructor() { super(); }
|
|
16
|
-
|
|
17
|
-
protected firstUpdated() {
|
|
18
|
-
|
|
19
|
-
this.shadowRoot!.querySelector(".reset")!.addEventListener("click", () => {
|
|
20
|
-
this.restPassword();
|
|
21
|
-
} );
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Handle input changes to keep the password property in sync
|
|
26
|
-
private handleEmail(event: Event) {
|
|
27
|
-
const input = event.target as HTMLInputElement;
|
|
28
|
-
this.userEmail = input.value; // Update the property with the input value
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
protected render():TemplateResult {
|
|
32
|
-
return html`
|
|
33
|
-
|
|
34
|
-
<form class="resetPass">
|
|
35
|
-
|
|
36
|
-
<input
|
|
37
|
-
class ="email"
|
|
38
|
-
type ="text"
|
|
39
|
-
placeholder ="email"
|
|
40
|
-
@change ="${this.handleEmail}">
|
|
41
|
-
|
|
42
|
-
<button
|
|
43
|
-
type ="submit"
|
|
44
|
-
class ="reset">Forgot Password</button>
|
|
45
|
-
|
|
46
|
-
</form>
|
|
47
|
-
|
|
48
|
-
<input
|
|
49
|
-
class ="phoneVerify"
|
|
50
|
-
type ="text" />
|
|
51
|
-
|
|
52
|
-
`
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// Reset Password Email
|
|
57
|
-
private restPassword = async () => {
|
|
58
|
-
|
|
59
|
-
await sendPasswordResetEmail( auth, this.userEmail )
|
|
60
|
-
.catch( (error:any) => { console.log(error); } );
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
/*
|
|
64
|
-
private async restCode () {
|
|
65
|
-
|
|
66
|
-
await verifyPasswordResetCode(auth, this.code);
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
declare global {
|
|
74
|
-
interface HTMLElementTagNameMap {
|
|
75
|
-
'reset-email': ResetEmail;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/*
|
|
81
|
-
let actionCodeSettings = {
|
|
82
|
-
url: 'https://www.contractorscentre.com/?email=user@example.com',
|
|
83
|
-
iOS: {
|
|
84
|
-
bundleId: 'com.contracotors.ios'
|
|
85
|
-
},
|
|
86
|
-
android: {
|
|
87
|
-
packageName: 'com.contracotors.android',
|
|
88
|
-
installApp: true,
|
|
89
|
-
minimumVersion: '12'
|
|
90
|
-
},
|
|
91
|
-
handleCodeInApp: true
|
|
92
|
-
};
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
private _restCode() {
|
|
98
|
-
let x:any = this.shadowRoot!.querySelector('.email')!
|
|
99
|
-
let email = x.target.value
|
|
100
|
-
// @ts-ignore
|
|
101
|
-
firebase
|
|
102
|
-
.auth()
|
|
103
|
-
.sendPasswordResetEmail( email )
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
.then( () => { firebase.auth().confirmPasswordReset( code, newPassword )})
|
|
106
|
-
.catch( (error:any) => { console.log("Password Reset Error: ", error); });
|
|
107
|
-
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
firebase
|
|
110
|
-
.auth()
|
|
111
|
-
// @ts-ignore
|
|
112
|
-
.verifyPasswordResetCode( code )
|
|
113
|
-
.then()
|
|
114
|
-
.catch()
|
|
115
|
-
|
|
116
|
-
// firebase.auth().confirmPasswordReset( code, newPassword )
|
|
117
|
-
// firebase.auth().verifyPasswordResetCode( code )
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*/
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { html, LitElement, css } from 'lit';
|
|
2
|
-
import { customElement, state } from 'lit/decorators.js';
|
|
3
|
-
|
|
4
|
-
import { EmailAuthProvider, signInWithCredential } from 'firebase/auth';
|
|
5
|
-
import { auth } from '../../../firebase/authentication';
|
|
6
|
-
|
|
7
|
-
import { buttonStyle } from '../../../css/form/button';
|
|
8
|
-
import { labelStyle } from '../../../css/form/label';
|
|
9
|
-
import { inputStyle } from '../../../css/form/input';
|
|
10
|
-
import { listStyle } from '../../../css/form/list';
|
|
11
|
-
import { toggleStyle } from '../css/toggle';
|
|
12
|
-
|
|
13
|
-
import store from '../../../store';
|
|
14
|
-
import { signUpAction } from '../../../redux/frontend';
|
|
15
|
-
|
|
16
|
-
@customElement('user-log-in')
|
|
17
|
-
export class UserLogIn extends LitElement {
|
|
18
|
-
|
|
19
|
-
@state() private email = '';
|
|
20
|
-
@state() private password = '';
|
|
21
|
-
|
|
22
|
-
constructor() { super(); }
|
|
23
|
-
|
|
24
|
-
static get styles() { return [
|
|
25
|
-
listStyle,
|
|
26
|
-
labelStyle,
|
|
27
|
-
inputStyle,
|
|
28
|
-
buttonStyle,
|
|
29
|
-
toggleStyle,
|
|
30
|
-
css`
|
|
31
|
-
|
|
32
|
-
.double {
|
|
33
|
-
display: grid;
|
|
34
|
-
grid-template-columns: 1fr auto;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
`
|
|
38
|
-
] };
|
|
39
|
-
|
|
40
|
-
protected render() {
|
|
41
|
-
return html`
|
|
42
|
-
|
|
43
|
-
<!-- Log-in State -->
|
|
44
|
-
<form
|
|
45
|
-
@submit=${this._handleSubmit}
|
|
46
|
-
autocomplete="on">
|
|
47
|
-
|
|
48
|
-
<ul>
|
|
49
|
-
|
|
50
|
-
<li>
|
|
51
|
-
<label for="pwa-login-email">Email</label>
|
|
52
|
-
<input
|
|
53
|
-
id="pwa-login-email"
|
|
54
|
-
type="email"
|
|
55
|
-
@change="${this.handleEmail}">
|
|
56
|
-
</li>
|
|
57
|
-
|
|
58
|
-
<li>
|
|
59
|
-
<label for="pwa-login-pass">Password</label>
|
|
60
|
-
<input
|
|
61
|
-
id="pwa-login-pass"
|
|
62
|
-
type="password"
|
|
63
|
-
@change="${this.handlePassword}">
|
|
64
|
-
</li>
|
|
65
|
-
|
|
66
|
-
<li>
|
|
67
|
-
<button
|
|
68
|
-
class="login action-button"
|
|
69
|
-
@click="${this.login}">Sign in</button>
|
|
70
|
-
|
|
71
|
-
</li>
|
|
72
|
-
|
|
73
|
-
<!-- Change State -->
|
|
74
|
-
<li>
|
|
75
|
-
<p class="divider">Or</p>
|
|
76
|
-
<button
|
|
77
|
-
class="new"
|
|
78
|
-
@click="${ this.change }">create a new account</button>
|
|
79
|
-
</li>
|
|
80
|
-
|
|
81
|
-
</ul>
|
|
82
|
-
|
|
83
|
-
</form>
|
|
84
|
-
|
|
85
|
-
`;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private change() {
|
|
89
|
-
store.dispatch(signUpAction());
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Sync Email
|
|
93
|
-
private handleEmail(event: Event) {
|
|
94
|
-
const input = event.target as HTMLInputElement;
|
|
95
|
-
this.email = input.value; // Update the property with the input value
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Sync Password
|
|
99
|
-
private handlePassword(event: Event) {
|
|
100
|
-
const input = event.target as HTMLInputElement;
|
|
101
|
-
this.password = input.value; // Update the property with the input value
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Form Default
|
|
105
|
-
private _handleSubmit(event: Event) {
|
|
106
|
-
event.preventDefault(); // Prevent Form Default Behaviour
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Login Action
|
|
110
|
-
private login() {
|
|
111
|
-
if (this.email.length < 4) { alert('Please enter an email address.'); return; }
|
|
112
|
-
if (this.password.length < 4) { alert('Please enter a password.'); return; }
|
|
113
|
-
this.signIn(this.email,this.password); // Sign in with email and password
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// Firebase Authentication Function: Sign in using Email and Password
|
|
118
|
-
private signIn = async (email:any, password:any) => {
|
|
119
|
-
|
|
120
|
-
const authCredential = EmailAuthProvider.credential(email, password);
|
|
121
|
-
|
|
122
|
-
await signInWithCredential(auth, authCredential).catch((error)=>{console.log(error)}); /*.then((/*credentials*)=>{/*onsole.log(credentials)})*/
|
|
123
|
-
|
|
124
|
-
// await signInWithEmailAndPassword(auth, email, password);
|
|
125
|
-
// EmailAuthProvider.credential(email, password);
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
declare global {
|
|
132
|
-
interface HTMLElementTagNameMap {
|
|
133
|
-
'user-log-in': UserLogIn;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { css, html, LitElement } from 'lit';
|
|
2
|
-
import { customElement, state } from 'lit/decorators.js';
|
|
3
|
-
|
|
4
|
-
import { createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
|
|
5
|
-
import { auth } from '../../../firebase/authentication';
|
|
6
|
-
import { logAccount } from '../../../firebase/interface';
|
|
7
|
-
|
|
8
|
-
import { buttonStyle } from '../../../css/form/button';
|
|
9
|
-
import { labelStyle } from '../../../css/form/label';
|
|
10
|
-
import { inputStyle } from '../../../css/form/input';
|
|
11
|
-
import { listStyle } from '../../../css/form/list';
|
|
12
|
-
import { toggleStyle } from '../css/toggle';
|
|
13
|
-
|
|
14
|
-
import store from '../../../store';
|
|
15
|
-
import { signUpAction } from '../../../redux/frontend';
|
|
16
|
-
|
|
17
|
-
@customElement('user-sign-up')
|
|
18
|
-
export class UserSignUp extends LitElement {
|
|
19
|
-
|
|
20
|
-
@state() private email = '';
|
|
21
|
-
@state() private password = '';
|
|
22
|
-
|
|
23
|
-
constructor() { super(); }
|
|
24
|
-
|
|
25
|
-
static get styles() { return [
|
|
26
|
-
listStyle,
|
|
27
|
-
labelStyle,
|
|
28
|
-
inputStyle,
|
|
29
|
-
buttonStyle,
|
|
30
|
-
toggleStyle,
|
|
31
|
-
css`
|
|
32
|
-
|
|
33
|
-
.double {
|
|
34
|
-
display: grid;
|
|
35
|
-
grid-template-columns: 1fr auto;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
`
|
|
39
|
-
] };
|
|
40
|
-
|
|
41
|
-
protected render() {
|
|
42
|
-
return html`
|
|
43
|
-
|
|
44
|
-
<!-- Sign Up State-->
|
|
45
|
-
<form
|
|
46
|
-
@submit=${this._handleSubmit}
|
|
47
|
-
autocomplete="on">
|
|
48
|
-
|
|
49
|
-
<ul>
|
|
50
|
-
|
|
51
|
-
<li>
|
|
52
|
-
<label for="pwa-signup-email">Email</label>
|
|
53
|
-
<input
|
|
54
|
-
id="pwa-signup-email"
|
|
55
|
-
type="email"
|
|
56
|
-
@change="${this.handleEmail}">
|
|
57
|
-
</li>
|
|
58
|
-
|
|
59
|
-
<!-- <label><input id="verifyEmail" type="email" >Verify Email</label> -->
|
|
60
|
-
|
|
61
|
-
<li>
|
|
62
|
-
<label for="pwa-signup-pass">Password</label>
|
|
63
|
-
<input
|
|
64
|
-
id="pwa-signup-pass"
|
|
65
|
-
type="password"
|
|
66
|
-
@change="${this.handlePassword}">
|
|
67
|
-
</li>
|
|
68
|
-
|
|
69
|
-
<li>
|
|
70
|
-
<button
|
|
71
|
-
class="newUser action-button"
|
|
72
|
-
@click="${this.signUp}">Sign up</button>
|
|
73
|
-
</li>
|
|
74
|
-
|
|
75
|
-
<!-- <label><input id="veriftPassword" type="password" >Verify Password</label> -->
|
|
76
|
-
|
|
77
|
-
<!-- Change State -->
|
|
78
|
-
<li>
|
|
79
|
-
<p class="divider">Or</p>
|
|
80
|
-
<button
|
|
81
|
-
class="new"
|
|
82
|
-
@click="${ this.change }">login with existing email</button>
|
|
83
|
-
</li>
|
|
84
|
-
|
|
85
|
-
</ul>
|
|
86
|
-
|
|
87
|
-
</form>
|
|
88
|
-
|
|
89
|
-
`;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
private change() {
|
|
93
|
-
store.dispatch(signUpAction());
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Form Default Behavior
|
|
97
|
-
private _handleSubmit(event: Event) {
|
|
98
|
-
event.preventDefault();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Sync Email
|
|
102
|
-
private handleEmail(event: Event) {
|
|
103
|
-
const input = event.target as HTMLInputElement;
|
|
104
|
-
this.email = input.value; // Update the property with the input value
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Sync Password
|
|
108
|
-
private handlePassword(event: Event) {
|
|
109
|
-
const input = event.target as HTMLInputElement;
|
|
110
|
-
this.password = input.value; // Update the property with the input value
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Sign Up Action
|
|
114
|
-
private signUp() {
|
|
115
|
-
if (this.email.length < 4) { alert('Please enter an email address.'); return; }
|
|
116
|
-
if (this.password.length < 4) { alert('Please enter a password.'); return; }
|
|
117
|
-
this.newAccount(this.email, this.password); // Sign UP with email and password.
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Create New Account using Email and Password
|
|
121
|
-
private newAccount = async (email:any, password:any) => {
|
|
122
|
-
|
|
123
|
-
await createUserWithEmailAndPassword(auth, email, password)
|
|
124
|
-
|
|
125
|
-
.then((userCredential) => {
|
|
126
|
-
|
|
127
|
-
// User created
|
|
128
|
-
const user = userCredential.user;
|
|
129
|
-
// Send email verification
|
|
130
|
-
sendEmailVerification(user)
|
|
131
|
-
.then(() => {
|
|
132
|
-
// Email verification sent
|
|
133
|
-
console.log("Verification email sent.");
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
}).then( () => { logAccount(); } );
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
/* To Do: Integration
|
|
142
|
-
|
|
143
|
-
// Google Tag Manager Conversion - Integrateion
|
|
144
|
-
private gtag_report_conversion = async () => {
|
|
145
|
-
|
|
146
|
-
// @ts-ignore
|
|
147
|
-
gtag('event', 'conversion', {'send_to': 'AW-/'});
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
declare global {
|
|
156
|
-
interface HTMLElementTagNameMap {
|
|
157
|
-
'user-sign-up': UserSignUp;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
|
|
3
|
-
export const iconStyles = css`
|
|
4
|
-
|
|
5
|
-
:host {
|
|
6
|
-
margin: auto;
|
|
7
|
-
display: grid;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/* Shared Styles */
|
|
11
|
-
.icon, .login {
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
margin: auto;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
border: var(--pwa_icon_border, 2px solid black);
|
|
16
|
-
background-color: var(--pwa_icon_background, #6cc04a);
|
|
17
|
-
color: white;
|
|
18
|
-
font-size: 15px;
|
|
19
|
-
text-decoration: none;
|
|
20
|
-
transition-duration: 2s;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/* Hover Styles */
|
|
24
|
-
.icon:hover,
|
|
25
|
-
.login:hover {
|
|
26
|
-
background-color: var(--pwa_icon_hover, lightgrey);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/* Logged-in State: The Icon Button */
|
|
30
|
-
.icon {
|
|
31
|
-
height: var(--pwa_icon_diameter, 32px);
|
|
32
|
-
width: var(--pwa_icon_diameter, 32px);
|
|
33
|
-
border-radius: 50%;
|
|
34
|
-
padding: 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* The Login Button */
|
|
38
|
-
.login {
|
|
39
|
-
width: auto;
|
|
40
|
-
border-radius: var(--pwa_icon_radius, 6px);
|
|
41
|
-
height: var(--pwa_icon_height, 32px);
|
|
42
|
-
padding: var(--pwa_icon_padding, 0px 16px);
|
|
43
|
-
font-family: var(--pwa_icon_font, 'Arial', sans-serif);
|
|
44
|
-
font-weight: 500;
|
|
45
|
-
text-align: center;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* Icon Artwork */
|
|
49
|
-
.userImage {
|
|
50
|
-
object-fit: cover;
|
|
51
|
-
transition-property: all;
|
|
52
|
-
transition-duration: 2s;
|
|
53
|
-
clip-path: circle(50%);
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
width: calc(var(--pwa_icon_diameter, 32px) - 2px);
|
|
56
|
-
height: calc(var(--pwa_icon_diameter, 32px) - 2px);
|
|
57
|
-
margin: auto;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
`;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { CSSResultArray, html, LitElement } from 'lit';
|
|
2
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
3
|
-
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
4
|
-
import { store, AppState } from '../../store';
|
|
5
|
-
import { iconStyles } from './css/icon';
|
|
6
|
-
import { toggleSign } from '../../redux/frontend';
|
|
7
|
-
// import { faceIcon } from '../../css/svg';
|
|
8
|
-
|
|
9
|
-
@customElement('user-icon')
|
|
10
|
-
export class UserIcon extends connect(store)(LitElement) {
|
|
11
|
-
|
|
12
|
-
/** @attr subscribe */
|
|
13
|
-
@property({type: Boolean, reflect: true}) public subscribe = false;
|
|
14
|
-
|
|
15
|
-
/** @attr emptyArtwork */
|
|
16
|
-
@property({type: String, reflect: true}) public emptyArtwork = '';
|
|
17
|
-
|
|
18
|
-
@state() private _user = false;
|
|
19
|
-
@state() private _photoURL = '';
|
|
20
|
-
// @state() private _sign = false;
|
|
21
|
-
|
|
22
|
-
constructor() { super(); }
|
|
23
|
-
|
|
24
|
-
protected firstUpdated() {
|
|
25
|
-
this.shadowRoot!.querySelector('.toggles')!.addEventListener('click', () => {
|
|
26
|
-
// console.log('logged-in: ',this._user);
|
|
27
|
-
store.dispatch(toggleSign());
|
|
28
|
-
console.log('here');
|
|
29
|
-
} );
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
stateChanged(state: AppState) {
|
|
33
|
-
this._user = state.frontend!.login;
|
|
34
|
-
this._photoURL = state.backend!.photoURL;
|
|
35
|
-
// this._sign = state.frontend!.register;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static get styles():CSSResultArray { return [ iconStyles ] }
|
|
39
|
-
|
|
40
|
-
protected render() {
|
|
41
|
-
return html`
|
|
42
|
-
|
|
43
|
-
<!-- two classes: icon / login -->
|
|
44
|
-
<button
|
|
45
|
-
class="${this._user ? 'icon' : 'login'} toggles"
|
|
46
|
-
aria-label="login">
|
|
47
|
-
|
|
48
|
-
${ this._user ? html`
|
|
49
|
-
<!-- <div
|
|
50
|
-
class = "iconArea"> -->
|
|
51
|
-
<input
|
|
52
|
-
type = "image"
|
|
53
|
-
class = "userImage"
|
|
54
|
-
alt = "Login"
|
|
55
|
-
height = "38px"
|
|
56
|
-
width = "38px"
|
|
57
|
-
src = "${this._photoURL ? this._photoURL : this.emptyArtwork}">
|
|
58
|
-
<!-- </div> -->
|
|
59
|
-
` : this.subscribe ? 'Subscribe' : 'Login' }
|
|
60
|
-
|
|
61
|
-
</button>
|
|
62
|
-
|
|
63
|
-
`;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
declare global {
|
|
68
|
-
interface HTMLElementTagNameMap {
|
|
69
|
-
'user-icon': UserIcon;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
|
|
3
|
-
export const navigation = css`
|
|
4
|
-
|
|
5
|
-
nav { overflow: hidden; }
|
|
6
|
-
|
|
7
|
-
/* Navigation Menu */
|
|
8
|
-
nav > ul {
|
|
9
|
-
|
|
10
|
-
list-style-type: none;
|
|
11
|
-
margin: 0px;
|
|
12
|
-
padding: 0px;
|
|
13
|
-
display: grid;
|
|
14
|
-
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
15
|
-
grid-gap: 8px;
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/* Navigation Button */
|
|
20
|
-
nav > ul > li > button {
|
|
21
|
-
|
|
22
|
-
color: var(--pwa_nav_button, grey);
|
|
23
|
-
border: 0;
|
|
24
|
-
width: 100%;
|
|
25
|
-
height: 36px;
|
|
26
|
-
margin: auto;
|
|
27
|
-
padding: 0px;
|
|
28
|
-
font-weight: 800;
|
|
29
|
-
font-size: .8em;
|
|
30
|
-
border-radius: 5px;
|
|
31
|
-
background-color: transparent;
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/* Navigation Button - Active */
|
|
36
|
-
nav > ul > li > button[on] {
|
|
37
|
-
|
|
38
|
-
color: var(--pwa_nav_select, black);
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/* Navigation Button - Hover */
|
|
43
|
-
nav > ul > li > button:hover {
|
|
44
|
-
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
section[on] { display: grid; }
|
|
50
|
-
section { display: none; }
|
|
51
|
-
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/* Navigation Button - Media Text Justification
|
|
56
|
-
@media (max-width: 460px) {
|
|
57
|
-
|
|
58
|
-
button[value=profile], button[value=email] { text-align: left; }
|
|
59
|
-
button[value=delete], button[value=password] { text-align: right; }
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.formTitle {
|
|
64
|
-
display: grid;
|
|
65
|
-
grid-auto-flow: column;
|
|
66
|
-
grid-gap: 8px;
|
|
67
|
-
grid-template-columns: min-content;
|
|
68
|
-
}*/
|
|
69
|
-
|
|
70
|
-
/* Uploader - Page Border Divider
|
|
71
|
-
.profile {
|
|
72
|
-
width: 200px;
|
|
73
|
-
margin: auto;
|
|
74
|
-
}*/
|
|
75
|
-
|
|
76
|
-
/* Uploader - Display Photo
|
|
77
|
-
.userImage {
|
|
78
|
-
border-radius: 50%;
|
|
79
|
-
overflow: hidden;
|
|
80
|
-
margin: auto;
|
|
81
|
-
border: 2px solid #303030;
|
|
82
|
-
box-shadow: 1px 1px 2px black, 0 0 25px grey, 0 0 5px #fff;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/* Uploader - button Visual Indicator Outline
|
|
86
|
-
button:focus { outline: none; }
|
|
87
|
-
|
|
88
|
-
/* Uploader -
|
|
89
|
-
.file-container { }
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*/
|