@ciromaciel/auth-react 1.2.0 → 1.4.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 +37 -7
- package/dist/index.esm.js +444 -122
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +445 -119
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -121,18 +121,48 @@ email form.
|
|
|
121
121
|
- An account is saved only after a session exists: the code confirmed, or the provider's token
|
|
122
122
|
back. A mistyped email never becomes a suggestion.
|
|
123
123
|
- The list keeps the five most recent accounts. Each entry holds the email, the way in and the
|
|
124
|
-
time of the last sign-in.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
time of the last sign-in.
|
|
125
|
+
- Every app of the same application shares the list, even across origins: the Auth worker keeps
|
|
126
|
+
it in an HttpOnly cookie on its own host and answers only to the origins the application
|
|
127
|
+
allows. A copy in `localStorage` (`auth:recent-accounts`) renders at once while the shared list
|
|
128
|
+
loads, and stands in when the worker cannot be reached.
|
|
129
|
+
- Signing out keeps the list. "Gerenciar" on the screen removes an account from every app of the
|
|
130
|
+
application; nothing else about that account changes.
|
|
128
131
|
|
|
129
132
|
```jsx
|
|
130
133
|
<SignIn /> {/* shows and saves recent accounts */}
|
|
131
134
|
<SignIn recentAccounts={false} /> {/* shared computers: neither shows nor saves */}
|
|
132
135
|
```
|
|
133
136
|
|
|
134
|
-
Building your own screen? `
|
|
135
|
-
`
|
|
137
|
+
Building your own screen? `fetchRecentAccounts()`, `saveRecentAccount(method)` and
|
|
138
|
+
`deleteRecentAccount(email)` talk to the shared list; `listRecentAccounts()`,
|
|
139
|
+
`rememberAccount(email, method)`, `forgetAccount(email)` and `adoptRecentAccounts(list)` manage
|
|
140
|
+
the local copy.
|
|
141
|
+
|
|
142
|
+
### The account card
|
|
143
|
+
|
|
144
|
+
`<UserInformation />` is what opens from the footer of a sidebar: who is signed in, in which
|
|
145
|
+
organization and on which plan, then one list of actions with "Sair" last.
|
|
146
|
+
|
|
147
|
+
```jsx
|
|
148
|
+
<UserInformation
|
|
149
|
+
user={user}
|
|
150
|
+
signOut={signOut}
|
|
151
|
+
onAccountClick={openAccount}
|
|
152
|
+
onBillingClick={openBilling}
|
|
153
|
+
items={[{ id: 'docs', label: 'Documentação', icon: IconFileText, onClick: openDocs }]}
|
|
154
|
+
plan={{ name: 'Pro', used: 3, limit: 9, unit: 'projetos', onClick: openPlans }}
|
|
155
|
+
organization={{ name: 'Acme', role: 'owner' }}
|
|
156
|
+
/>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
- The title is the user's name, or the email when there is none — never both saying the same
|
|
160
|
+
thing.
|
|
161
|
+
- `items` are your app's own rows, passed as data (`{ id, label, icon, onClick }`), shown in their
|
|
162
|
+
own group after billing. The component takes no JSX, so every app's card keeps the same shape.
|
|
163
|
+
- `plan` and `organization` draw the context strip; leave them out and it is not drawn.
|
|
164
|
+
`limit: null` hides the usage bar.
|
|
165
|
+
- `branded={false}` removes the "Protegido por Auth" line.
|
|
136
166
|
|
|
137
167
|
## API
|
|
138
168
|
|
|
@@ -142,7 +172,7 @@ Building your own screen? `listRecentAccounts()`, `rememberAccount(email, method
|
|
|
142
172
|
| ------------------------- | ------------------------------------------------------------ |
|
|
143
173
|
| `<SignIn />` | The whole way in: asks for the email, then takes the code |
|
|
144
174
|
| `<UserProfile />` | User profile management modal |
|
|
145
|
-
| `<UserInformation />` |
|
|
175
|
+
| `<UserInformation />` | The account card: who, where, which plan, then the actions |
|
|
146
176
|
| `<SocialButtons />` | Sign-in buttons for the providers the application enabled |
|
|
147
177
|
| `<AuthCard />` | The card shell the screens are built on |
|
|
148
178
|
| `<Wordmark />` | Application wordmark |
|