chore: follow adrs

This commit is contained in:
Yordis Prieto
2024-09-26 22:50:55 -04:00
parent e5d0c36122
commit 4d690dd0e9
85 changed files with 257 additions and 254 deletions

View File

@@ -1,7 +1,7 @@
import { DynamicTheme } from "@/components/dynamic-theme";
import { SessionsList } from "@/components/sessions-list";
import { getAllSessionCookieIds } from "@/lib/cookies"; import { getAllSessionCookieIds } from "@/lib/cookies";
import { getBrandingSettings, listSessions } from "@/lib/zitadel"; import { getBrandingSettings, listSessions } from "@/lib/zitadel";
import DynamicTheme from "@/ui/DynamicTheme";
import SessionsList from "@/ui/SessionsList";
import { UserPlusIcon } from "@heroicons/react/24/outline"; import { UserPlusIcon } from "@heroicons/react/24/outline";
import Link from "next/link"; import Link from "next/link";

View File

@@ -1,11 +1,11 @@
"use client"; "use client";
import { Boundary } from "@/ui/Boundary"; import { Boundary } from "@/components/boundary";
import { Button } from "@/ui/Button"; import { Button } from "@/components/button";
import React from "react"; import { useEffect } from "react";
export default function Error({ error, reset }: any) { export default function Error({ error, reset }: any) {
React.useEffect(() => { useEffect(() => {
console.log("logging error:", error); console.log("logging error:", error);
}, [error]); }, [error]);

View File

@@ -1,5 +1,5 @@
import { DynamicTheme } from "@/components/dynamic-theme";
import { getBrandingSettings } from "@/lib/zitadel"; import { getBrandingSettings } from "@/lib/zitadel";
import DynamicTheme from "@/ui/DynamicTheme";
import { IdentityProviderType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; import { IdentityProviderType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
// This configuration shows the given name in the respective IDP button as fallback // This configuration shows the given name in the respective IDP button as fallback

View File

@@ -1,3 +1,6 @@
import { Alert, AlertType } from "@/components/alert";
import { DynamicTheme } from "@/components/dynamic-theme";
import { IdpSignin } from "@/components/idp-signin";
import { idpTypeToIdentityProviderType, PROVIDER_MAPPING } from "@/lib/idp"; import { idpTypeToIdentityProviderType, PROVIDER_MAPPING } from "@/lib/idp";
import { import {
addIDPLink, addIDPLink,
@@ -7,9 +10,6 @@ import {
listUsers, listUsers,
retrieveIDPIntent, retrieveIDPIntent,
} from "@/lib/zitadel"; } from "@/lib/zitadel";
import Alert, { AlertType } from "@/ui/Alert";
import DynamicTheme from "@/ui/DynamicTheme";
import IdpSignin from "@/ui/IdpSignin";
import { AutoLinkingOption } from "@zitadel/proto/zitadel/idp/v2/idp_pb"; import { AutoLinkingOption } from "@zitadel/proto/zitadel/idp/v2/idp_pb";
export default async function Page({ export default async function Page({

View File

@@ -1,6 +1,6 @@
import { DynamicTheme } from "@/components/dynamic-theme";
import { SignInWithIdp } from "@/components/sign-in-with-idp";
import { getBrandingSettings, settingsService } from "@/lib/zitadel"; import { getBrandingSettings, settingsService } from "@/lib/zitadel";
import DynamicTheme from "@/ui/DynamicTheme";
import { SignInWithIDP } from "@/ui/SignInWithIDP";
import { makeReqCtx } from "@zitadel/client/v2"; import { makeReqCtx } from "@zitadel/client/v2";
function getIdentityProviders(orgId?: string) { function getIdentityProviders(orgId?: string) {
@@ -36,12 +36,12 @@ export default async function Page({
</p> </p>
{identityProviders && ( {identityProviders && (
<SignInWithIDP <SignInWithIdp
host={host} host={host}
identityProviders={identityProviders} identityProviders={identityProviders}
authRequestId={authRequestId} authRequestId={authRequestId}
organization={organization} organization={organization}
></SignInWithIDP> ></SignInWithIdp>
)} )}
</div> </div>
</DynamicTheme> </DynamicTheme>

View File

@@ -1,12 +1,12 @@
import { DynamicTheme } from "@/components/dynamic-theme";
import { SignInWithIdp } from "@/components/sign-in-with-idp";
import { UsernameForm } from "@/components/username-form";
import { import {
getBrandingSettings, getBrandingSettings,
getLegalAndSupportSettings, getLegalAndSupportSettings,
getLoginSettings, getLoginSettings,
settingsService, settingsService,
} from "@/lib/zitadel"; } from "@/lib/zitadel";
import DynamicTheme from "@/ui/DynamicTheme";
import { SignInWithIDP } from "@/ui/SignInWithIDP";
import UsernameForm from "@/ui/UsernameForm";
import { makeReqCtx } from "@zitadel/client/v2"; import { makeReqCtx } from "@zitadel/client/v2";
function getIdentityProviders(orgId?: string) { function getIdentityProviders(orgId?: string) {
@@ -52,12 +52,12 @@ export default async function Page({
allowRegister={!!loginSettings?.allowRegister} allowRegister={!!loginSettings?.allowRegister}
> >
{legal && identityProviders && process.env.ZITADEL_API_URL && ( {legal && identityProviders && process.env.ZITADEL_API_URL && (
<SignInWithIDP <SignInWithIdp
host={host} host={host}
identityProviders={identityProviders} identityProviders={identityProviders}
authRequestId={authRequestId} authRequestId={authRequestId}
organization={organization} organization={organization}
></SignInWithIDP> ></SignInWithIdp>
)} )}
</UsernameForm> </UsernameForm>
</div> </div>

View File

@@ -1,13 +1,13 @@
import { Alert } from "@/components/alert";
import { ChangePasswordForm } from "@/components/change-password-form";
import { DynamicTheme } from "@/components/dynamic-theme";
import { UserAvatar } from "@/components/user-avatar";
import { getSessionCookieById } from "@/lib/cookies"; import { getSessionCookieById } from "@/lib/cookies";
import { import {
getBrandingSettings, getBrandingSettings,
getPasswordComplexitySettings, getPasswordComplexitySettings,
getSession, getSession,
} from "@/lib/zitadel"; } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import ChangePasswordForm from "@/ui/ChangePasswordForm";
import DynamicTheme from "@/ui/DynamicTheme";
import UserAvatar from "@/ui/UserAvatar";
export default async function Page({ export default async function Page({
searchParams, searchParams,

View File

@@ -1,3 +1,8 @@
import { Alert } from "@/components/alert";
import { BackButton } from "@/components/back-button";
import { ChooseSecondFactor } from "@/components/choose-second-factor";
import { DynamicTheme } from "@/components/dynamic-theme";
import { UserAvatar } from "@/components/user-avatar";
import { getSessionCookieById } from "@/lib/cookies"; import { getSessionCookieById } from "@/lib/cookies";
import { loadMostRecentSession } from "@/lib/session"; import { loadMostRecentSession } from "@/lib/session";
import { import {
@@ -5,11 +10,6 @@ import {
getSession, getSession,
listAuthenticationMethodTypes, listAuthenticationMethodTypes,
} from "@/lib/zitadel"; } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import BackButton from "@/ui/BackButton";
import ChooseSecondFactor from "@/ui/ChooseSecondFactor";
import DynamicTheme from "@/ui/DynamicTheme";
import UserAvatar from "@/ui/UserAvatar";
export default async function Page({ export default async function Page({
searchParams, searchParams,

View File

@@ -1,3 +1,8 @@
import { Alert } from "@/components/alert";
import { BackButton } from "@/components/back-button";
import { ChooseSecondFactorToSetup } from "@/components/choose-second-factor-to-setup";
import { DynamicTheme } from "@/components/dynamic-theme";
import { UserAvatar } from "@/components/user-avatar";
import { getSessionCookieById } from "@/lib/cookies"; import { getSessionCookieById } from "@/lib/cookies";
import { loadMostRecentSession } from "@/lib/session"; import { loadMostRecentSession } from "@/lib/session";
import { import {
@@ -7,11 +12,6 @@ import {
getUserByID, getUserByID,
listAuthenticationMethodTypes, listAuthenticationMethodTypes,
} from "@/lib/zitadel"; } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import BackButton from "@/ui/BackButton";
import ChooseSecondFactorToSetup from "@/ui/ChooseSecondFactorToSetup";
import DynamicTheme from "@/ui/DynamicTheme";
import UserAvatar from "@/ui/UserAvatar";
import { Timestamp, timestampDate } from "@zitadel/client"; import { Timestamp, timestampDate } from "@zitadel/client";
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb"; import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";

View File

@@ -1,9 +1,9 @@
import { Alert } from "@/components/alert";
import { DynamicTheme } from "@/components/dynamic-theme";
import { LoginOTP } from "@/components/login-otp";
import { UserAvatar } from "@/components/user-avatar";
import { loadMostRecentSession } from "@/lib/session"; import { loadMostRecentSession } from "@/lib/session";
import { getBrandingSettings } from "@/lib/zitadel"; import { getBrandingSettings } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import DynamicTheme from "@/ui/DynamicTheme";
import LoginOTP from "@/ui/LoginOTP";
import UserAvatar from "@/ui/UserAvatar";
export default async function Page({ export default async function Page({
searchParams, searchParams,

View File

@@ -1,3 +1,9 @@
import { Alert } from "@/components/alert";
import { BackButton } from "@/components/back-button";
import { Button, ButtonVariants } from "@/components/button";
import { DynamicTheme } from "@/components/dynamic-theme";
import { TotpRegister } from "@/components/totp-register";
import { UserAvatar } from "@/components/user-avatar";
import { loadMostRecentSession } from "@/lib/session"; import { loadMostRecentSession } from "@/lib/session";
import { import {
addOTPEmail, addOTPEmail,
@@ -5,12 +11,6 @@ import {
getBrandingSettings, getBrandingSettings,
registerTOTP, registerTOTP,
} from "@/lib/zitadel"; } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import BackButton from "@/ui/BackButton";
import { Button, ButtonVariants } from "@/ui/Button";
import DynamicTheme from "@/ui/DynamicTheme";
import TOTPRegister from "@/ui/TOTPRegister";
import UserAvatar from "@/ui/UserAvatar";
import { RegisterTOTPResponse } from "@zitadel/proto/zitadel/user/v2/user_service_pb"; import { RegisterTOTPResponse } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import Link from "next/link"; import Link from "next/link";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
@@ -129,7 +129,7 @@ export default async function Page({
Scan the QR Code or navigate to the URL manually. Scan the QR Code or navigate to the URL manually.
</p> </p>
<div> <div>
<TOTPRegister <TotpRegister
uri={totpResponse.uri as string} uri={totpResponse.uri as string}
secret={totpResponse.secret as string} secret={totpResponse.secret as string}
loginName={loginName} loginName={loginName}
@@ -137,7 +137,7 @@ export default async function Page({
authRequestId={authRequestId} authRequestId={authRequestId}
organization={organization} organization={organization}
checkAfter={checkAfter === "true"} checkAfter={checkAfter === "true"}
></TOTPRegister> ></TotpRegister>
</div>{" "} </div>{" "}
</> </>
) : ( ) : (

View File

@@ -1,10 +1,10 @@
import { Alert } from "@/components/alert";
import { DynamicTheme } from "@/components/dynamic-theme";
import { LoginPasskey } from "@/components/login-passkey";
import { UserAvatar } from "@/components/user-avatar";
import { getSessionCookieById } from "@/lib/cookies"; import { getSessionCookieById } from "@/lib/cookies";
import { loadMostRecentSession } from "@/lib/session"; import { loadMostRecentSession } from "@/lib/session";
import { getBrandingSettings, getSession } from "@/lib/zitadel"; import { getBrandingSettings, getSession } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import DynamicTheme from "@/ui/DynamicTheme";
import LoginPasskey from "@/ui/LoginPasskey";
import UserAvatar from "@/ui/UserAvatar";
const title = "Authenticate with a passkey"; const title = "Authenticate with a passkey";
const description = const description =

View File

@@ -1,9 +1,9 @@
import { Alert, AlertType } from "@/components/alert";
import { DynamicTheme } from "@/components/dynamic-theme";
import { RegisterPasskey } from "@/components/register-passkey";
import { UserAvatar } from "@/components/user-avatar";
import { loadMostRecentSession } from "@/lib/session"; import { loadMostRecentSession } from "@/lib/session";
import { getBrandingSettings } from "@/lib/zitadel"; import { getBrandingSettings } from "@/lib/zitadel";
import Alert, { AlertType } from "@/ui/Alert";
import DynamicTheme from "@/ui/DynamicTheme";
import RegisterPasskey from "@/ui/RegisterPasskey";
import UserAvatar from "@/ui/UserAvatar";
export default async function Page({ export default async function Page({
searchParams, searchParams,

View File

@@ -1,9 +1,9 @@
import { Alert } from "@/components/alert";
import { DynamicTheme } from "@/components/dynamic-theme";
import { PasswordForm } from "@/components/password-form";
import { UserAvatar } from "@/components/user-avatar";
import { loadMostRecentSession } from "@/lib/session"; import { loadMostRecentSession } from "@/lib/session";
import { getBrandingSettings, getLoginSettings } from "@/lib/zitadel"; import { getBrandingSettings, getLoginSettings } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import DynamicTheme from "@/ui/DynamicTheme";
import PasswordForm from "@/ui/PasswordForm";
import UserAvatar from "@/ui/UserAvatar";
import { PasskeysType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; import { PasskeysType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
export default async function Page({ export default async function Page({

View File

@@ -1,11 +1,11 @@
import { DynamicTheme } from "@/components/dynamic-theme";
import { RegisterFormWithoutPassword } from "@/components/register-form-without-password";
import { SetPasswordForm } from "@/components/set-password-form";
import { import {
getBrandingSettings, getBrandingSettings,
getLegalAndSupportSettings, getLegalAndSupportSettings,
getPasswordComplexitySettings, getPasswordComplexitySettings,
} from "@/lib/zitadel"; } from "@/lib/zitadel";
import DynamicTheme from "@/ui/DynamicTheme";
import RegisterFormWithoutPassword from "@/ui/RegisterFormWithoutPassword";
import SetPasswordForm from "@/ui/SetPasswordForm";
export default async function Page({ export default async function Page({
searchParams, searchParams,

View File

@@ -1,8 +1,8 @@
import { DynamicTheme } from "@/components/dynamic-theme";
import { SelfServiceMenu } from "@/components/self-service-menu";
import { UserAvatar } from "@/components/user-avatar";
import { getMostRecentCookieWithLoginname } from "@/lib/cookies"; import { getMostRecentCookieWithLoginname } from "@/lib/cookies";
import { createCallback, getBrandingSettings, getSession } from "@/lib/zitadel"; import { createCallback, getBrandingSettings, getSession } from "@/lib/zitadel";
import DynamicTheme from "@/ui/DynamicTheme";
import SelfServiceMenu from "@/ui/SelfServiceMenu";
import UserAvatar from "@/ui/UserAvatar";
import { create } from "@zitadel/client"; import { create } from "@zitadel/client";
import { import {
CreateCallbackRequestSchema, CreateCallbackRequestSchema,

View File

@@ -1,10 +1,10 @@
import { Alert } from "@/components/alert";
import { DynamicTheme } from "@/components/dynamic-theme";
import { LoginPasskey } from "@/components/login-passkey";
import { UserAvatar } from "@/components/user-avatar";
import { getSessionCookieById } from "@/lib/cookies"; import { getSessionCookieById } from "@/lib/cookies";
import { loadMostRecentSession } from "@/lib/session"; import { loadMostRecentSession } from "@/lib/session";
import { getBrandingSettings, getSession } from "@/lib/zitadel"; import { getBrandingSettings, getSession } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import DynamicTheme from "@/ui/DynamicTheme";
import LoginPasskey from "@/ui/LoginPasskey";
import UserAvatar from "@/ui/UserAvatar";
export default async function Page({ export default async function Page({
searchParams, searchParams,

View File

@@ -1,9 +1,9 @@
import { Alert } from "@/components/alert";
import { DynamicTheme } from "@/components/dynamic-theme";
import { RegisterU2f } from "@/components/register-u2f";
import { UserAvatar } from "@/components/user-avatar";
import { loadMostRecentSession } from "@/lib/session"; import { loadMostRecentSession } from "@/lib/session";
import { getBrandingSettings } from "@/lib/zitadel"; import { getBrandingSettings } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import DynamicTheme from "@/ui/DynamicTheme";
import RegisterU2F from "@/ui/RegisterU2F";
import UserAvatar from "@/ui/UserAvatar";
export default async function Page({ export default async function Page({
searchParams, searchParams,
@@ -48,7 +48,7 @@ export default async function Page({
)} )}
{sessionFactors?.id && ( {sessionFactors?.id && (
<RegisterU2F <RegisterU2f
loginName={loginName} loginName={loginName}
sessionId={sessionFactors.id} sessionId={sessionFactors.id}
organization={organization} organization={organization}

View File

@@ -1,7 +1,7 @@
import { Alert } from "@/components/alert";
import { DynamicTheme } from "@/components/dynamic-theme";
import { VerifyEmailForm } from "@/components/verify-email-form";
import { getBrandingSettings, getLoginSettings } from "@/lib/zitadel"; import { getBrandingSettings, getLoginSettings } from "@/lib/zitadel";
import Alert from "@/ui/Alert";
import DynamicTheme from "@/ui/DynamicTheme";
import VerifyEmailForm from "@/ui/VerifyEmailForm";
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
export default async function Page({ searchParams }: { searchParams: any }) { export default async function Page({ searchParams }: { searchParams: any }) {

View File

@@ -1,10 +1,12 @@
import "@/styles/globals.scss"; import "@/styles/globals.scss";
import { AddressBar } from "@/ui/AddressBar";
import { GlobalNav } from "@/ui/GlobalNav"; import { AddressBar } from "@/components/address-bar";
import Theme from "@/ui/Theme"; import { GlobalNav } from "@/components/global-nav";
import ThemeProvider from "@/ui/ThemeProvider"; import { Theme } from "@/components/theme";
import { ThemeProvider } from "@/components/theme-provider";
import { Analytics } from "@vercel/analytics/react"; import { Analytics } from "@vercel/analytics/react";
import { Lato } from "next/font/google"; import { Lato } from "next/font/google";
import { ReactNode } from "react";
const lato = Lato({ const lato = Lato({
weight: ["400", "700", "900"], weight: ["400", "700", "900"],
@@ -16,7 +18,7 @@ export const revalidate = 60; // revalidate every minute
export default async function RootLayout({ export default async function RootLayout({
children, children,
}: { }: {
children: React.ReactNode; children: ReactNode;
}) { }) {
// later only shown with dev mode enabled // later only shown with dev mode enabled
const showNav = process.env.DEBUG === "true"; const showNav = process.env.DEBUG === "true";

View File

@@ -1,12 +1,3 @@
import {
CreateCallbackRequestSchema,
SessionSchema,
} from "@zitadel/proto/zitadel/oidc/v2/oidc_service_pb";
export const dynamic = "force-dynamic";
export const revalidate = false;
export const fetchCache = "default-no-store";
import { getAllSessions } from "@/lib/cookies"; import { getAllSessions } from "@/lib/cookies";
import { idpTypeToSlug } from "@/lib/idp"; import { idpTypeToSlug } from "@/lib/idp";
import { import {
@@ -22,9 +13,17 @@ import {
AuthRequest, AuthRequest,
Prompt, Prompt,
} from "@zitadel/proto/zitadel/oidc/v2/authorization_pb"; } from "@zitadel/proto/zitadel/oidc/v2/authorization_pb";
import {
CreateCallbackRequestSchema,
SessionSchema,
} from "@zitadel/proto/zitadel/oidc/v2/oidc_service_pb";
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb"; import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
import { NextRequest, NextResponse } from "next/server"; import { NextRequest, NextResponse } from "next/server";
export const dynamic = "force-dynamic";
export const revalidate = false;
export const fetchCache = "default-no-store";
async function loadSessions(ids: string[]): Promise<Session[]> { async function loadSessions(ids: string[]): Promise<Session[]> {
const response = await listSessions( const response = await listSessions(
ids.filter((id: string | undefined) => !!id), ids.filter((id: string | undefined) => !!id),

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
import React from "react"; import { Fragment } from "react";
type Props = { type Props = {
domain: string; domain: string;
@@ -39,7 +39,7 @@ export function AddressBar({ domain }: Props) {
.filter((s) => !!s) .filter((s) => !!s)
.map((segment) => { .map((segment) => {
return ( return (
<React.Fragment key={segment}> <Fragment key={segment}>
<span> <span>
<span <span
key={segment} key={segment}
@@ -50,7 +50,7 @@ export function AddressBar({ domain }: Props) {
</span> </span>
<span className="text-gray-600">/</span> <span className="text-gray-600">/</span>
</React.Fragment> </Fragment>
); );
})} })}
</> </>

View File

@@ -2,10 +2,11 @@ import {
ExclamationTriangleIcon, ExclamationTriangleIcon,
InformationCircleIcon, InformationCircleIcon,
} from "@heroicons/react/24/outline"; } from "@heroicons/react/24/outline";
import clsx from "clsx"; import { clsx } from "clsx";
import { ReactNode } from "react";
type Props = { type Props = {
children: React.ReactNode; children: ReactNode;
type?: AlertType; type?: AlertType;
}; };
@@ -21,7 +22,7 @@ const red =
const neutral = const neutral =
"border-divider-light dark:border-divider-dark bg-black/5 text-gray-600 dark:bg-white/10 dark:text-gray-200"; "border-divider-light dark:border-divider-dark bg-black/5 text-gray-600 dark:bg-white/10 dark:text-gray-200";
export default function Alert({ children, type = AlertType.ALERT }: Props) { export function Alert({ children, type = AlertType.ALERT }: Props) {
return ( return (
<div <div
className={clsx( className={clsx(

View File

@@ -1,8 +1,8 @@
import { CheckIcon } from "@heroicons/react/24/solid"; import { CheckIcon } from "@heroicons/react/24/solid";
import clsx from "clsx"; import { clsx } from "clsx";
import Link from "next/link"; import Link from "next/link";
import { ReactNode } from "react"; import { ReactNode } from "react";
import { BadgeState, StateBadge } from "./StateBadge"; import { BadgeState, StateBadge } from "./state-badge";
const cardClasses = (alreadyAdded: boolean) => const cardClasses = (alreadyAdded: boolean) =>
clsx( clsx(

View File

@@ -13,7 +13,7 @@ export const methods = [
}, },
]; ];
export default function AuthenticationMethodRadio({ export function AuthenticationMethodRadio({
selected, selected,
selectionChanged, selectionChanged,
}: { }: {

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { ColorShade, getColorHash } from "@/utils/colors"; import { ColorShade, getColorHash } from "@/helpers/colors";
import { useTheme } from "next-themes"; import { useTheme } from "next-themes";
import Image from "next/image"; import Image from "next/image";

View File

@@ -1,9 +1,9 @@
"use client"; "use client";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
export default function BackButton() { export function BackButton() {
const router = useRouter(); const router = useRouter();
return ( return (
<Button <Button

View File

@@ -1,12 +1,12 @@
import clsx from "clsx"; import { clsx } from "clsx";
import React from "react"; import { ReactNode } from "react";
const Label = ({ const Label = ({
children, children,
animateRerendering, animateRerendering,
color, color,
}: { }: {
children: React.ReactNode; children: ReactNode;
animateRerendering?: boolean; animateRerendering?: boolean;
color?: "default" | "pink" | "blue" | "violet" | "cyan" | "orange" | "red"; color?: "default" | "pink" | "blue" | "violet" | "cyan" | "orange" | "red";
}) => { }) => {
@@ -34,7 +34,7 @@ export const Boundary = ({
color = "default", color = "default",
animateRerendering = true, animateRerendering = true,
}: { }: {
children: React.ReactNode; children: ReactNode;
labels?: string[]; labels?: string[];
size?: "small" | "default"; size?: "small" | "default";
color?: "default" | "pink" | "blue" | "violet" | "cyan" | "orange" | "red"; color?: "default" | "pink" | "blue" | "violet" | "cyan" | "orange" | "red";

View File

@@ -1,4 +1,4 @@
import clsx from "clsx"; import { clsx } from "clsx";
import { ButtonHTMLAttributes, DetailedHTMLProps, forwardRef } from "react"; import { ButtonHTMLAttributes, DetailedHTMLProps, forwardRef } from "react";
export enum ButtonSizes { export enum ButtonSizes {

View File

@@ -1,22 +1,22 @@
"use client"; "use client";
import { setPassword } from "@/lib/self";
import { import {
lowerCaseValidator, lowerCaseValidator,
numberValidator, numberValidator,
symbolValidator, symbolValidator,
upperCaseValidator, upperCaseValidator,
} from "@/utils/validators"; } from "@/helpers/validators";
import { setPassword } from "@/lib/self";
import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb"; import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { FieldValues, useForm } from "react-hook-form"; import { FieldValues, useForm } from "react-hook-form";
import Alert from "./Alert"; import { Alert } from "./alert";
import BackButton from "./BackButton"; import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { TextInput } from "./Input"; import { TextInput } from "./input";
import PasswordComplexity from "./PasswordComplexity"; import { PasswordComplexity } from "./password-complexity";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Inputs = type Inputs =
| { | {
@@ -31,7 +31,7 @@ type Props = {
sessionId: string; sessionId: string;
}; };
export default function ChangePasswordForm({ export function ChangePasswordForm({
passwordComplexitySettings, passwordComplexitySettings,
userId, userId,
sessionId, sessionId,

View File

@@ -5,7 +5,7 @@ import {
SecondFactorType, SecondFactorType,
} from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb"; import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import { EMAIL, SMS, TOTP, U2F } from "./AuthMethods"; import { EMAIL, SMS, TOTP, U2F } from "./auth-methods";
type Props = { type Props = {
loginName?: string; loginName?: string;
@@ -19,7 +19,7 @@ type Props = {
emailVerified: boolean; emailVerified: boolean;
}; };
export default function ChooseSecondFactorToSetup({ export function ChooseSecondFactorToSetup({
loginName, loginName,
sessionId, sessionId,
authRequestId, authRequestId,

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb"; import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import { EMAIL, SMS, TOTP, U2F } from "./AuthMethods"; import { EMAIL, SMS, TOTP, U2F } from "./auth-methods";
type Props = { type Props = {
loginName?: string; loginName?: string;
@@ -11,7 +11,7 @@ type Props = {
userMethods: AuthenticationMethodType[]; userMethods: AuthenticationMethodType[];
}; };
export default function ChooseSecondFactor({ export function ChooseSecondFactor({
loginName, loginName,
sessionId, sessionId,
authRequestId, authRequestId,

View File

@@ -11,7 +11,7 @@ type Props = {
value: string; value: string;
}; };
export default function CopyToClipboard({ value }: Props) { export function CopyToClipboard({ value }: Props) {
const [copied, setCopied] = useState(false); const [copied, setCopied] = useState(false);
useEffect(() => { useEffect(() => {

View File

@@ -1,15 +1,15 @@
"use client"; "use client";
import { Logo } from "@/ui/Logo"; import { Logo } from "@/components/logo";
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb"; import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
import React from "react"; import { ReactNode } from "react";
import ThemeWrapper from "./ThemeWrapper"; import { ThemeWrapper } from "./theme-wrapper";
export default function DynamicTheme({ export function DynamicTheme({
branding, branding,
children, children,
}: { }: {
children: React.ReactNode; children: ReactNode;
branding?: BrandingSettings; branding?: BrandingSettings;
}) { }) {
return ( return (

View File

@@ -1,10 +1,11 @@
import { ArrowRightIcon } from "@heroicons/react/24/solid"; import { ArrowRightIcon } from "@heroicons/react/24/solid";
import { ReactNode } from "react";
export const ExternalLink = ({ export const ExternalLink = ({
children, children,
href, href,
}: { }: {
children: React.ReactNode; children: ReactNode;
href: string; href: string;
}) => { }) => {
return ( return (

View File

@@ -1,13 +1,13 @@
"use client"; "use client";
import { ZitadelLogo } from "@/components/zitadel-logo";
import { demos, type Item } from "@/lib/demos"; import { demos, type Item } from "@/lib/demos";
import { ZitadelLogo } from "@/ui/ZitadelLogo";
import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/solid"; import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/solid";
import clsx from "clsx"; import { clsx } from "clsx";
import Link from "next/link"; import Link from "next/link";
import { usePathname, useSelectedLayoutSegment } from "next/navigation"; import { usePathname, useSelectedLayoutSegment } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import Theme from "./Theme"; import { Theme } from "./theme";
export function GlobalNav() { export function GlobalNav() {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);

View File

@@ -3,8 +3,8 @@
import { createNewSession } from "@/lib/server/session"; import { createNewSession } from "@/lib/server/session";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import Alert from "./Alert"; import { Alert } from "./alert";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Props = { type Props = {
userId: string; userId: string;
@@ -16,7 +16,7 @@ type Props = {
authRequestId?: string; authRequestId?: string;
}; };
export default function IdpSignin({ export function IdpSignin({
userId, userId,
idpIntent: { idpIntentId, idpIntentToken }, idpIntent: { idpIntentId, idpIntentToken },
authRequestId, authRequestId,

View File

@@ -1,10 +1,10 @@
import { ButtonHTMLAttributes, DetailedHTMLProps } from "react"; import { ButtonHTMLAttributes, DetailedHTMLProps, ReactNode } from "react";
export const IdpButtonClasses = export const IdpButtonClasses =
"transition-all w-full cursor-pointer flex flex-row items-center bg-background-light-400 text-text-light-500 dark:bg-background-dark-500 dark:text-text-dark-500 border border-divider-light hover:border-black dark:border-divider-dark hover:dark:border-white focus:border-primary-light-500 focus:dark:border-primary-dark-500 outline-none rounded-md px-4 text-sm"; "transition-all w-full cursor-pointer flex flex-row items-center bg-background-light-400 text-text-light-500 dark:bg-background-dark-500 dark:text-text-dark-500 border border-divider-light hover:border-black dark:border-divider-dark hover:dark:border-white focus:border-primary-light-500 focus:dark:border-primary-dark-500 outline-none rounded-md px-4 text-sm";
export interface SignInWithIDPProps { export interface SignInWithIDPProps {
children?: React.ReactNode; children?: ReactNode;
orgId?: string; orgId?: string;
} }

View File

@@ -3,7 +3,7 @@
import { ReactNode, forwardRef } from "react"; import { ReactNode, forwardRef } from "react";
import { IdpButtonClasses, SignInWithIdentityProviderProps } from "./classes"; import { IdpButtonClasses, SignInWithIdentityProviderProps } from "./classes";
export const SignInWithAzureAD = forwardRef< export const SignInWithAzureAd = forwardRef<
HTMLButtonElement, HTMLButtonElement,
SignInWithIdentityProviderProps SignInWithIdentityProviderProps
>( >(
@@ -37,4 +37,4 @@ export const SignInWithAzureAD = forwardRef<
), ),
); );
SignInWithAzureAD.displayName = "SignInWithAzureAD"; SignInWithAzureAd.displayName = "SignInWithAzureAD";

View File

@@ -1,7 +1,7 @@
import { afterEach, describe, expect, test } from "vitest"; import { afterEach, describe, expect, test } from "vitest";
import { cleanup, render, screen } from "@testing-library/react"; import { cleanup, render, screen } from "@testing-library/react";
import { SignInWithGitlab } from "./SignInWithGitlab"; import { SignInWithGitlab } from "./sign-in-with-gitlab";
afterEach(cleanup); afterEach(cleanup);

View File

@@ -1,7 +1,7 @@
import { afterEach, describe, expect, test } from "vitest"; import { afterEach, describe, expect, test } from "vitest";
import { cleanup, render, screen } from "@testing-library/react"; import { cleanup, render, screen } from "@testing-library/react";
import { SignInWithGoogle } from "./SignInWithGoogle"; import { SignInWithGoogle } from "./sign-in-with-google";
afterEach(cleanup); afterEach(cleanup);

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { CheckCircleIcon } from "@heroicons/react/24/solid"; import { CheckCircleIcon } from "@heroicons/react/24/solid";
import clsx from "clsx"; import { clsx } from "clsx";
import { import {
ChangeEvent, ChangeEvent,
DetailedHTMLProps, DetailedHTMLProps,

View File

@@ -1,9 +1,10 @@
"use client"; "use client";
import { useTheme } from "next-themes"; import { useTheme } from "next-themes";
import { ReactNode } from "react";
type Props = { type Props = {
children: React.ReactNode; children: ReactNode;
}; };
export function LayoutProviders({ children }: Props) { export function LayoutProviders({ children }: Props) {

View File

@@ -7,11 +7,11 @@ import { ChecksSchema } from "@zitadel/proto/zitadel/session/v2/session_service_
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import Alert, { AlertType } from "./Alert"; import { Alert, AlertType } from "./alert";
import BackButton from "./BackButton"; import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { TextInput } from "./Input"; import { TextInput } from "./input";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
// either loginName or sessionId must be provided // either loginName or sessionId must be provided
type Props = { type Props = {
@@ -27,7 +27,7 @@ type Inputs = {
code: string; code: string;
}; };
export default function LoginOTP({ export function LoginOTP({
loginName, loginName,
sessionId, sessionId,
authRequestId, authRequestId,

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { coerceToArrayBuffer, coerceToBase64Url } from "@/helpers/base64";
import { updateSession } from "@/lib/server/session"; import { updateSession } from "@/lib/server/session";
import { coerceToArrayBuffer, coerceToBase64Url } from "@/utils/base64";
import { create } from "@zitadel/client"; import { create } from "@zitadel/client";
import { import {
RequestChallengesSchema, RequestChallengesSchema,
@@ -10,10 +10,10 @@ import {
import { Checks } from "@zitadel/proto/zitadel/session/v2/session_service_pb"; import { Checks } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import Alert from "./Alert"; import { Alert } from "./alert";
import BackButton from "./BackButton"; import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
// either loginName or sessionId must be provided // either loginName or sessionId must be provided
type Props = { type Props = {
@@ -25,7 +25,7 @@ type Props = {
organization?: string; organization?: string;
}; };
export default function LoginPasskey({ export function LoginPasskey({
loginName, loginName,
sessionId, sessionId,
authRequestId, authRequestId,

View File

@@ -1,19 +1,26 @@
"use client"; "use client";
import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/solid"; import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/solid";
import clsx from "clsx"; import { clsx } from "clsx";
import React from "react"; import {
createContext,
Dispatch,
ReactNode,
SetStateAction,
useContext,
useState,
} from "react";
const MobileNavContext = React.createContext< const MobileNavContext = createContext<
[boolean, React.Dispatch<React.SetStateAction<boolean>>] | undefined [boolean, Dispatch<SetStateAction<boolean>>] | undefined
>(undefined); >(undefined);
export function MobileNavContextProvider({ export function MobileNavContextProvider({
children, children,
}: { }: {
children: React.ReactNode; children: ReactNode;
}) { }) {
const [isOpen, setIsOpen] = React.useState(false); const [isOpen, setIsOpen] = useState(false);
return ( return (
<MobileNavContext.Provider value={[isOpen, setIsOpen]}> <MobileNavContext.Provider value={[isOpen, setIsOpen]}>
{children} {children}
@@ -22,7 +29,7 @@ export function MobileNavContextProvider({
} }
export function useMobileNavToggle() { export function useMobileNavToggle() {
const context = React.useContext(MobileNavContext); const context = useContext(MobileNavContext);
if (context === undefined) { if (context === undefined) {
throw new Error( throw new Error(
"useMobileNavToggle must be used within a MobileNavContextProvider", "useMobileNavToggle must be used within a MobileNavContextProvider",
@@ -31,7 +38,7 @@ export function useMobileNavToggle() {
return context; return context;
} }
export function MobileNavToggle({ children }: { children: React.ReactNode }) { export function MobileNavToggle({ children }: { children: ReactNode }) {
const [isOpen, setIsOpen] = useMobileNavToggle(); const [isOpen, setIsOpen] = useMobileNavToggle();
return ( return (

View File

@@ -6,7 +6,7 @@ import {
within, within,
} from "@testing-library/react"; } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, test } from "vitest"; import { afterEach, beforeEach, describe, expect, test } from "vitest";
import PasswordComplexity from "./PasswordComplexity"; import { PasswordComplexity } from "./password-complexity";
const matchesTitle = `Matches`; const matchesTitle = `Matches`;
const doesntMatchTitle = `Doesn't match`; const doesntMatchTitle = `Doesn't match`;

View File

@@ -3,7 +3,7 @@ import {
numberValidator, numberValidator,
symbolValidator, symbolValidator,
upperCaseValidator, upperCaseValidator,
} from "@/utils/validators"; } from "@/helpers/validators";
import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb"; import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb";
type Props = { type Props = {
@@ -51,7 +51,7 @@ const cross = (
const desc = const desc =
"text-14px leading-4 text-input-light-label dark:text-input-dark-label"; "text-14px leading-4 text-input-light-label dark:text-input-dark-label";
export default function PasswordComplexity({ export function PasswordComplexity({
passwordComplexitySettings, passwordComplexitySettings,
password, password,
equals, equals,

View File

@@ -8,11 +8,11 @@ import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_se
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import Alert, { AlertType } from "./Alert"; import { Alert, AlertType } from "./alert";
import BackButton from "./BackButton"; import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { TextInput } from "./Input"; import { TextInput } from "./input";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Inputs = { type Inputs = {
password: string; password: string;
@@ -27,7 +27,7 @@ type Props = {
promptPasswordless?: boolean; promptPasswordless?: boolean;
}; };
export default function PasswordForm({ export function PasswordForm({
loginSettings, loginSettings,
loginName, loginName,
organization, organization,

View File

@@ -2,7 +2,7 @@
import { LegalAndSupportSettings } from "@zitadel/proto/zitadel/settings/v2/legal_settings_pb"; import { LegalAndSupportSettings } from "@zitadel/proto/zitadel/settings/v2/legal_settings_pb";
import Link from "next/link"; import Link from "next/link";
import { useState } from "react"; import { useState } from "react";
import { Checkbox } from "./Checkbox"; import { Checkbox } from "./checkbox";
type Props = { type Props = {
legal: LegalAndSupportSettings; legal: LegalAndSupportSettings;

View File

@@ -5,15 +5,16 @@ import { LegalAndSupportSettings } from "@zitadel/proto/zitadel/settings/v2/lega
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { FieldValues, useForm } from "react-hook-form"; import { FieldValues, useForm } from "react-hook-form";
import Alert from "./Alert"; import { Alert } from "./alert";
import AuthenticationMethodRadio, { import {
AuthenticationMethodRadio,
methods, methods,
} from "./AuthenticationMethodRadio"; } from "./authentication-method-radio";
import BackButton from "./BackButton"; import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { TextInput } from "./Input"; import { TextInput } from "./input";
import { PrivacyPolicyCheckboxes } from "./PrivacyPolicyCheckboxes"; import { PrivacyPolicyCheckboxes } from "./privacy-policy-checkboxes";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Inputs = type Inputs =
| { | {
@@ -32,7 +33,7 @@ type Props = {
authRequestId?: string; authRequestId?: string;
}; };
export default function RegisterFormWithoutPassword({ export function RegisterFormWithoutPassword({
legal, legal,
email, email,
firstname, firstname,

View File

@@ -1,14 +1,14 @@
"use client"; "use client";
import { coerceToArrayBuffer, coerceToBase64Url } from "@/helpers/base64";
import { registerPasskeyLink, verifyPasskey } from "@/lib/server/passkeys"; import { registerPasskeyLink, verifyPasskey } from "@/lib/server/passkeys";
import { coerceToArrayBuffer, coerceToBase64Url } from "@/utils/base64";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import Alert from "./Alert"; import { Alert } from "./alert";
import BackButton from "./BackButton"; import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Inputs = {}; type Inputs = {};
@@ -19,7 +19,7 @@ type Props = {
organization?: string; organization?: string;
}; };
export default function RegisterPasskey({ export function RegisterPasskey({
sessionId, sessionId,
isPrompt, isPrompt,
organization, organization,

View File

@@ -1,14 +1,14 @@
"use client"; "use client";
import { coerceToArrayBuffer, coerceToBase64Url } from "@/helpers/base64";
import { addU2F, verifyU2F } from "@/lib/server/u2f"; import { addU2F, verifyU2F } from "@/lib/server/u2f";
import { coerceToArrayBuffer, coerceToBase64Url } from "@/utils/base64";
import { RegisterU2FResponse } from "@zitadel/proto/zitadel/user/v2/user_service_pb"; import { RegisterU2FResponse } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import Alert from "./Alert"; import { Alert } from "./alert";
import BackButton from "./BackButton"; import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Props = { type Props = {
loginName?: string; loginName?: string;
@@ -18,7 +18,7 @@ type Props = {
checkAfter: boolean; checkAfter: boolean;
}; };
export default function RegisterU2F({ export function RegisterU2f({
loginName, loginName,
sessionId, sessionId,
organization, organization,

View File

@@ -1,6 +1,6 @@
import Link from "next/link"; import Link from "next/link";
export default function SelfServiceMenu({ sessionId }: { sessionId: string }) { export function SelfServiceMenu({ sessionId }: { sessionId: string }) {
const list: any[] = []; const list: any[] = [];
// if (!!config.selfservice.change_password.enabled) { // if (!!config.selfservice.change_password.enabled) {

View File

@@ -7,7 +7,7 @@ import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
import moment from "moment"; import moment from "moment";
import Link from "next/link"; import Link from "next/link";
import { useState } from "react"; import { useState } from "react";
import { Avatar } from "./Avatar"; import { Avatar } from "./avatar";
export function isSessionValid(session: Partial<Session>): { export function isSessionValid(session: Partial<Session>): {
valid: boolean; valid: boolean;
@@ -25,7 +25,7 @@ export function isSessionValid(session: Partial<Session>): {
return { valid, verifiedAt }; return { valid, verifiedAt };
} }
export default function SessionItem({ export function SessionItem({
session, session,
reload, reload,
authRequestId, authRequestId,

View File

@@ -2,15 +2,15 @@
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb"; import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
import { useState } from "react"; import { useState } from "react";
import Alert from "./Alert"; import { Alert } from "./alert";
import SessionItem from "./SessionItem"; import { SessionItem } from "./session-item";
type Props = { type Props = {
sessions: Session[]; sessions: Session[];
authRequestId?: string; authRequestId?: string;
}; };
export default function SessionsList({ sessions, authRequestId }: Props) { export function SessionsList({ sessions, authRequestId }: Props) {
const [list, setList] = useState<Session[]>(sessions); const [list, setList] = useState<Session[]>(sessions);
return sessions ? ( return sessions ? (
<div className="flex flex-col space-y-2"> <div className="flex flex-col space-y-2">

View File

@@ -1,22 +1,22 @@
"use client"; "use client";
import { registerUser, RegisterUserResponse } from "@/lib/server/register";
import { import {
lowerCaseValidator, lowerCaseValidator,
numberValidator, numberValidator,
symbolValidator, symbolValidator,
upperCaseValidator, upperCaseValidator,
} from "@/utils/validators"; } from "@/helpers/validators";
import { registerUser, RegisterUserResponse } from "@/lib/server/register";
import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb"; import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { FieldValues, useForm } from "react-hook-form"; import { FieldValues, useForm } from "react-hook-form";
import Alert from "./Alert"; import { Alert } from "./alert";
import BackButton from "./BackButton"; import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { TextInput } from "./Input"; import { TextInput } from "./input";
import PasswordComplexity from "./PasswordComplexity"; import { PasswordComplexity } from "./password-complexity";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Inputs = type Inputs =
| { | {
@@ -34,7 +34,7 @@ type Props = {
authRequestId?: string; authRequestId?: string;
}; };
export default function SetPasswordForm({ export function SetPasswordForm({
passwordComplexitySettings, passwordComplexitySettings,
email, email,
firstname, firstname,

View File

@@ -8,13 +8,13 @@ import {
} from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { ReactNode, useState } from "react"; import { ReactNode, useState } from "react";
import Alert from "./Alert"; import { Alert } from "./alert";
import { SignInWithApple } from "./idps/SignInWithApple"; import { SignInWithApple } from "./idps/sign-in-with-apple";
import { SignInWithAzureAD } from "./idps/SignInWithAzureAD"; import { SignInWithAzureAd } from "./idps/sign-in-with-azure-ad";
import { SignInWithGeneric } from "./idps/SignInWithGeneric"; import { SignInWithGeneric } from "./idps/sign-in-with-generic";
import { SignInWithGithub } from "./idps/SignInWithGithub"; import { SignInWithGithub } from "./idps/sign-in-with-github";
import { SignInWithGitlab } from "./idps/SignInWithGitlab"; import { SignInWithGitlab } from "./idps/sign-in-with-gitlab";
import { SignInWithGoogle } from "./idps/SignInWithGoogle"; import { SignInWithGoogle } from "./idps/sign-in-with-google";
export interface SignInWithIDPProps { export interface SignInWithIDPProps {
children?: ReactNode; children?: ReactNode;
@@ -24,7 +24,7 @@ export interface SignInWithIDPProps {
organization?: string; organization?: string;
} }
export function SignInWithIDP({ export function SignInWithIdp({
host, host,
identityProviders, identityProviders,
authRequestId, authRequestId,
@@ -130,13 +130,13 @@ export function SignInWithIDP({
); );
case IdentityProviderType.AZURE_AD: case IdentityProviderType.AZURE_AD:
return ( return (
<SignInWithAzureAD <SignInWithAzureAd
key={`idp-${i}`} key={`idp-${i}`}
name={idp.name} name={idp.name}
onClick={() => onClick={() =>
navigateToAuthUrl(idp.id, IdentityProviderType.AZURE_AD) navigateToAuthUrl(idp.id, IdentityProviderType.AZURE_AD)
} }
></SignInWithAzureAD> ></SignInWithAzureAd>
); );
case IdentityProviderType.GOOGLE: case IdentityProviderType.GOOGLE:
return ( return (
@@ -185,4 +185,4 @@ export function SignInWithIDP({
); );
} }
SignInWithIDP.displayName = "SignInWithIDP"; SignInWithIdp.displayName = "SignInWithIDP";

View File

@@ -1,4 +1,4 @@
import clsx from "clsx"; import { clsx } from "clsx";
export const SkeletonCard = ({ isLoading }: { isLoading?: boolean }) => ( export const SkeletonCard = ({ isLoading }: { isLoading?: boolean }) => (
<div <div

View File

@@ -1,4 +1,4 @@
import clsx from "clsx"; import { clsx } from "clsx";
import { ReactNode } from "react"; import { ReactNode } from "react";
export enum BadgeState { export enum BadgeState {

View File

@@ -1,4 +1,4 @@
import { Tab } from "@/ui/Tab"; import { Tab } from "@/components/tab";
export type Item = { export type Item = {
text: string; text: string;

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import type { Item } from "@/ui/TabGroup"; import type { Item } from "@/components/tab-group";
import clsx from "clsx"; import { clsx } from "clsx";
import Link from "next/link"; import Link from "next/link";
import { useSelectedLayoutSegment } from "next/navigation"; import { useSelectedLayoutSegment } from "next/navigation";

View File

@@ -2,7 +2,7 @@
import { ThemeProvider as ThemeP } from "next-themes"; import { ThemeProvider as ThemeP } from "next-themes";
import { ReactNode } from "react"; import { ReactNode } from "react";
export default function ThemeProvider({ children }: { children: ReactNode }) { export function ThemeProvider({ children }: { children: ReactNode }) {
return ( return (
<ThemeP <ThemeP
attribute="class" attribute="class"

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { setTheme } from "@/utils/colors"; import { setTheme } from "@/helpers/colors";
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb"; import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
import { ReactNode, useEffect } from "react"; import { ReactNode, useEffect } from "react";
@@ -9,7 +9,7 @@ type Props = {
children: ReactNode; children: ReactNode;
}; };
const ThemeWrapper = ({ children, branding }: Props) => { export const ThemeWrapper = ({ children, branding }: Props) => {
useEffect(() => { useEffect(() => {
setTheme(document, branding); setTheme(document, branding);
}, []); }, []);
@@ -18,5 +18,3 @@ const ThemeWrapper = ({ children, branding }: Props) => {
return <div className={defaultClasses}>{children}</div>; return <div className={defaultClasses}>{children}</div>;
}; };
export default ThemeWrapper;

View File

@@ -4,7 +4,7 @@ import { MoonIcon, SunIcon } from "@heroicons/react/24/outline";
import { useTheme } from "next-themes"; import { useTheme } from "next-themes";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
function Theme() { export function Theme() {
const { resolvedTheme, setTheme } = useTheme(); const { resolvedTheme, setTheme } = useTheme();
const [mounted, setMounted] = useState<boolean>(false); const [mounted, setMounted] = useState<boolean>(false);
@@ -42,5 +42,3 @@ function Theme() {
</div> </div>
); );
} }
export default Theme;

View File

@@ -5,11 +5,11 @@ import { useRouter } from "next/navigation";
import { QRCodeSVG } from "qrcode.react"; import { QRCodeSVG } from "qrcode.react";
import { useState } from "react"; import { useState } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import Alert from "./Alert"; import { Alert } from "./alert";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import CopyToClipboard from "./CopyToClipboard"; import { CopyToClipboard } from "./copy-to-clipboard";
import { TextInput } from "./Input"; import { TextInput } from "./input";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Inputs = { type Inputs = {
code: string; code: string;
@@ -24,7 +24,7 @@ type Props = {
organization?: string; organization?: string;
checkAfter?: boolean; checkAfter?: boolean;
}; };
export default function TOTPRegister({ export function TotpRegister({
uri, uri,
secret, secret,
loginName, loginName,

View File

@@ -1,4 +1,4 @@
import { Avatar } from "@/ui/Avatar"; import { Avatar } from "@/components/avatar";
import { ChevronDownIcon } from "@heroicons/react/24/outline"; import { ChevronDownIcon } from "@heroicons/react/24/outline";
import Link from "next/link"; import Link from "next/link";
@@ -9,7 +9,7 @@ type Props = {
searchParams?: Record<string | number | symbol, string | undefined>; searchParams?: Record<string | number | symbol, string | undefined>;
}; };
export default function UserAvatar({ export function UserAvatar({
loginName, loginName,
displayName, displayName,
showDropdown, showDropdown,

View File

@@ -4,11 +4,11 @@ import { sendLoginname } from "@/lib/server/loginname";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { ReactNode, useEffect, useState } from "react"; import { ReactNode, useEffect, useState } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import Alert from "./Alert"; import { Alert } from "./alert";
import BackButton from "./BackButton"; import { BackButton } from "./back-button";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { TextInput } from "./Input"; import { TextInput } from "./input";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Inputs = { type Inputs = {
loginName: string; loginName: string;
@@ -23,7 +23,7 @@ type Props = {
children?: ReactNode; children?: ReactNode;
}; };
export default function UsernameForm({ export function UsernameForm({
loginName, loginName,
authRequestId, authRequestId,
organization, organization,

View File

@@ -1,14 +1,14 @@
"use client"; "use client";
import { Alert } from "@/components/alert";
import { resendVerifyEmail, verifyUserByEmail } from "@/lib/server/email"; import { resendVerifyEmail, verifyUserByEmail } from "@/lib/server/email";
import Alert from "@/ui/Alert";
import { LoginSettings } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; import { LoginSettings } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { Button, ButtonVariants } from "./Button"; import { Button, ButtonVariants } from "./button";
import { TextInput } from "./Input"; import { TextInput } from "./input";
import { Spinner } from "./Spinner"; import { Spinner } from "./spinner";
type Inputs = { type Inputs = {
code: string; code: string;
@@ -25,7 +25,7 @@ type Props = {
loginSettings?: LoginSettings; loginSettings?: LoginSettings;
}; };
export default function VerifyEmailForm({ export function VerifyEmailForm({
userId, userId,
loginName, loginName,
code, code,

View File

@@ -3,9 +3,4 @@ module.exports = {
rules: { rules: {
"@next/next/no-html-link-for-pages": "off", "@next/next/no-html-link-for-pages": "off",
}, },
parserOptions: {
babelOptions: {
presets: [require.resolve("next/babel")],
},
},
}; };