pwa-auth 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -26
- package/README.md +102 -104
- package/demo/index.html +11 -5
- package/demo/styles.css +12 -7
- package/deploy/interface.d.ts +37 -0
- package/deploy/interface.d.ts.map +1 -0
- package/deploy/interface.js +176 -0
- package/deploy/start.d.ts.map +1 -1
- package/npm/pwa-styles.css +66 -0
- package/package.json +1 -1
- package/deploy/custom-elements/drawer/css/visibility.d.ts +0 -3
- package/deploy/custom-elements/drawer/css/visibility.d.ts.map +0 -1
- package/deploy/custom-elements/drawer/css/visibility.js +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
==========
|
|
3
|
+
All notable changes to pwa-auth.js will be documented in this file.
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
- Social Login Flow
|
|
7
|
+
- animated login and data
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
# [2.0.4] - 2025-09-31
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
## Changed
|
|
12
|
+
- updated readme file
|
|
13
|
+
|
|
14
|
+
## Goals
|
|
15
|
+
- Photo Editor
|
|
16
|
+
- Password Verifier
|
|
17
|
+
- Email Verifier
|
|
14
18
|
|
|
15
19
|
# [1.2.4] - 2025-08-31
|
|
16
20
|
|
|
@@ -46,23 +50,6 @@ Security - in case of vulnerabilities.
|
|
|
46
50
|
## REMOVED
|
|
47
51
|
- Telephone Verification for version 1 simplicity
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## [Unreleased]
|
|
54
|
-
- Facebook Login
|
|
55
|
-
- Phone Login
|
|
56
|
-
- Play Games Login
|
|
57
|
-
- X Login
|
|
58
|
-
- Github Login
|
|
59
|
-
- display nested content after webcomponent loads
|
|
60
|
-
- create password after social Login
|
|
61
|
-
- animated login
|
|
62
|
-
- animated data
|
|
63
|
-
- update user info upon change submission
|
|
64
|
-
- change user-icon to "Login" text
|
|
65
|
-
|
|
66
53
|
## [1.0.0] - 2025-08-04
|
|
67
54
|
|
|
68
55
|
## To Do
|
|
@@ -152,4 +139,15 @@ Security - in case of vulnerabilities.
|
|
|
152
139
|
- settings > profile: user dashbaord
|
|
153
140
|
|
|
154
141
|
### Removed
|
|
155
|
-
- `<user-drawer>`: Custom Drawer Header Text
|
|
142
|
+
- `<user-drawer>`: Custom Drawer Header Text
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# Footnotes
|
|
146
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
147
|
+
|
|
148
|
+
Added - for new features.
|
|
149
|
+
Changed - for changes in existing functionality.
|
|
150
|
+
Deprecated - for soon-to-be removed features.
|
|
151
|
+
Removed - for now removed features.
|
|
152
|
+
Fixed - for any bug fixes.
|
|
153
|
+
Security - in case of vulnerabilities.
|
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@ pwa-auth.js is a bundle of 3 Custom HTML Elements for Firebase (IAM) Authenicati
|
|
|
6
6
|
|
|
7
7
|
You will learn how to reference, initialize, and place 3 Custom HTML Tags for use. By either <b>Standard</b> or <b>Modular</b> ECMA Script.
|
|
8
8
|
|
|
9
|
-
Authentication Components are for anyone who is looking for a quick and simple way to sign-up, log-in, log-out, modify, or delete a firebase account from thier own personal domain.
|
|
9
|
+
pwa-auth.js (Authentication Components) are for anyone who is looking for a quick and simple way to sign-up, log-in, log-out, modify, or delete a firebase account information from thier own personal domain.
|
|
10
10
|
|
|
11
|
-
Jack's Publishing is dedicated to maintaining components for your projects. This specific project is
|
|
11
|
+
Jack's Publishing is dedicated to maintaining components for your projects. This specific project is designed to be simple, by meeting basic user needs with the interplay of an Icon Button, Drop-down Drawer, and a Settings Page.
|
|
12
12
|
|
|
13
13
|
Continue reading to start installing the bundle:
|
|
14
14
|
- Pick the JavaScript File Type to Reference
|
|
@@ -18,107 +18,108 @@ Continue reading to start installing the bundle:
|
|
|
18
18
|
- Color Scheme: CSS Custom Properties
|
|
19
19
|
- Firebase Initialization
|
|
20
20
|
|
|
21
|
-
[Live Demo](https://pwa-authentic.firebaseapp.com)
|
|
21
|
+
## [Visit: Live Demo](https://pwa-authentic.firebaseapp.com)
|
|
22
22
|
|
|
23
|
-
##
|
|
24
|
-
- copy the bundle: node_modules/pwa-auth/npm/pwa-auth.js
|
|
25
|
-
|
|
26
|
-
## Modular JavaScript
|
|
27
|
-
```javascript
|
|
28
|
-
import 'pwa-auth';
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Technological Stack
|
|
32
|
-
- Development Environment: [Node JavaScript](https://nodejs.org)
|
|
33
|
-
- Backend: Google Cloud: [Firebase](https://firebase.google.com/)
|
|
34
|
-
- Predicate State Behavior: [Redux](https://redux.js.org/)
|
|
35
|
-
- Frontend: [Lit](https://lit.dev)
|
|
36
|
-
|
|
37
|
-
## PWA-AUTH Features:
|
|
23
|
+
## pwa-auth.js Features:
|
|
38
24
|
- Register through Email and Password
|
|
39
|
-
- Log-in
|
|
40
|
-
- Log-out
|
|
25
|
+
- Log-in
|
|
26
|
+
- Log-out
|
|
41
27
|
- Change Username
|
|
42
28
|
- Change Profile Picture
|
|
43
29
|
- Change Email
|
|
44
30
|
- Change Password
|
|
45
|
-
- Delete Account
|
|
31
|
+
- Delete Account
|
|
32
|
+
|
|
33
|
+
## Standard JavaScript
|
|
34
|
+
- copy the bundle
|
|
35
|
+
- node_modules/pwa-auth/npm/pwa-auth.js
|
|
36
|
+
|
|
37
|
+
## Modular JavaScript
|
|
38
|
+
```javascript
|
|
39
|
+
import 'pwa-auth';
|
|
40
|
+
```
|
|
46
41
|
|
|
47
42
|
## Boilerplate
|
|
48
|
-
- 3 Tag Placements (Custom
|
|
43
|
+
- 3 Tag Placements (HTML - Custom Elements)
|
|
49
44
|
- user-icon
|
|
50
45
|
- user-drawer
|
|
51
46
|
- user-settings
|
|
52
|
-
- Cascading Style Sheets (CSS)
|
|
47
|
+
- Cascading Style Sheets (CSS - Custom Properties)
|
|
53
48
|
- ECMA Script (JavaScript)
|
|
54
49
|
|
|
55
|
-
## Custom Elements
|
|
56
|
-
|
|
50
|
+
## HTML Custom Elements
|
|
57
51
|
```html
|
|
58
|
-
<
|
|
52
|
+
<head>
|
|
53
|
+
|
|
54
|
+
<!-- CSS Custom Properties - Choice 1: Link Tag -->
|
|
55
|
+
<link type="stylesheet" href="pwa-styles.css">
|
|
56
|
+
|
|
57
|
+
</head>
|
|
58
|
+
|
|
59
|
+
<body>
|
|
60
|
+
|
|
61
|
+
<header>
|
|
62
|
+
<!-- subscribe property: (Initial State): Subscribe -->
|
|
63
|
+
<!-- subscribe property: else (Initial State): Login -->
|
|
64
|
+
<!-- Logged-out (State): txt: Login Button -->
|
|
65
|
+
<!-- Logged-out (State): txt: Subscribe Button -->
|
|
66
|
+
<!-- Logged-in (State): photo: Icon Button -->
|
|
67
|
+
<user-icon subscribe></user-icon>
|
|
68
|
+
</header>
|
|
69
|
+
|
|
70
|
+
<!-- settingsURL property: location of <pwa-settings> Tag -->
|
|
71
|
+
<!-- subscribe property: (Initial State): Subscribe -->
|
|
72
|
+
<!-- subscribe property: else (Initial State): Login -->
|
|
73
|
+
<!-- Top-down, Drop-down Feature: height, 1.4 seconds -->
|
|
74
|
+
<!-- logged-out (State): Sign-up by Email Addresses and Password -->
|
|
75
|
+
<!-- logged-out (State): Sign-in by Email Addresses and Password -->
|
|
76
|
+
<!-- logged-in (State): Settings Page Link, Log-out Button -->
|
|
77
|
+
<user-drawer subscribe settingsURL="/settings"></user-drawer>
|
|
78
|
+
|
|
79
|
+
<main>
|
|
80
|
+
<!-- 1 Photo Upload Feature, view uploaded bucket of photos, photo ediotr -->
|
|
81
|
+
<!-- Unavailable Photo -->
|
|
82
|
+
<!-- Update Username -->
|
|
83
|
+
<!-- Update Email / Verify -->
|
|
84
|
+
<!-- Update Password -->
|
|
85
|
+
<!-- Delete Account, Photos, Information -->
|
|
86
|
+
<user-settings></user-settings>
|
|
87
|
+
</main>
|
|
88
|
+
|
|
89
|
+
<script>/* Initialize ECMA Script Properties */</script>
|
|
90
|
+
<style>/* CSS Custom Properties - Choice 2: Style Tag */</style>
|
|
91
|
+
<script src="pwa-auth.js"></script>
|
|
92
|
+
|
|
93
|
+
</body>
|
|
59
94
|
```
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```html
|
|
64
|
-
<user-drawer subscribe settingsURL=""></user-drawer>
|
|
65
|
-
```
|
|
66
|
-
- Drop-down
|
|
67
|
-
- Sign-up by Email Addresses and Password
|
|
68
|
-
- Sign-in by Email Addresses and Password
|
|
69
|
-
- logged-in state
|
|
70
|
-
- logged-out state
|
|
71
|
-
|
|
72
|
-
```html
|
|
73
|
-
<user-settings></user-settings>
|
|
74
|
-
```
|
|
75
|
-
- 1 Photo Upload
|
|
76
|
-
- Unavailable Photo
|
|
77
|
-
- Update Username
|
|
78
|
-
- Update Email / Verify
|
|
79
|
-
- Update Password
|
|
80
|
-
- Delete Account
|
|
81
|
-
|
|
82
|
-
# Website Setup:
|
|
83
|
-
```html
|
|
84
|
-
<header>
|
|
85
|
-
<!-- subscribe: Indicate the 'register' boolean for 'subscribe state' -->
|
|
86
|
-
<!-- subscribe: else 'login state' -->
|
|
87
|
-
<user-icon subscribe></user-icon>
|
|
88
|
-
</header>
|
|
89
|
-
|
|
90
|
-
<!-- settingsURL: where the <pwa-settings> Tag will be placed-->
|
|
91
|
-
<!-- subscribe: boolean for 'subscribe state' -->
|
|
92
|
-
<!-- subscribe: else 'login state' -->
|
|
93
|
-
<user-drawer subscribe settingsURL="/settings"></user-drawer>
|
|
94
|
-
|
|
95
|
-
<main>
|
|
96
|
-
<user-settings></user-settings>
|
|
97
|
-
</main>
|
|
98
|
-
|
|
99
|
-
<script>/* Initialize ECMA Script Properties */</script>
|
|
100
|
-
<style>/* CSS Custom Properties */</style>
|
|
101
|
-
<script src="pwa-auth.js"></script>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## CSS Default Custom Properties
|
|
105
|
-
| CSS Custom Property | Description | Default | Custom Element |
|
|
95
|
+
## CSS Custom Properties
|
|
96
|
+
| Custom Namespace | Description | Default | Custom Element |
|
|
106
97
|
| :--- | ---: | :---: | :--- |
|
|
107
|
-
| --
|
|
108
|
-
| --
|
|
109
|
-
| --
|
|
110
|
-
| --
|
|
111
|
-
| --
|
|
112
|
-
| --
|
|
113
|
-
| --
|
|
114
|
-
| --
|
|
115
|
-
| --
|
|
116
|
-
| --
|
|
117
|
-
| --
|
|
118
|
-
| --
|
|
119
|
-
| --
|
|
120
|
-
| --
|
|
121
|
-
|
|
98
|
+
| --pwa_icon_background | Button | #6cc04a; | user-icon |
|
|
99
|
+
| --pwa_icon_hover | Button | lightgrey | user-icon |
|
|
100
|
+
| --pwa_icon_border | Button | 2px solid black | user-icon |
|
|
101
|
+
| --pwa_icon_height (sync) | Login State | 32px | user-icon |
|
|
102
|
+
| --pwa_icon_padding | Login State | 0px 16px | user-icon |
|
|
103
|
+
| --pwa_icon_radius | Login State | 6px | user-icon |
|
|
104
|
+
| --pwa_icon_font | Login State | 'Arial', sans-serif | user-icon |
|
|
105
|
+
| --pwa_icon_diameter (sync) | Icon State | 32px | user-icon |
|
|
106
|
+
| --pwa_drawer_border | Drawer | 3px #303030 solid | user-drawer |
|
|
107
|
+
| --pwa_drawer_z-index | Drawer | 2 | user-drawer |
|
|
108
|
+
| --pwa_drawer_border-radius | Drawer | 20px | user-drawer |
|
|
109
|
+
| --pwa_drawer_text_color | Input txt | #303030 | user-drawer |
|
|
110
|
+
| --pwa_drawer_background_color | Input txt | #fff | user-drawer |
|
|
111
|
+
| --pwa_settings_background | Navigation | grey | user-settings |
|
|
112
|
+
| --pwa_nav_button | Navigation | grey | user-settings |
|
|
113
|
+
| --pwa_nav_select | Navigation | black | user-settings |
|
|
114
|
+
| --pwa_divider | Divider | grey | user-settings |
|
|
115
|
+
| --pwa_input_background | Input | #E1E5EB | user-settings |
|
|
116
|
+
| --pwa_label_text_color | Input | black | user-settings |
|
|
117
|
+
| --pwa_section_header | Header | black | user-settings |
|
|
118
|
+
| --pwa_action_text_color | Button | #fff | user-settings |
|
|
119
|
+
| --pwa_action_background_color | Button | #6cc04a | user-settings |
|
|
120
|
+
| --pwa_action_border_color | Button | #60b23e | user-settings |
|
|
121
|
+
|
|
122
|
+
## CSS Setup
|
|
122
123
|
```html
|
|
123
124
|
<!-- CSS: Custom Variables -->
|
|
124
125
|
<!-- Place this txt into your document -->
|
|
@@ -136,7 +137,7 @@ import 'pwa-auth';
|
|
|
136
137
|
/* WebComponent 1: logged-out
|
|
137
138
|
<user-icon>
|
|
138
139
|
<button class="login"> */
|
|
139
|
-
--pwa_icon_height: 32px;
|
|
140
|
+
--pwa_icon_height: 32px; /* sync to --pwa_icon_diameter */
|
|
140
141
|
--pwa_icon_padding: 0px 16px;
|
|
141
142
|
--pwa_icon_radius: 6px;
|
|
142
143
|
--pwa_icon_font: 'Arial', sans-serif;
|
|
@@ -144,7 +145,7 @@ import 'pwa-auth';
|
|
|
144
145
|
/* WebComponent 1: logged-in
|
|
145
146
|
<user-icon>
|
|
146
147
|
<button class="icon"> */
|
|
147
|
-
--pwa_icon_diameter:
|
|
148
|
+
--pwa_icon_diameter: 32px; /* sync to --pwa_icon_height */
|
|
148
149
|
|
|
149
150
|
|
|
150
151
|
|
|
@@ -162,9 +163,6 @@ import 'pwa-auth';
|
|
|
162
163
|
--pwa_drawer_text_color: #303030;
|
|
163
164
|
--pwa_drawer_background_color: #fff;
|
|
164
165
|
|
|
165
|
-
/* WebComponent 2: Drop-down Drawer - logged-in
|
|
166
|
-
<div class="spec" on> */
|
|
167
|
-
|
|
168
166
|
|
|
169
167
|
|
|
170
168
|
/* WebComponent 3: Settings Page
|
|
@@ -179,7 +177,7 @@ import 'pwa-auth';
|
|
|
179
177
|
--pwa_nav_select: black;
|
|
180
178
|
|
|
181
179
|
/* Section Header */
|
|
182
|
-
--pwa_section_header:
|
|
180
|
+
--pwa_section_header: black;
|
|
183
181
|
|
|
184
182
|
/* Label */
|
|
185
183
|
--pwa_label_text_color: black;
|
|
@@ -194,25 +192,19 @@ import 'pwa-auth';
|
|
|
194
192
|
|
|
195
193
|
}
|
|
196
194
|
|
|
197
|
-
/* Dark Theme */
|
|
198
|
-
@media (prefers-color-scheme: dark) { /* etc. */ }
|
|
199
|
-
|
|
200
|
-
/* Light Theme */
|
|
201
|
-
@media (prefers-color-scheme: light) { /* etc. */ }
|
|
202
|
-
|
|
203
195
|
</style>
|
|
204
196
|
```
|
|
197
|
+
# JavaScript Setup
|
|
205
198
|
|
|
206
|
-
## Google
|
|
199
|
+
## Google
|
|
207
200
|
- Google Analytics
|
|
208
201
|
- Firebase Project
|
|
209
202
|
|
|
210
|
-
## Firebase
|
|
203
|
+
## Firebase
|
|
211
204
|
- Authentication - email login
|
|
212
205
|
- Cloud Storage - icon save location
|
|
213
206
|
|
|
214
|
-
|
|
215
|
-
### Modular Firebase Initialization
|
|
207
|
+
### Initialize Modular Firebase Instance Configuration
|
|
216
208
|
```javascript
|
|
217
209
|
// Initialize Firebase
|
|
218
210
|
let connect = {
|
|
@@ -230,11 +222,17 @@ if (lolalhost) { connect = { /* etc. */ } }
|
|
|
230
222
|
```
|
|
231
223
|
|
|
232
224
|
### Global Namespaced Firebase Configuration
|
|
233
|
-
pwa-auth is built upon the Firebase SDK (Software Development Kit).
|
|
225
|
+
pwa-auth.js is built upon the Firebase SDK (Software Development Kit).
|
|
234
226
|
The entire bundle is one instance of firebase that takes in the configuration information, internally.
|
|
235
227
|
|
|
236
228
|
If you are looking for a Namespaced Firebase Configuration, please send it as feedback, and will make that version for you.
|
|
237
229
|
|
|
230
|
+
# Technological Engineering
|
|
231
|
+
- Development Environment: [Node JavaScript](https://nodejs.org)
|
|
232
|
+
- Backend: Google Cloud: [Firebase](https://firebase.google.com/)
|
|
233
|
+
- Predicate State Behavior: [Redux](https://redux.js.org/)
|
|
234
|
+
- Frontend: [Lit](https://lit.dev)
|
|
235
|
+
|
|
238
236
|
# Feedback
|
|
239
237
|
All feedback, comments, bugs, and requests are welcome.
|
|
240
238
|
* [Jack's Publishing](https://www.jackspublishing.com)
|
package/demo/index.html
CHANGED
|
@@ -45,9 +45,6 @@
|
|
|
45
45
|
|
|
46
46
|
<header>
|
|
47
47
|
|
|
48
|
-
<!-- Sponsor Me -->
|
|
49
|
-
<iframe src="https://github.com/sponsors/busynest/button" title="Sponsor busynest" height="32" width="114" style="border: 0; border-radius: 6px; margin: auto 0 auto 0;"></iframe>
|
|
50
|
-
|
|
51
48
|
<!-- Icon Tag -->
|
|
52
49
|
<user-icon subscribe></user-icon>
|
|
53
50
|
|
|
@@ -63,6 +60,15 @@
|
|
|
63
60
|
|
|
64
61
|
</main>
|
|
65
62
|
|
|
63
|
+
<footer>
|
|
64
|
+
|
|
65
|
+
<div style="margin: auto">
|
|
66
|
+
<!-- Sponsor Me -->
|
|
67
|
+
<iframe src="https://github.com/sponsors/busynest/button" title="Sponsor busynest" height="32" width="114" style="border: 0; border-radius: 6px; margin: auto 0 auto 0;"></iframe>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
</footer>
|
|
71
|
+
|
|
66
72
|
<!-- CSS: Custom Variables: <head> tag -->
|
|
67
73
|
<style>
|
|
68
74
|
|
|
@@ -78,7 +84,7 @@
|
|
|
78
84
|
/* WebComponent 1: logged-out
|
|
79
85
|
<user-icon>
|
|
80
86
|
<button class="login"> */
|
|
81
|
-
--pwa_icon_height: 32px;
|
|
87
|
+
--pwa_icon_height: 32px; /* sync to --pwa_icon_diameter */
|
|
82
88
|
--pwa_icon_padding: 0px 16px;
|
|
83
89
|
--pwa_icon_radius: 6px;
|
|
84
90
|
--pwa_icon_font: 'Arial', sans-serif;
|
|
@@ -86,7 +92,7 @@
|
|
|
86
92
|
/* WebComponent 1: logged-in
|
|
87
93
|
<user-icon>
|
|
88
94
|
<button class="icon"> */
|
|
89
|
-
--pwa_icon_diameter:
|
|
95
|
+
--pwa_icon_diameter: 32px; /* sync to --pwa_icon_height */
|
|
90
96
|
|
|
91
97
|
|
|
92
98
|
|
package/demo/styles.css
CHANGED
|
@@ -22,22 +22,27 @@ body {
|
|
|
22
22
|
grid-gap: 16px;
|
|
23
23
|
grid-template-areas:
|
|
24
24
|
"head"
|
|
25
|
-
"main"
|
|
26
|
-
|
|
25
|
+
"main"
|
|
26
|
+
"foot";
|
|
27
|
+
grid-template-rows: auto 1fr auto;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
header { grid-area: head; }
|
|
30
31
|
main { grid-area: main; }
|
|
32
|
+
footer { grid-area: foot; }
|
|
31
33
|
|
|
32
34
|
header {
|
|
33
|
-
display:
|
|
34
|
-
grid-template-columns: 1fr auto;
|
|
35
|
+
display: grid;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
main {
|
|
38
|
-
border:
|
|
39
|
-
border-radius:
|
|
40
|
-
overflow:
|
|
39
|
+
border: 2px solid black;
|
|
40
|
+
border-radius: 6px;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
footer {
|
|
45
|
+
display: grid;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
body {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface base {
|
|
2
|
+
applyActionCode: any;
|
|
3
|
+
beforeAuthStateChanged: any;
|
|
4
|
+
checkActionCode: any;
|
|
5
|
+
confirmPasswordReset: any;
|
|
6
|
+
connectAuthEmulator: any;
|
|
7
|
+
createUserWithEmailAndPassword: any;
|
|
8
|
+
fetchSignInMethodsForEmail: any;
|
|
9
|
+
getMultiFactorResolver: any;
|
|
10
|
+
getRedirectResult: any;
|
|
11
|
+
initializeRecaptchaConfig: any;
|
|
12
|
+
isSignInWithEmailLink: any;
|
|
13
|
+
onAuthStateChanged: any;
|
|
14
|
+
onIdTokenChanged: any;
|
|
15
|
+
revokeAccessToken: any;
|
|
16
|
+
sendPasswordResetEmail: any;
|
|
17
|
+
sendSignInLinkToEmail: any;
|
|
18
|
+
setPersistence: any;
|
|
19
|
+
signInAnonymously: any;
|
|
20
|
+
signInWithCredential: any;
|
|
21
|
+
signInWithCustomToken: any;
|
|
22
|
+
signInWithEmailAndPassword: any;
|
|
23
|
+
signInWithEmailLink: any;
|
|
24
|
+
signInWithPhoneNumber: any;
|
|
25
|
+
signInWithPopup: any;
|
|
26
|
+
signInWithRedirect: any;
|
|
27
|
+
signOut: any;
|
|
28
|
+
updateCurrentUser: any;
|
|
29
|
+
useDeviceLanguage: any;
|
|
30
|
+
validatePassword: any;
|
|
31
|
+
verifyPasswordResetCode: any;
|
|
32
|
+
handleRecoverEmail: any;
|
|
33
|
+
sendEmailVerification: any;
|
|
34
|
+
}
|
|
35
|
+
export declare const authFunctions: base;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAIA,UAAU,IAAI;IAEd,eAAe,EAAG,GAAG,CAAC;IACtB,sBAAsB,EAAG,GAAG,CAAC;IAC7B,eAAe,EAAG,GAAG,CAAC;IACtB,oBAAoB,EAAG,GAAG,CAAC;IAC3B,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,qBAAqB,EAAG,GAAG,CAAC;IAC5B,kBAAkB,EAAG,GAAG,CAAC;IACzB,gBAAgB,EAAG,GAAG,CAAC;IACvB,iBAAiB,EAAG,GAAG,CAAC;IACxB,sBAAsB,EAAG,GAAG,CAAC;IAC7B,qBAAqB,EAAG,GAAG,CAAC;IAC5B,cAAc,EAAG,GAAG,CAAC;IACrB,iBAAiB,EAAG,GAAG,CAAC;IACxB,oBAAoB,EAAG,GAAG,CAAC;IAC3B,qBAAqB,EAAG,GAAG,CAAC;IAC5B,0BAA0B,EAAG,GAAG,CAAC;IACjC,mBAAmB,EAAG,GAAG,CAAC;IAC1B,qBAAqB,EAAG,GAAG,CAAC;IAC5B,eAAe,EAAG,GAAG,CAAC;IACtB,kBAAkB,EAAG,GAAG,CAAC;IACzB,OAAO,EAAG,GAAG,CAAC;IACd,iBAAiB,EAAG,GAAG,CAAC;IACxB,iBAAiB,EAAG,GAAG,CAAC;IACxB,gBAAgB,EAAG,GAAG,CAAC;IACvB,uBAAuB,EAAG,GAAG,CAAC;IAC9B,kBAAkB,EAAC,GAAG,CAAC;IACvB,qBAAqB,EAAE,GAAG,CAAA;CACzB;AAqDD,eAAO,MAAM,aAAa,EAAG,IA6O1B,CAAA"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { applyActionCode, beforeAuthStateChanged, checkActionCode, confirmPasswordReset, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, getRedirectResult, isSignInWithEmailLink, onAuthStateChanged, onIdTokenChanged, sendPasswordResetEmail, setPersistence, signInAnonymously, signInWithCredential, signInWithCustomToken, signInWithEmailAndPassword, signInWithEmailLink, signInWithPhoneNumber, signInWithPopup, signInWithRedirect, signOut, updateCurrentUser, useDeviceLanguage, verifyPasswordResetCode } 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
|
+
example: (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
|
+
example: (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
|
+
example: (code, newPassword) => confirmPasswordReset(auth, code, newPassword)
|
|
23
|
+
.then(() => ({ success: true }))
|
|
24
|
+
.catch((error) => ({ error: error.code, message: error.message }))
|
|
25
|
+
},
|
|
26
|
+
connectAuthEmulator: {},
|
|
27
|
+
createUserWithEmailAndPassword: {
|
|
28
|
+
description: "Creates a new user account with email and password, and signs them in.",
|
|
29
|
+
example: (email, password) => createUserWithEmailAndPassword(auth, email, password)
|
|
30
|
+
.then((userCredential) => ({ user: userCredential.user }))
|
|
31
|
+
.catch((error) => ({ error: error.code, message: error.message }))
|
|
32
|
+
},
|
|
33
|
+
fetchSignInMethodsForEmail: {
|
|
34
|
+
description: "Gets the list of sign-in methods for a given email.",
|
|
35
|
+
example: (email) => fetchSignInMethodsForEmail(auth, email)
|
|
36
|
+
.then((methods) => ({ methods }))
|
|
37
|
+
.catch((error) => ({ error: error.code, message: error.message }))
|
|
38
|
+
},
|
|
39
|
+
getMultiFactorResolver: {},
|
|
40
|
+
getRedirectResult: {
|
|
41
|
+
description: "Retrieves the result of a redirect-based sign-in flow.",
|
|
42
|
+
example: () => getRedirectResult(auth)
|
|
43
|
+
.then((result) => ({ user: result.user }))
|
|
44
|
+
.catch((error) => ({ error: error.code, message: error.message }))
|
|
45
|
+
},
|
|
46
|
+
initializeRecaptchaConfig: {},
|
|
47
|
+
isSignInWithEmailLink: {
|
|
48
|
+
description: "Checks if a link is a valid sign-in with email link.",
|
|
49
|
+
example: (link) => isSignInWithEmailLink(auth, link)
|
|
50
|
+
},
|
|
51
|
+
onAuthStateChanged: {
|
|
52
|
+
description: "Listens for changes in the authentication state.",
|
|
53
|
+
example: (callback) => onAuthStateChanged(auth, callback)
|
|
54
|
+
},
|
|
55
|
+
signOut: {
|
|
56
|
+
description: "Signs out the current user.",
|
|
57
|
+
example: () => signOut(auth)
|
|
58
|
+
.then(() => ({ success: true }))
|
|
59
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
60
|
+
},
|
|
61
|
+
onIdTokenChanged: {
|
|
62
|
+
description: "Listens for changes in the ID token.",
|
|
63
|
+
example: (callback) => onIdTokenChanged(auth, callback)
|
|
64
|
+
},
|
|
65
|
+
handleRecoverEmail(actionCode, lang) {
|
|
66
|
+
let restoredEmail = null;
|
|
67
|
+
checkActionCode(auth, actionCode).then((info) => {
|
|
68
|
+
restoredEmail = info['data']['email'];
|
|
69
|
+
return applyActionCode(auth, actionCode);
|
|
70
|
+
}).then(() => {
|
|
71
|
+
sendPasswordResetEmail(auth, restoredEmail).then(() => {
|
|
72
|
+
}).catch((error) => {
|
|
73
|
+
});
|
|
74
|
+
}).catch((error) => {
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
signInWithEmailAndPassword: {
|
|
78
|
+
description: "Signs in a user with email and password.",
|
|
79
|
+
example: (email, password) => signInWithEmailAndPassword(auth, email, password)
|
|
80
|
+
.then(userCredential => ({ user: userCredential.user }))
|
|
81
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
82
|
+
},
|
|
83
|
+
signInWithPopup: {
|
|
84
|
+
description: "Signs in a user via a popup with a federated provider (e.g., Google, Facebook).",
|
|
85
|
+
example: (provider) => signInWithPopup(auth, provider)
|
|
86
|
+
.then(result => ({ user: result.user }))
|
|
87
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
88
|
+
},
|
|
89
|
+
signInWithRedirect: {
|
|
90
|
+
description: "Signs in a user via redirect with a federated provider.",
|
|
91
|
+
example: (provider) => signInWithRedirect(auth, provider)
|
|
92
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
93
|
+
},
|
|
94
|
+
signInAnonymously: {
|
|
95
|
+
description: "Signs in a user anonymously without credentials.",
|
|
96
|
+
example: () => signInAnonymously(auth)
|
|
97
|
+
.then(userCredential => ({ user: userCredential.user }))
|
|
98
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
99
|
+
},
|
|
100
|
+
signInWithCustomToken: {
|
|
101
|
+
description: "Signs in a user with a custom token from an external auth system.",
|
|
102
|
+
example: (token) => signInWithCustomToken(auth, token)
|
|
103
|
+
.then(userCredential => ({ user: userCredential.user }))
|
|
104
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
105
|
+
},
|
|
106
|
+
signInWithEmailLink: {
|
|
107
|
+
description: "Signs in a user with an email link.",
|
|
108
|
+
example: (email, link) => signInWithEmailLink(auth, email, link)
|
|
109
|
+
.then(userCredential => ({ user: userCredential.user }))
|
|
110
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
111
|
+
},
|
|
112
|
+
signInWithPhoneNumber: {
|
|
113
|
+
description: "Signs in a user with a phone number and verification code.",
|
|
114
|
+
example: (phoneNumber, appVerifier) => signInWithPhoneNumber(auth, phoneNumber, appVerifier)
|
|
115
|
+
.then(confirmationResult => ({ confirmationResult }))
|
|
116
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
117
|
+
},
|
|
118
|
+
signInWithCredential: {
|
|
119
|
+
description: "Signs in a user with a credential object (e.g., from OAuth).",
|
|
120
|
+
example: (credential) => signInWithCredential(auth, credential)
|
|
121
|
+
.then(userCredential => ({ user: userCredential.user }))
|
|
122
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
123
|
+
},
|
|
124
|
+
updateCurrentUser: {
|
|
125
|
+
description: "Updates the current user with a new User object.",
|
|
126
|
+
example: (user) => updateCurrentUser(auth, user)
|
|
127
|
+
.then(() => ({ success: true }))
|
|
128
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
129
|
+
},
|
|
130
|
+
sendPasswordResetEmail: {
|
|
131
|
+
description: "Sends a password reset email to the user.",
|
|
132
|
+
example: (email) => sendPasswordResetEmail(auth, email)
|
|
133
|
+
.then(() => ({ success: true }))
|
|
134
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
135
|
+
},
|
|
136
|
+
verifyPasswordResetCode: {
|
|
137
|
+
description: "Verifies a password reset code sent to the user.",
|
|
138
|
+
example: (code) => verifyPasswordResetCode(auth, code)
|
|
139
|
+
.then(email => ({ email }))
|
|
140
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
141
|
+
},
|
|
142
|
+
sendEmailVerification: {
|
|
143
|
+
description: "Sends an email verification to the current user.",
|
|
144
|
+
example: (user) => user.sendEmailVerification()
|
|
145
|
+
.then(() => ({ success: true }))
|
|
146
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
147
|
+
},
|
|
148
|
+
setPersistence: {
|
|
149
|
+
description: "Sets the persistence mechanism for auth state.",
|
|
150
|
+
example: (persistence) => setPersistence(auth, persistence)
|
|
151
|
+
.then(() => ({ success: true }))
|
|
152
|
+
.catch(error => ({ error: error.code, message: error.message }))
|
|
153
|
+
},
|
|
154
|
+
useDeviceLanguage: {
|
|
155
|
+
description: "Sets the auth instance language to the device's language.",
|
|
156
|
+
example: () => useDeviceLanguage(auth)
|
|
157
|
+
},
|
|
158
|
+
self, : .onmessage = (event) => {
|
|
159
|
+
const { action, data } = event.data;
|
|
160
|
+
if (action === 'executeAuthFunction' && authFunctions[data.functionName]) {
|
|
161
|
+
authFunctions[data.functionName].example(...(data.args || []))
|
|
162
|
+
.then(result => self.postMessage({ status: 'success', result }))
|
|
163
|
+
.catch(error => self.postMessage({ status: 'error', error }));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
self.postMessage({ status: 'error', error: 'Invalid function or request' });
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
self, : .postMessage({
|
|
170
|
+
status: 'init',
|
|
171
|
+
authFunctions: Object.keys(authFunctions).map(key => ({
|
|
172
|
+
name: key,
|
|
173
|
+
description: authFunctions[key].description
|
|
174
|
+
}))
|
|
175
|
+
})
|
|
176
|
+
};
|
package/deploy/start.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,WAAW,EAAiB,MAAM,cAAc,CAAC;AAG1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAA+D,MAAM,eAAe,CAAC;AAGxG,OAAO,EAAgB,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAG7E,OAAO,EAAc,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAiBhE,eAAO,MAAM,WAAW,EAAM,WAA0C,CAAC;AACzE,eAAO,MAAM,EAAE,EAAe,SAA6C,CAAC;AAC5E,eAAO,MAAM,OAAO,EAAU,eAA2C,CAAC;AAC1E,eAAO,MAAM,IAAI,EAAa,IAAwC,CAAC;AACvE,eAAO,MAAM,IAAI,EAAa,IAAI,GAAG,IAA6B,CAAC;AA+HnE,eAAO,MAAM,MAAM,qBAAoD,CAAC;AACxE,eAAO,MAAM,UAAU,qBAAiE,CAAC;AACzF,eAAO,MAAM,gBAAgB,qBAA2D,CAAC;AACzF,eAAO,MAAM,cAAc,GAAc,SAAQ,MAAM,EAAE,MAAK,MAAM,kBAInE,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
|
|
3
|
+
/* WebComponent 1 : User Icon
|
|
4
|
+
<user-icon>
|
|
5
|
+
<button> */
|
|
6
|
+
--pwa_icon_hover: lightgrey;
|
|
7
|
+
--pwa_icon_background: #6cc04a;
|
|
8
|
+
--pwa_icon_border: 2px solid black;
|
|
9
|
+
|
|
10
|
+
/* WebComponent 1: logged-out
|
|
11
|
+
<user-icon>
|
|
12
|
+
<button class="login"> */
|
|
13
|
+
--pwa_icon_height: 32px; /* sync to --pwa_icon_diameter */
|
|
14
|
+
--pwa_icon_padding: 0px 16px;
|
|
15
|
+
--pwa_icon_radius: 6px;
|
|
16
|
+
--pwa_icon_font: 'Arial', sans-serif;
|
|
17
|
+
|
|
18
|
+
/* WebComponent 1: logged-in
|
|
19
|
+
<user-icon>
|
|
20
|
+
<button class="icon"> */
|
|
21
|
+
--pwa_icon_diameter: 32px; /* sync to --pwa_icon_height */
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/* WebComponent 2: Drop-down Drawer
|
|
26
|
+
<user-drawer>
|
|
27
|
+
<section>
|
|
28
|
+
<header></header>
|
|
29
|
+
<div class="spec"> */
|
|
30
|
+
--pwa_drawer_border: 3px #303030 solid;
|
|
31
|
+
--pwa_drawer_z-index: 2;
|
|
32
|
+
--pwa_drawer_border-radius: 20px;
|
|
33
|
+
|
|
34
|
+
/* WebComponent 2: Drop-down Drawer - logged-out
|
|
35
|
+
<div class="spec"> */
|
|
36
|
+
--pwa_drawer_text_color: #303030;
|
|
37
|
+
--pwa_drawer_background_color: #fff;
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/* WebComponent 3: Settings Page
|
|
42
|
+
<user-settings>
|
|
43
|
+
<nav></nav>
|
|
44
|
+
<section></section> */
|
|
45
|
+
--pwa_settings_background: white;
|
|
46
|
+
--pwa_divider: black;
|
|
47
|
+
|
|
48
|
+
/* Navigation */
|
|
49
|
+
--pwa_nav_button: grey;
|
|
50
|
+
--pwa_nav_select: black;
|
|
51
|
+
|
|
52
|
+
/* Section Header */
|
|
53
|
+
--pwa_section_header: black;
|
|
54
|
+
|
|
55
|
+
/* Label */
|
|
56
|
+
--pwa_label_text_color: black;
|
|
57
|
+
|
|
58
|
+
/* Input */
|
|
59
|
+
--pwa_input_background: #E1E5EB;
|
|
60
|
+
|
|
61
|
+
/* Button */
|
|
62
|
+
--pwa_action_text_color: #fff;
|
|
63
|
+
--pwa_action_background_color: #6cc04a;
|
|
64
|
+
--pwa_action_border_color: #60b23e;
|
|
65
|
+
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pwa-auth",
|
|
3
3
|
"author": "Jacek Markiewicz <jack.solutionbox@gmail.com>(https://www.jackspublishing.com)",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.4",
|
|
5
5
|
"description": "User Management Component with 3 HTML Tags, and 1 Boilerplate Function to display user icon, sign up, login, log out, change account details, delete account.",
|
|
6
6
|
"homepage": "https://pwa-authentic.firebaseapp.com",
|
|
7
7
|
"main": "pwa-auth.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../../src/custom-elements/drawer/css/visibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC,eAAO,MAAM,UAAU,EAAE,SAsBxB,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
export const visibility = css `
|
|
3
|
-
/*
|
|
4
|
-
.visibility[on] {
|
|
5
|
-
visibility: visible;
|
|
6
|
-
transform: translate3d(0, 0, 0);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.visibility {
|
|
10
|
-
position: fixed;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
right: 0;
|
|
14
|
-
visibility: hidden;
|
|
15
|
-
will-change: transform;
|
|
16
|
-
transform: translate3d(0, -150%, 0);
|
|
17
|
-
transition-property: visibility, transform;
|
|
18
|
-
display: block;
|
|
19
|
-
}
|
|
20
|
-
*/
|
|
21
|
-
/* max-height is a programmed transition effect */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
`;
|