@appocus/auth-react-router 0.2.0 → 0.3.2
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 +2 -2
- package/dist/client.d.ts +19 -0
- package/dist/esm/client.js +19 -0
- package/dist/esm/middleware.js +1 -1
- package/dist/esm/oauth-authorize-url.js +1 -1
- package/dist/esm/routes/callback.js +2 -2
- package/dist/esm/routes/logout.js +2 -2
- package/dist/routes/callback.d.ts +1 -1
- package/package.json +13 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @appocus/auth-react-router
|
|
2
2
|
|
|
3
|
-
OAuth login plumbing for Appocus apps built on React Router 7 + `@zauru-sdk/
|
|
3
|
+
OAuth login plumbing for Appocus apps built on React Router 7 + `@zauru-sdk/services`.
|
|
4
4
|
|
|
5
5
|
## What's inside
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ OAuth login plumbing for Appocus apps built on React Router 7 + `@zauru-sdk/weba
|
|
|
18
18
|
pnpm add @appocus/auth-react-router
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Peer deps: `react`, `react-router`, `sonner`, `@zauru-sdk/
|
|
21
|
+
Peer deps: `react`, `react-router`, `sonner`, `@zauru-sdk/services`, `@zauru-sdk/config`.
|
|
22
22
|
|
|
23
23
|
## Configure once
|
|
24
24
|
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe entry point for @appocus/auth-react-router.
|
|
3
|
+
*
|
|
4
|
+
* Does NOT include middleware.ts or the route factories that depend on
|
|
5
|
+
* @zauru-sdk/services (which pulls in @remix-run/node at runtime).
|
|
6
|
+
* Those server-only exports remain accessible via the default entry point in
|
|
7
|
+
* SSR / Node.js environments.
|
|
8
|
+
*/
|
|
9
|
+
export * from "./authenticated-fetch.js";
|
|
10
|
+
export * from "./oauth-authorize-url.js";
|
|
11
|
+
export * from "./reauth-constants.js";
|
|
12
|
+
export * from "./reauth-popup.client.js";
|
|
13
|
+
export * from "./auth-shell-layout.js";
|
|
14
|
+
export * from "./redirect-if-authenticated.js";
|
|
15
|
+
export * from "./route-types.js";
|
|
16
|
+
export * from "./runtime-config.js";
|
|
17
|
+
export * from "./routes/callback.js";
|
|
18
|
+
export * from "./routes/login-popup.js";
|
|
19
|
+
export * from "./routes/reauth-popup-done.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe entry point for @appocus/auth-react-router.
|
|
3
|
+
*
|
|
4
|
+
* Does NOT include middleware.ts or the route factories that depend on
|
|
5
|
+
* @zauru-sdk/services (which pulls in @remix-run/node at runtime).
|
|
6
|
+
* Those server-only exports remain accessible via the default entry point in
|
|
7
|
+
* SSR / Node.js environments.
|
|
8
|
+
*/
|
|
9
|
+
export * from "./authenticated-fetch.js";
|
|
10
|
+
export * from "./oauth-authorize-url.js";
|
|
11
|
+
export * from "./reauth-constants.js";
|
|
12
|
+
export * from "./reauth-popup.client.js";
|
|
13
|
+
export * from "./auth-shell-layout.js";
|
|
14
|
+
export * from "./redirect-if-authenticated.js";
|
|
15
|
+
export * from "./route-types.js";
|
|
16
|
+
export * from "./runtime-config.js";
|
|
17
|
+
export * from "./routes/callback.js";
|
|
18
|
+
export * from "./routes/login-popup.js";
|
|
19
|
+
export * from "./routes/reauth-popup-done.js";
|
package/dist/esm/middleware.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { redirect } from "react-router";
|
|
2
|
-
import { getSession, getRefreshSession } from "@zauru-sdk/
|
|
2
|
+
import { getSession, getRefreshSession } from "@zauru-sdk/services";
|
|
3
3
|
/**
|
|
4
4
|
* Throws a redirect to `/login` if the request has no OAuth session cookie.
|
|
5
5
|
* Attach as a route middleware on authenticated routes.
|
|
@@ -3,8 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { redirect, useNavigate, useSearchParams, useSubmit, } from "react-router";
|
|
5
5
|
import { toast } from "sonner";
|
|
6
|
-
import { commitSession, getSession, nativeLogin, } from "@zauru-sdk/
|
|
7
|
-
import { config } from "@zauru-sdk/
|
|
6
|
+
import { commitSession, getSession, nativeLogin, } from "@zauru-sdk/services";
|
|
7
|
+
import { config } from "@zauru-sdk/config";
|
|
8
8
|
import { loginMiddleware } from "../middleware.js";
|
|
9
9
|
import { AuthShellLayout } from "../auth-shell-layout.js";
|
|
10
10
|
import { getAuthRuntime } from "../runtime-config.js";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
4
|
import { redirect, useSubmit } from "react-router";
|
|
5
|
-
import { getSession, destroySession } from "@zauru-sdk/
|
|
6
|
-
import { config } from "@zauru-sdk/
|
|
5
|
+
import { getSession, destroySession } from "@zauru-sdk/services";
|
|
6
|
+
import { config } from "@zauru-sdk/config";
|
|
7
7
|
import { AuthShellLayout } from "../auth-shell-layout.js";
|
|
8
8
|
/** Module-scope flag to avoid double-submission under React Strict Mode. */
|
|
9
9
|
let logoutAutoSubmitStarted = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LoginFormComponent, RouteModule } from "../route-types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Minimal session contract this route depends on. Re-typed locally so we don't
|
|
4
|
-
* pull `@zauru-sdk/
|
|
4
|
+
* pull `@zauru-sdk/services` types into the consumer surface.
|
|
5
5
|
*/
|
|
6
6
|
type ZauruSession = {
|
|
7
7
|
get: (key: string) => unknown;
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appocus/auth-react-router",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "OAuth login flow building blocks for Appocus React Router apps: middlewares, OAuth URL builder, authenticated fetch with reauth popup, and route factories for /login, /logout, /login-popup, /callback and the reauth-popup-done page.",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"browser": "./dist/esm/client.js",
|
|
12
|
+
"import": "./dist/esm/index.js",
|
|
13
|
+
"default": "./dist/esm/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
9
16
|
"publishConfig": {
|
|
10
17
|
"access": "public",
|
|
11
18
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -23,20 +30,20 @@
|
|
|
23
30
|
},
|
|
24
31
|
"license": "MIT",
|
|
25
32
|
"peerDependencies": {
|
|
26
|
-
"@zauru-sdk/
|
|
27
|
-
"@zauru-sdk/
|
|
33
|
+
"@zauru-sdk/config": "*",
|
|
34
|
+
"@zauru-sdk/services": "*",
|
|
28
35
|
"react": "^18.2.0 || ^19.0.0",
|
|
29
36
|
"react-router": "^7.0.0",
|
|
30
37
|
"sonner": "^1.0.0 || ^2.0.0"
|
|
31
38
|
},
|
|
32
39
|
"devDependencies": {
|
|
33
40
|
"@types/react": "^19.0.0",
|
|
34
|
-
"@zauru-sdk/
|
|
35
|
-
"@zauru-sdk/
|
|
41
|
+
"@zauru-sdk/config": "^6.0.0",
|
|
42
|
+
"@zauru-sdk/services": "^6.0.0",
|
|
36
43
|
"react": "^19.0.0",
|
|
37
44
|
"react-router": "^7.10.1",
|
|
38
45
|
"sonner": "^2.0.7",
|
|
39
46
|
"typescript": "^5.1.6"
|
|
40
47
|
},
|
|
41
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "dabafd40914d3d0dd6fcd39f3490c074659a4309"
|
|
42
49
|
}
|