pwa-auth 3.5.1 → 3.7.0
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 +139 -491
- package/base/export/drawer.d.ts +2 -0
- package/base/export/drawer.d.ts.map +1 -0
- package/base/export/drawer.js +2 -0
- package/base/export/drawer.js.map +1 -0
- package/base/export/icon.d.ts +2 -0
- package/base/export/icon.d.ts.map +1 -0
- package/base/export/icon.js +2 -0
- package/base/export/icon.js.map +1 -0
- package/base/export/login.d.ts +2 -0
- package/base/export/login.d.ts.map +1 -0
- package/base/export/login.js +2 -0
- package/base/export/login.js.map +1 -0
- package/base/export/reset.d.ts +2 -0
- package/base/export/reset.d.ts.map +1 -0
- package/base/export/reset.js +2 -0
- package/base/export/reset.js.map +1 -0
- package/base/export/settings.d.ts +2 -0
- package/base/export/settings.d.ts.map +1 -0
- package/base/export/settings.js +2 -0
- package/base/export/settings.js.map +1 -0
- package/base/firebase/google.d.ts +9 -0
- package/base/firebase/google.d.ts.map +1 -0
- package/base/firebase/google.js +56 -0
- package/base/firebase/google.js.map +1 -0
- package/base/firebase/interface.d.ts.map +1 -1
- package/base/firebase/interface.js +2 -0
- package/base/firebase/interface.js.map +1 -1
- package/base/firebase/message.d.ts.map +1 -1
- package/base/firebase/message.js +1 -0
- package/base/firebase/message.js.map +1 -1
- package/base/webcomponents/css/animation.d.ts +2 -0
- package/base/webcomponents/css/animation.d.ts.map +1 -1
- package/base/webcomponents/css/animation.js +49 -11
- package/base/webcomponents/css/animation.js.map +1 -1
- package/base/webcomponents/drawer/css/drawer.d.ts.map +1 -1
- package/base/webcomponents/drawer/css/drawer.js +11 -55
- package/base/webcomponents/drawer/css/drawer.js.map +1 -1
- package/base/webcomponents/drawer/css/exit.js +1 -1
- package/base/webcomponents/drawer/css/paragraph.d.ts.map +1 -1
- package/base/webcomponents/drawer/css/paragraph.js +10 -3
- package/base/webcomponents/drawer/css/paragraph.js.map +1 -1
- package/base/webcomponents/drawer/drawer.d.ts +25 -0
- package/base/webcomponents/drawer/drawer.d.ts.map +1 -1
- package/base/webcomponents/drawer/drawer.js +276 -20
- package/base/webcomponents/drawer/drawer.js.map +1 -1
- package/base/webcomponents/form/css/button.d.ts.map +1 -1
- package/base/webcomponents/form/css/button.js +53 -15
- package/base/webcomponents/form/css/button.js.map +1 -1
- package/base/webcomponents/form/css/input.d.ts.map +1 -1
- package/base/webcomponents/form/css/input.js +10 -1
- package/base/webcomponents/form/css/input.js.map +1 -1
- package/base/webcomponents/form/css/label.d.ts.map +1 -1
- package/base/webcomponents/form/css/label.js +19 -1
- package/base/webcomponents/form/css/label.js.map +1 -1
- package/base/webcomponents/form/css/list.d.ts.map +1 -1
- package/base/webcomponents/form/css/list.js +2 -1
- package/base/webcomponents/form/css/list.js.map +1 -1
- package/base/webcomponents/form/css/notice.js +3 -3
- package/base/webcomponents/form/css/status.d.ts.map +1 -1
- package/base/webcomponents/form/css/status.js +18 -5
- package/base/webcomponents/form/css/status.js.map +1 -1
- package/base/webcomponents/form/css/toggle.d.ts.map +1 -1
- package/base/webcomponents/form/css/toggle.js +7 -0
- package/base/webcomponents/form/css/toggle.js.map +1 -1
- package/base/webcomponents/form/forgot.d.ts.map +1 -1
- package/base/webcomponents/form/forgot.js +5 -4
- package/base/webcomponents/form/forgot.js.map +1 -1
- package/base/webcomponents/form/google-button.d.ts +3 -0
- package/base/webcomponents/form/google-button.d.ts.map +1 -0
- package/base/webcomponents/form/google-button.js +23 -0
- package/base/webcomponents/form/google-button.js.map +1 -0
- package/base/webcomponents/form/login.d.ts +5 -0
- package/base/webcomponents/form/login.d.ts.map +1 -1
- package/base/webcomponents/form/login.js +41 -1
- package/base/webcomponents/form/login.js.map +1 -1
- package/base/webcomponents/form/signup.d.ts +5 -0
- package/base/webcomponents/form/signup.d.ts.map +1 -1
- package/base/webcomponents/form/signup.js +41 -1
- package/base/webcomponents/form/signup.js.map +1 -1
- package/base/webcomponents/icon/css/icon.d.ts.map +1 -1
- package/base/webcomponents/icon/css/icon.js +9 -0
- package/base/webcomponents/icon/css/icon.js.map +1 -1
- package/base/webcomponents/login/css/auth.d.ts +2 -2
- package/base/webcomponents/login/css/auth.d.ts.map +1 -1
- package/base/webcomponents/login/css/auth.js +12 -13
- package/base/webcomponents/login/css/auth.js.map +1 -1
- package/base/webcomponents/login/page.d.ts +21 -1
- package/base/webcomponents/login/page.d.ts.map +1 -1
- package/base/webcomponents/login/page.js +191 -8
- package/base/webcomponents/login/page.js.map +1 -1
- package/base/webcomponents/settings/css/navigation.js +3 -3
- package/base/webcomponents/settings/input/delete.d.ts.map +1 -1
- package/base/webcomponents/settings/input/delete.js +7 -1
- package/base/webcomponents/settings/input/delete.js.map +1 -1
- package/base/webcomponents/settings/input/uploader.d.ts.map +1 -1
- package/base/webcomponents/settings/input/uploader.js +8 -4
- package/base/webcomponents/settings/input/uploader.js.map +1 -1
- package/base/webcomponents/settings/input/verify.d.ts.map +1 -1
- package/base/webcomponents/settings/input/verify.js +24 -7
- package/base/webcomponents/settings/input/verify.js.map +1 -1
- package/base/webcomponents/settings/settings.d.ts +19 -1
- package/base/webcomponents/settings/settings.d.ts.map +1 -1
- package/base/webcomponents/settings/settings.js +177 -12
- package/base/webcomponents/settings/settings.js.map +1 -1
- package/docs/drawer-slide.md +206 -0
- package/docs/sliders.md +73 -0
- package/package.json +49 -10
- package/source/pwa-auth.js +510 -297
- package/source/pwa-styles.css +0 -7
- package/firebase.md +0 -107
- package/intro.md +0 -19
package/README.md
CHANGED
|
@@ -1,547 +1,195 @@
|
|
|
1
1
|
# pwa-auth
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
[](license)
|
|
3
|
+
Sign-in elements for a site that keeps its own pages. [Demo](https://pwa-authentic.firebaseapp.com).
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
Five tags. They share one sign-in. MIT.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Install
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Place the tags. Set Firebase with the script or `initialize()`. Listen for `pwa-` events, or call the small API (`getCurrentUser`, `onUserChanged`, `openDrawer`, `closeDrawer`, `toggleDrawer`). Restyle with `--pwa_` variables.
|
|
13
|
-
|
|
14
|
-
Peers: `lit` ^3.3.0 and `firebase` ^12.0.0. The package is ESM (`"type": "module"`).
|
|
15
|
-
|
|
16
|
-
## Contents
|
|
17
|
-
|
|
18
|
-
- [Quick start](#quick-start)
|
|
19
|
-
- [Install & entries](#install--entries)
|
|
20
|
-
- [Firebase](firebase.md)
|
|
21
|
-
- [Elements](#elements)
|
|
22
|
-
- [Page examples](#page-examples)
|
|
23
|
-
- [Events](#events)
|
|
24
|
-
- [API](#api)
|
|
25
|
-
- [Exports](#exports)
|
|
26
|
-
- [Theme](#theme)
|
|
27
|
-
- [Parts](#parts)
|
|
28
|
-
- [Drawer behaviour](#drawer-behaviour)
|
|
29
|
-
- [Data ownership](#data-ownership)
|
|
30
|
-
- [Contributing](#contributing)
|
|
31
|
-
- [Feedback](#feedback)
|
|
32
|
-
|
|
33
|
-
## Quick start
|
|
34
|
-
|
|
35
|
-
Install the package and the peers. Serve this page from the project root. Do not open it with `file://`.
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm install pwa-auth lit firebase
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
```html
|
|
42
|
-
<user-icon></user-icon>
|
|
43
|
-
<user-drawer></user-drawer>
|
|
44
|
-
<script>
|
|
45
|
-
window.process = { env: { FIREBASE_CONFIG: JSON.stringify({
|
|
46
|
-
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
47
|
-
authDomain: "xxxxxxx.xxxxxxx.xxx",
|
|
48
|
-
databaseURL: "https://xxxxxxx.xxxxxxx.xxx",
|
|
49
|
-
projectId: "xxxxxxx",
|
|
50
|
-
storageBucket: "xxxxxxx.xxxxxxx.xxx",
|
|
51
|
-
messagingSenderId: "xxxxxxxxxxx",
|
|
52
|
-
appId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
53
|
-
measurementId: "xxxxxxxxxxx"
|
|
54
|
-
}) } };
|
|
55
|
-
</script>
|
|
56
|
-
<script type="module" src="./node_modules/pwa-auth/source/pwa-auth.js"></script>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
The module script loads the production bundle. Lit and Firebase are already in the file. A bundler imports `pwa-auth` instead. See [Install & entries](#install--entries). Setup for that script, including `initialize({ config })`, is in [firebase.md](firebase.md).
|
|
60
|
-
|
|
61
|
-
## Install & entries
|
|
9
|
+
Install `lit` and `firebase` alongside pwa-auth.
|
|
62
10
|
|
|
63
11
|
```bash
|
|
64
12
|
npm install pwa-auth lit firebase
|
|
65
13
|
```
|
|
66
14
|
|
|
67
|
-
`lit` and `firebase` are peers. Redux ships inside the package.
|
|
68
|
-
|
|
69
|
-
Two entries.
|
|
70
|
-
|
|
71
|
-
A bundler (Vite, Rollup, webpack) loads the tsc graph. The peers stay outside the bundle. Install them.
|
|
72
|
-
|
|
73
15
|
```javascript
|
|
74
16
|
import 'pwa-auth';
|
|
75
17
|
```
|
|
76
18
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
A plain module script loads one file. Lit and Firebase are inside it. From the project root:
|
|
80
|
-
|
|
81
|
-
```html
|
|
82
|
-
<script type="module" src="./node_modules/pwa-auth/source/pwa-auth.js"></script>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
The same file, when a bundler asks for it:
|
|
19
|
+
That turns on all five tags. One tag at a time:
|
|
86
20
|
|
|
87
21
|
```javascript
|
|
88
|
-
import 'pwa-auth/
|
|
22
|
+
import 'pwa-auth/icon';
|
|
23
|
+
import 'pwa-auth/drawer';
|
|
24
|
+
import 'pwa-auth/login';
|
|
25
|
+
import 'pwa-auth/settings';
|
|
26
|
+
import 'pwa-auth/reset';
|
|
89
27
|
```
|
|
90
28
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## Firebase
|
|
94
|
-
|
|
95
|
-
Project setup, `initialize({ config })`, `FIREBASE_CONFIG`, rules, and emulators are in [firebase.md](firebase.md).
|
|
96
|
-
|
|
97
|
-
## Elements
|
|
98
|
-
|
|
99
|
-
Importing the package defines all five.
|
|
100
|
-
|
|
101
|
-
### `<user-icon>`
|
|
102
|
-
|
|
103
|
-
The button that opens the drawer.
|
|
104
|
-
|
|
105
|
-
| Attribute | |
|
|
106
|
-
|---|---|
|
|
107
|
-
| `subscribe` | Logged-out label is Subscribe. Without it, the label is Login. |
|
|
108
|
-
| `empty` | Image URL used when the account has no photo and no name or email to initial. |
|
|
109
|
-
|
|
110
|
-
Logged in, the button shows the photo. With no photo, it shows initials from the display name, or from the email. `empty` is the last fallback. The click opens or closes the drawer. Style it with `user-icon::part(button)`, `user-icon::part(photo)`, and `user-icon::part(initials)`.
|
|
111
|
-
|
|
112
|
-
### `<user-drawer>`
|
|
113
|
-
|
|
114
|
-
Drops open from the top. Timing is in [Drawer behaviour](#drawer-behaviour).
|
|
115
|
-
|
|
116
|
-
| Attribute | |
|
|
117
|
-
|---|---|
|
|
118
|
-
| `subscribe` | Starts on the sign-up form. Without it, starts on sign-in. |
|
|
119
|
-
| `url` | `href` of the Settings control shown after sign-in. Set it only when that page is a real route. Leave it unset when `<user-settings>` is already on this page. |
|
|
120
|
-
| `drawer` | Reflects the open state. Redux overwrites it. Do not treat it as an input. |
|
|
121
|
-
|
|
122
|
-
Logged out, the header reads Subscribe or Login to match the form. The slots are in the signed-in block, so they are not shown until someone is signed in. Logged in, the header shows the display name, or the email when the account has no name, then, in this order:
|
|
123
|
-
|
|
124
|
-
1. slot `before`
|
|
125
|
-
2. Settings (`url`, or the button that stays on this page)
|
|
126
|
-
3. the default slot
|
|
127
|
-
4. Log out
|
|
128
|
-
|
|
129
|
-
There is no slot named `within`. The second slot is the default slot.
|
|
130
|
-
|
|
131
|
-
Each slot has fallback text so the host can see where a link will sit: `slotted - before` in the before slot, `slotted - default` in the default slot. Pass a link or a button and that marker is replaced.
|
|
29
|
+
A page with no build step. Lit and Firebase are already in this file.
|
|
132
30
|
|
|
133
31
|
```html
|
|
134
|
-
<
|
|
135
|
-
<a slot="before" href="/account">Account</a>
|
|
136
|
-
<a href="/archive" aria-current="page">Archive</a>
|
|
137
|
-
</user-drawer>
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
`::slotted(a)` and `::slotted(button)` share one style: a full-width row, the line colour, and a 44px tap target. `aria-current` on either one uses the nav highlight. A click on a slotted link or button closes the drawer, the same as Settings. Call `preventDefault()` on that click to leave the drawer open.
|
|
141
|
-
|
|
142
|
-
`url` is only the Settings control. It is not the slot. Leave `url` unset when `<user-settings>` is on this page. Set `url` when Settings is a real route. Slotted links are the host's own pages.
|
|
143
|
-
|
|
144
|
-
Slotted links can flash before the element upgrades. Hide them:
|
|
145
|
-
|
|
146
|
-
```css
|
|
147
|
-
/* Optional - hide slotted links until user-drawer upgrades */
|
|
148
|
-
user-drawer:not(:defined) { display: none; }
|
|
32
|
+
<script type="module" src="./node_modules/pwa-auth/source/pwa-auth.js"></script>
|
|
149
33
|
```
|
|
150
34
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
### `<user-login>`
|
|
154
|
-
|
|
155
|
-
The same forms, in the page instead of the drawer.
|
|
35
|
+
`import 'pwa-auth/production'` is that same file.
|
|
156
36
|
|
|
157
|
-
|
|
|
158
|
-
|
|
159
|
-
| `
|
|
37
|
+
| Import | What you get |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| `pwa-auth` | All five tags, and the functions below |
|
|
40
|
+
| `pwa-auth/icon` | `<user-icon>` only. Class `UserIcon` |
|
|
41
|
+
| `pwa-auth/drawer` | `<user-drawer>` only. Class `UserDrawer` |
|
|
42
|
+
| `pwa-auth/login` | `<user-login>` only. Class `UserLogin` |
|
|
43
|
+
| `pwa-auth/settings` | `<user-settings>` only. Class `UserSettings` |
|
|
44
|
+
| `pwa-auth/reset` | `<email-reset>` only. Class `EmailReset` |
|
|
45
|
+
| `pwa-auth/production` | The single file. Same functions as `pwa-auth` |
|
|
160
46
|
|
|
161
|
-
|
|
47
|
+
Works in current Chrome, Edge, Firefox, and Safari. The fields fit any layout, from a phone to a desktop.
|
|
162
48
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Sign-up calls `sendEmailVerification`. `actionCodeSettings` from `initialize` is passed through when it is set. The form shows "Check your inbox for the verification email. You can still sign in." The same notice stays on `<user-login>` and in the drawer until the address is verified.
|
|
166
|
-
|
|
167
|
-
Each password field has a Show control. Logged in, the forms are replaced by slot `content`.
|
|
49
|
+
## Tags
|
|
168
50
|
|
|
169
51
|
```html
|
|
52
|
+
<user-icon subscribe></user-icon>
|
|
53
|
+
<user-drawer subscribe></user-drawer>
|
|
170
54
|
<user-login>
|
|
171
|
-
<
|
|
172
|
-
<p>Page content</p>
|
|
173
|
-
</div>
|
|
55
|
+
<p slot="content">Signed in.</p>
|
|
174
56
|
</user-login>
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
### `<user-settings>`
|
|
178
|
-
|
|
179
|
-
Four tabs: Icon, Profile, Password, Delete.
|
|
180
|
-
|
|
181
|
-
| Attribute | |
|
|
182
|
-
|---|---|
|
|
183
|
-
| `empty` | Fallback photo, passed through to the uploader as `emptyArtwork`. |
|
|
184
|
-
|
|
185
|
-
Signed out, the element shows one line: sign in to change the photo, name, email, or password. The tabs and fields are not in the tree.
|
|
186
|
-
|
|
187
|
-
Profile saves the display name with `updateProfile`. The icon, the drawer, and this panel read that name back. A saved name is still there after the next sign-in.
|
|
188
|
-
|
|
189
|
-
The photo uploads to `pwa-auth/{uid}/`. On completion the status reads Photo saved. and the same URL is the account photo. Initials stand in until a photo exists.
|
|
190
|
-
|
|
191
|
-
A failed action writes a sentence into that tab's `aria-live` region and dispatches `pwa-auth-error`. The Update, Delete, and upload controls disable and read a busy label while the request is in flight.
|
|
192
|
-
|
|
193
|
-
When the signed-in address is unverified:
|
|
194
|
-
|
|
195
|
-
- That tab shows the address, the words Not verified (`::part(unverified)`), and a Resend verification email button (`::part(verify-submit)`).
|
|
196
|
-
- The same words and the same button are in the drawer, next to the name or email.
|
|
197
|
-
- The status (`::part(verify-status)`) is an `aria-live` region.
|
|
198
|
-
- The button reads Sending… while the request is in flight, then waits 45 seconds. The confirmation is "Check your inbox for the verification email."
|
|
199
|
-
- `auth/too-many-requests` and `auth/network-request-failed` write a short sentence into the status region and dispatch `pwa-auth-error`.
|
|
200
|
-
- A verified address shows a check (`::part(verified)`, aria-label Email verified) beside the email in settings and beside the name or email in the drawer. The colour is `--pwa_verified_color`.
|
|
201
|
-
- Opening the drawer, or focusing the window, calls `user.reload()`. When that reload sees the address become verified, the page fires `pwa-email-verified`.
|
|
202
|
-
- Sign-in is not blocked either way.
|
|
203
|
-
- Changing the email calls `verifyBeforeUpdateEmail`. `actionCodeSettings` from `initialize` is passed through. If the address still on the account is unverified, `sendEmailVerification` runs as well.
|
|
204
|
-
|
|
205
|
-
Email, password, and delete ask for the current password and call `reauthenticate` first.
|
|
206
|
-
|
|
207
|
-
- Email then calls `verifyBeforeUpdateEmail`. On success the page dispatches `pwa-email-changed` on `window` with `{ email }`. The old `userEmailChanged` event still fires and is deprecated.
|
|
208
|
-
- Password requires the verify field to match. A new password is 8 to 128 characters, the same rule as sign-up. On success the page dispatches `pwa-password-changed` on `window` with `{ uid }`.
|
|
209
|
-
- Delete removes this user's files under `pwa-auth/{uid}`, calls `logAccountDelete`, then deletes the auth user. It does not delete `users/{uid}`. See [Data ownership](#data-ownership).
|
|
210
|
-
- A failed action writes a short sentence into the status region and dispatches `pwa-auth-error`.
|
|
211
|
-
|
|
212
|
-
### `<email-reset>`
|
|
213
|
-
|
|
214
|
-
Sends a password reset for the address in the field. The address is checked before `sendPasswordResetEmail`. An empty or short address fires `pwa-auth-error` with `pwa/missing-email`. A malformed address uses `pwa/invalid-email`.
|
|
215
|
-
|
|
216
|
-
While the request is in flight the button is disabled and reads Sending…. Success shows one sentence either way, including when Firebase returns `auth/user-not-found`: "If an account uses that email, a reset link is on its way." The page dispatches `pwa-reset-sent` on `window` with `{ email }`. The button then waits 45 seconds.
|
|
217
|
-
|
|
218
|
-
`auth/invalid-email`, `auth/too-many-requests`, and `auth/network-request-failed` write a short sentence into the status region and dispatch `pwa-auth-error`. The event still carries the Firebase code.
|
|
219
|
-
|
|
220
|
-
If a sign-in form on the page already has an email, the field starts with that address until someone types in the reset field. Back to sign in opens `<user-drawer>` on the sign-in form. With no drawer, it shows the sign-in form in `<user-login>`.
|
|
221
|
-
|
|
222
|
-
| Attribute | |
|
|
223
|
-
|---|---|
|
|
224
|
-
| `active` | Required. The element renders nothing until `active` is set. |
|
|
225
|
-
|
|
226
|
-
```html
|
|
57
|
+
<user-settings></user-settings>
|
|
227
58
|
<email-reset active></email-reset>
|
|
228
59
|
```
|
|
229
60
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
user-drawer:not(:defined) { display: none; }
|
|
238
|
-
</style>
|
|
239
|
-
|
|
240
|
-
<body>
|
|
241
|
-
<header>
|
|
242
|
-
<user-icon subscribe></user-icon>
|
|
243
|
-
</header>
|
|
244
|
-
|
|
245
|
-
<user-drawer subscribe>
|
|
246
|
-
<a slot="before" href="#settings">Settings</a>
|
|
247
|
-
<a href="./elsewhere">Another link</a>
|
|
248
|
-
</user-drawer>
|
|
249
|
-
|
|
250
|
-
<main>
|
|
251
|
-
<user-settings id="settings"></user-settings>
|
|
252
|
-
</main>
|
|
253
|
-
</body>
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### Sign-in page
|
|
257
|
-
|
|
258
|
-
```html
|
|
259
|
-
<body>
|
|
260
|
-
<header>
|
|
261
|
-
<user-icon subscribe></user-icon>
|
|
262
|
-
</header>
|
|
263
|
-
|
|
264
|
-
<main>
|
|
265
|
-
<user-login subscribe>
|
|
266
|
-
<div slot="content">
|
|
267
|
-
<p>Page content</p>
|
|
268
|
-
</div>
|
|
269
|
-
</user-login>
|
|
270
|
-
|
|
271
|
-
<user-settings></user-settings>
|
|
272
|
-
</main>
|
|
273
|
-
</body>
|
|
274
|
-
```
|
|
61
|
+
| Tag | What you set | What it sets | Slots |
|
|
62
|
+
| --- | --- | --- | --- |
|
|
63
|
+
| `user-icon` | `subscribe` starts the label on Subscribe. `empty` is the picture when there is no photo and no initials. `firebase-config` is the Firebase JSON | | |
|
|
64
|
+
| `user-drawer` | `subscribe` starts on sign-up. `hide-google` removes Continue with Google. `url` is the Settings link; leave it off to stay on this page. `firebase-config` as above | `drawer` while open. `sliding` while it moves | `before`, and the default slot, for your own links |
|
|
65
|
+
| `user-login` | `subscribe` and `hide-google`, same as the drawer. `firebase-config` as above | | `content` replaces the form after sign-in |
|
|
66
|
+
| `user-settings` | `empty` is the picture when the account has none. `firebase-config` as above. Signed out, one line and no fields | | |
|
|
67
|
+
| `email-reset` | `active`, or the form stays blank. Then it emails a reset link for the address in the field | | |
|
|
275
68
|
|
|
276
69
|
## Events
|
|
277
70
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
- `pwa-auth-changed` — every `onAuthStateChanged`. Detail: `{ user: { uid, displayName, email, photoURL, emailVerified } | null }`
|
|
281
|
-
- `pwa-login` — email sign-in succeeded. Detail: `{ user: { uid, displayName, email, photoURL, emailVerified } }`
|
|
282
|
-
- `pwa-logout` — `logOut()` finished. Detail: `{ user: null }`
|
|
283
|
-
- `pwa-signup` — `createUserWithEmailAndPassword` succeeded. Detail: `{ user: { uid, displayName, email, photoURL, emailVerified } }`
|
|
284
|
-
- `pwa-account-deleted` — the auth user was deleted. Detail: `{ uid }`. The host deletes its own `users/{uid}` document.
|
|
285
|
-
- `pwa-profile-updated` — display name or photo saved. Detail: `{ uid, displayName, photoURL }`
|
|
286
|
-
- `pwa-email-changed` — `verifyBeforeUpdateEmail` accepted the address. Detail: `{ email }`
|
|
287
|
-
- `pwa-password-changed` — `updatePassword` succeeded. Detail: `{ uid }`. The new password is not included.
|
|
288
|
-
- `pwa-reset-sent` — `sendPasswordResetEmail` finished, or the address has no account. Detail: `{ email }`. The same event either way.
|
|
289
|
-
- `pwa-drawer-toggle` — the drawer open flag changed. Detail: `{ open }`
|
|
290
|
-
- `pwa-settings` — Settings was chosen. Detail: `{ url }`. `url` is empty when the control stays on this page. Cancel the event to handle it yourself.
|
|
291
|
-
- `pwa-auth-error` — an account action failed. Detail: `{ code, message }`
|
|
292
|
-
- `pwa-verification-sent` — `sendEmailVerification` accepted the message. Detail: `{ email }`
|
|
293
|
-
- `pwa-email-verified` — a reload saw `emailVerified` become true. Detail: `{ user }` with `user.emailVerified === true`
|
|
294
|
-
|
|
295
|
-
`userEmailChanged` still fires on `window` with `{ email }`. Deprecated. Listen for `pwa-email-changed`.
|
|
296
|
-
|
|
297
|
-
```javascript
|
|
298
|
-
import { pwaAuthChanged, pwaDrawerToggleName } from 'pwa-auth';
|
|
299
|
-
|
|
300
|
-
window.addEventListener(pwaAuthChanged, (event) => {
|
|
301
|
-
const user = event.detail.user;
|
|
302
|
-
console.log(user && user.uid);
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
window.addEventListener(pwaDrawerToggleName, (event) => {
|
|
306
|
-
console.log(event.detail.open);
|
|
307
|
-
});
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
## API
|
|
311
|
-
|
|
312
|
-
```javascript
|
|
313
|
-
import {
|
|
314
|
-
initialize,
|
|
315
|
-
getCurrentUser,
|
|
316
|
-
onUserChanged,
|
|
317
|
-
sendVerification,
|
|
318
|
-
isEmailVerified,
|
|
319
|
-
openDrawer,
|
|
320
|
-
closeDrawer,
|
|
321
|
-
toggleDrawer,
|
|
322
|
-
eventName
|
|
323
|
-
} from 'pwa-auth';
|
|
324
|
-
|
|
325
|
-
initialize({ config });
|
|
326
|
-
|
|
327
|
-
const stop = onUserChanged((user) => {
|
|
328
|
-
console.log(user && user.emailVerified);
|
|
329
|
-
});
|
|
330
|
-
stop();
|
|
331
|
-
|
|
332
|
-
getCurrentUser();
|
|
333
|
-
await sendVerification();
|
|
334
|
-
await isEmailVerified();
|
|
335
|
-
openDrawer();
|
|
336
|
-
closeDrawer();
|
|
337
|
-
toggleDrawer();
|
|
71
|
+
Listen on `window`. `pwa-drawer-toggle` and `pwa-settings` also fire on `user-drawer`. Cancel `pwa-settings` to keep the drawer open. `userEmailChanged` is the old name for `pwa-email-changed`.
|
|
338
72
|
|
|
339
|
-
|
|
340
|
-
console.log(event.detail.user.email);
|
|
341
|
-
});
|
|
342
|
-
```
|
|
73
|
+
A user is `{ uid, displayName, email, photoURL, emailVerified }` or `null`.
|
|
343
74
|
|
|
344
|
-
|
|
|
345
|
-
|
|
346
|
-
| `
|
|
347
|
-
| `
|
|
348
|
-
| `
|
|
349
|
-
| `
|
|
350
|
-
| `
|
|
351
|
-
| `
|
|
352
|
-
| `
|
|
353
|
-
| `
|
|
354
|
-
| `
|
|
355
|
-
| `
|
|
75
|
+
| Event | Detail |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| `pwa-auth-changed` | `{ user }` on every sign-in change. `user` is `null` when signed out |
|
|
78
|
+
| `pwa-login` | `{ user }` |
|
|
79
|
+
| `pwa-logout` | `{ user: null }` |
|
|
80
|
+
| `pwa-signup` | `{ user }` |
|
|
81
|
+
| `pwa-account-deleted` | `{ uid }` |
|
|
82
|
+
| `pwa-profile-updated` | `{ uid, displayName, photoURL }` |
|
|
83
|
+
| `pwa-email-changed` | `{ email }` |
|
|
84
|
+
| `pwa-password-changed` | `{ uid }` |
|
|
85
|
+
| `pwa-reset-sent` | `{ email }`. Same event if no account uses that address |
|
|
86
|
+
| `pwa-verification-sent` | `{ email }` |
|
|
87
|
+
| `pwa-email-verified` | `{ user }` when the address becomes verified |
|
|
88
|
+
| `pwa-auth-error` | `{ code, message }` |
|
|
89
|
+
| `pwa-drawer-toggle` | `{ open }` |
|
|
90
|
+
| `pwa-settings` | `{ url }`. `url` is empty when Settings stays on this page |
|
|
91
|
+
| `userEmailChanged` | `{ email }`. Old name |
|
|
356
92
|
|
|
357
|
-
`
|
|
93
|
+
`eventName` is those strings in one object. `PwaEventMap` pairs each name with its event.
|
|
358
94
|
|
|
359
|
-
##
|
|
95
|
+
## Functions
|
|
360
96
|
|
|
361
97
|
```javascript
|
|
362
|
-
import 'pwa-auth';
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
|
374
|
-
|
|
375
|
-
| `
|
|
376
|
-
| `
|
|
377
|
-
| `
|
|
378
|
-
| `
|
|
379
|
-
| `
|
|
380
|
-
| `
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
98
|
+
import { initialize, getCurrentUser, onUserChanged, openDrawer, closeDrawer } from 'pwa-auth';
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
| Function | Returns |
|
|
102
|
+
| --- | --- |
|
|
103
|
+
| `initialize({ config, app, actionCodeSettings })` | The Firebase app. Pass `config`, or an `app` you already started. `actionCodeSettings` is the link in the verification email |
|
|
104
|
+
| `getCurrentUser()` | The user object, or `null` |
|
|
105
|
+
| `onUserChanged(fn)` | Calls `fn` with the user object. Returns a function that stops the calls |
|
|
106
|
+
| `openDrawer()` | Opens the drawer |
|
|
107
|
+
| `closeDrawer()` | Closes the drawer |
|
|
108
|
+
| `toggleDrawer()` | Opens it if shut, closes it if open |
|
|
109
|
+
| `sendVerification()` | `true` if the verification email went out, `false` if it was already verified |
|
|
110
|
+
| `isEmailVerified()` | `true` or `false` after a reload |
|
|
111
|
+
| `logOut()` | Signs out |
|
|
112
|
+
| `reauthenticate(password)` | `true` if that password matches the current account |
|
|
113
|
+
| `logAccount()` | Counts a new account, if Analytics is on |
|
|
114
|
+
| `logAccountDelete()` | Counts a deleted account, if Analytics is on |
|
|
115
|
+
| `deleteDocument(collection, id)` | Deletes that Firestore document |
|
|
116
|
+
| `pwaDrawerToggle()` | Closes the drawer |
|
|
117
|
+
|
|
118
|
+
Also exported: `firebaseConfig`, `application`, `db`, `storage`, `auth`. `user` is only a snapshot from startup. Use `getCurrentUser()`.
|
|
119
|
+
|
|
120
|
+
## Look
|
|
121
|
+
|
|
122
|
+
Set these on the element. `--pwa_background` replaces the older background names `--pwa_drawer_background_color`, `--pwa_settings_background_color`, and `--section_background_color`.
|
|
123
|
+
|
|
124
|
+
| Variable | What it does | Default |
|
|
125
|
+
| --- | --- | --- |
|
|
126
|
+
| `--pwa_inset` | Space between the element's edge and its fields | `0` |
|
|
127
|
+
| `--pwa_max_width` | Widest the form gets. Centered | `400px` |
|
|
128
|
+
| `--pwa_slide` | Animation length. `0s` when the visitor prefers less motion | `2s` |
|
|
129
|
+
| `--pwa_background` | Background | white |
|
|
130
|
+
| `--pwa_input_background_color` | Field fill | white |
|
|
131
|
+
| `--pwa_drawer_text_color` | Text | `#1c2430` |
|
|
132
|
+
| `--pwa_label_text_color` | Labels | `#1c2430` |
|
|
133
|
+
| `--pwa_header_color` | Settings title | `#1c2430` |
|
|
134
|
+
| `--pwa_line_color` | Borders | `#e3daca` |
|
|
135
|
+
| `--pwa_nav_button_color` | Quiet text | `#4e5b6a` |
|
|
136
|
+
| `--pwa_nav_highlight_color` | Selected tab text | `#1c2430` |
|
|
137
|
+
| `--pwa_nav_on_background` | Selected tab and notice | `#f2f2f2` |
|
|
138
|
+
| `--pwa_action_text_color` | Button text | white |
|
|
139
|
+
| `--pwa_action_background_color` | Green buttons and links | `#2a6b45` |
|
|
140
|
+
| `--pwa_action_border_color` | Button border | `#214f34` |
|
|
141
|
+
| `--pwa_close_color` | Close mark and errors | `#9a3b32` |
|
|
142
|
+
| `--pwa_verified_color` | Verified check | the button green |
|
|
143
|
+
| `--pwa_tap` | Shortest a control can be | `44px` |
|
|
144
|
+
| `--pwa_icon_background_color` | Icon button | `#2a6b45` |
|
|
145
|
+
| `--pwa_icon_hover_color` | Icon button, pointer over it | `#214f34` |
|
|
146
|
+
| `--pwa_icon_border` | Icon button border | `0` |
|
|
147
|
+
| `--pwa_icon_height` | Signed-out button height | `44px` |
|
|
148
|
+
| `--pwa_icon_padding` | Signed-out button padding | `0 18px` |
|
|
149
|
+
| `--pwa_icon_radius` | Signed-out button corners | `10px` |
|
|
150
|
+
| `--pwa_icon_font` | Signed-out button font | `"Avenir Next", "Segoe UI", system-ui, sans-serif` |
|
|
151
|
+
| `--pwa_icon_diameter` | Signed-in button size | `44px` |
|
|
152
|
+
| `--pwa_drawer_position` | Drawer placement | `absolute` |
|
|
153
|
+
| `--pwa_drawer_border` | Line under the drawer | `0` |
|
|
154
|
+
| `--pwa_drawer_z-index` | Drawer stacking | `3` |
|
|
155
|
+
| `--pwa_drawer_border-radius` | Drawer corners | `0 0 18px 18px` |
|
|
399
156
|
|
|
400
157
|
```css
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
--
|
|
404
|
-
|
|
405
|
-
/* <user-icon> */
|
|
406
|
-
--pwa_icon_background_color: #2a6b45;
|
|
407
|
-
--pwa_icon_hover_color: #214f34;
|
|
408
|
-
--pwa_icon_border: 0;
|
|
409
|
-
--pwa_icon_radius: 10px;
|
|
410
|
-
--pwa_icon_padding: 0 18px;
|
|
411
|
-
--pwa_icon_font: "Avenir Next", "Segoe UI", system-ui, sans-serif;
|
|
412
|
-
--pwa_icon_height: 44px; /* logged out, sync to diameter */
|
|
413
|
-
--pwa_icon_diameter: 44px; /* logged in, sync to height */
|
|
414
|
-
|
|
415
|
-
/* Optional - master beat. See Drawer behaviour for the ratios. */
|
|
416
|
-
--pwa_slide_time: 1.4s;
|
|
417
|
-
/* Optional - shared ease for the drawer and the form swap */
|
|
418
|
-
--pwa_slide_ease: ease-in-out;
|
|
419
|
-
|
|
420
|
-
/* <user-drawer> */
|
|
421
|
-
--pwa_drawer_position: absolute;
|
|
422
|
-
--pwa_drawer_background_color: #fffdf8;
|
|
423
|
-
--pwa_drawer_text_color: #1c2430;
|
|
424
|
-
--pwa_drawer_border: 0;
|
|
425
|
-
--pwa_drawer_border-radius: 0 0 18px 18px;
|
|
426
|
-
--pwa_drawer_z-index: 3;
|
|
427
|
-
--pwa_close_color: #9a3b32;
|
|
428
|
-
|
|
429
|
-
/* <user-settings> and <user-login> */
|
|
430
|
-
--pwa_settings_background_color: #fffdf8;
|
|
431
|
-
--section_background_color: #fffdf8;
|
|
432
|
-
--pwa_header_color: #1c2430;
|
|
433
|
-
--pwa_nav_button_color: #4e5b6a;
|
|
434
|
-
--pwa_nav_highlight_color: #1c2430;
|
|
435
|
-
--pwa_nav_on_background: #f3efe6;
|
|
436
|
-
--pwa_divider_color: #e3daca;
|
|
437
|
-
--pwa_line_color: #e3daca;
|
|
438
|
-
--pwa_label_text_color: #1c2430;
|
|
439
|
-
--pwa_input_background_color: #f3efe6;
|
|
440
|
-
--pwa_action_text_color: #fff;
|
|
441
|
-
--pwa_action_background_color: #2a6b45;
|
|
442
|
-
--pwa_action_border_color: #214f34;
|
|
443
|
-
|
|
444
|
-
/* Email verified check */
|
|
445
|
-
--pwa_verified_color: #2a6b45;
|
|
158
|
+
user-drawer, user-login, user-settings, email-reset {
|
|
159
|
+
--pwa_inset: 16px;
|
|
160
|
+
--pwa_max_width: 400px;
|
|
446
161
|
}
|
|
447
162
|
```
|
|
448
163
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
## Parts
|
|
164
|
+
The drawer unrolls downward and its buttons ride the bottom edge. Nothing animates on page load. Less motion makes that instant. [The roll](docs/drawer-slide.md).
|
|
452
165
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
- `user-icon`: `button`, `photo`, `initials`
|
|
456
|
-
- `user-drawer`: `panel`, `header`, `title`, `close`, `settings`, `notice`, `verified`, `unverified`, `verify-submit`, `verify-status`, `logout`, `login-email`, `login-password`, `login-submit`, `login-switch`, `login-forgot`, `login-status`, `login-reveal`, `signup-email`, `signup-password`, `signup-submit`, `signup-switch`, `signup-status`, `signup-reveal`, `signup-notice`
|
|
457
|
-
- `user-login`: `panel`, `header`, `title`, `notice`, and the same `login-*` and `signup-*` field parts
|
|
458
|
-
- `user-settings`: `tab`, `panel`, `signed-out`, `name`, `name-submit`, `email`, `email-submit`, `verified`, `unverified`, `verify-submit`, `verify-status`, `password`, `verify`, `password-submit`, `progress`, `file`, `preview`, `delete`
|
|
459
|
-
- `email-reset`: `email`, `submit`, `status`, `back`
|
|
460
|
-
|
|
461
|
-
```css
|
|
462
|
-
user-icon::part(button) { border-radius: 8px; }
|
|
463
|
-
user-drawer::part(panel) { background: #fff; }
|
|
464
|
-
user-drawer::part(login-submit) { letter-spacing: 0.02em; }
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
## Drawer behaviour
|
|
468
|
-
|
|
469
|
-
The drawer loads hidden at the top (`max-height: 0`). A press on `user-icon` slides it down.
|
|
470
|
-
|
|
471
|
-
Sign-in and sign-up share one grid area, `pages`. They slide past each other. The closed form is translated `translate3d(0, -100%, 0)`, `visibility: hidden`, and `inert`.
|
|
472
|
-
|
|
473
|
-
`--pwa_slide_time` is the master beat. Default `1.4s`. `--pwa_slide_ease` is the shared curve. Default `ease-in-out`. Durations are multiples of the beat:
|
|
474
|
-
|
|
475
|
-
- drawer max-height, and the close visibility delay: 1x (`1.4s`)
|
|
476
|
-
- `.spec-in`: 1.071x (about `1.5s`)
|
|
477
|
-
- `.spec-out`: 1.571x (about `2.2s`). The forms follow the drawer down
|
|
478
|
-
- form swap, and the closed-form visibility delay: 1.429x (about `2s`)
|
|
479
|
-
|
|
480
|
-
Set `--pwa_slide_time: 0.7s` to halve every one of those. `prefers-reduced-motion: reduce` sets the beat to `0s`.
|
|
481
|
-
|
|
482
|
-
While the drawer is open it covers `user-icon`. Close it with the ✕ button or Escape. The drawer is a dialog. Tab stays inside while it is open, and focus returns to the control that opened it. Off-screen forms are `inert`. The panel is `inert` while it is closed.
|
|
483
|
-
|
|
484
|
-
Slotted links can flash before the element upgrades. Hide them:
|
|
485
|
-
|
|
486
|
-
```css
|
|
487
|
-
/* Optional - hide slotted links until user-drawer upgrades */
|
|
488
|
-
user-drawer:not(:defined) { display: none; }
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
## Data ownership
|
|
492
|
-
|
|
493
|
-
The host app owns its Firestore documents. Contractors Centre creates `users/{uid}` on signup and deletes that document when it hears `pwa-account-deleted`.
|
|
494
|
-
|
|
495
|
-
Sign-up calls `sendEmailVerification` and fires `pwa-verification-sent` with `{ email }`. Sign-in still succeeds when `emailVerified` is false. pwa-auth does not block an unverified account. The host, including Contractors Centre, decides whether a feature needs a verified email. Read `emailVerified` from `getCurrentUser()`, `onUserChanged`, and `pwa-auth-changed`. Call `isEmailVerified()` to reload. When that reload sees the address become verified, the page fires `pwa-email-verified`.
|
|
496
|
-
|
|
497
|
-
pwa-auth does not write `users/{uid}`. Account deletion removes this user's Storage files under `pwa-auth/{uid}`, calls `logAccountDelete`, deletes the Auth user, and fires `pwa-account-deleted` with `{ uid }`.
|
|
498
|
-
|
|
499
|
-
`deleteDocument(collect, item)` is still exported. The host can call it. The package does not call it for `users/{uid}`.
|
|
500
|
-
|
|
501
|
-
## Contributing
|
|
502
|
-
|
|
503
|
-
### Project layout
|
|
504
|
-
|
|
505
|
-
Edit `typescript/` only. That folder is the source.
|
|
506
|
-
|
|
507
|
-
`npm run build` runs tsc. The emit lands in `base/`. `base/export/pwa-auth.js` is the default package entry. Do not hand-edit `base/`.
|
|
508
|
-
|
|
509
|
-
Rollup reads that emit. `npm run rollup` writes `source/pwa-auth.js` (the npm production bundle) and `website/javascript/pwa-auth.js` (the site bundle). Do not hand-edit those files.
|
|
510
|
-
|
|
511
|
-
`demonstration/` is the dev demo. It imports `../base/export/pwa-auth.js`. `npm run demo` serves `demonstration/index.html`.
|
|
512
|
-
|
|
513
|
-
`website/` is the hosted site at [pwa-authentic.firebaseapp.com](https://pwa-authentic.firebaseapp.com). It loads `website/javascript/pwa-auth.js`. `npm run website` serves `website/index.html`.
|
|
166
|
+
## Firebase
|
|
514
167
|
|
|
515
|
-
|
|
168
|
+
Turn on Email/Password. Turn on Google if that button stays. Photos go to Storage at `pwa-auth/{uid}/`. Let the signed-in person read and write that folder. The elements do not write Firestore.
|
|
516
169
|
|
|
517
|
-
|
|
170
|
+
1. `initialize()` is the one to use.
|
|
518
171
|
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
172
|
+
```javascript
|
|
173
|
+
import { initialize } from 'pwa-auth';
|
|
174
|
+
|
|
175
|
+
initialize({
|
|
176
|
+
config: {
|
|
177
|
+
apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
178
|
+
authDomain: 'xxxxxxx.xxxxxxx.xxx',
|
|
179
|
+
projectId: 'xxxxxxx',
|
|
180
|
+
storageBucket: 'xxxxxxx.xxxxxxx.xxx',
|
|
181
|
+
messagingSenderId: 'xxxxxxxxxxx',
|
|
182
|
+
appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
|
183
|
+
}
|
|
184
|
+
});
|
|
525
185
|
```
|
|
526
186
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
A pull request runs `.github/workflows/ci.yml`: `npm ci`, `npm run build`, `npm run rollup`, `npm test`.
|
|
530
|
-
|
|
531
|
-
### Publish
|
|
532
|
-
|
|
533
|
-
`npm publish` runs `prepublishOnly`, which is `npm run build` then `npm run rollup`. The action runs those two commands on their own as well, so the log shows them. No `NPM_TOKEN`.
|
|
534
|
-
|
|
535
|
-
One-time setup on npmjs.com. Package settings, Trusted Publisher, GitHub Actions. Organization or user: `busynest`. Repository: `user`. Workflow filename: `publish.yml`. Leave the environment name empty. Allow direct `npm publish`. A trusted publisher created now only stages unless you allow publish. Merge `publish.yml` to `master` first. npm drops a publisher that has not published within two days.
|
|
187
|
+
2. Or put that same JSON in `firebase-config` on `user-icon`, `user-drawer`, `user-login`, or `user-settings`.
|
|
536
188
|
|
|
537
|
-
|
|
189
|
+
3. Or set `window.process.env.FIREBASE_CONFIG` to that JSON string before pwa-auth loads. If `window.process` is already there, add the value on it.
|
|
538
190
|
|
|
539
|
-
|
|
191
|
+
Use one of these. Once Firebase is connected, another one leaves it as it is.
|
|
540
192
|
|
|
541
|
-
##
|
|
193
|
+
## License
|
|
542
194
|
|
|
543
|
-
|
|
544
|
-
* [contractor's centre](https://www.contractorscentre.com)
|
|
545
|
-
* [npm](https://www.npmjs.com/package/pwa-auth)
|
|
546
|
-
* [Sponsor Jacek Markiewicz](https://github.com/sponsors/busynest)
|
|
547
|
-
* [Issues](https://github.com/busynest/user/issues)
|
|
195
|
+
MIT. See [license](license). Third-party notices are in [LICENSES.txt](LICENSES.txt).
|