Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/elements-react/src/client/frontendClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"use client"
import {
Configuration,
ConfigurationParameters,
type ConfigurationParameters,
FrontendApi,
OAuth2Api,
} from "@ory/client-fetch"
Expand Down
2 changes: 1 addition & 1 deletion packages/elements-react/src/client/session-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

"use client"
import { Session } from "@ory/client-fetch"
import type { Session } from "@ory/client-fetch"
import { createContext, useCallback, useEffect, useRef, useState } from "react"
import { frontendClient } from "./frontendClient"

Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/client/useSession.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

// useSession.test.tsx

import { Session } from "@ory/client-fetch"
import type { Session } from "@ory/client-fetch"
import { act, render, screen, waitFor } from "@testing-library/react"
import { useSession } from "./useSession"
import { frontendClient } from "./frontendClient"
import { SessionProvider } from "./session-provider"
import { PropsWithChildren } from "react"
import type { PropsWithChildren } from "react"

jest.mock("./frontendClient", () => ({
frontendClient: jest.fn(() => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/elements-react/src/components/card/card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { PropsWithChildren } from "react"
import type { PropsWithChildren } from "react"
import { useComponents } from "../../context"
import { OryFormProvider } from "../form/form-provider"

Expand Down
2 changes: 1 addition & 1 deletion packages/elements-react/src/components/card/content.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { PropsWithChildren } from "react"
import type { PropsWithChildren } from "react"
import { useComponents } from "../../context"

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/elements-react/src/components/card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { OryCardHeader, OryCardHeaderProps } from "./header"
import { OryCard, OryCardRootProps } from "./card"
import { OryCardFooter, OryCardFooterProps } from "./footer"
import { OryCardContent, OryCardContentProps } from "./content"
import { OryCardHeader, type OryCardHeaderProps } from "./header"
import { OryCard, type OryCardRootProps } from "./card"
import { OryCardFooter, type OryCardFooterProps } from "./footer"
import { OryCardContent, type OryCardContentProps } from "./content"
import { OrySelfServiceFlowCard } from "./card-two-step"
import { OryConsentCard } from "./card-consent"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import {
AuthenticatorAssuranceLevel,
FlowType,
UiNode,
UiNodeAttributes,
type UiNode,
type UiNodeAttributes,
UiNodeGroupEnum,
} from "@ory/client-fetch"
import {
import type {
LoginFlowContainer,
RegistrationFlowContainer,
} from "@ory/elements-react"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import {
isUiNodeScriptAttributes,
UiNode,
type UiNode,
UiNodeGroupEnum,
} from "@ory/client-fetch"
import { useComponents, useNodeSorter, useOryFlow } from "../../../context"
import { FormStateMethodActive } from "../../../context/form-state"
import type { FormStateMethodActive } from "../../../context/form-state"
import { useNodeGroupsWithVisibleNodes } from "../../../util/ui"
import { OryForm } from "../../form/form"
import { OryCardValidationMessages } from "../../form/messages"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { UiNode, UiNodeGroupEnum } from "@ory/client-fetch"
import { type UiNode, UiNodeGroupEnum } from "@ory/client-fetch"
import { useComponents, useNodeSorter, useOryFlow } from "../../../context"
import { isNodeVisible, withoutSingleSignOnNodes } from "../../../util/ui"
import { OryForm } from "../../form/form"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

import {
isUiNodeScriptAttributes,
UiNode,
type UiNode,
UiNodeGroupEnum,
UiText,
type UiText,
} from "@ory/client-fetch"
import { useIntl } from "react-intl"
import { useComponents, useNodeSorter, useOryFlow } from "../../../context"
import { kratosMessages } from "../../../util/i18n/generated/kratosMessages"
import {
GroupedNodes,
type GroupedNodes,
hasSingleSignOnNodes,
useFunctionalNodes,
useNodeGroupsWithVisibleNodes,
Expand Down
10 changes: 5 additions & 5 deletions packages/elements-react/src/components/card/two-step/utils.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { FlowType, UiNode, UiNodeGroupEnum } from "@ory/client-fetch"
import {
import { FlowType, type UiNode, UiNodeGroupEnum } from "@ory/client-fetch"
import type {
LoginFlowContainer,
RegistrationFlowContainer,
} from "../../../util/flowContainer"
import { isGroupImmediateSubmit } from "../../../theme/default/utils/form"
import { GroupedNodes, isUiNodeGroupEnum } from "../../../util/ui"
import { Dispatch } from "react"
import { FormStateAction } from "@ory/elements-react"
import { type GroupedNodes, isUiNodeGroupEnum } from "../../../util/ui"
import type { Dispatch } from "react"
import type { FormStateAction } from "@ory/elements-react"

function isScreenSelectionNode(node: UiNode) {
if (
Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/components/form/form-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { isUiNodeInputAttributes, UiNode } from "@ory/client-fetch"
import { FormValues } from "../../types"
import { isUiNodeInputAttributes, type UiNode } from "@ory/client-fetch"
import type { FormValues } from "../../types"

export function computeDefaultValues(flow: {
active?: string
Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/components/form/form-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { FlowType, UiNode, UiNodeGroupEnum } from "@ory/client-fetch"
import { PropsWithChildren, useEffect, useRef } from "react"
import { FlowType, type UiNode, UiNodeGroupEnum } from "@ory/client-fetch"
import { type PropsWithChildren, useEffect, useRef } from "react"
import { FormProvider, useForm } from "react-hook-form"
import { useOryFlow } from "../../context"
import { computeDefaultValues } from "./form-helpers"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { FlowType, LoginFlow } from "@ory/client-fetch"
import { FlowType, type LoginFlow } from "@ory/client-fetch"
import { renderHook } from "@testing-library/react"
import { PropsWithChildren } from "react"
import type { PropsWithChildren } from "react"
import { OryFlowProvider } from "../../context/flow-context"
import { FormValues } from "../../types"
import type { FormValues } from "../../types"
import { useOryFormResolver } from "./form-resolver"

const testCases = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { useOryFlow } from "../../context"
import { FormValues } from "../../types"
import type { FormValues } from "../../types"
import { isUiNodeInputAttributes } from "@ory/client-fetch"

function isCodeResendRequest(data: FormValues) {
Expand Down
24 changes: 12 additions & 12 deletions packages/elements-react/src/components/form/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {
isUiNodeImageAttributes,
isUiNodeInputAttributes,
isUiNodeScriptAttributes,
UiText,
type UiText,
} from "@ory/client-fetch"
import { ComponentType, PropsWithChildren } from "react"
import type { ComponentType, PropsWithChildren } from "react"
import { useFormContext } from "react-hook-form"
import { useIntl } from "react-intl"
import { useComponents, useOryFlow } from "../../context"
import {
import type {
OryCardAuthMethodListItemProps,
OryCardLogoProps,
OryFormGroupProps,
Expand All @@ -32,21 +32,21 @@ import {
OryNodeSsoButtonProps,
OryNodeTextProps,
} from "../../types"
import { OryCardFooterProps } from "../card"
import { OryCardRootProps } from "../card/card"
import { OryCardContentProps } from "../card/content"
import { OryPageHeaderProps } from "../generic"
import { OryCardDividerProps } from "../generic/divider"
import {
import type { OryCardFooterProps } from "../card"
import type { OryCardRootProps } from "../card/card"
import type { OryCardContentProps } from "../card/content"
import type { OryPageHeaderProps } from "../generic"
import type { OryCardDividerProps } from "../generic/divider"
import type {
OrySettingsSsoProps,
OrySettingsPasskeyProps,
OrySettingsRecoveryCodesProps,
OrySettingsTotpProps,
OrySettingsWebauthnProps,
} from "../settings"
import { OryMessageContentProps, OryMessageRootProps } from "./messages"
import { OryCardSettingsSectionProps } from "./settings-section"
import { OryFormSsoRootProps } from "./social"
import type { OryMessageContentProps, OryMessageRootProps } from "./messages"
import type { OryCardSettingsSectionProps } from "./settings-section"
import type { OryFormSsoRootProps } from "./social"
import { useOryFormSubmit } from "./useOryFormSubmit"
import { kratosMessages } from "../../util/i18n/generated/kratosMessages"

Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/components/form/messages.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { UiText } from "@ory/client-fetch"
import type { UiText } from "@ory/client-fetch"
import { useComponents, useOryFlow } from "../../context"
import { PropsWithChildren } from "react"
import type { PropsWithChildren } from "react"

/**
* Props for the OryMessageContent component.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { UiNodeInputAttributes } from "@ory/client-fetch"
import { MouseEventHandler } from "react"
import type { UiNodeInputAttributes } from "@ory/client-fetch"
import type { MouseEventHandler } from "react"
import { useController } from "react-hook-form"
import { triggerToWindowCall } from "../../../../util/ui"
import { OryNodeInputInputProps } from "../../../../types"
import type { OryNodeInputInputProps } from "../../../../types"
import { useOryFlow } from "../../../../context"

export function useInputProps(
Expand Down
6 changes: 3 additions & 3 deletions packages/elements-react/src/components/form/nodes/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

import {
UiNodeGroupEnum,
UiNodeInputAttributes,
type UiNodeInputAttributes,
UiNodeInputAttributesTypeEnum,
} from "@ory/client-fetch"
import { ReactNode, useEffect, useRef } from "react"
import { type ReactNode, useEffect, useRef } from "react"
import { useFormContext } from "react-hook-form"
import { useComponents } from "../../../context"
import { triggerToWindowCall } from "../../../util/ui"
import { UiNodeInput } from "../../../util/utilFixSDKTypesHelper"
import type { UiNodeInput } from "../../../util/utilFixSDKTypesHelper"
import { NodeButton } from "./node-button"
import { CheckboxRenderer } from "./renderer/checkbox-renderer"
import { ConsentCheckboxRenderer } from "./renderer/consent-checkbox-renderer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { UiNodeGroupEnum } from "@ory/client-fetch"
import { UiNodeInput } from "../../../util/utilFixSDKTypesHelper"
import type { UiNodeInput } from "../../../util/utilFixSDKTypesHelper"
import { NodeRenderer } from "./renderer"

type NodeButtonProps = {
Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/components/form/nodes/node.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { UiNode, UiNodeGroupEnum } from "@ory/client-fetch"
import { ReactNode } from "react"
import { type UiNode, UiNodeGroupEnum } from "@ory/client-fetch"
import type { ReactNode } from "react"
import { useComponents } from "../../../context"
import {
isUiNodeAnchor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { useCallback, useEffect } from "react"
import { useFormContext } from "react-hook-form"
import { useDebounceValue } from "usehooks-ts"
import { useComponents, useOryFlow } from "../../../../context"
import { OryNodeButtonButtonProps } from "../../../../types"
import type { OryNodeButtonButtonProps } from "../../../../types"
import { triggerToWindowCall } from "../../../../util/ui"
import { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"
import type { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"

type ButtonRendererProps = {
node: UiNodeInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import { useController } from "react-hook-form"
import { useComponents } from "../../../../context"
import { OryNodeCheckboxInputProps } from "../../../../types"
import { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"
import type { OryNodeCheckboxInputProps } from "../../../../types"
import type { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"

type CheckboxRendererProps = {
node: UiNodeInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import { useMemo } from "react"
import { useFormContext } from "react-hook-form"
import { useComponents } from "../../../../context"
import { OryNodeConsentScopeCheckboxProps } from "../../../../types"
import { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"
import type { OryNodeConsentScopeCheckboxProps } from "../../../../types"
import type { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"

export function ConsentCheckboxRenderer({ node }: { node: UiNodeInput }) {
const attributes = node.attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { useComponents } from "../../../../context"
import { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"
import type { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"
import { useInputProps } from "../hooks/useInputProps"

type HiddenInputRendererProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { useComponents } from "../../../../context"
import { UiNodeImage } from "../../../../util/utilFixSDKTypesHelper"
import type { UiNodeImage } from "../../../../util/utilFixSDKTypesHelper"

type ImageRendererProps = {
node: UiNodeImage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { getNodeLabel } from "@ory/client-fetch"
import { useComponents } from "../../../../context"
import { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"
import type { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"
import { useIntl } from "react-intl"
import { useFormState } from "react-hook-form"
import { resolvePlaceholder } from "../../../../util"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { fireEvent, screen } from "@testing-library/react"
import { IntlProvider } from "../../../../context/intl-context"
import { LocaleMap } from "../../../../locales"
import type { LocaleMap } from "../../../../locales"
import { renderWithOryElements } from "../../../../tests/jest/test-utils"
import { Node } from "../node"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useFormState } from "react-hook-form"
import { useIntl } from "react-intl"
import { useComponents } from "../../../../context"
import { resolvePlaceholder } from "../../../../util"
import {
import type {
UiNodeInput,
UiNodeInputAttributesOption,
} from "../../../../util/utilFixSDKTypesHelper"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useCallback, useEffect } from "react"
import { useFormContext } from "react-hook-form"
import { useDebounceValue } from "usehooks-ts"
import { useComponents, useOryFlow } from "../../../../context"
import { OryNodeButtonButtonProps } from "../../../../types"
import { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"
import type { OryNodeButtonButtonProps } from "../../../../types"
import type { UiNodeInput } from "../../../../util/utilFixSDKTypesHelper"

type SsoButtonProps = {
node: UiNodeInput
Expand Down
Loading
Loading