@pofsis-nbt/pofsis-auth 0.1.0 → 1.0.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/Documentation.md +139 -0
- package/README.md +38 -157
- package/dist/PofsisAuth.d.ts +1 -1
- package/dist/PofsisAuth.d.ts.map +1 -1
- package/dist/auth/authLaunch.d.ts +1 -1
- package/dist/auth/authLaunch.d.ts.map +1 -1
- package/dist/auth/config.d.ts +4 -2
- package/dist/auth/config.d.ts.map +1 -1
- package/dist/components/AuthPathShell.d.ts +2 -4
- package/dist/components/AuthPathShell.d.ts.map +1 -1
- package/dist/components/RequireAuth.d.ts.map +1 -1
- package/dist/context/useAuth.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +203 -204
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +15 -16
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -5
- package/API.md +0 -166
package/Documentation.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# POFSIS Auth Documentation
|
|
2
|
+
|
|
3
|
+
This is the complete public API and integration reference for `@pofsis-nbt/pofsis-auth@1.0.1`.
|
|
4
|
+
|
|
5
|
+
## Integration process
|
|
6
|
+
|
|
7
|
+
1. Install `@pofsis-nbt/pofsis-auth` with its React, React DOM, and optional Axios peers.
|
|
8
|
+
2. Import `@pofsis-nbt/pofsis-auth/style.css` once.
|
|
9
|
+
3. Wrap the application in `PofsisAuth` and supply runtime configuration.
|
|
10
|
+
4. Protect authenticated content with `RequireAuth` or use `useAuth` directly.
|
|
11
|
+
5. Register `/auth/callback` and the application origin with the POFSIS Auth service.
|
|
12
|
+
|
|
13
|
+
The consuming application owns environment lookup. The library never reads `import.meta.env`.
|
|
14
|
+
|
|
15
|
+
## Public components
|
|
16
|
+
|
|
17
|
+
### `PofsisAuth`
|
|
18
|
+
|
|
19
|
+
The provider restores the cookie-backed session, manages the in-memory access token, coordinates cross-tab logout, runs OAuth/PKCE, and handles fixed auth paths.
|
|
20
|
+
|
|
21
|
+
`PofsisAuthProps`:
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Required | Meaning |
|
|
24
|
+
| --------------- | ------------------------ | -------- | -------------------------------------- |
|
|
25
|
+
| `children` | `ReactNode` | yes | Application content |
|
|
26
|
+
| `appName` | `string` | yes | Registered POFSIS application identity |
|
|
27
|
+
| `apiBaseUrl` | `string` | yes | Auth API base URL |
|
|
28
|
+
| `authUrl` | `string` | yes | OAuth authorize URL |
|
|
29
|
+
| `scope` | `string` | no | Defaults to `openid profile email` |
|
|
30
|
+
| `postLoginPath` | `string` | no | Callback destination; defaults to `/` |
|
|
31
|
+
| `components` | `AuthComponentOverrides` | no | Custom loading and error screens |
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
<PofsisAuth
|
|
35
|
+
appName="ORBIT"
|
|
36
|
+
apiBaseUrl={runtimeConfig.authApi}
|
|
37
|
+
authUrl={runtimeConfig.authorizeUrl}
|
|
38
|
+
components={{ LoadingScreen: AppLoader, ErrorScreen: AppAuthError }}
|
|
39
|
+
>
|
|
40
|
+
<App />
|
|
41
|
+
</PofsisAuth>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### `RequireAuth`
|
|
45
|
+
|
|
46
|
+
`RequireAuth({ children, fallback?, onUnauthenticated? })` renders authenticated content. `fallback` overrides loading UI for that guard. Without `onUnauthenticated`, an unauthenticated visitor starts login; failures route to `/auth/error`.
|
|
47
|
+
|
|
48
|
+
### `AuthLoadingScreen`
|
|
49
|
+
|
|
50
|
+
The default full-screen loader. `AuthLoadingScreenProps.callback` changes the message for login/callback work.
|
|
51
|
+
|
|
52
|
+
### `AuthErrorScreen`
|
|
53
|
+
|
|
54
|
+
The default error page. `AuthErrorScreenProps.retryHref` defaults to `/login`. Its illustration is emitted into the compiled bundle as a data asset.
|
|
55
|
+
|
|
56
|
+
## `useAuth`
|
|
57
|
+
|
|
58
|
+
`useAuth(): AuthContextValue` must be called below `PofsisAuth`.
|
|
59
|
+
|
|
60
|
+
| Value or method | Meaning |
|
|
61
|
+
| --------------------------------------- | ----------------------------------------------------------------------------- |
|
|
62
|
+
| `user` | Current `PofsisUser`, or `null` |
|
|
63
|
+
| `session` | Current `SessionPayload`, or `null` |
|
|
64
|
+
| `isAuthenticated` | Whether a session is present |
|
|
65
|
+
| `isLoading` | Whether initial session restoration is running |
|
|
66
|
+
| `login(options?)` | Starts OAuth/PKCE login |
|
|
67
|
+
| `logout()` | Ends the remote session, clears local state, broadcasts logout, and redirects |
|
|
68
|
+
| `refreshSession()` | Exchanges the refresh cookie for a new access token |
|
|
69
|
+
| `getAccessToken()` | Returns the in-memory token or `null` |
|
|
70
|
+
| `getAccountProfile()` | Fetches and merges the current `AccountProfile` |
|
|
71
|
+
| `updateAccountProfile(profile)` | Updates first and/or last name |
|
|
72
|
+
| `uploadAccountProfileImage(kind, file)` | Uploads a `profile` or `cover` image |
|
|
73
|
+
| `deleteAccountProfileImage(kind)` | Removes a `profile` or `cover` image |
|
|
74
|
+
| `completeCallback(code, state)` | Completes PKCE callback; normally used internally |
|
|
75
|
+
|
|
76
|
+
## Login options and URL hints
|
|
77
|
+
|
|
78
|
+
`login(options)` accepts `AuthLaunchOptions`:
|
|
79
|
+
|
|
80
|
+
- `returnUrl`: accepted only when it starts with `/` and not `//`; unsafe or external values are discarded.
|
|
81
|
+
- `screen`: `login`, `signup`, or `reset`; legacy `register` is normalized to `signup`.
|
|
82
|
+
- `loginHint`: valid email or Philippine mobile number. Emails are trimmed/lowercased; mobile numbers normalize to `+63`; invalid or values over 320 characters are ignored.
|
|
83
|
+
- `method`: `password`, `passkey`, or `otp`; used only for the login screen.
|
|
84
|
+
|
|
85
|
+
The `/login` route also reads `screen`, `login_hint`, and `method`. Legacy `email` is accepted only as an email hint and only when canonical `login_hint` is absent. Unknown values are ignored. Signup forces password; reset does not forward a method.
|
|
86
|
+
|
|
87
|
+
Fixed paths are `/login`, `/auth/callback`, and `/auth/error`. Saved callback destinations are restricted to safe local paths.
|
|
88
|
+
|
|
89
|
+
## Axios interceptor
|
|
90
|
+
|
|
91
|
+
`attachAuthInterceptor(client, getToken, refresh)` adds the current bearer token and performs one refresh-and-retry after a 401. It returns a cleanup function that ejects both interceptors. Axios is optional unless this helper is used.
|
|
92
|
+
|
|
93
|
+
## Configuration helper
|
|
94
|
+
|
|
95
|
+
`resolveConfig(overrides: ConfigOverrides)` validates `appName`, `apiBaseUrl`, and `authUrl`, trims values, removes a trailing slash from URLs, and supplies the default scope. Missing required values throw synchronously.
|
|
96
|
+
|
|
97
|
+
## Exported types
|
|
98
|
+
|
|
99
|
+
- `PofsisAuthProps`, `PofsisAuthConfig`, `ConfigOverrides`, `AuthComponentOverrides`
|
|
100
|
+
- `AuthLoadingScreenProps`, `AuthErrorScreenProps`, `RequireAuthProps`
|
|
101
|
+
- `AuthContextValue`, `AuthLaunchOptions`, `AuthScreen`, `AuthMethod`
|
|
102
|
+
- `PofsisUser`, `AccountProfile`, `SessionPayload`, `TokenResponse`
|
|
103
|
+
- `OAuthClientConfig`
|
|
104
|
+
|
|
105
|
+
`SessionPayload` contains `token_type`, `expires_in`, and `user`. `TokenResponse` adds `access_token`. Access tokens remain in memory. `PofsisUser` exposes identity, display/profile media, and optional roles. `AccountProfile` represents the editable account profile and timestamps. `OAuthClientConfig` represents server-resolved client, redirect, and logout details.
|
|
106
|
+
|
|
107
|
+
## Module formats
|
|
108
|
+
|
|
109
|
+
ESM/JavaScript and TypeScript use the same package import:
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import { PofsisAuth, useAuth } from '@pofsis-nbt/pofsis-auth'
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
CommonJS uses:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
const { PofsisAuth, useAuth } = require('@pofsis-nbt/pofsis-auth')
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
TypeScript declarations resolve from `dist/index.d.ts`. No separate TypeScript package is needed.
|
|
122
|
+
|
|
123
|
+
## Build and verification process
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm run format:check
|
|
127
|
+
npm run typecheck
|
|
128
|
+
npm test
|
|
129
|
+
npm run build
|
|
130
|
+
npm run pack:check
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`dist/` contains ESM and CommonJS JavaScript, source maps, declaration files/maps, component declarations, and `style.css`. The npm package includes only `dist`, `package.json`, `README.md`, and `Documentation.md`.
|
|
134
|
+
|
|
135
|
+
## Public boundary and migration
|
|
136
|
+
|
|
137
|
+
Supported imports are the package root and `@pofsis-nbt/pofsis-auth/style.css`. Files under `auth/`, `components/`, `context/`, `src/`, and `dist/` are implementation details and are not exported.
|
|
138
|
+
|
|
139
|
+
Migrating from `@pofsis/auth-react` requires changing the package name, passing explicit provider configuration, and importing the stylesheet. OAuth paths, PKCE/session behavior, hooks, profile methods, UI overrides, and interceptor behavior remain available.
|
package/README.md
CHANGED
|
@@ -1,86 +1,41 @@
|
|
|
1
1
|
# @pofsis-nbt/pofsis-auth
|
|
2
2
|
|
|
3
|
-
React
|
|
4
|
-
|
|
5
|
-
The package ships one implementation for JavaScript and TypeScript applications:
|
|
6
|
-
|
|
7
|
-
- ESM: `dist/index.js`
|
|
8
|
-
- CommonJS: `dist/index.cjs`
|
|
9
|
-
- TypeScript declarations: `dist/index.d.ts`
|
|
10
|
-
- Component styles: `dist/style.css`
|
|
11
|
-
|
|
12
|
-
## Requirements
|
|
13
|
-
|
|
14
|
-
- Node.js `^20.19.0` or `>=22.12.0` for package development and builds
|
|
15
|
-
- React and React DOM 18 or newer
|
|
16
|
-
- Axios 1 or newer only when using `attachAuthInterceptor`
|
|
3
|
+
React OAuth 2.0/PKCE authentication for POFSIS applications. One package serves JavaScript and TypeScript consumers through ESM, CommonJS, generated declarations, and extracted CSS.
|
|
17
4
|
|
|
18
5
|
## Install
|
|
19
6
|
|
|
20
7
|
```bash
|
|
21
|
-
npm install @pofsis-nbt/pofsis-auth react react-dom
|
|
8
|
+
npm install @pofsis-nbt/pofsis-auth axios react react-dom
|
|
22
9
|
```
|
|
23
10
|
|
|
24
|
-
Install Axios when using the optional interceptor helper:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm install axios
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## JavaScript usage
|
|
31
|
-
|
|
32
11
|
Import the package stylesheet once in the application entry point:
|
|
33
12
|
|
|
34
|
-
```
|
|
13
|
+
```ts
|
|
35
14
|
import '@pofsis-nbt/pofsis-auth/style.css'
|
|
36
|
-
import { PofsisAuth, RequireAuth } from '@pofsis-nbt/pofsis-auth'
|
|
37
|
-
|
|
38
|
-
export function App() {
|
|
39
|
-
return (
|
|
40
|
-
<PofsisAuth
|
|
41
|
-
appName="Orbit"
|
|
42
|
-
apiBaseUrl="https://auth.example.com/api"
|
|
43
|
-
authUrl="https://auth.example.com/authorize"
|
|
44
|
-
>
|
|
45
|
-
<RequireAuth>
|
|
46
|
-
<YourApplication />
|
|
47
|
-
</RequireAuth>
|
|
48
|
-
</PofsisAuth>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
15
|
```
|
|
52
16
|
|
|
53
|
-
##
|
|
54
|
-
|
|
55
|
-
The same imports provide bundled declarations; no separate type package is needed:
|
|
17
|
+
## Quick start
|
|
56
18
|
|
|
57
19
|
```tsx
|
|
20
|
+
import { PofsisAuth, RequireAuth } from '@pofsis-nbt/pofsis-auth'
|
|
58
21
|
import '@pofsis-nbt/pofsis-auth/style.css'
|
|
59
|
-
import { PofsisAuth, RequireAuth, type PofsisAuthProps } from '@pofsis-nbt/pofsis-auth'
|
|
60
|
-
|
|
61
|
-
const authConfig: Pick<PofsisAuthProps, 'appName' | 'apiBaseUrl' | 'authUrl' | 'scope'> = {
|
|
62
|
-
appName: 'Orbit',
|
|
63
|
-
apiBaseUrl: 'https://auth.example.com/api',
|
|
64
|
-
authUrl: 'https://auth.example.com/authorize',
|
|
65
|
-
scope: 'openid profile email',
|
|
66
|
-
}
|
|
67
22
|
|
|
68
23
|
export function App() {
|
|
69
24
|
return (
|
|
70
|
-
<PofsisAuth
|
|
25
|
+
<PofsisAuth
|
|
26
|
+
appName="ORBIT"
|
|
27
|
+
apiBaseUrl="https://auth-api.example.com"
|
|
28
|
+
authUrl="https://auth.example.com/authorize"
|
|
29
|
+
>
|
|
71
30
|
<RequireAuth>
|
|
72
|
-
<
|
|
31
|
+
<Dashboard />
|
|
73
32
|
</RequireAuth>
|
|
74
33
|
</PofsisAuth>
|
|
75
34
|
)
|
|
76
35
|
}
|
|
77
36
|
```
|
|
78
37
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
The library never reads `import.meta.env`, `process.env`, or another environment system. The consuming application supplies configuration through `PofsisAuth`.
|
|
82
|
-
|
|
83
|
-
### Vite consumer
|
|
38
|
+
`appName`, `apiBaseUrl`, and `authUrl` are required. The library does not read environment variables. A Vite application may pass its own values:
|
|
84
39
|
|
|
85
40
|
```tsx
|
|
86
41
|
<PofsisAuth
|
|
@@ -89,148 +44,74 @@ The library never reads `import.meta.env`, `process.env`, or another environment
|
|
|
89
44
|
authUrl={import.meta.env.VITE_POFSIS_AUTH_URL}
|
|
90
45
|
scope={import.meta.env.VITE_POFSIS_SCOPE}
|
|
91
46
|
>
|
|
92
|
-
<
|
|
47
|
+
<App />
|
|
93
48
|
</PofsisAuth>
|
|
94
49
|
```
|
|
95
50
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
```tsx
|
|
99
|
-
const runtimeConfig = window.applicationConfig.auth
|
|
100
|
-
|
|
101
|
-
<PofsisAuth
|
|
102
|
-
appName={runtimeConfig.appName}
|
|
103
|
-
apiBaseUrl={runtimeConfig.apiBaseUrl}
|
|
104
|
-
authUrl={runtimeConfig.authUrl}
|
|
105
|
-
scope={runtimeConfig.scope}
|
|
106
|
-
>
|
|
107
|
-
<AppRoutes />
|
|
108
|
-
</PofsisAuth>
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
`appName`, `apiBaseUrl`, and `authUrl` are required. `scope` defaults to `openid profile email`.
|
|
112
|
-
|
|
113
|
-
## Auth routes
|
|
114
|
-
|
|
115
|
-
`PofsisAuth` handles these browser paths before rendering application children:
|
|
116
|
-
|
|
117
|
-
| Path | Behavior |
|
|
118
|
-
| ---------------- | ----------------------------------------------------------------------------------------------------- |
|
|
119
|
-
| `/login` | Starts the PKCE authorization redirect. |
|
|
120
|
-
| `/auth/callback` | Verifies state, exchanges the authorization code, and redirects to the saved path or `postLoginPath`. |
|
|
121
|
-
| `/auth/error` | Renders the configured error screen. |
|
|
122
|
-
|
|
123
|
-
The consuming application must serve its SPA entry point for these paths and register the callback and logout URIs with POFSIS Auth.
|
|
51
|
+
The same props may come from server-injected runtime configuration or hardcoded deployment configuration. The default scope is `openid profile email`.
|
|
124
52
|
|
|
125
53
|
## Session and login
|
|
126
54
|
|
|
127
55
|
```tsx
|
|
128
56
|
import { useAuth } from '@pofsis-nbt/pofsis-auth'
|
|
129
57
|
|
|
130
|
-
|
|
131
|
-
const {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return <button onClick={() => void login()}>Sign in</button>
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return <button onClick={() => void logout()}>Sign out {user?.displayName}</button>
|
|
58
|
+
function AccountMenu() {
|
|
59
|
+
const { user, login, logout } = useAuth()
|
|
60
|
+
if (!user) return <button onClick={() => void login()}>Sign in</button>
|
|
61
|
+
return <button onClick={() => void logout()}>Sign out {user.displayName}</button>
|
|
138
62
|
}
|
|
139
63
|
```
|
|
140
64
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Login supports screens and editable hints:
|
|
144
|
-
|
|
145
|
-
```tsx
|
|
146
|
-
void login({
|
|
147
|
-
screen: 'login',
|
|
148
|
-
loginHint: 'sample@example.com',
|
|
149
|
-
method: 'password',
|
|
150
|
-
returnUrl: '/requested-page',
|
|
151
|
-
})
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
- `screen`: `login`, `signup`, or `reset`; `register` remains a compatibility alias for `signup`.
|
|
155
|
-
- `method`: `password`, `passkey`, or `otp`; applied only to the login screen.
|
|
156
|
-
- `loginHint`: a valid email or Philippine mobile number.
|
|
157
|
-
- `returnUrl`: a local path beginning with one `/`, never `//`.
|
|
158
|
-
|
|
159
|
-
The `/login` route accepts `screen`, `login_hint`, `method`, and legacy `email` query parameters. Hints are editable and untrusted; they never bypass authentication or authorization.
|
|
65
|
+
The provider handles `/login`, `/auth/callback`, and `/auth/error`. Login supports `screen`, `loginHint`, `method`, and a safe application-relative `returnUrl`. See [Documentation.md](./Documentation.md) for the complete API.
|
|
160
66
|
|
|
161
|
-
##
|
|
162
|
-
|
|
163
|
-
```tsx
|
|
164
|
-
import type { AuthErrorScreenProps, AuthLoadingScreenProps } from '@pofsis-nbt/pofsis-auth'
|
|
165
|
-
|
|
166
|
-
function LoadingScreen({ callback }: AuthLoadingScreenProps) {
|
|
167
|
-
return <p>{callback ? 'Completing sign-in...' : 'Restoring session...'}</p>
|
|
168
|
-
}
|
|
67
|
+
## Axios
|
|
169
68
|
|
|
170
|
-
|
|
171
|
-
return <a href={retryHref}>Try signing in again</a>
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
;<PofsisAuth {...authConfig} components={{ LoadingScreen, ErrorScreen }}>
|
|
175
|
-
<YourApplication />
|
|
176
|
-
</PofsisAuth>
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
`RequireAuth` also accepts a route-specific `fallback`.
|
|
180
|
-
|
|
181
|
-
## Axios integration
|
|
182
|
-
|
|
183
|
-
```tsx
|
|
184
|
-
import { useEffect } from 'react'
|
|
69
|
+
```ts
|
|
185
70
|
import axios from 'axios'
|
|
186
71
|
import { attachAuthInterceptor, useAuth } from '@pofsis-nbt/pofsis-auth'
|
|
187
72
|
|
|
188
73
|
const api = axios.create({ baseURL: '/api' })
|
|
189
74
|
|
|
190
|
-
function
|
|
75
|
+
function ApiAuthBridge() {
|
|
191
76
|
const { getAccessToken, refreshSession } = useAuth()
|
|
192
|
-
|
|
193
|
-
useEffect(
|
|
77
|
+
React.useEffect(
|
|
194
78
|
() => attachAuthInterceptor(api, getAccessToken, refreshSession),
|
|
195
79
|
[getAccessToken, refreshSession],
|
|
196
80
|
)
|
|
197
|
-
|
|
198
81
|
return null
|
|
199
82
|
}
|
|
200
83
|
```
|
|
201
84
|
|
|
202
|
-
The returned cleanup function ejects both interceptors.
|
|
203
|
-
|
|
204
85
|
## CommonJS
|
|
205
86
|
|
|
206
|
-
Bundlers and Node-compatible tooling can use the CommonJS export:
|
|
207
|
-
|
|
208
87
|
```js
|
|
209
|
-
const { PofsisAuth, RequireAuth } = require('@pofsis-nbt/pofsis-auth')
|
|
88
|
+
const { PofsisAuth, RequireAuth, useAuth } = require('@pofsis-nbt/pofsis-auth')
|
|
89
|
+
require('@pofsis-nbt/pofsis-auth/style.css')
|
|
210
90
|
```
|
|
211
91
|
|
|
212
|
-
|
|
92
|
+
JavaScript consumers use the compiled JavaScript. TypeScript consumers use the same imports and automatically receive declarations.
|
|
213
93
|
|
|
214
|
-
|
|
215
|
-
require('@pofsis-nbt/pofsis-auth/style.css')
|
|
216
|
-
```
|
|
94
|
+
## Development
|
|
217
95
|
|
|
218
|
-
|
|
96
|
+
Requires Node `^20.19.0` or `>=22.12.0`.
|
|
219
97
|
|
|
220
98
|
```bash
|
|
99
|
+
npm install
|
|
100
|
+
npm run format:check
|
|
221
101
|
npm run typecheck
|
|
222
102
|
npm test
|
|
223
103
|
npm run build
|
|
224
104
|
npm run pack:check
|
|
225
105
|
```
|
|
226
106
|
|
|
227
|
-
|
|
107
|
+
Build output is written to `dist/` with ESM (`index.js`), CommonJS (`index.cjs`), source maps, declarations, and `style.css`.
|
|
108
|
+
|
|
109
|
+
## Migration
|
|
228
110
|
|
|
229
|
-
|
|
111
|
+
When migrating from `@pofsis/auth-react`:
|
|
230
112
|
|
|
231
|
-
1.
|
|
232
|
-
2.
|
|
233
|
-
3.
|
|
234
|
-
4. Remove Vite dependency-prebundle workarounds used for the source-only package.
|
|
113
|
+
1. Change imports to `@pofsis-nbt/pofsis-auth`.
|
|
114
|
+
2. Pass `appName`, `apiBaseUrl`, and `authUrl` to `PofsisAuth`.
|
|
115
|
+
3. Import `@pofsis-nbt/pofsis-auth/style.css` once.
|
|
235
116
|
|
|
236
|
-
|
|
117
|
+
Do not import `src/`, `dist/` internals, or internal auth helpers. Only the package-root exports and `style.css` are supported.
|
package/dist/PofsisAuth.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import type { PofsisAuthProps } from './types';
|
|
|
3
3
|
* Single integration surface for tool apps.
|
|
4
4
|
* Handles session restore, PKCE login, and fixed paths `/login`, `/auth/callback`, `/auth/error`.
|
|
5
5
|
*/
|
|
6
|
-
export declare function PofsisAuth({ children, appName, apiBaseUrl, authUrl,
|
|
6
|
+
export declare function PofsisAuth({ children, appName, apiBaseUrl, authUrl, scope, postLoginPath, components, }: PofsisAuthProps): import("react").JSX.Element;
|
|
7
7
|
//# sourceMappingURL=PofsisAuth.d.ts.map
|
package/dist/PofsisAuth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PofsisAuth.d.ts","sourceRoot":"","sources":["../src/PofsisAuth.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAIR,eAAe,EAElB,MAAM,SAAS,CAAA;AAmVhB;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACvB,QAAQ,EACR,OAAO,EACP,UAAU,EACV,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"PofsisAuth.d.ts","sourceRoot":"","sources":["../src/PofsisAuth.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAIR,eAAe,EAElB,MAAM,SAAS,CAAA;AAmVhB;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACvB,QAAQ,EACR,OAAO,EACP,UAAU,EACV,OAAO,EACP,KAAK,EACL,aAAmB,EACnB,UAAU,GACb,EAAE,eAAe,+BA4BjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AuthLaunchOptions, AuthMethod, AuthScreen } from '../types';
|
|
2
|
-
export declare function normalizeAuthLaunchOptions(value
|
|
2
|
+
export declare function normalizeAuthLaunchOptions(value?: AuthLaunchOptions | string | null, defaultScreen?: AuthScreen): {
|
|
3
3
|
returnUrl: string | undefined;
|
|
4
4
|
screen: AuthScreen;
|
|
5
5
|
loginHint: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authLaunch.d.ts","sourceRoot":"","sources":["../../src/auth/authLaunch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAiBzE,wBAAgB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"authLaunch.d.ts","sourceRoot":"","sources":["../../src/auth/authLaunch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAiBzE,wBAAgB,0BAA0B,CACtC,KAAK,CAAC,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,EACzC,aAAa,GAAE,UAAoB;;;;;EAgBtC;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM;;;;;EAYzD;AAED,wBAAgB,oBAAoB,CAAC,EACjC,OAAO,EACP,OAAO,EACP,KAAK,EACL,OAAO,GACV,EAAE;IACC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,eAAe,CAAA;IACtB,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC9B,UAoBA"}
|
package/dist/auth/config.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PofsisAuthConfig } from '../types';
|
|
2
|
-
export type ConfigOverrides = Partial<PofsisAuthConfig
|
|
2
|
+
export type ConfigOverrides = Omit<Partial<PofsisAuthConfig>, 'scope'> & {
|
|
3
|
+
scope?: string;
|
|
4
|
+
};
|
|
3
5
|
/**
|
|
4
|
-
* Validate and normalize
|
|
6
|
+
* Validate and normalize explicitly supplied runtime configuration.
|
|
5
7
|
*/
|
|
6
8
|
export declare function resolveConfig(overrides?: ConfigOverrides): PofsisAuthConfig;
|
|
7
9
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/auth/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAMhD,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/auth/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAMhD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3F;;GAEG;AACH,wBAAgB,aAAa,CAAC,SAAS,GAAE,eAAoB,GAAG,gBAAgB,CAuB/E"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { AuthComponentOverrides } from '../types';
|
|
3
|
-
|
|
3
|
+
export declare function AuthPathShell({ children, components, postLoginPath, returnPathKey, }: {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
components: Required<AuthComponentOverrides>;
|
|
6
6
|
postLoginPath: string;
|
|
7
7
|
returnPathKey: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function AuthPathShell({ children, components, postLoginPath, returnPathKey, }: AuthPathShellProps): import("react").JSX.Element | null;
|
|
10
|
-
export {};
|
|
8
|
+
}): import("react").JSX.Element | null;
|
|
11
9
|
//# sourceMappingURL=AuthPathShell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthPathShell.d.ts","sourceRoot":"","sources":["../../src/components/AuthPathShell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGrE,OAAO,KAAK,EAAE,sBAAsB,EAAoB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"AuthPathShell.d.ts","sourceRoot":"","sources":["../../src/components/AuthPathShell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGrE,OAAO,KAAK,EAAE,sBAAsB,EAAoB,MAAM,UAAU,CAAA;AA6DxE,wBAAgB,aAAa,CAAC,EAC1B,QAAQ,EACR,UAAU,EACV,aAAa,EACb,aAAa,GAChB,EAAE;IACC,QAAQ,EAAE,SAAS,CAAA;IACnB,UAAU,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAA;IAC5C,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;CACxB,sCAqBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequireAuth.d.ts","sourceRoot":"","sources":["../../src/components/RequireAuth.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"RequireAuth.d.ts","sourceRoot":"","sources":["../../src/components/RequireAuth.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAI7D,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAA;IACnB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,gBAAgB,+BAmBtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/context/useAuth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/context/useAuth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,wBAAgB,OAAO,IAAI,gBAAgB,CAI1C"}
|