@schemavaults/auth-server-sdk 0.36.4 → 0.36.5

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/dist/cli.cjs CHANGED
@@ -89,7 +89,7 @@ var init_resolve_codegen_templates_directory = __esm({
89
89
 
90
90
  // src/NextjsAppDirectoryPlugin/codegen-marker.ts
91
91
  function getCodegenMarkerComment() {
92
- const version = true ? "0.36.4" : "unknown";
92
+ const version = true ? "0.36.5" : "unknown";
93
93
  return `${CODEGEN_MARKER_PREFIX}${version}`;
94
94
  }
95
95
  function hasCodegenMarker(firstLine) {
@@ -345,7 +345,7 @@ async function main() {
345
345
  return;
346
346
  }
347
347
  if (args.includes("--version") || args.includes("-v")) {
348
- console.log(`${PACKAGE_NAME}@${"0.36.4"}`);
348
+ console.log(`${PACKAGE_NAME}@${"0.36.5"}`);
349
349
  return;
350
350
  }
351
351
  const command = args.find((arg) => !arg.startsWith("-")) ?? "codegen";
@@ -2,10 +2,14 @@
2
2
 
3
3
  import { LoadingPage, useToast } from "@schemavaults/ui";
4
4
  import { useStartLoginOauthPKCEFlow } from "@schemavaults/auth-react-provider";
5
- import { type ReactElement } from "react";
5
+ import { useSearchParams } from "next/navigation";
6
+ import { type ReactElement, Suspense } from "react";
6
7
 
7
- export default function LoginPage(): ReactElement {
8
+ function LoginFlow(): ReactElement {
8
9
  const { toast } = useToast();
10
+ // The page a route guard turned the user away from, to return them to
11
+ // once they have signed in.
12
+ const next_href: string | null = useSearchParams().get("next_href");
9
13
 
10
14
  function onError(e: unknown): void {
11
15
  toast({
@@ -17,7 +21,7 @@ export default function LoginPage(): ReactElement {
17
21
  return;
18
22
  }
19
23
 
20
- useStartLoginOauthPKCEFlow({ onError });
24
+ useStartLoginOauthPKCEFlow({ onError, next_href });
21
25
 
22
26
  return (
23
27
  <>
@@ -25,3 +29,11 @@ export default function LoginPage(): ReactElement {
25
29
  </>
26
30
  );
27
31
  }
32
+
33
+ export default function LoginPage(): ReactElement {
34
+ return (
35
+ <Suspense fallback={<LoadingPage message="Commencing login flow..." />}>
36
+ <LoginFlow />
37
+ </Suspense>
38
+ );
39
+ }
@@ -3,10 +3,13 @@
3
3
  import { LoadingPage } from "@schemavaults/ui";
4
4
  import { useStartRegisterOauthPKCEFlow } from "@schemavaults/auth-react-provider";
5
5
  import { useToast } from "@schemavaults/ui";
6
- import type { ReactElement } from "react";
6
+ import { useSearchParams } from "next/navigation";
7
+ import { type ReactElement, Suspense } from "react";
7
8
 
8
- export default function RegisterPage(): ReactElement {
9
+ function RegisterFlow(): ReactElement {
9
10
  const { toast } = useToast();
11
+ // The page to return the user to once they have registered.
12
+ const next_href: string | null = useSearchParams().get("next_href");
10
13
 
11
14
  function onError(e: unknown): void {
12
15
  toast({
@@ -19,6 +22,7 @@ export default function RegisterPage(): ReactElement {
19
22
 
20
23
  useStartRegisterOauthPKCEFlow({
21
24
  onError,
25
+ next_href,
22
26
  });
23
27
 
24
28
  return (
@@ -27,3 +31,11 @@ export default function RegisterPage(): ReactElement {
27
31
  </>
28
32
  );
29
33
  }
34
+
35
+ export default function RegisterPage(): ReactElement {
36
+ return (
37
+ <Suspense fallback={<LoadingPage message="Commencing register flow..." />}>
38
+ <RegisterFlow />
39
+ </Suspense>
40
+ );
41
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@schemavaults/auth-server-sdk",
3
3
  "description": "TypeScript SDK for building authenticated endpoints/middlewares for the Auth Server and Resource Servers",
4
- "version": "0.36.4",
4
+ "version": "0.36.5",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
7
7
  "repository": {