pwa-auth 2.0.2 → 2.0.3
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 +60 -56
- package/demo/index.html +11 -5
- package/demo/styles.css +12 -7
- package/deploy/interface.d.ts +36 -0
- package/deploy/interface.d.ts.map +1 -0
- package/deploy/interface.js +176 -0
- package/deploy/start.d.ts.map +1 -1
- 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/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
|
|
@@ -20,29 +20,30 @@ Continue reading to start installing the bundle:
|
|
|
20
20
|
|
|
21
21
|
[Live Demo](https://pwa-authentic.firebaseapp.com)
|
|
22
22
|
|
|
23
|
-
##
|
|
24
|
-
-
|
|
23
|
+
## pwa-auth.js Features:
|
|
24
|
+
- Register through Email and Password
|
|
25
|
+
- Log-in
|
|
26
|
+
- Log-out
|
|
27
|
+
- Change Username
|
|
28
|
+
- Change Profile Picture
|
|
29
|
+
- Change Email
|
|
30
|
+
- Change Password
|
|
31
|
+
- Delete Account
|
|
25
32
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
33
|
+
## Standard JavaScript
|
|
34
|
+
- copy the bundle
|
|
35
|
+
- node_modules/pwa-auth/npm/pwa-auth.js
|
|
30
36
|
|
|
31
|
-
## Technological
|
|
37
|
+
## Technological Engineering
|
|
32
38
|
- Development Environment: [Node JavaScript](https://nodejs.org)
|
|
33
39
|
- Backend: Google Cloud: [Firebase](https://firebase.google.com/)
|
|
34
40
|
- Predicate State Behavior: [Redux](https://redux.js.org/)
|
|
35
41
|
- Frontend: [Lit](https://lit.dev)
|
|
36
42
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- Change Username
|
|
42
|
-
- Change Profile Picture
|
|
43
|
-
- Change Email
|
|
44
|
-
- Change Password
|
|
45
|
-
- Delete Account
|
|
43
|
+
## Modular JavaScript
|
|
44
|
+
```javascript
|
|
45
|
+
import 'pwa-auth';
|
|
46
|
+
```
|
|
46
47
|
|
|
47
48
|
## Boilerplate
|
|
48
49
|
- 3 Tag Placements (Custom HTML Elements)
|
|
@@ -53,31 +54,27 @@ import 'pwa-auth';
|
|
|
53
54
|
- ECMA Script (JavaScript)
|
|
54
55
|
|
|
55
56
|
## Custom Elements
|
|
56
|
-
|
|
57
57
|
```html
|
|
58
58
|
<user-icon subscribe></user-icon>
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
59
|
+
<!-- Logged-out txt: Login Button (State) -->
|
|
60
|
+
<!-- Logged-out txt: Subscribe Button (State) -->
|
|
61
|
+
<!-- Logged-in Icon Button (State) -->
|
|
62
62
|
|
|
63
|
-
```html
|
|
64
63
|
<user-drawer subscribe settingsURL=""></user-drawer>
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
- logged-out state
|
|
64
|
+
<!-- Top-down, Drop-down Feature -->
|
|
65
|
+
<!-- Sign-up by Email Addresses and Password (State) -->
|
|
66
|
+
<!-- Sign-in by Email Addresses and Password (State) -->
|
|
67
|
+
<!-- logged-in (State) -->
|
|
68
|
+
<!-- logged-out (State) -->
|
|
71
69
|
|
|
72
|
-
```html
|
|
73
70
|
<user-settings></user-settings>
|
|
71
|
+
<!-- 1 Photo Upload Feature, view uploaded bucket of photos, photo ediotr -->
|
|
72
|
+
<!-- Unavailable Photo -->
|
|
73
|
+
<!-- Update Username -->
|
|
74
|
+
<!-- Update Email / Verify -->
|
|
75
|
+
<!-- Update Password -->
|
|
76
|
+
<!-- Delete Account, Photos, Information -->
|
|
74
77
|
```
|
|
75
|
-
- 1 Photo Upload
|
|
76
|
-
- Unavailable Photo
|
|
77
|
-
- Update Username
|
|
78
|
-
- Update Email / Verify
|
|
79
|
-
- Update Password
|
|
80
|
-
- Delete Account
|
|
81
78
|
|
|
82
79
|
# Website Setup:
|
|
83
80
|
```html
|
|
@@ -104,20 +101,30 @@ import 'pwa-auth';
|
|
|
104
101
|
## CSS Default Custom Properties
|
|
105
102
|
| CSS Custom Property | Description | Default | Custom Element |
|
|
106
103
|
| :--- | ---: | :---: | :--- |
|
|
107
|
-
| --
|
|
108
|
-
| --
|
|
109
|
-
| --
|
|
110
|
-
| --
|
|
111
|
-
| --
|
|
112
|
-
| --
|
|
113
|
-
| --
|
|
114
|
-
| --
|
|
115
|
-
| --
|
|
116
|
-
| --
|
|
117
|
-
| --
|
|
118
|
-
| --
|
|
119
|
-
| --
|
|
120
|
-
| --
|
|
104
|
+
| --pwa_icon_background | Button | #6cc04a; | user-icon |
|
|
105
|
+
| --pwa_icon_hover | Button | lightgrey | user-icon |
|
|
106
|
+
| --pwa_icon_border | Button | 2px solid black | user-icon |
|
|
107
|
+
| --pwa_icon_height (sync) | Login State | 32px | user-icon |
|
|
108
|
+
| --pwa_icon_padding | Login State | 0px 16px | user-icon |
|
|
109
|
+
| --pwa_icon_radius | Login State | 6px | user-icon |
|
|
110
|
+
| --pwa_icon_font | Login State | 'Arial', sans-serif | user-icon |
|
|
111
|
+
| --pwa_icon_diameter (sync) | Icon State | 32px | user-icon |
|
|
112
|
+
| --pwa_drawer_border | Drawer | 3px #303030 solid | user-drawer |
|
|
113
|
+
| --pwa_drawer_z-index | Drawer | 2 | user-drawer |
|
|
114
|
+
| --pwa_drawer_border-radius | Drawer | 20px | user-drawer |
|
|
115
|
+
| --pwa_drawer_text_color | Input txt | #303030 | user-drawer |
|
|
116
|
+
| --pwa_drawer_background_color | Input txt | #fff | user-drawer |
|
|
117
|
+
| --pwa_settings_background | Navigation | grey | user-settings |
|
|
118
|
+
| --pwa_nav_button | Navigation | grey | user-settings |
|
|
119
|
+
| --pwa_nav_select | Navigation | black | user-settings |
|
|
120
|
+
| --pwa_divider | Divider | grey | user-settings |
|
|
121
|
+
| --pwa_input_background | Input | #E1E5EB | user-settings |
|
|
122
|
+
| --pwa_label_text_color | Input | black | user-settings |
|
|
123
|
+
| --pwa_section_header | Header | black | user-settings |
|
|
124
|
+
| --pwa_action_text_color | Button | #fff | user-settings |
|
|
125
|
+
| --pwa_action_background_color | Button | #6cc04a | user-settings |
|
|
126
|
+
| --pwa_action_border_color | Button | #60b23e | user-settings |
|
|
127
|
+
|
|
121
128
|
|
|
122
129
|
```html
|
|
123
130
|
<!-- CSS: Custom Variables -->
|
|
@@ -136,7 +143,7 @@ import 'pwa-auth';
|
|
|
136
143
|
/* WebComponent 1: logged-out
|
|
137
144
|
<user-icon>
|
|
138
145
|
<button class="login"> */
|
|
139
|
-
--pwa_icon_height: 32px;
|
|
146
|
+
--pwa_icon_height: 32px; /* sync to --pwa_icon_diameter */
|
|
140
147
|
--pwa_icon_padding: 0px 16px;
|
|
141
148
|
--pwa_icon_radius: 6px;
|
|
142
149
|
--pwa_icon_font: 'Arial', sans-serif;
|
|
@@ -144,7 +151,7 @@ import 'pwa-auth';
|
|
|
144
151
|
/* WebComponent 1: logged-in
|
|
145
152
|
<user-icon>
|
|
146
153
|
<button class="icon"> */
|
|
147
|
-
--pwa_icon_diameter:
|
|
154
|
+
--pwa_icon_diameter: 32px; /* sync to --pwa_icon_height */
|
|
148
155
|
|
|
149
156
|
|
|
150
157
|
|
|
@@ -162,9 +169,6 @@ import 'pwa-auth';
|
|
|
162
169
|
--pwa_drawer_text_color: #303030;
|
|
163
170
|
--pwa_drawer_background_color: #fff;
|
|
164
171
|
|
|
165
|
-
/* WebComponent 2: Drop-down Drawer - logged-in
|
|
166
|
-
<div class="spec" on> */
|
|
167
|
-
|
|
168
172
|
|
|
169
173
|
|
|
170
174
|
/* WebComponent 3: Settings Page
|
|
@@ -230,7 +234,7 @@ if (lolalhost) { connect = { /* etc. */ } }
|
|
|
230
234
|
```
|
|
231
235
|
|
|
232
236
|
### Global Namespaced Firebase Configuration
|
|
233
|
-
pwa-auth is built upon the Firebase SDK (Software Development Kit).
|
|
237
|
+
pwa-auth.js is built upon the Firebase SDK (Software Development Kit).
|
|
234
238
|
The entire bundle is one instance of firebase that takes in the configuration information, internally.
|
|
235
239
|
|
|
236
240
|
If you are looking for a Namespaced Firebase Configuration, please send it as feedback, and will make that version for you.
|
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,36 @@
|
|
|
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
|
+
}
|
|
34
|
+
export declare const authFunctions: base;
|
|
35
|
+
export {};
|
|
36
|
+
//# 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,CAAA;IAC7B,kBAAkB,EAAC,GAAG,CAAA;CACrB;AAqDD,eAAO,MAAM,aAAa,EAAG,IA4O1B,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"}
|
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.3",
|
|
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
|
-
`;
|