pwa-auth 3.3.7 → 3.3.9
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 +116 -106
- package/base/export/pwa-auth.d.ts +7 -6
- package/base/export/pwa-auth.js +7 -6
- package/base/export/pwa-auth.js.map +1 -1
- package/base/firebase/authentication.d.ts +10 -10
- package/base/firebase/authentication.js +10 -10
- package/base/firebase/authentication.js.map +1 -1
- package/base/firebase/interface.d.ts +5 -4
- package/base/firebase/interface.js +80 -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 +122 -113
- package/base/redux/backend.js +43 -43
- package/base/redux/drawer.d.ts +19 -17
- package/base/redux/drawer.js +21 -21
- package/base/redux/drawer.js.map +1 -1
- package/base/redux/frontend.d.ts +198 -185
- 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 +8 -6
- package/base/webcomponents/css/animation.js.map +1 -1
- 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 +42 -18
- package/base/webcomponents/drawer/css/drawer.js.map +1 -1
- package/base/webcomponents/drawer/css/exit.d.ts +2 -2
- package/base/webcomponents/drawer/css/exit.js +8 -2
- package/base/webcomponents/drawer/css/exit.js.map +1 -1
- 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 +18 -6
- package/base/webcomponents/drawer/css/paragraph.js.map +1 -1
- package/base/webcomponents/drawer/drawer.d.ts +58 -58
- package/base/webcomponents/drawer/drawer.js +108 -104
- 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 +3 -3
- package/base/webcomponents/form/css/input.d.ts +2 -2
- package/base/webcomponents/form/css/input.js +4 -4
- package/base/webcomponents/form/css/label.d.ts +2 -2
- package/base/webcomponents/form/css/label.js +4 -3
- package/base/webcomponents/form/css/label.js.map +1 -1
- 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 +6 -4
- package/base/webcomponents/form/css/toggle.js.map +1 -1
- 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 +97 -93
- package/base/webcomponents/form/login.js.map +1 -1
- package/base/webcomponents/form/signup.d.ts +20 -20
- package/base/webcomponents/form/signup.js +104 -100
- 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 +6 -8
- package/base/webcomponents/icon/css/icon.js.map +1 -1
- 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 +5 -3
- package/base/webcomponents/login/css/auth.js.map +1 -1
- 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 +73 -73
- 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 +24 -4
- package/base/webcomponents/settings/css/navigation.js.map +1 -1
- 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 +152 -151
- 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 -91
- package/base/webcomponents/settings/settings.js.map +1 -1
- package/package.json +11 -10
- package/source/pwa-auth.js +106 -56
|
@@ -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,57 +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 { 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 {
|
|
50
50
|
box-sizing: border-box;
|
|
51
51
|
-webkit-box-sizing: border-box;
|
|
52
52
|
display: grid;
|
|
53
|
+
grid-gap: 16px;
|
|
54
|
+
grid-template-rows: auto 1fr auto;
|
|
53
55
|
grid-template-columns: 1fr;
|
|
54
|
-
grid-gap: 4px;
|
|
55
56
|
width: 100%;
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -63,10 +64,10 @@ export class ContactPhoto extends connect(store)(LitElement) {
|
|
|
63
64
|
box-shadow: 1px 1px 2px black, 0 0 25px grey, 0 0 5px #fff;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
`
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
render() {
|
|
67
|
+
`
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
70
71
|
return html `
|
|
71
72
|
<label
|
|
72
73
|
for="pwa-uploader"
|
|
@@ -133,104 +134,104 @@ export class ContactPhoto extends connect(store)(LitElement) {
|
|
|
133
134
|
</label>
|
|
134
135
|
|
|
135
136
|
<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);
|
|
137
|
+
`;
|
|
138
|
+
}
|
|
139
|
+
async saveImage() {
|
|
140
|
+
const uploader = this.shadowRoot.querySelector('.uploader');
|
|
141
|
+
if (auth.currentUser) {
|
|
142
|
+
this.error = '';
|
|
143
|
+
this.status = 'Uploading...';
|
|
144
|
+
const file = this.shadowRoot.querySelector('#photoURL');
|
|
145
|
+
if (!file) {
|
|
146
|
+
console.error('No file selected');
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const location = ref(storage, "/" +
|
|
150
|
+
"pwa-auth" +
|
|
151
|
+
"/" +
|
|
152
|
+
this.user +
|
|
153
|
+
"/" +
|
|
154
|
+
file.files[0].name);
|
|
155
|
+
const newMetadata = {
|
|
156
|
+
cacheControl: 'public,max-age=300',
|
|
157
|
+
contentType: file.files[0].type
|
|
158
|
+
};
|
|
159
|
+
const uploadTask = uploadBytesResumable(location, file.files[0], newMetadata);
|
|
160
|
+
uploadTask.on('state_changed', (snapshot) => {
|
|
161
|
+
this.progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
|
162
|
+
this.status = `Upload is ${Math.round(this.progress)}% done`;
|
|
163
|
+
switch (snapshot.state) {
|
|
164
|
+
case 'paused':
|
|
165
|
+
this.status = 'Upload is paused';
|
|
166
|
+
break;
|
|
167
|
+
case 'running':
|
|
168
|
+
this.status = `Upload is running (${Math.round(this.progress)}%)`;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
let progress = 0;
|
|
172
|
+
if (snapshot.totalBytes > 0) {
|
|
173
|
+
progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
|
174
|
+
}
|
|
175
|
+
if (isFinite(progress)) {
|
|
176
|
+
uploader.value = progress;
|
|
177
|
+
uploader.textContent = `${Math.round(progress)}%`;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
uploader.value = 0;
|
|
181
|
+
uploader.textContent = '0%';
|
|
182
|
+
}
|
|
183
|
+
}, (error) => {
|
|
184
|
+
this.error = `Upload failed: ${error.message}`;
|
|
185
|
+
this.status = '';
|
|
186
|
+
console.error('Upload failed:', error);
|
|
187
|
+
uploader.value = 0;
|
|
188
|
+
uploader.textContent = 'Error';
|
|
189
|
+
}, async () => {
|
|
190
|
+
await getDownloadURL(uploadTask.snapshot.ref)
|
|
191
|
+
.then((url) => {
|
|
192
|
+
updateMetadata(location, newMetadata)
|
|
193
|
+
.then(() => { }).catch((error) => { console.log("error: ", error); });
|
|
194
|
+
if (user) {
|
|
195
|
+
updateProfile(user, { photoURL: url })
|
|
196
|
+
.then(() => {
|
|
197
|
+
uploader.value = 100;
|
|
198
|
+
uploader.textContent = 'Complete';
|
|
199
|
+
});
|
|
200
|
+
this.status = 'User profile updated successfully!';
|
|
201
|
+
this.dispatchPhoto(url);
|
|
202
|
+
}
|
|
203
|
+
}).catch(() => { });
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
__decorate([
|
|
209
|
+
property(),
|
|
210
|
+
__metadata("design:type", Object)
|
|
211
|
+
], ContactPhoto.prototype, "photo", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: String, reflect: true }),
|
|
214
|
+
__metadata("design:type", Object)
|
|
215
|
+
], ContactPhoto.prototype, "emptyArtwork", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
state(),
|
|
218
|
+
__metadata("design:type", Object)
|
|
219
|
+
], ContactPhoto.prototype, "user", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
state(),
|
|
222
|
+
__metadata("design:type", Boolean)
|
|
223
|
+
], ContactPhoto.prototype, "login", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
state(),
|
|
226
|
+
__metadata("design:type", Number)
|
|
227
|
+
], ContactPhoto.prototype, "progress", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
state(),
|
|
230
|
+
__metadata("design:type", String)
|
|
231
|
+
], ContactPhoto.prototype, "error", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
state(),
|
|
234
|
+
__metadata("design:type", String)
|
|
235
|
+
], ContactPhoto.prototype, "status", void 0);
|
|
236
|
+
customElements.define('contact-photo', ContactPhoto);
|
|
236
237
|
//# sourceMappingURL=uploader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploader.js","sourceRoot":"","sources":["../../../../typescript/webcomponents/settings/input/uploader.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAkB,MAAQ,KAAK,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAe,mBAAmB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAY,MAAe,gBAAgB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAuB,aAAa,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAW,kCAAkC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAiB,eAAe,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAsB,wBAAwB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,OAAO,YAAa,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAmB1D;QACE,KAAK,EAAE,CAAC;QAjBS,UAAK,GAAyB,EAAE,CAAC;QAGJ,iBAAY,GAAG,EAAE,CAAC;QAEjD,SAAI,GAAmB,EAAE,CAAC;QAC1B,UAAK,GAAa,KAAK,CAAC;QAIxB,aAAQ,GAAW,CAAC,CAAC;QAErB,UAAK,GAAW,EAAE,CAAC;QACnB,WAAM,GAAW,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"uploader.js","sourceRoot":"","sources":["../../../../typescript/webcomponents/settings/input/uploader.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAkB,MAAQ,KAAK,CAAC;AAC9D,OAA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AAE,GAAG,EAAE,GAAE,CAAC,CAAE,CAAC;YAIzB,CAAC,CAAC,CAAC;SAIF;IAIH,CAAC;CAiBF;AAnTC;IAAC,QAAQ,EAAE;;2CAAyC;AAGpD;IAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;;kDAA0B;AAElE;IAAC,KAAK,EAAE;;0CAAmC;AAC3C;IAAC,KAAK,EAAE;;2CAAiC;AAIzC;IAAC,KAAK,EAAE;;8CAA8B;AAEtC;IAAC,KAAK,EAAE;;2CAA4B;AACpC;IAAC,KAAK,EAAE;;4CAA6B;AAwSvC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { CSSResultArray, LitElement } from 'lit';
|
|
2
|
-
import { AppState } from '../../store';
|
|
3
|
-
import './input/uploader';
|
|
4
|
-
import './input/name';
|
|
5
|
-
import './input/email';
|
|
6
|
-
import './input/password';
|
|
7
|
-
import './input/delete';
|
|
8
|
-
declare const UserSettings_base: (new (...args: any[]) => {
|
|
9
|
-
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
10
|
-
connectedCallback(): void;
|
|
11
|
-
disconnectedCallback(): void;
|
|
12
|
-
stateChanged(_state: {
|
|
13
|
-
frontend: {
|
|
14
|
-
settings: string;
|
|
15
|
-
login: boolean;
|
|
16
|
-
drawer: boolean;
|
|
17
|
-
registerOne: boolean;
|
|
18
|
-
registerTwo: boolean;
|
|
19
|
-
userId: string;
|
|
20
|
-
customer: string;
|
|
21
|
-
profileChoice: string;
|
|
22
|
-
name: string;
|
|
23
|
-
photoURL: string;
|
|
24
|
-
phone: string;
|
|
25
|
-
email: string;
|
|
26
|
-
};
|
|
27
|
-
drawer: {
|
|
28
|
-
drawer: boolean;
|
|
29
|
-
};
|
|
30
|
-
backend: {
|
|
31
|
-
verified: boolean;
|
|
32
|
-
anon: boolean;
|
|
33
|
-
userId: string;
|
|
34
|
-
name: string;
|
|
35
|
-
email: string;
|
|
36
|
-
photoURL: string;
|
|
37
|
-
phone: string;
|
|
38
|
-
msgToken: string;
|
|
39
|
-
};
|
|
40
|
-
}): void;
|
|
41
|
-
readonly isConnected: boolean;
|
|
42
|
-
}) & typeof LitElement;
|
|
43
|
-
export declare class UserSettings extends UserSettings_base {
|
|
44
|
-
empty: string;
|
|
45
|
-
private profileTopic;
|
|
46
|
-
private name;
|
|
47
|
-
constructor();
|
|
48
|
-
protected firstUpdated(): void;
|
|
49
|
-
stateChanged(state: AppState): void;
|
|
50
|
-
static get styles(): CSSResultArray;
|
|
51
|
-
protected render(): import("lit-html").TemplateResult<1>;
|
|
52
|
-
}
|
|
53
|
-
declare global {
|
|
54
|
-
interface HTMLElementTagNameMap {
|
|
55
|
-
'user-settings': UserSettings;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
export {};
|
|
1
|
+
import { CSSResultArray, LitElement } from 'lit';
|
|
2
|
+
import { AppState } from '../../store';
|
|
3
|
+
import './input/uploader';
|
|
4
|
+
import './input/name';
|
|
5
|
+
import './input/email';
|
|
6
|
+
import './input/password';
|
|
7
|
+
import './input/delete';
|
|
8
|
+
declare const UserSettings_base: (new (...args: any[]) => {
|
|
9
|
+
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
disconnectedCallback(): void;
|
|
12
|
+
stateChanged(_state: {
|
|
13
|
+
frontend: {
|
|
14
|
+
settings: string;
|
|
15
|
+
login: boolean;
|
|
16
|
+
drawer: boolean;
|
|
17
|
+
registerOne: boolean;
|
|
18
|
+
registerTwo: boolean;
|
|
19
|
+
userId: string;
|
|
20
|
+
customer: string;
|
|
21
|
+
profileChoice: string;
|
|
22
|
+
name: string;
|
|
23
|
+
photoURL: string;
|
|
24
|
+
phone: string;
|
|
25
|
+
email: string;
|
|
26
|
+
};
|
|
27
|
+
drawer: {
|
|
28
|
+
drawer: boolean;
|
|
29
|
+
};
|
|
30
|
+
backend: {
|
|
31
|
+
verified: boolean;
|
|
32
|
+
anon: boolean;
|
|
33
|
+
userId: string;
|
|
34
|
+
name: string;
|
|
35
|
+
email: string;
|
|
36
|
+
photoURL: string;
|
|
37
|
+
phone: string;
|
|
38
|
+
msgToken: string;
|
|
39
|
+
};
|
|
40
|
+
}): void;
|
|
41
|
+
readonly isConnected: boolean;
|
|
42
|
+
}) & typeof LitElement;
|
|
43
|
+
export declare class UserSettings extends UserSettings_base {
|
|
44
|
+
empty: string;
|
|
45
|
+
private profileTopic;
|
|
46
|
+
private name;
|
|
47
|
+
constructor();
|
|
48
|
+
protected firstUpdated(): void;
|
|
49
|
+
stateChanged(state: AppState): void;
|
|
50
|
+
static get styles(): CSSResultArray;
|
|
51
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
52
|
+
}
|
|
53
|
+
declare global {
|
|
54
|
+
interface HTMLElementTagNameMap {
|
|
55
|
+
'user-settings': UserSettings;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export {};
|