@ionite/react 0.0.22-beta.20260728.2 → 0.0.22
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/package.json +2 -2
- package/README.md +0 -90
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ionite/react",
|
|
3
|
-
"version": "0.0.22
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "ionite React Components",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "ionite",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"./package.json": "./package.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ionite/core": "0.0.22
|
|
27
|
+
"@ionite/core": "^0.0.22"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "^18.0.0 || ^19.0.0",
|
package/README.md
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# @ionite/react
|
|
2
|
-
|
|
3
|
-
Client/browser React components and hooks for ionite apps: sign-in UI, current-user
|
|
4
|
-
state, and tenant URL helpers. This package is **client-safe** — it never pulls server-only SDK code
|
|
5
|
-
(tenant stores, session discovery, webhooks, vault, IAM/SCIM handlers) into your bundle.
|
|
6
|
-
|
|
7
|
-
> Import server-side and shared types/utilities from `@ionite/core`, and server handler
|
|
8
|
-
> code from `@ionite/core/server` or `@ionite/server`. This package
|
|
9
|
-
> intentionally re-exports only the client-safe symbols listed below.
|
|
10
|
-
|
|
11
|
-
## Install
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
bun add @ionite/react
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Peer dependencies: `react` and `react-dom` (`^18.0.0 || ^19.0.0`).
|
|
18
|
-
|
|
19
|
-
## Client-safe exports
|
|
20
|
-
|
|
21
|
-
Workforce (SSO):
|
|
22
|
-
|
|
23
|
-
- `SSOProvider`
|
|
24
|
-
- `useSSOContext` / `useOptionalSSOContext` (non-throwing)
|
|
25
|
-
- `logout`
|
|
26
|
-
|
|
27
|
-
Customer (CIAM):
|
|
28
|
-
|
|
29
|
-
- `CIAMProvider`
|
|
30
|
-
- `useCIAMContext` / `useOptionalCIAMContext` (non-throwing)
|
|
31
|
-
- `CIAMProviderList`, `useCIAMProviders`
|
|
32
|
-
- `getCustomer`
|
|
33
|
-
- `logoutCustomer`
|
|
34
|
-
|
|
35
|
-
Gating / shared:
|
|
36
|
-
|
|
37
|
-
- `SignedIn`, `SignedOut`, `SignInLoading` (each accepts `audience?: 'workforce' | 'customer'`, default `'workforce'`)
|
|
38
|
-
- `TenantProvider`, `useTenant`, `useOptionalTenant` (non-throwing), `createTenantUrls`
|
|
39
|
-
|
|
40
|
-
Re-exported client-safe types/utilities from core: `WorkforceUser`, `Customer`, `AuthenticatedUser`,
|
|
41
|
-
`CIAMProviderDescriptor` (+ branding/color/type), `IdTokenClaims`, `TenantRoutingStrategy`,
|
|
42
|
-
`TenantPathNamespace`, `Logger`, `silentLogger`, `defaultLogger`.
|
|
43
|
-
|
|
44
|
-
## Canonical pattern
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
import { SignedIn, SignedOut, SignInLoading, SSOProvider } from '@ionite/react';
|
|
48
|
-
|
|
49
|
-
<SSOProvider userUrl="/api/ionite/auth/user">
|
|
50
|
-
<SignInLoading>Loading…</SignInLoading>
|
|
51
|
-
<SignedIn>
|
|
52
|
-
<UserDisplay />
|
|
53
|
-
</SignedIn>
|
|
54
|
-
<SignedOut>
|
|
55
|
-
<a href="/api/ionite/auth/login">Sign in</a>
|
|
56
|
-
</SignedOut>
|
|
57
|
-
</SSOProvider>;
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Auth state and errors
|
|
61
|
-
|
|
62
|
-
`useSSOContext()` / `useCIAMContext()` return `{ user|customer, setUser|setCustomer, isLoading, error }`.
|
|
63
|
-
|
|
64
|
-
`error` lets you distinguish a backend outage from a signed-out user:
|
|
65
|
-
|
|
66
|
-
- `value === null && error === null` → signed out (the server returned `401`).
|
|
67
|
-
- `value === null && error !== null` → the fetch failed for a non-auth reason (network/5xx). Any
|
|
68
|
-
previously loaded value is preserved; render a "try again" affordance rather than treating the
|
|
69
|
-
user as logged out.
|
|
70
|
-
|
|
71
|
-
`CIAMProviderList` accepts an `errorFallback={(error, retry) => ...}` and clears the stale list when a
|
|
72
|
-
refresh fails.
|
|
73
|
-
|
|
74
|
-
## Storage
|
|
75
|
-
|
|
76
|
-
`storage` defaults to `'memory'` (no tokens are ever stored). Opt into `'local'`/`'session'` to
|
|
77
|
-
survive reloads; the stored record is a non-secret display subset. On load, records are validated
|
|
78
|
-
against an identity shape and discarded if expired. A custom `storageKey` is honored by the provider,
|
|
79
|
-
`getCustomer`, and `logout`/`logoutCustomer`.
|
|
80
|
-
|
|
81
|
-
## Cross-origin
|
|
82
|
-
|
|
83
|
-
By default `fetch` does not send cookies cross-origin. When `userUrl`/`customerUrl` is on a different
|
|
84
|
-
origin, pass `fetchInit={{ credentials: 'include' }}` (keep the object stable/memoized). The same
|
|
85
|
-
option exists on `getCustomer`/`logout`/`logoutCustomer`.
|
|
86
|
-
|
|
87
|
-
## Docs
|
|
88
|
-
|
|
89
|
-
See `site/public/docs/llms-react.txt` for the full usage guide, and the root `README.md` for server-side
|
|
90
|
-
setup that backs these components.
|