pwa-auth 3.3.3 → 3.3.5
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/LICENSES.txt +5 -5
- package/README.md +34 -20
- package/base/export/pwa-auth.d.ts +6 -6
- package/base/export/pwa-auth.js +6 -6
- package/base/firebase/authentication.d.ts +10 -10
- package/base/firebase/authentication.js +10 -10
- package/base/firebase/interface.d.ts +4 -4
- package/base/firebase/interface.js +79 -79
- package/base/firebase/interface.js.map +1 -1
- package/base/lazy-loader.d.ts +11 -11
- package/base/lazy-loader.js +22 -22
- package/base/lazy-loader.js.map +1 -1
- package/base/redux/backend.d.ts +113 -122
- package/base/redux/backend.js +43 -43
- package/base/redux/drawer.d.ts +17 -19
- package/base/redux/drawer.js +21 -21
- package/base/redux/drawer.js.map +1 -1
- package/base/redux/frontend.d.ts +185 -198
- package/base/redux/frontend.js +86 -86
- package/base/redux/frontend.js.map +1 -1
- package/base/store.d.ts +62 -62
- package/base/store.js +13 -13
- package/base/webcomponents/css/animation.d.ts +2 -2
- package/base/webcomponents/css/animation.js +2 -2
- package/base/webcomponents/css/svg.d.ts +3 -3
- package/base/webcomponents/css/svg.js +4 -4
- package/base/webcomponents/css/toggle.d.ts +1 -1
- package/base/webcomponents/css/toggle.js +2 -2
- package/base/webcomponents/drawer/css/drawer.d.ts +2 -2
- package/base/webcomponents/drawer/css/drawer.js +2 -2
- package/base/webcomponents/drawer/css/exit.d.ts +2 -2
- package/base/webcomponents/drawer/css/exit.js +2 -2
- package/base/webcomponents/drawer/css/link.d.ts +2 -2
- package/base/webcomponents/drawer/css/link.js +2 -2
- package/base/webcomponents/drawer/css/paragraph.d.ts +2 -2
- package/base/webcomponents/drawer/css/paragraph.js +2 -2
- package/base/webcomponents/drawer/drawer.d.ts +58 -58
- package/base/webcomponents/drawer/drawer.js +100 -100
- package/base/webcomponents/drawer/drawer.js.map +1 -1
- package/base/webcomponents/form/css/button.d.ts +2 -2
- package/base/webcomponents/form/css/button.js +2 -2
- package/base/webcomponents/form/css/input.d.ts +2 -2
- package/base/webcomponents/form/css/input.js +2 -2
- package/base/webcomponents/form/css/label.d.ts +2 -2
- package/base/webcomponents/form/css/label.js +2 -2
- package/base/webcomponents/form/css/list.d.ts +2 -2
- package/base/webcomponents/form/css/list.js +2 -2
- package/base/webcomponents/form/css/toggle.d.ts +2 -2
- package/base/webcomponents/form/css/toggle.js +2 -2
- package/base/webcomponents/form/forgot.d.ts +15 -15
- package/base/webcomponents/form/forgot.js +45 -45
- package/base/webcomponents/form/forgot.js.map +1 -1
- package/base/webcomponents/form/login.d.ts +20 -20
- package/base/webcomponents/form/login.js +88 -88
- package/base/webcomponents/form/login.js.map +1 -1
- package/base/webcomponents/form/signup.d.ts +20 -20
- package/base/webcomponents/form/signup.js +95 -95
- package/base/webcomponents/form/signup.js.map +1 -1
- package/base/webcomponents/icon/css/icon.d.ts +1 -1
- package/base/webcomponents/icon/css/icon.js +2 -2
- package/base/webcomponents/icon/icon.d.ts +54 -54
- package/base/webcomponents/icon/icon.js +59 -59
- package/base/webcomponents/icon/icon.js.map +1 -1
- package/base/webcomponents/login/css/auth.d.ts +2 -2
- package/base/webcomponents/login/css/auth.js +2 -2
- package/base/webcomponents/login/css/link.d.ts +2 -2
- package/base/webcomponents/login/css/link.js +2 -2
- package/base/webcomponents/login/css/paragraph.d.ts +2 -2
- package/base/webcomponents/login/css/paragraph.js +2 -2
- package/base/webcomponents/login/page.d.ts +55 -55
- package/base/webcomponents/login/page.js +71 -71
- package/base/webcomponents/login/page.js.map +1 -1
- package/base/webcomponents/settings/css/navigation.d.ts +1 -1
- package/base/webcomponents/settings/css/navigation.js +2 -2
- package/base/webcomponents/settings/input/delete.d.ts +55 -55
- package/base/webcomponents/settings/input/delete.js +73 -73
- package/base/webcomponents/settings/input/delete.js.map +1 -1
- package/base/webcomponents/settings/input/email.d.ts +55 -55
- package/base/webcomponents/settings/input/email.js +72 -72
- package/base/webcomponents/settings/input/email.js.map +1 -1
- package/base/webcomponents/settings/input/name.d.ts +54 -54
- package/base/webcomponents/settings/input/name.js +67 -67
- package/base/webcomponents/settings/input/name.js.map +1 -1
- package/base/webcomponents/settings/input/password.d.ts +57 -57
- package/base/webcomponents/settings/input/password.js +97 -97
- package/base/webcomponents/settings/input/password.js.map +1 -1
- package/base/webcomponents/settings/input/uploader.d.ts +58 -58
- package/base/webcomponents/settings/input/uploader.js +150 -150
- package/base/webcomponents/settings/input/uploader.js.map +1 -1
- package/base/webcomponents/settings/settings.d.ts +58 -58
- package/base/webcomponents/settings/settings.js +80 -80
- package/base/webcomponents/settings/settings.js.map +1 -1
- package/package.json +33 -39
- package/source/{development/pwa-auth.js → pwa-auth.js} +30 -31
- package/source/development/pwa-auth.js.map +0 -1
- package/source/esm/pwa-auth.js +0 -1109
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { LitElement, css, html } from "lit";
|
|
11
|
-
import { state } from "lit/decorators.js";
|
|
12
|
-
import { connect } from "pwa-helpers";
|
|
13
|
-
import store from "../../../store";
|
|
14
|
-
import { auth } from "../../../firebase/authentication";
|
|
15
|
-
import { labelStyle } from "../../form/css/label";
|
|
16
|
-
import { inputStyle } from "../../form/css/input";
|
|
17
|
-
import { buttonStyle } from "../../form/css/button";
|
|
18
|
-
import { updatePassword } from "firebase/auth";
|
|
19
|
-
export class InputPassword extends connect(store)(LitElement) {
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
this.message = '';
|
|
23
|
-
this.password = '';
|
|
24
|
-
this.login = false;
|
|
25
|
-
this.default = (e) => {
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
};
|
|
28
|
-
this.updatePass = async (newPassword) => {
|
|
29
|
-
if (auth.currentUser) {
|
|
30
|
-
await updatePassword(auth.currentUser, newPassword)
|
|
31
|
-
.then(() => { console.log("Password successful!"); })
|
|
32
|
-
.catch((error) => { console.log("Problem: " + error.messge); });
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
alert('Please Login');
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
firstUpdated() {
|
|
40
|
-
this.shadowRoot.querySelector('.pass').addEventListener('click', () => {
|
|
41
|
-
this.alertPassword();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
stateChanged(state) {
|
|
45
|
-
this.login = state.frontend.login;
|
|
46
|
-
}
|
|
47
|
-
handleInputChange(event) {
|
|
48
|
-
const input = event.target;
|
|
49
|
-
this.password = input.value;
|
|
50
|
-
}
|
|
51
|
-
static get styles() {
|
|
52
|
-
return [
|
|
53
|
-
labelStyle,
|
|
54
|
-
inputStyle,
|
|
55
|
-
buttonStyle,
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { LitElement, css, html } from "lit";
|
|
11
|
+
import { state } from "lit/decorators.js";
|
|
12
|
+
import { connect } from "pwa-helpers";
|
|
13
|
+
import store from "../../../store";
|
|
14
|
+
import { auth } from "../../../firebase/authentication";
|
|
15
|
+
import { labelStyle } from "../../form/css/label";
|
|
16
|
+
import { inputStyle } from "../../form/css/input";
|
|
17
|
+
import { buttonStyle } from "../../form/css/button";
|
|
18
|
+
import { updatePassword } from "firebase/auth";
|
|
19
|
+
export class InputPassword extends connect(store)(LitElement) {
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.message = '';
|
|
23
|
+
this.password = '';
|
|
24
|
+
this.login = false;
|
|
25
|
+
this.default = (e) => {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
};
|
|
28
|
+
this.updatePass = async (newPassword) => {
|
|
29
|
+
if (auth.currentUser) {
|
|
30
|
+
await updatePassword(auth.currentUser, newPassword)
|
|
31
|
+
.then(() => { console.log("Password successful!"); })
|
|
32
|
+
.catch((error) => { console.log("Problem: " + error.messge); });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
alert('Please Login');
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
firstUpdated() {
|
|
40
|
+
this.shadowRoot.querySelector('.pass').addEventListener('click', () => {
|
|
41
|
+
this.alertPassword();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
stateChanged(state) {
|
|
45
|
+
this.login = state.frontend.login;
|
|
46
|
+
}
|
|
47
|
+
handleInputChange(event) {
|
|
48
|
+
const input = event.target;
|
|
49
|
+
this.password = input.value;
|
|
50
|
+
}
|
|
51
|
+
static get styles() {
|
|
52
|
+
return [
|
|
53
|
+
labelStyle,
|
|
54
|
+
inputStyle,
|
|
55
|
+
buttonStyle,
|
|
56
56
|
css `
|
|
57
57
|
|
|
58
58
|
:host{
|
|
@@ -63,10 +63,10 @@ export class InputPassword extends connect(store)(LitElement) {
|
|
|
63
63
|
|
|
64
64
|
p.error { color: red; }
|
|
65
65
|
|
|
66
|
-
`
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
render() {
|
|
66
|
+
`
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
render() {
|
|
70
70
|
return html `
|
|
71
71
|
|
|
72
72
|
<form
|
|
@@ -123,42 +123,42 @@ export class InputPassword extends connect(store)(LitElement) {
|
|
|
123
123
|
|
|
124
124
|
</form>
|
|
125
125
|
|
|
126
|
-
`;
|
|
127
|
-
}
|
|
128
|
-
alertPassword() {
|
|
129
|
-
if (!this.password) {
|
|
130
|
-
this.message = 'Please enter a password';
|
|
131
|
-
}
|
|
132
|
-
else if (this.password.length < 8) {
|
|
133
|
-
this.message = 'Password must be at least 8 characters long';
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
this.message = `Password entered:`;
|
|
137
|
-
if (!/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/.test(this.password)) {
|
|
138
|
-
this.message = 'Password must include letters, numbers, and be 8+ characters';
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
if (auth.currentUser) {
|
|
142
|
-
this.updatePass(this.password);
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
alert('Please Login');
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
__decorate([
|
|
152
|
-
state(),
|
|
153
|
-
__metadata("design:type", String)
|
|
154
|
-
], InputPassword.prototype, "message", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
state(),
|
|
157
|
-
__metadata("design:type", String)
|
|
158
|
-
], InputPassword.prototype, "password", void 0);
|
|
159
|
-
__decorate([
|
|
160
|
-
state(),
|
|
161
|
-
__metadata("design:type", Boolean)
|
|
162
|
-
], InputPassword.prototype, "login", void 0);
|
|
163
|
-
customElements.define('input-password', InputPassword);
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
alertPassword() {
|
|
129
|
+
if (!this.password) {
|
|
130
|
+
this.message = 'Please enter a password';
|
|
131
|
+
}
|
|
132
|
+
else if (this.password.length < 8) {
|
|
133
|
+
this.message = 'Password must be at least 8 characters long';
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
this.message = `Password entered:`;
|
|
137
|
+
if (!/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/.test(this.password)) {
|
|
138
|
+
this.message = 'Password must include letters, numbers, and be 8+ characters';
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
if (auth.currentUser) {
|
|
142
|
+
this.updatePass(this.password);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
alert('Please Login');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
__decorate([
|
|
152
|
+
state(),
|
|
153
|
+
__metadata("design:type", String)
|
|
154
|
+
], InputPassword.prototype, "message", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
state(),
|
|
157
|
+
__metadata("design:type", String)
|
|
158
|
+
], InputPassword.prototype, "password", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
state(),
|
|
161
|
+
__metadata("design:type", Boolean)
|
|
162
|
+
], InputPassword.prototype, "login", void 0);
|
|
163
|
+
customElements.define('input-password', InputPassword);
|
|
164
164
|
//# sourceMappingURL=password.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password.js","sourceRoot":"","sources":["../../../../typescript/webcomponents/settings/input/password.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAkB,UAAU,EAAE,GAAG,EAA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M,CAAC;oBAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAAC,CAAC;qBACnC,CAAC;oBAAC,KAAK,CAAC,cAAc,CAAC,CAAC;gBAAC,CAAC;YAEtD,CAAC;QAEH,CAAC;IAEH,CAAC;CAgBF;AA9IkB;IAAhB,KAAK,EAAE;;8CAAqC;AAC5B;IAAhB,KAAK,EAAE;;+CAAqC;AAC5B;IAAhB,KAAK,EAAE;;4CAAwC;AA8IlD,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC"}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { LitElement, CSSResultArray } from 'lit';
|
|
2
|
-
import { AppState } from '../../../store';
|
|
3
|
-
declare const ContactPhoto_base: (new (...args: any[]) => {
|
|
4
|
-
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
5
|
-
connectedCallback(): void;
|
|
6
|
-
disconnectedCallback(): void;
|
|
7
|
-
stateChanged(_state: {
|
|
8
|
-
frontend: {
|
|
9
|
-
settings: string;
|
|
10
|
-
login: boolean;
|
|
11
|
-
drawer: boolean;
|
|
12
|
-
registerOne: boolean;
|
|
13
|
-
registerTwo: boolean;
|
|
14
|
-
userId: string;
|
|
15
|
-
customer: string;
|
|
16
|
-
profileChoice: string;
|
|
17
|
-
name: string;
|
|
18
|
-
photoURL: string;
|
|
19
|
-
phone: string;
|
|
20
|
-
email: string;
|
|
21
|
-
};
|
|
22
|
-
drawer: {
|
|
23
|
-
drawer: boolean;
|
|
24
|
-
};
|
|
25
|
-
backend: {
|
|
26
|
-
verified: boolean;
|
|
27
|
-
anon: boolean;
|
|
28
|
-
userId: string;
|
|
29
|
-
name: string;
|
|
30
|
-
email: string;
|
|
31
|
-
photoURL: string;
|
|
32
|
-
phone: string;
|
|
33
|
-
msgToken: string;
|
|
34
|
-
};
|
|
35
|
-
}): void;
|
|
36
|
-
readonly isConnected: boolean;
|
|
37
|
-
}) & typeof LitElement;
|
|
38
|
-
export declare class ContactPhoto extends ContactPhoto_base {
|
|
39
|
-
photo: string | void | any;
|
|
40
|
-
emptyArtwork: string;
|
|
41
|
-
private user;
|
|
42
|
-
private login;
|
|
43
|
-
private progress;
|
|
44
|
-
private error;
|
|
45
|
-
private status;
|
|
46
|
-
constructor();
|
|
47
|
-
stateChanged(state: AppState): void;
|
|
48
|
-
static get styles(): CSSResultArray;
|
|
49
|
-
protected render(): import("lit-html").TemplateResult<1>;
|
|
50
|
-
private saveImage;
|
|
51
|
-
private dispatchPhoto;
|
|
52
|
-
}
|
|
53
|
-
declare global {
|
|
54
|
-
interface HTMLElementTagNameMap {
|
|
55
|
-
'contact-photo': ContactPhoto;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
export {};
|
|
1
|
+
import { LitElement, CSSResultArray } from 'lit';
|
|
2
|
+
import { AppState } from '../../../store';
|
|
3
|
+
declare const ContactPhoto_base: (new (...args: any[]) => {
|
|
4
|
+
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
stateChanged(_state: {
|
|
8
|
+
frontend: {
|
|
9
|
+
settings: string;
|
|
10
|
+
login: boolean;
|
|
11
|
+
drawer: boolean;
|
|
12
|
+
registerOne: boolean;
|
|
13
|
+
registerTwo: boolean;
|
|
14
|
+
userId: string;
|
|
15
|
+
customer: string;
|
|
16
|
+
profileChoice: string;
|
|
17
|
+
name: string;
|
|
18
|
+
photoURL: string;
|
|
19
|
+
phone: string;
|
|
20
|
+
email: string;
|
|
21
|
+
};
|
|
22
|
+
drawer: {
|
|
23
|
+
drawer: boolean;
|
|
24
|
+
};
|
|
25
|
+
backend: {
|
|
26
|
+
verified: boolean;
|
|
27
|
+
anon: boolean;
|
|
28
|
+
userId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
email: string;
|
|
31
|
+
photoURL: string;
|
|
32
|
+
phone: string;
|
|
33
|
+
msgToken: string;
|
|
34
|
+
};
|
|
35
|
+
}): void;
|
|
36
|
+
readonly isConnected: boolean;
|
|
37
|
+
}) & typeof LitElement;
|
|
38
|
+
export declare class ContactPhoto extends ContactPhoto_base {
|
|
39
|
+
photo: string | void | any;
|
|
40
|
+
emptyArtwork: string;
|
|
41
|
+
private user;
|
|
42
|
+
private login;
|
|
43
|
+
private progress;
|
|
44
|
+
private error;
|
|
45
|
+
private status;
|
|
46
|
+
constructor();
|
|
47
|
+
stateChanged(state: AppState): void;
|
|
48
|
+
static get styles(): CSSResultArray;
|
|
49
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
50
|
+
private saveImage;
|
|
51
|
+
private dispatchPhoto;
|
|
52
|
+
}
|
|
53
|
+
declare global {
|
|
54
|
+
interface HTMLElementTagNameMap {
|
|
55
|
+
'contact-photo': ContactPhoto;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { html, css, LitElement } from 'lit';
|
|
11
|
-
import { property, state } from 'lit/decorators.js';
|
|
12
|
-
import { store } from '../../../store';
|
|
13
|
-
import { connect } from 'pwa-helpers';
|
|
14
|
-
import { auth, storage, user } from '../../../firebase/authentication';
|
|
15
|
-
import { updateProfile } from 'firebase/auth';
|
|
16
|
-
import { accImage } from '../../../redux/backend';
|
|
17
|
-
import { ref, updateMetadata, getDownloadURL, uploadBytesResumable } from "@firebase/storage";
|
|
18
|
-
import { labelStyle } from '../../form/css/label';
|
|
19
|
-
export class ContactPhoto extends connect(store)(LitElement) {
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
this.photo = '';
|
|
23
|
-
this.emptyArtwork = '';
|
|
24
|
-
this.user = '';
|
|
25
|
-
this.login = false;
|
|
26
|
-
this.progress = 0;
|
|
27
|
-
this.error = '';
|
|
28
|
-
this.status = '';
|
|
29
|
-
this.dispatchPhoto = async (url) => {
|
|
30
|
-
if (auth.currentUser) {
|
|
31
|
-
await updateProfile(auth.currentUser, { photoURL: url }).catch((error) => { console.log(error); });
|
|
32
|
-
store.dispatch(accImage(url));
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
this.progress = 0;
|
|
36
|
-
this.error = '';
|
|
37
|
-
this.status = '';
|
|
38
|
-
}
|
|
39
|
-
stateChanged(state) {
|
|
40
|
-
this.login = state.frontend.login;
|
|
41
|
-
this.user = state.backend.userId;
|
|
42
|
-
this.photo = state.backend.photoURL;
|
|
43
|
-
}
|
|
44
|
-
static get styles() {
|
|
45
|
-
return [
|
|
46
|
-
labelStyle,
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { html, css, LitElement } from 'lit';
|
|
11
|
+
import { property, state } from 'lit/decorators.js';
|
|
12
|
+
import { store } from '../../../store';
|
|
13
|
+
import { connect } from 'pwa-helpers';
|
|
14
|
+
import { auth, storage, user } from '../../../firebase/authentication';
|
|
15
|
+
import { updateProfile } from 'firebase/auth';
|
|
16
|
+
import { accImage } from '../../../redux/backend';
|
|
17
|
+
import { ref, updateMetadata, getDownloadURL, uploadBytesResumable } from "@firebase/storage";
|
|
18
|
+
import { labelStyle } from '../../form/css/label';
|
|
19
|
+
export class ContactPhoto extends connect(store)(LitElement) {
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.photo = '';
|
|
23
|
+
this.emptyArtwork = '';
|
|
24
|
+
this.user = '';
|
|
25
|
+
this.login = false;
|
|
26
|
+
this.progress = 0;
|
|
27
|
+
this.error = '';
|
|
28
|
+
this.status = '';
|
|
29
|
+
this.dispatchPhoto = async (url) => {
|
|
30
|
+
if (auth.currentUser) {
|
|
31
|
+
await updateProfile(auth.currentUser, { photoURL: url }).catch((error) => { console.log(error); });
|
|
32
|
+
store.dispatch(accImage(url));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
this.progress = 0;
|
|
36
|
+
this.error = '';
|
|
37
|
+
this.status = '';
|
|
38
|
+
}
|
|
39
|
+
stateChanged(state) {
|
|
40
|
+
this.login = state.frontend.login;
|
|
41
|
+
this.user = state.backend.userId;
|
|
42
|
+
this.photo = state.backend.photoURL;
|
|
43
|
+
}
|
|
44
|
+
static get styles() {
|
|
45
|
+
return [
|
|
46
|
+
labelStyle,
|
|
47
47
|
css `
|
|
48
48
|
|
|
49
49
|
:host {
|
|
@@ -63,10 +63,10 @@ export class ContactPhoto extends connect(store)(LitElement) {
|
|
|
63
63
|
box-shadow: 1px 1px 2px black, 0 0 25px grey, 0 0 5px #fff;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
`
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
render() {
|
|
66
|
+
`
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
render() {
|
|
70
70
|
return html `
|
|
71
71
|
<label
|
|
72
72
|
for="pwa-uploader"
|
|
@@ -133,104 +133,104 @@ export class ContactPhoto extends connect(store)(LitElement) {
|
|
|
133
133
|
</label>
|
|
134
134
|
|
|
135
135
|
<p style="text-align:center;">${this.status}${this.error}</p>
|
|
136
|
-
`;
|
|
137
|
-
}
|
|
138
|
-
async saveImage() {
|
|
139
|
-
const uploader = this.shadowRoot.querySelector('.uploader');
|
|
140
|
-
if (auth.currentUser) {
|
|
141
|
-
this.error = '';
|
|
142
|
-
this.status = 'Uploading...';
|
|
143
|
-
const file = this.shadowRoot.querySelector('#photoURL');
|
|
144
|
-
if (!file) {
|
|
145
|
-
console.error('No file selected');
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const location = ref(storage, "/" +
|
|
149
|
-
"pwa-auth" +
|
|
150
|
-
"/" +
|
|
151
|
-
this.user +
|
|
152
|
-
"/" +
|
|
153
|
-
file.files[0].name);
|
|
154
|
-
const newMetadata = {
|
|
155
|
-
cacheControl: 'public,max-age=300',
|
|
156
|
-
contentType: file.files[0].type
|
|
157
|
-
};
|
|
158
|
-
const uploadTask = uploadBytesResumable(location, file.files[0], newMetadata);
|
|
159
|
-
uploadTask.on('state_changed', (snapshot) => {
|
|
160
|
-
this.progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
|
161
|
-
this.status = `Upload is ${Math.round(this.progress)}% done`;
|
|
162
|
-
switch (snapshot.state) {
|
|
163
|
-
case 'paused':
|
|
164
|
-
this.status = 'Upload is paused';
|
|
165
|
-
break;
|
|
166
|
-
case 'running':
|
|
167
|
-
this.status = `Upload is running (${Math.round(this.progress)}%)`;
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
let progress = 0;
|
|
171
|
-
if (snapshot.totalBytes > 0) {
|
|
172
|
-
progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
|
173
|
-
}
|
|
174
|
-
if (isFinite(progress)) {
|
|
175
|
-
uploader.value = progress;
|
|
176
|
-
uploader.textContent = `${Math.round(progress)}%`;
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
uploader.value = 0;
|
|
180
|
-
uploader.textContent = '0%';
|
|
181
|
-
}
|
|
182
|
-
}, (error) => {
|
|
183
|
-
this.error = `Upload failed: ${error.message}`;
|
|
184
|
-
this.status = '';
|
|
185
|
-
console.error('Upload failed:', error);
|
|
186
|
-
uploader.value = 0;
|
|
187
|
-
uploader.textContent = 'Error';
|
|
188
|
-
}, async () => {
|
|
189
|
-
await getDownloadURL(uploadTask.snapshot.ref)
|
|
190
|
-
.then((url) => {
|
|
191
|
-
updateMetadata(location, newMetadata)
|
|
192
|
-
.then(() => { }).catch((error) => { console.log("error: ", error); });
|
|
193
|
-
if (user) {
|
|
194
|
-
updateProfile(user, { photoURL: url })
|
|
195
|
-
.then(() => {
|
|
196
|
-
uploader.value = 100;
|
|
197
|
-
uploader.textContent = 'Complete';
|
|
198
|
-
});
|
|
199
|
-
this.status = 'User profile updated successfully!';
|
|
200
|
-
this.dispatchPhoto(url);
|
|
201
|
-
}
|
|
202
|
-
}).catch(() => { });
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
__decorate([
|
|
208
|
-
property(),
|
|
209
|
-
__metadata("design:type", Object)
|
|
210
|
-
], ContactPhoto.prototype, "photo", void 0);
|
|
211
|
-
__decorate([
|
|
212
|
-
property({ type: String, reflect: true }),
|
|
213
|
-
__metadata("design:type", Object)
|
|
214
|
-
], ContactPhoto.prototype, "emptyArtwork", void 0);
|
|
215
|
-
__decorate([
|
|
216
|
-
state(),
|
|
217
|
-
__metadata("design:type", Object)
|
|
218
|
-
], ContactPhoto.prototype, "user", void 0);
|
|
219
|
-
__decorate([
|
|
220
|
-
state(),
|
|
221
|
-
__metadata("design:type", Boolean)
|
|
222
|
-
], ContactPhoto.prototype, "login", void 0);
|
|
223
|
-
__decorate([
|
|
224
|
-
state(),
|
|
225
|
-
__metadata("design:type", Number)
|
|
226
|
-
], ContactPhoto.prototype, "progress", void 0);
|
|
227
|
-
__decorate([
|
|
228
|
-
state(),
|
|
229
|
-
__metadata("design:type", String)
|
|
230
|
-
], ContactPhoto.prototype, "error", void 0);
|
|
231
|
-
__decorate([
|
|
232
|
-
state(),
|
|
233
|
-
__metadata("design:type", String)
|
|
234
|
-
], ContactPhoto.prototype, "status", void 0);
|
|
235
|
-
customElements.define('contact-photo', ContactPhoto);
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
async saveImage() {
|
|
139
|
+
const uploader = this.shadowRoot.querySelector('.uploader');
|
|
140
|
+
if (auth.currentUser) {
|
|
141
|
+
this.error = '';
|
|
142
|
+
this.status = 'Uploading...';
|
|
143
|
+
const file = this.shadowRoot.querySelector('#photoURL');
|
|
144
|
+
if (!file) {
|
|
145
|
+
console.error('No file selected');
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const location = ref(storage, "/" +
|
|
149
|
+
"pwa-auth" +
|
|
150
|
+
"/" +
|
|
151
|
+
this.user +
|
|
152
|
+
"/" +
|
|
153
|
+
file.files[0].name);
|
|
154
|
+
const newMetadata = {
|
|
155
|
+
cacheControl: 'public,max-age=300',
|
|
156
|
+
contentType: file.files[0].type
|
|
157
|
+
};
|
|
158
|
+
const uploadTask = uploadBytesResumable(location, file.files[0], newMetadata);
|
|
159
|
+
uploadTask.on('state_changed', (snapshot) => {
|
|
160
|
+
this.progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
|
161
|
+
this.status = `Upload is ${Math.round(this.progress)}% done`;
|
|
162
|
+
switch (snapshot.state) {
|
|
163
|
+
case 'paused':
|
|
164
|
+
this.status = 'Upload is paused';
|
|
165
|
+
break;
|
|
166
|
+
case 'running':
|
|
167
|
+
this.status = `Upload is running (${Math.round(this.progress)}%)`;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
let progress = 0;
|
|
171
|
+
if (snapshot.totalBytes > 0) {
|
|
172
|
+
progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
|
173
|
+
}
|
|
174
|
+
if (isFinite(progress)) {
|
|
175
|
+
uploader.value = progress;
|
|
176
|
+
uploader.textContent = `${Math.round(progress)}%`;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
uploader.value = 0;
|
|
180
|
+
uploader.textContent = '0%';
|
|
181
|
+
}
|
|
182
|
+
}, (error) => {
|
|
183
|
+
this.error = `Upload failed: ${error.message}`;
|
|
184
|
+
this.status = '';
|
|
185
|
+
console.error('Upload failed:', error);
|
|
186
|
+
uploader.value = 0;
|
|
187
|
+
uploader.textContent = 'Error';
|
|
188
|
+
}, async () => {
|
|
189
|
+
await getDownloadURL(uploadTask.snapshot.ref)
|
|
190
|
+
.then((url) => {
|
|
191
|
+
updateMetadata(location, newMetadata)
|
|
192
|
+
.then(() => { }).catch((error) => { console.log("error: ", error); });
|
|
193
|
+
if (user) {
|
|
194
|
+
updateProfile(user, { photoURL: url })
|
|
195
|
+
.then(() => {
|
|
196
|
+
uploader.value = 100;
|
|
197
|
+
uploader.textContent = 'Complete';
|
|
198
|
+
});
|
|
199
|
+
this.status = 'User profile updated successfully!';
|
|
200
|
+
this.dispatchPhoto(url);
|
|
201
|
+
}
|
|
202
|
+
}).catch(() => { });
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
__decorate([
|
|
208
|
+
property(),
|
|
209
|
+
__metadata("design:type", Object)
|
|
210
|
+
], ContactPhoto.prototype, "photo", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ type: String, reflect: true }),
|
|
213
|
+
__metadata("design:type", Object)
|
|
214
|
+
], ContactPhoto.prototype, "emptyArtwork", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
state(),
|
|
217
|
+
__metadata("design:type", Object)
|
|
218
|
+
], ContactPhoto.prototype, "user", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
state(),
|
|
221
|
+
__metadata("design:type", Boolean)
|
|
222
|
+
], ContactPhoto.prototype, "login", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
state(),
|
|
225
|
+
__metadata("design:type", Number)
|
|
226
|
+
], ContactPhoto.prototype, "progress", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
state(),
|
|
229
|
+
__metadata("design:type", String)
|
|
230
|
+
], ContactPhoto.prototype, "error", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
state(),
|
|
233
|
+
__metadata("design:type", String)
|
|
234
|
+
], ContactPhoto.prototype, "status", void 0);
|
|
235
|
+
customElements.define('contact-photo', ContactPhoto);
|
|
236
236
|
//# sourceMappingURL=uploader.js.map
|