pwa-auth 2.0.7 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +65 -54
  3. package/demonstration/compiled/pwa-auth.js +880 -0
  4. package/{website → demonstration}/css/styles.css +4 -2
  5. package/{demo → demonstration}/index.html +7 -4
  6. package/package.json +12 -10
  7. package/pwa-auth.js +4 -3
  8. package/{website → src}/THIRD_PARTY_LICENSES.txt +56 -56
  9. package/src/compiled/pwa-auth.js +880 -0
  10. package/{source → src-typescript}/css/form/label.ts +0 -2
  11. package/src-typescript/css/toggle.ts +9 -0
  12. package/src-typescript/development/junk/firebase-object.ts +49 -0
  13. package/src-typescript/development/junk/notes.md +96 -0
  14. package/src-typescript/development/junk/phone.ts +146 -0
  15. package/src-typescript/development/junk/photo.ts +440 -0
  16. package/src-typescript/development/junk/telephone.ts +282 -0
  17. package/{source/firebase/firebase-login.ts → src-typescript/development/login.ts} +1 -1
  18. package/{source/firebase/firebase.ts → src-typescript/development/object.ts} +1 -1
  19. package/src-typescript/firebase/authentication.ts +11 -0
  20. package/{source/firebase/start.ts → src-typescript/firebase/interface.ts} +35 -64
  21. package/{source/custom-elements → src-typescript/webcomponents}/drawer/drawer.ts +1 -1
  22. package/{source/custom-elements → src-typescript/webcomponents}/drawer/input/forgot.ts +1 -1
  23. package/{source/custom-elements → src-typescript/webcomponents}/drawer/input/login.ts +1 -1
  24. package/{source/custom-elements → src-typescript/webcomponents}/drawer/input/sign-up.ts +2 -1
  25. package/{deploy/custom-elements/icon/css/icon.js → src-typescript/webcomponents/icon/css/icon.ts} +4 -3
  26. package/{source/custom-elements → src-typescript/webcomponents}/icon/icon.ts +2 -21
  27. package/{source/custom-elements → src-typescript/webcomponents}/settings/input/delete.ts +1 -1
  28. package/{source/custom-elements → src-typescript/webcomponents}/settings/input/email.ts +1 -1
  29. package/{source/custom-elements → src-typescript/webcomponents}/settings/input/images.ts +1 -1
  30. package/{source/custom-elements → src-typescript/webcomponents}/settings/input/name.ts +1 -1
  31. package/{source/custom-elements → src-typescript/webcomponents}/settings/input/password.ts +1 -1
  32. package/{source/custom-elements → src-typescript/webcomponents}/settings/input/uploader.ts +2 -1
  33. package/{source/custom-elements → src-typescript/webcomponents}/settings/settings.ts +2 -2
  34. package/demo/css/styles.css +0 -67
  35. package/deploy/css/default.d.ts +0 -5
  36. package/deploy/css/default.d.ts.map +0 -1
  37. package/deploy/css/default.js +0 -99
  38. package/deploy/css/font.d.ts +0 -2
  39. package/deploy/css/font.d.ts.map +0 -1
  40. package/deploy/css/font.js +0 -16
  41. package/deploy/css/form/button.d.ts +0 -3
  42. package/deploy/css/form/button.d.ts.map +0 -1
  43. package/deploy/css/form/button.js +0 -54
  44. package/deploy/css/form/input.d.ts +0 -3
  45. package/deploy/css/form/input.d.ts.map +0 -1
  46. package/deploy/css/form/input.js +0 -24
  47. package/deploy/css/form/label.d.ts +0 -3
  48. package/deploy/css/form/label.d.ts.map +0 -1
  49. package/deploy/css/form/label.js +0 -24
  50. package/deploy/css/form/list.d.ts +0 -3
  51. package/deploy/css/form/list.d.ts.map +0 -1
  52. package/deploy/css/form/list.js +0 -22
  53. package/deploy/css/svg.d.ts +0 -4
  54. package/deploy/css/svg.d.ts.map +0 -1
  55. package/deploy/css/svg.js +0 -4
  56. package/deploy/css/toggle.d.ts +0 -2
  57. package/deploy/css/toggle.d.ts.map +0 -1
  58. package/deploy/css/toggle.js +0 -8
  59. package/deploy/custom-elements/drawer/css/drawer.d.ts +0 -3
  60. package/deploy/custom-elements/drawer/css/drawer.d.ts.map +0 -1
  61. package/deploy/custom-elements/drawer/css/drawer.js +0 -55
  62. package/deploy/custom-elements/drawer/css/exit.d.ts +0 -3
  63. package/deploy/custom-elements/drawer/css/exit.d.ts.map +0 -1
  64. package/deploy/custom-elements/drawer/css/exit.js +0 -48
  65. package/deploy/custom-elements/drawer/css/link.d.ts +0 -3
  66. package/deploy/custom-elements/drawer/css/link.d.ts.map +0 -1
  67. package/deploy/custom-elements/drawer/css/link.js +0 -12
  68. package/deploy/custom-elements/drawer/css/paragraph.d.ts +0 -3
  69. package/deploy/custom-elements/drawer/css/paragraph.d.ts.map +0 -1
  70. package/deploy/custom-elements/drawer/css/paragraph.js +0 -10
  71. package/deploy/custom-elements/drawer/css/toggle.d.ts +0 -3
  72. package/deploy/custom-elements/drawer/css/toggle.d.ts.map +0 -1
  73. package/deploy/custom-elements/drawer/css/toggle.js +0 -18
  74. package/deploy/custom-elements/drawer/drawer.d.ts +0 -37
  75. package/deploy/custom-elements/drawer/drawer.d.ts.map +0 -1
  76. package/deploy/custom-elements/drawer/drawer.js +0 -128
  77. package/deploy/custom-elements/drawer/input/forgot.d.ts +0 -16
  78. package/deploy/custom-elements/drawer/input/forgot.d.ts.map +0 -1
  79. package/deploy/custom-elements/drawer/input/forgot.js +0 -60
  80. package/deploy/custom-elements/drawer/input/login.d.ts +0 -20
  81. package/deploy/custom-elements/drawer/input/login.d.ts.map +0 -1
  82. package/deploy/custom-elements/drawer/input/login.js +0 -128
  83. package/deploy/custom-elements/drawer/input/sign-up.d.ts +0 -20
  84. package/deploy/custom-elements/drawer/input/sign-up.d.ts.map +0 -1
  85. package/deploy/custom-elements/drawer/input/sign-up.js +0 -137
  86. package/deploy/custom-elements/icon/css/icon.d.ts +0 -2
  87. package/deploy/custom-elements/icon/css/icon.d.ts.map +0 -1
  88. package/deploy/custom-elements/icon/icon.d.ts +0 -33
  89. package/deploy/custom-elements/icon/icon.d.ts.map +0 -1
  90. package/deploy/custom-elements/icon/icon.js +0 -72
  91. package/deploy/custom-elements/settings/css/navigation.d.ts +0 -2
  92. package/deploy/custom-elements/settings/css/navigation.d.ts.map +0 -1
  93. package/deploy/custom-elements/settings/css/navigation.js +0 -51
  94. package/deploy/custom-elements/settings/input/delete.d.ts +0 -34
  95. package/deploy/custom-elements/settings/input/delete.d.ts.map +0 -1
  96. package/deploy/custom-elements/settings/input/delete.js +0 -87
  97. package/deploy/custom-elements/settings/input/email.d.ts +0 -34
  98. package/deploy/custom-elements/settings/input/email.d.ts.map +0 -1
  99. package/deploy/custom-elements/settings/input/email.js +0 -98
  100. package/deploy/custom-elements/settings/input/images.d.ts +0 -2
  101. package/deploy/custom-elements/settings/input/images.d.ts.map +0 -1
  102. package/deploy/custom-elements/settings/input/images.js +0 -22
  103. package/deploy/custom-elements/settings/input/name.d.ts +0 -33
  104. package/deploy/custom-elements/settings/input/name.d.ts.map +0 -1
  105. package/deploy/custom-elements/settings/input/name.js +0 -90
  106. package/deploy/custom-elements/settings/input/password.d.ts +0 -36
  107. package/deploy/custom-elements/settings/input/password.d.ts.map +0 -1
  108. package/deploy/custom-elements/settings/input/password.js +0 -145
  109. package/deploy/custom-elements/settings/input/uploader.d.ts +0 -37
  110. package/deploy/custom-elements/settings/input/uploader.d.ts.map +0 -1
  111. package/deploy/custom-elements/settings/input/uploader.js +0 -224
  112. package/deploy/custom-elements/settings/settings.d.ts +0 -37
  113. package/deploy/custom-elements/settings/settings.d.ts.map +0 -1
  114. package/deploy/custom-elements/settings/settings.js +0 -197
  115. package/deploy/firebase/firebase-login.d.ts +0 -21
  116. package/deploy/firebase/firebase-login.d.ts.map +0 -1
  117. package/deploy/firebase/firebase-login.js +0 -85
  118. package/deploy/firebase/firebase.d.ts +0 -20
  119. package/deploy/firebase/firebase.d.ts.map +0 -1
  120. package/deploy/firebase/firebase.js +0 -76
  121. package/deploy/firebase/start.d.ts +0 -14
  122. package/deploy/firebase/start.d.ts.map +0 -1
  123. package/deploy/firebase/start.js +0 -86
  124. package/deploy/lazy-loader.d.ts +0 -11
  125. package/deploy/lazy-loader.d.ts.map +0 -1
  126. package/deploy/lazy-loader.js +0 -20
  127. package/deploy/redux/backend.d.ts +0 -16
  128. package/deploy/redux/backend.d.ts.map +0 -1
  129. package/deploy/redux/backend.js +0 -43
  130. package/deploy/redux/drawer.d.ts +0 -18
  131. package/deploy/redux/drawer.d.ts.map +0 -1
  132. package/deploy/redux/drawer.js +0 -21
  133. package/deploy/redux/frontend.d.ts +0 -17
  134. package/deploy/redux/frontend.d.ts.map +0 -1
  135. package/deploy/redux/frontend.js +0 -67
  136. package/deploy/redux/object.d.ts +0 -24
  137. package/deploy/redux/object.d.ts.map +0 -1
  138. package/deploy/redux/object.js +0 -1
  139. package/deploy/store.d.ts +0 -19
  140. package/deploy/store.d.ts.map +0 -1
  141. package/deploy/store.js +0 -13
  142. package/npm/THIRD_PARTY_LICENSES.txt +0 -303
  143. package/npm/pwa-auth.js +0 -306
  144. package/source/css/toggle.ts +0 -9
  145. package/source/custom-elements/icon/css/icon.ts +0 -70
  146. package/website/404.html +0 -33
  147. package/website/css/pwa-styles.css +0 -36
  148. package/website/images/empty.jpg +0 -0
  149. package/website/images/favicon.ico +0 -0
  150. package/website/images/manifest/logo-144.png +0 -0
  151. package/website/images/manifest/logo-192.png +0 -0
  152. package/website/images/manifest/logo-48.png +0 -0
  153. package/website/images/manifest/logo-512.png +0 -0
  154. package/website/images/manifest/logo-72.png +0 -0
  155. package/website/images/manifest/logo-96.png +0 -0
  156. package/website/images/manifest/maskable_icon_x128.png +0 -0
  157. package/website/images/manifest/maskable_icon_x192.png +0 -0
  158. package/website/images/manifest/maskable_icon_x384.png +0 -0
  159. package/website/images/manifest/maskable_icon_x48.png +0 -0
  160. package/website/images/manifest/maskable_icon_x512.png +0 -0
  161. package/website/images/manifest/maskable_icon_x72.png +0 -0
  162. package/website/images/manifest/maskable_icon_x96.png +0 -0
  163. package/website/index.html +0 -72
  164. package/website/js/pwa-auth.js +0 -306
  165. package/website/sitemap.xml +0 -11
  166. /package/{demo → demonstration}/css/pwa-styles.css +0 -0
  167. /package/{demo → demonstration}/images/empty.jpg +0 -0
  168. /package/{npm/images → src}/empty.jpg +0 -0
  169. /package/{npm → src}/pwa-styles.css +0 -0
  170. /package/{source → src-typescript}/css/default.ts +0 -0
  171. /package/{source → src-typescript}/css/font.ts +0 -0
  172. /package/{source → src-typescript}/css/form/button.ts +0 -0
  173. /package/{source → src-typescript}/css/form/input.ts +0 -0
  174. /package/{source → src-typescript}/css/form/list.ts +0 -0
  175. /package/{source → src-typescript}/css/svg.ts +0 -0
  176. /package/{source → src-typescript}/lazy-loader.ts +0 -0
  177. /package/{source → src-typescript}/redux/backend.ts +0 -0
  178. /package/{source → src-typescript}/redux/drawer.ts +0 -0
  179. /package/{source → src-typescript}/redux/frontend.ts +0 -0
  180. /package/{source → src-typescript}/redux/object.ts +0 -0
  181. /package/{source → src-typescript}/store.ts +0 -0
  182. /package/{source/custom-elements → src-typescript/webcomponents}/drawer/css/drawer.ts +0 -0
  183. /package/{source/custom-elements → src-typescript/webcomponents}/drawer/css/exit.ts +0 -0
  184. /package/{source/custom-elements → src-typescript/webcomponents}/drawer/css/link.ts +0 -0
  185. /package/{source/custom-elements → src-typescript/webcomponents}/drawer/css/paragraph.ts +0 -0
  186. /package/{source/custom-elements → src-typescript/webcomponents}/drawer/css/toggle.ts +0 -0
  187. /package/{source/custom-elements → src-typescript/webcomponents}/settings/css/navigation.ts +0 -0
