primus-react-ui 1.0.14 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -30
- package/dist/index.d.mts +229 -115
- package/dist/index.d.ts +229 -115
- package/dist/index.js +1290 -611
- package/dist/index.mjs +1190 -534
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,22 +13,23 @@ npm install primus-react-ui
|
|
|
13
13
|
```tsx
|
|
14
14
|
import { PrimusProvider, PrimusLogin } from 'primus-react-ui';
|
|
15
15
|
|
|
16
|
-
function App() {
|
|
17
|
-
return (
|
|
18
|
-
<PrimusProvider authority="https://your-api.com" clientId="your-client-id">
|
|
19
|
-
<PrimusLogin
|
|
20
|
-
socialProviders={['google', 'github']}
|
|
21
|
-
onLogin={({ username, password }) => {
|
|
22
|
-
console.log(username, password);
|
|
23
|
-
}}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
function App() {
|
|
17
|
+
return (
|
|
18
|
+
<PrimusProvider authority="https://your-api.com" authBasePath="/api/auth" clientId="your-client-id">
|
|
19
|
+
<PrimusLogin
|
|
20
|
+
socialProviders={['google', 'github']}
|
|
21
|
+
onLogin={({ username, password }) => {
|
|
22
|
+
console.log(username, password);
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
</PrimusProvider>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If your backend exposes `/auth/*` instead of `/api/auth/*`, set `authBasePath="/auth"`.
|
|
31
|
+
|
|
32
|
+
Identity Broker note: social provider login is redirect-based (`GET /api/auth/{provider}`).
|
|
32
33
|
|
|
33
34
|
## Components
|
|
34
35
|
|
|
@@ -91,20 +92,29 @@ function App() {
|
|
|
91
92
|
- `useRealtimeNotifications`
|
|
92
93
|
- `usePrimusTheme`
|
|
93
94
|
|
|
94
|
-
## Props Reference
|
|
95
|
-
|
|
96
|
-
### PrimusLogin
|
|
97
|
-
| Prop | Type | Description |
|
|
98
|
-
|------|------|-------------|
|
|
99
|
-
| `onLogin` | `(credentials: { username: string; password: string }) => void` | Email/password submit handler |
|
|
100
|
-
| `socialProviders` | `SocialProvider[]` | Social providers to display |
|
|
101
|
-
| `onSocialLogin` | `(provider: SocialProvider) => void` | Social login handler |
|
|
102
|
-
| `authEndpoint` | `string` | Base path for social auth redirects |
|
|
103
|
-
| `showEmailLogin` | `boolean` | Show email/password form |
|
|
104
|
-
| `title` | `string` | Form title |
|
|
105
|
-
| `subtitle` | `string` | Form subtitle |
|
|
106
|
-
| `logo` | `ReactNode \| string` | Logo element or URL |
|
|
107
|
-
| `theme` | `'light' \| 'dark'` | Theme override |
|
|
95
|
+
## Props Reference
|
|
96
|
+
|
|
97
|
+
### PrimusLogin
|
|
98
|
+
| Prop | Type | Description |
|
|
99
|
+
|------|------|-------------|
|
|
100
|
+
| `onLogin` | `(credentials: { username: string; password: string }) => void` | Email/password submit handler |
|
|
101
|
+
| `socialProviders` | `SocialProvider[]` | Social providers to display |
|
|
102
|
+
| `onSocialLogin` | `(provider: SocialProvider) => void` | Social login handler |
|
|
103
|
+
| `authEndpoint` | `string` | Base path for social auth redirects |
|
|
104
|
+
| `showEmailLogin` | `boolean` | Show email/password form |
|
|
105
|
+
| `title` | `string` | Form title |
|
|
106
|
+
| `subtitle` | `string` | Form subtitle |
|
|
107
|
+
| `logo` | `ReactNode \| string` | Logo element or URL |
|
|
108
|
+
| `theme` | `'light' \| 'dark'` | Theme override |
|
|
109
|
+
|
|
110
|
+
### PrimusProvider
|
|
111
|
+
| Prop | Type | Description |
|
|
112
|
+
|------|------|-------------|
|
|
113
|
+
| `authority` | `string` | API base URL (origin only) |
|
|
114
|
+
| `authBasePath` | `string` | Broker base path (default: `/api/auth`) |
|
|
115
|
+
| `csrfCookieName` | `string` | CSRF cookie name (default: `XSRF-TOKEN`) |
|
|
116
|
+
| `csrfHeaderName` | `string` | CSRF header name (default: `X-Primus-CSRF`) |
|
|
117
|
+
| `seedCsrfOnLoad` | `boolean` | Seed CSRF cookie on load (default: true) |
|
|
108
118
|
|
|
109
119
|
### CheckoutForm
|
|
110
120
|
| Prop | Type | Description |
|