@percepta/create 4.1.16 → 4.2.0

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.
@@ -1,53 +0,0 @@
1
- import type { Metadata } from "next";
2
- import { redirect } from "next/navigation";
3
- import { Suspense } from "react";
4
- import { AUTH_MODE, getServerSession } from "../../../../lib/auth";
5
- import { CredentialsSignUpForm } from "./CredentialsSignUpForm";
6
-
7
- type SearchParamValue = string | string[] | undefined;
8
-
9
- export const metadata: Metadata = {
10
- title: "Create Account — __APP_TITLE__",
11
- };
12
-
13
- function getFirstSearchParam(value: SearchParamValue): string | undefined {
14
- return Array.isArray(value) ? value[0] : value;
15
- }
16
-
17
- function getSignInPath(searchParams: Record<string, SearchParamValue>): string {
18
- const callbackUrl = getFirstSearchParam(searchParams.callbackUrl);
19
- if (callbackUrl == null || callbackUrl.length === 0) {
20
- return "/auth/signin";
21
- }
22
-
23
- return `/auth/signin?callbackUrl=${encodeURIComponent(callbackUrl)}`;
24
- }
25
-
26
- export default async function SignUpPage({
27
- searchParams,
28
- }: {
29
- searchParams?:
30
- | Promise<Record<string, SearchParamValue>>
31
- | Record<string, SearchParamValue>;
32
- } = {}) {
33
- const resolvedSearchParams = (await searchParams) ?? {};
34
- const session = await getServerSession();
35
-
36
- if (session?.user != null) {
37
- redirect("/");
38
- }
39
-
40
- if (AUTH_MODE !== "username-password") {
41
- redirect(getSignInPath(resolvedSearchParams));
42
- }
43
-
44
- return (
45
- <Suspense
46
- fallback={
47
- <p className="text-center text-sm text-muted-foreground">Loading...</p>
48
- }
49
- >
50
- <CredentialsSignUpForm />
51
- </Suspense>
52
- );
53
- }
@@ -1,12 +0,0 @@
1
- import {
2
- ensurePerceptaAuthModeEnv,
3
- type PerceptaAuthMode,
4
- } from "@percepta/auth/better-auth";
5
-
6
- export type AuthMode = PerceptaAuthMode;
7
-
8
- const APP_AUTH_MODE: AuthMode = "__AUTH_MODE__" as AuthMode;
9
-
10
- export const AUTH_MODE = ensurePerceptaAuthModeEnv({
11
- defaultAuthMode: APP_AUTH_MODE,
12
- });