@@ -1,224 +0,0 @@
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
- import { html, css, LitElement } from 'lit';
8
- import { property, state } from 'lit/decorators.js';
9
- import { store } from '../../../store';
10
- import { connect } from 'pwa-helpers';
11
- import { auth, storage, user } from '../../../firebase/start';
12
- import { updateProfile } from 'firebase/auth';
13
- import { accImage } from '../../../redux/backend';
14
- import { ref, updateMetadata, getDownloadURL, uploadBytesResumable } from "@firebase/storage";
15
- import { labelStyle } from '../../../css/form/label';
16
- export class ContactPhoto extends connect(store)(LitElement) {
17
- constructor() {
18
- super();
19
- this.photo = '';
20
- this.emptyArtwork = '';
21
- this.user = '';
22
- this.login = false;
23
- this.progress = 0;
24
- this.error = '';
25
- this.status = '';
26
- this.dispatchPhoto = async (url) => {
27
- if (auth.currentUser) {
28
- await updateProfile(auth.currentUser, { photoURL: url }).catch((error) => { console.log(error); });
29
- store.dispatch(accImage(url));
30
- }
31
- };
32
- this.progress = 0;
33
- this.error = '';
34
- this.status = '';
35
- }
36
- stateChanged(state) {
37
- this.login = state.frontend.login;
38
- this.user = state.backend.userId;
39
- this.photo = state.backend.photoURL;
40
- }
41
- static get styles() {
42
- return [
43
- labelStyle,
44
- css `
45
-
46
- :host {
47
- box-sizing: border-box;
48
- -webkit-box-sizing: border-box;
49
- display: grid;
50
- grid-template-columns: 1fr;
51
- grid-gap: 4px;
52
- width: 100%;
53
- }
54
-
55
- input[type=file] {
56
- border-radius: 50%;
57
- overflow: hidden;
58
- margin: auto;
59
- border: 2px solid #303030;
60
- box-shadow: 1px 1px 2px black, 0 0 25px grey, 0 0 5px #fff;
61
- }
62
-
63
- `
64
- ];
65
- }
66
- render() {
67
- return html `
68
- <label
69
- for="pwa-uploader"
70
- style="
71
- grid-template-columns: auto 1fr;
72
- grid-gap:16px;
73
- padding: 0 16px;
74
- ">Upload:
75
- <progress
76
- id ="pwa-uploader"
77
- class ="uploader"
78
- value ="0"
79
- max ="100"
80
- style="
81
- height: 24px;
82
- width: 100%;
83
- margin: auto;
84
- "></label>
85
-
86
-
87
-
88
- <!-- Input - Upload Image -->
89
- <input
90
- id ="photoURL"
91
- type ="file"
92
- name ="photoURL"
93
- class ="contractorPhoto"
94
- accept ="image/*"
95
- @change ="${this.saveImage}"
96
- ?disabled="${this.login === false}"
97
- style ="
98
- display: none;
99
- cursor: pointer;
100
- position: absolute;
101
- z-index: -1;
102
- "/></progress>
103
-
104
- <label
105
- style="
106
- border: 2px dashed;
107
- border-radius: 6px;
108
- overflow: hidden;
109
- padding: 0 16px 16px 16px;
110
- "
111
- for ="photoURL">Photo:
112
-
113
- <!-- Output - Retrieved Image -->
114
- <canvas
115
- style="
116
- margin: auto;
117
- height: 200px;
118
- width: 100%;
119
- background-image: url(${this.photo ? this.photo : this.emptyArtwork});
120
- background-size: contain;
121
- background-repeat: no-repeat;
122
- background-position: center;
123
- cursor: pointer;
124
- overflow: hidden;
125
- box-sizing: border-box;
126
- ">
127
- </canvas>
128
-
129
- </label>
130
-
131
- <p style="text-align:center;">${this.status}${this.error}</p>
132
- `;
133
- }
134
- async saveImage() {
135
- const uploader = this.shadowRoot.querySelector('.uploader');
136
- if (auth.currentUser) {
137
- this.error = '';
138
- this.status = 'Uploading...';
139
- const file = this.shadowRoot.querySelector('#photoURL');
140
- if (!file) {
141
- console.error('No file selected');
142
- return;
143
- }
144
- const location = ref(storage, "/" +
145
- "pwa-auth" +
146
- "/" +
147
- this.user +
148
- "/" +
149
- file.files[0].name);
150
- const newMetadata = {
151
- cacheControl: 'public,max-age=300',
152
- contentType: file.files[0].type
153
- };
154
- const uploadTask = uploadBytesResumable(location, file.files[0], newMetadata);
155
- uploadTask.on('state_changed', (snapshot) => {
156
- this.progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
157
- this.status = `Upload is ${Math.round(this.progress)}% done`;
158
- switch (snapshot.state) {
159
- case 'paused':
160
- this.status = 'Upload is paused';
161
- break;
162
- case 'running':
163
- this.status = `Upload is running (${Math.round(this.progress)}%)`;
164
- break;
165
- }
166
- let progress = 0;
167
- if (snapshot.totalBytes > 0) {
168
- progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
169
- }
170
- if (isFinite(progress)) {
171
- uploader.value = progress;
172
- uploader.textContent = `${Math.round(progress)}%`;
173
- }
174
- else {
175
- uploader.value = 0;
176
- uploader.textContent = '0%';
177
- }
178
- }, (error) => {
179
- this.error = `Upload failed: ${error.message}`;
180
- this.status = '';
181
- console.error('Upload failed:', error);
182
- uploader.value = 0;
183
- uploader.textContent = 'Error';
184
- }, async () => {
185
- await getDownloadURL(uploadTask.snapshot.ref)
186
- .then((url) => {
187
- updateMetadata(location, newMetadata)
188
- .then(() => { }).catch((error) => { console.log("error: ", error); });
189
- if (user) {
190
- updateProfile(user, { photoURL: url })
191
- .then(() => {
192
- uploader.value = 100;
193
- uploader.textContent = 'Complete';
194
- });
195
- this.status = 'User profile updated successfully!';
196
- this.dispatchPhoto(url);
197
- }
198
- }).catch(() => { });
199
- });
200
- }
201
- }
202
- }
203
- __decorate([
204
- property()
205
- ], ContactPhoto.prototype, "photo", void 0);
206
- __decorate([
207
- property({ type: String, reflect: true })
208
- ], ContactPhoto.prototype, "emptyArtwork", void 0);
209
- __decorate([
210
- state()
211
- ], ContactPhoto.prototype, "user", void 0);
212
- __decorate([
213
- state()
214
- ], ContactPhoto.prototype, "login", void 0);
215
- __decorate([
216
- state()
217
- ], ContactPhoto.prototype, "progress", void 0);
218
- __decorate([
219
- state()
220
- ], ContactPhoto.prototype, "error", void 0);
221
- __decorate([
222
- state()
223
- ], ContactPhoto.prototype, "status", void 0);
224
- customElements.define('contact-photo', ContactPhoto);
@@ -1,37 +0,0 @@
1
- import { 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: import("../../redux/object").frontendAuth;
14
- drawer: {
15
- drawer: boolean;
16
- };
17
- backend: import("../../redux/object").backendAuth;
18
- }): void;
19
- readonly isConnected: boolean;
20
- }) & typeof LitElement;
21
- export declare class UserSettings extends UserSettings_base {
22
- emptyArtwork: string;
23
- private profileTopic;
24
- private name;
25
- constructor();
26
- protected firstUpdated(): void;
27
- stateChanged(state: AppState): void;
28
- static get styles(): import("lit").CSSResult[];
29
- protected render(): import("lit-html").TemplateResult<1>;
30
- }
31
- declare global {
32
- interface HTMLElementTagNameMap {
33
- 'user-settings': UserSettings;
34
- }
35
- }
36
- export {};
37
- //# sourceMappingURL=settings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../source/custom-elements/settings/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAe,KAAK,CAAC;AAGrD,OAAO,EAAS,QAAQ,EAAE,MAAqB,aAAa,CAAC;AAG7D,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,eAAe,CAAC;AACvB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;AAGxB,qBACa,YAAa,SAAQ,iBAA0B;IAGV,YAAY,SAAM;IAEzD,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,IAAI,CAAM;;IAI3B,SAAS,CAAC,YAAY;IA8BtB,YAAY,CAAC,KAAK,EAAE,QAAQ;IAK5B,MAAM,KAAK,MAAM,8BAyCX;IAEN,SAAS,CAAC,MAAM;CA6FjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC3B,eAAe,EAAE,YAAY,CAAC;KACjC;CACF"}
@@ -1,197 +0,0 @@
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
- import { css, html, LitElement } from 'lit';
8
- import { state, customElement, property } from 'lit/decorators.js';
9
- import { connect } from 'pwa-helpers/connect-mixin.js';
10
- import { store } from '../../store';
11
- import { navigateAuth } from '../../redux/frontend';
12
- import { navigation } from './css/navigation';
13
- import './input/uploader';
14
- import './input/name';
15
- import './input/email';
16
- import './input/password';
17
- import './input/delete';
18
- import { listStyle } from '../../css/form/list';
19
- let UserSettings = class UserSettings extends connect(store)(LitElement) {
20
- constructor() {
21
- super();
22
- this.emptyArtwork = '';
23
- this.profileTopic = '';
24
- this.name = '';
25
- }
26
- firstUpdated() {
27
- const forms = this.querySelectorAll('form');
28
- forms.forEach(item => {
29
- item.preventDefault();
30
- });
31
- this.shadowRoot.querySelector('button[value=profile]').addEventListener('click', () => {
32
- store.dispatch(navigateAuth('profile'));
33
- });
34
- this.shadowRoot.querySelector('button[value=verification]').addEventListener('click', () => {
35
- store.dispatch(navigateAuth('verification'));
36
- });
37
- this.shadowRoot.querySelector('button[value=password]').addEventListener('click', () => {
38
- store.dispatch(navigateAuth('password'));
39
- });
40
- this.shadowRoot.querySelector('button[value=delete]').addEventListener('click', () => {
41
- store.dispatch(navigateAuth('delete'));
42
- });
43
- }
44
- stateChanged(state) {
45
- this.profileTopic = state.frontend.settings;
46
- this.name = state.backend.name;
47
- }
48
- static get styles() {
49
- return [
50
- navigation,
51
- listStyle,
52
- css `
53
-
54
- /* Button Padding for Border Outline */
55
- :host {
56
- display: grid;
57
- background-color: var(--pwa_settings_background, white);
58
- }
59
-
60
- /* Page Form */
61
- form {
62
- box-sizing: border-box;
63
- display: grid;
64
- border: 0;
65
- }
66
-
67
- /* Page Title */
68
- .pageTitle { margin: 0; }
69
-
70
- h2 {
71
- color: var(--pwa_section_header, black);
72
- text-align: center;
73
- text-shadow: 1px 1px 2px black, 0 0 15px grey, 0 0 5px #fff;
74
-
75
- border-top: 2px solid var(--pwa_divider, black);
76
- border-bottom: 2px solid var(--pwa_divider, black);
77
-
78
- margin: 0;
79
- padding: 8px 0;
80
- }
81
-
82
- /* up to 576 pixels */
83
- @media only screen and (max-width: 576px) {
84
- h2 {
85
- font-size: medium;
86
- }
87
- }
88
-
89
- `
90
- ];
91
- }
92
- render() {
93
- return html `
94
-
95
- <!-- Page Menu -->
96
- <nav>
97
-
98
- <ul>
99
-
100
- <li>
101
- <button
102
- value="profile"
103
- ?on="${this.profileTopic === 'profile'}">Icon
104
- </button>
105
- </li>
106
-
107
- <li>
108
- <button
109
- value="verification"
110
- ?on="${this.profileTopic === 'verification'}">Profile
111
- </button>
112
- </li>
113
-
114
- <li>
115
- <button
116
- value="password"
117
- ?on="${this.profileTopic === 'password'}">Password
118
- </button>
119
- </li>
120
-
121
- <li>
122
- <button
123
- value="delete"
124
- ?on="${this.profileTopic === 'delete'}">Delete
125
- </button>
126
- </li>
127
-
128
- </ul>
129
-
130
- </nav>
131
-
132
- <!-- Page 1: Profile -->
133
- <section ?on="${this.profileTopic === 'profile'}">
134
-
135
- <!-- Display Username -->
136
- <h2>${this.name}</h2>
137
-
138
- <!-- Custom Image Element - Display / Upload -->
139
- <contact-photo emptyArtwork="${this.emptyArtwork}"></contact-photo>
140
-
141
- </section>
142
-
143
- <!-- Page 2: Verification -->
144
- <section ?on="${this.profileTopic === 'verification'}">
145
-
146
- <!-- Page Title -->
147
- <h2>Contact Information</h2>
148
-
149
- <!-- Custom - Username -->
150
- <input-name></input-name>
151
-
152
- <!-- Custom - Email -->
153
- <contact-email></contact-email>
154
-
155
- <!-- Indicator - Verified -->
156
- <div class="verified"></div>
157
-
158
- </section>
159
-
160
- <!-- Page 3: Password -->
161
- <section ?on="${this.profileTopic === 'password'}">
162
-
163
- <!-- Page Title -->
164
- <h2>Password</h2>
165
-
166
- <!-- Custom - Password -->
167
- <input-password></input-password>
168
-
169
- </section>
170
-
171
- <!-- Page 4: Delete -->
172
- <section ?on="${this.profileTopic === 'delete'}">
173
-
174
- <!-- Page Title -->
175
- <h2>Delete Account</h2>
176
-
177
- <!-- Custom - Delete -->
178
- <delete-user></delete-user>
179
-
180
- </section>
181
-
182
- `;
183
- }
184
- };
185
- __decorate([
186
- property({ type: String, reflect: true })
187
- ], UserSettings.prototype, "emptyArtwork", void 0);
188
- __decorate([
189
- state()
190
- ], UserSettings.prototype, "profileTopic", void 0);
191
- __decorate([
192
- state()
193
- ], UserSettings.prototype, "name", void 0);
194
- UserSettings = __decorate([
195
- customElement('user-settings')
196
- ], UserSettings);
197
- export { UserSettings };
@@ -1,21 +0,0 @@
1
- interface baseVerify {
2
- verifyPasswordResetCode: any;
3
- emailVerification: any;
4
- }
5
- interface baseLogin {
6
- signOut: any;
7
- isSignInWithEmailLink: any;
8
- signInWithEmailAndPassword: any;
9
- signInWithPopup: any;
10
- signInWithRedirect: any;
11
- signInAnonymously: any;
12
- signInWithCustomToken: any;
13
- signInWithEmailLink: any;
14
- signInWithPhoneNumber: any;
15
- signInWithCredential: any;
16
- updateCurrentUser: any;
17
- }
18
- export declare const authVerify: baseVerify;
19
- export declare const authLogin: baseLogin;
20
- export {};
21
- //# sourceMappingURL=firebase-login.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firebase-login.d.ts","sourceRoot":"","sources":["../../source/firebase/firebase-login.ts"],"names":[],"mappings":"AAkBA,UAAU,UAAU;IAClB,uBAAuB,EAAG,GAAG,CAAC;IAC9B,iBAAiB,EAAE,GAAG,CAAA;CACvB;AAED,UAAU,SAAS;IACjB,OAAO,EAAG,GAAG,CAAC;IACd,qBAAqB,EAAG,GAAG,CAAC;IAC5B,0BAA0B,EAAG,GAAG,CAAC;IACjC,eAAe,EAAG,GAAG,CAAC;IACtB,kBAAkB,EAAG,GAAG,CAAC;IACzB,iBAAiB,EAAG,GAAG,CAAC;IACxB,qBAAqB,EAAG,GAAG,CAAC;IAC5B,mBAAmB,EAAG,GAAG,CAAC;IAC1B,qBAAqB,EAAG,GAAG,CAAC;IAC5B,oBAAoB,EAAG,GAAG,CAAC;IAC3B,iBAAiB,EAAG,GAAG,CAAA;CACxB;AAED,eAAO,MAAM,UAAU,EAAG,UAiBzB,CAAA;AACD,eAAO,MAAM,SAAS,EAAG,SAwExB,CAAA"}
@@ -1,85 +0,0 @@
1
- import { isSignInWithEmailLink, signInAnonymously, signInWithCredential, signInWithCustomToken, signInWithEmailAndPassword, signInWithEmailLink, signInWithPhoneNumber, signInWithPopup, signInWithRedirect, signOut, updateCurrentUser, verifyPasswordResetCode, sendEmailVerification } from "firebase/auth";
2
- import { auth, user } from "./start";
3
- export const authVerify = {
4
- verifyPasswordResetCode: {
5
- description: "Verifies a password reset code sent to the user.",
6
- action: (code) => verifyPasswordResetCode(auth, code)
7
- .then(email => ({ email }))
8
- .catch(error => ({ error: error.code, message: error.message }))
9
- },
10
- emailVerification: {
11
- description: "Sends an email verification to the current user.",
12
- action: () => {
13
- if (user) {
14
- sendEmailVerification(user)
15
- .then(() => ({ success: true }))
16
- .catch((error) => ({ error: error.code, message: error.message }));
17
- }
18
- }
19
- }
20
- };
21
- export const authLogin = {
22
- isSignInWithEmailLink: {
23
- description: "Checks if a link is a valid sign-in with email link.",
24
- action: (link) => isSignInWithEmailLink(auth, link)
25
- },
26
- signInWithEmailAndPassword: {
27
- description: "Signs in a user with email and password.",
28
- action: (email, password) => signInWithEmailAndPassword(auth, email, password)
29
- .then(userCredential => ({ user: userCredential.user }))
30
- .catch(error => ({ error: error.code, message: error.message }))
31
- },
32
- signInWithPopup: {
33
- description: "Signs in a user via a popup with a federated provider (e.g., Google, Facebook).",
34
- action: (provider) => signInWithPopup(auth, provider)
35
- .then(result => ({ user: result.user }))
36
- .catch(error => ({ error: error.code, message: error.message }))
37
- },
38
- signInWithRedirect: {
39
- description: "Signs in a user via redirect with a federated provider.",
40
- action: (provider) => signInWithRedirect(auth, provider)
41
- .catch(error => ({ error: error.code, message: error.message }))
42
- },
43
- signInAnonymously: {
44
- description: "Signs in a user anonymously without credentials.",
45
- action: () => signInAnonymously(auth)
46
- .then(userCredential => ({ user: userCredential.user }))
47
- .catch(error => ({ error: error.code, message: error.message }))
48
- },
49
- signInWithCustomToken: {
50
- description: "Signs in a user with a custom token from an external auth system.",
51
- action: (token) => signInWithCustomToken(auth, token)
52
- .then(userCredential => ({ user: userCredential.user }))
53
- .catch(error => ({ error: error.code, message: error.message }))
54
- },
55
- signInWithEmailLink: {
56
- description: "Signs in a user with an email link.",
57
- action: (email, link) => signInWithEmailLink(auth, email, link)
58
- .then(userCredential => ({ user: userCredential.user }))
59
- .catch(error => ({ error: error.code, message: error.message }))
60
- },
61
- signInWithPhoneNumber: {
62
- description: "Signs in a user with a phone number and verification code.",
63
- action: (phoneNumber, appVerifier) => signInWithPhoneNumber(auth, phoneNumber, appVerifier)
64
- .then(confirmationResult => ({ confirmationResult }))
65
- .catch(error => ({ error: error.code, message: error.message }))
66
- },
67
- signInWithCredential: {
68
- description: "Signs in a user with a credential object (e.g., from OAuth).",
69
- action: (credential) => signInWithCredential(auth, credential)
70
- .then(userCredential => ({ user: userCredential.user }))
71
- .catch(error => ({ error: error.code, message: error.message }))
72
- },
73
- updateCurrentUser: {
74
- description: "Updates the current user with a new User object.",
75
- action: () => updateCurrentUser(auth, user)
76
- .then(() => ({ success: true }))
77
- .catch(error => ({ error: error.code, message: error.message }))
78
- },
79
- signOut: {
80
- description: "Signs out the current user.",
81
- action: () => signOut(auth)
82
- .then(() => ({ success: true }))
83
- .catch(error => ({ error: error.code, message: error.message }))
84
- }
85
- };
@@ -1,20 +0,0 @@
1
- interface base {
2
- applyActionCode: any;
3
- checkActionCode: any;
4
- beforeAuthStateChanged: any;
5
- confirmPasswordReset: any;
6
- sendPasswordResetEmail: any;
7
- connectAuthEmulator: any;
8
- createUserWithEmailAndPassword: any;
9
- fetchSignInMethodsForEmail: any;
10
- getMultiFactorResolver: any;
11
- getRedirectResult: any;
12
- initializeRecaptchaConfig: any;
13
- onAuthStateChanged: any;
14
- onIdTokenChanged: any;
15
- revokeAccessToken: any;
16
- }
17
- export declare const authFunctions: base;
18
- export declare const recoverEmail: (actionCode: any) => void;
19
- export {};
20
- //# sourceMappingURL=firebase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firebase.d.ts","sourceRoot":"","sources":["../../source/firebase/firebase.ts"],"names":[],"mappings":"AAiBA,UAAU,IAAI;IACZ,eAAe,EAAG,GAAG,CAAC;IACtB,eAAe,EAAG,GAAG,CAAC;IACtB,sBAAsB,EAAG,GAAG,CAAC;IAC7B,oBAAoB,EAAG,GAAG,CAAC;IAC3B,sBAAsB,EAAG,GAAG,CAAC;IAC7B,mBAAmB,EAAG,GAAG,CAAC;IAC1B,8BAA8B,EAAG,GAAG,CAAC;IACrC,0BAA0B,EAAG,GAAG,CAAC;IACjC,sBAAsB,EAAG,GAAG,CAAC;IAC7B,iBAAiB,EAAG,GAAG,CAAC;IACxB,yBAAyB,EAAG,GAAG,CAAC;IAChC,kBAAkB,EAAG,GAAG,CAAC;IACzB,gBAAgB,EAAG,GAAG,CAAC;IACvB,iBAAiB,EAAG,GAAG,CAAA;CACxB;AAGD,eAAO,MAAM,aAAa,EAAG,IAqF5B,CAAC;AAKF,eAAO,MAAM,YAAY,GAAc,YAAW,GAAG,SA6BpD,CAAA"}
@@ -1,76 +0,0 @@
1
- import { applyActionCode, beforeAuthStateChanged, checkActionCode, confirmPasswordReset, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, getRedirectResult, onAuthStateChanged, onIdTokenChanged, sendPasswordResetEmail } from "firebase/auth";
2
- import { auth } from "./start";
3
- export const authFunctions = {
4
- applyActionCode: {
5
- description: "Applies an out-of-band verification code (e.g., email verification).",
6
- action: (oobCode) => applyActionCode(auth, oobCode)
7
- .then(() => ({ success: true }))
8
- .catch((error) => ({ error: error.code, message: error.message }))
9
- },
10
- checkActionCode: {
11
- description: "Checks the metadata of an out-of-band verification code.",
12
- action: (code) => checkActionCode(auth, code)
13
- .then((info) => ({ info }))
14
- .catch((error) => ({ error: error.code, message: error.message }))
15
- },
16
- beforeAuthStateChanged: {
17
- description: 'Adds a blocking callback that runs before an auth state change sets a new user.',
18
- code: (callback, onAbort) => beforeAuthStateChanged(auth, callback, onAbort)
19
- },
20
- confirmPasswordReset: {
21
- description: "Completes the password reset process with a code and new password.",
22
- action: (code, newPassword) => confirmPasswordReset(auth, code, newPassword)
23
- .then(() => ({ success: true }))
24
- .catch((error) => ({ error: error.code, message: error.message }))
25
- },
26
- sendPasswordResetEmail: {
27
- description: "Sends a password reset email to the user.",
28
- action: (email) => sendPasswordResetEmail(auth, email)
29
- .then(() => ({ success: true }))
30
- .catch(error => ({ error: error.code, message: error.message }))
31
- },
32
- connectAuthEmulator: {},
33
- createUserWithEmailAndPassword: {
34
- description: "Creates a new user account with email and password, and signs them in.",
35
- action: (email, password) => createUserWithEmailAndPassword(auth, email, password)
36
- .then((userCredential) => ({ user: userCredential.user }))
37
- .catch((error) => ({ error: error.code, message: error.message }))
38
- },
39
- fetchSignInMethodsForEmail: {
40
- description: "Gets the list of sign-in methods for a given email.",
41
- action: (email) => fetchSignInMethodsForEmail(auth, email)
42
- .then((methods) => ({ methods }))
43
- .catch((error) => ({ error: error.code, message: error.message }))
44
- },
45
- getMultiFactorResolver: {},
46
- getRedirectResult: {
47
- description: "Retrieves the result of a redirect-based sign-in flow.",
48
- action: () => getRedirectResult(auth)
49
- .then((result) => ({ user: result.user }))
50
- .catch((error) => ({ error: error.code, message: error.message }))
51
- },
52
- initializeRecaptchaConfig: {},
53
- onAuthStateChanged: {
54
- description: "Listens for changes in the authentication state.",
55
- action: (callback) => onAuthStateChanged(auth, callback)
56
- },
57
- onIdTokenChanged: {
58
- description: "Listens for changes in the ID token.",
59
- action: (callback) => onIdTokenChanged(auth, callback)
60
- },
61
- revokeAccessToken: {}
62
- };
63
- export const recoverEmail = (actionCode) => {
64
- let restoredEmail = null;
65
- checkActionCode(auth, actionCode).then((info) => {
66
- restoredEmail = info['data']['email'];
67
- return applyActionCode(auth, actionCode);
68
- }).then(() => {
69
- sendPasswordResetEmail(auth, restoredEmail).then(() => {
70
- }).catch((error) => {
71
- console.log(error);
72
- });
73
- }).catch((error) => {
74
- console.log(error);
75
- });
76
- };