From f532d334c6d7491ac8d39e163cf41f2917fe190b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Szekiel?= <12242002+mszekiel@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:33:39 +0200 Subject: [PATCH] chore: bundling tsup --- package-lock.json | 1 + packages/elements-react/package.json | 1 + .../src/components/card/card-two-step.tsx | 4 ++-- packages/elements-react/src/components/card/header.tsx | 2 +- packages/elements-react/src/components/card/index.tsx | 2 +- packages/elements-react/src/components/form/form.tsx | 3 +-- packages/elements-react/src/components/form/groups.tsx | 4 ++-- .../elements-react/src/components/form/messages.tsx | 3 +-- .../elements-react/src/components/form/nodes/input.tsx | 2 +- .../elements-react/src/components/form/nodes/node.tsx | 2 +- packages/elements-react/src/components/form/social.tsx | 4 ++-- .../elements-react/src/components/generic/divider.tsx | 4 ++-- packages/elements-react/src/context/intl-context.tsx | 1 + .../src/theme/default/components/card/auth-methods.tsx | 2 +- .../src/theme/default/components/card/content.tsx | 2 +- .../components/card/current-identifier-button.tsx | 2 +- .../src/theme/default/components/card/footer.tsx | 2 +- .../src/theme/default/components/card/header.tsx | 3 +-- .../src/theme/default/components/card/index.tsx | 2 +- .../src/theme/default/components/card/logo.tsx | 2 +- .../theme/default/components/default-components.tsx | 2 +- .../src/theme/default/components/form/button.tsx | 3 +-- .../src/theme/default/components/form/checkbox.tsx | 4 ++-- .../theme/default/components/form/group-container.tsx | 2 +- .../src/theme/default/components/form/image.tsx | 2 +- .../src/theme/default/components/form/index.tsx | 4 ++-- .../src/theme/default/components/form/input.tsx | 2 +- .../src/theme/default/components/form/label.tsx | 6 +++--- .../src/theme/default/components/form/link-button.tsx | 4 ++-- .../theme/default/components/form/pin-code-input.tsx | 2 +- .../src/theme/default/components/form/social.tsx | 4 ++-- .../src/theme/default/components/form/text.tsx | 4 ++-- .../elements-react/src/theme/default/flows/error.tsx | 3 +-- .../elements-react/src/theme/default/flows/login.tsx | 10 ++++++---- .../src/theme/default/flows/recovery.tsx | 10 ++++++---- .../src/theme/default/flows/registration.tsx | 10 ++++++---- .../src/theme/default/flows/settings.tsx | 10 ++++++---- .../src/theme/default/flows/verification.tsx | 10 ++++++---- packages/elements-react/src/util/onSubmitLogin.ts | 1 - packages/elements-react/tsconfig.json | 5 ++++- packages/elements-react/tsup.config.ts | 4 +++- 41 files changed, 81 insertions(+), 69 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3f838e90e..75125bdcc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32002,6 +32002,7 @@ "tailwind-merge": "2.4.0" }, "devDependencies": { + "@svgr/plugin-jsx": "^8.1.0", "esbuild-plugin-svgr": "2.1.0", "eslint-plugin-react": "7.35.0", "tsup": "8.2.3" diff --git a/packages/elements-react/package.json b/packages/elements-react/package.json index cf3522b55..2a7d77d20 100644 --- a/packages/elements-react/package.json +++ b/packages/elements-react/package.json @@ -39,6 +39,7 @@ "react-dom": "18.3.1" }, "devDependencies": { + "@svgr/plugin-jsx": "^8.1.0", "esbuild-plugin-svgr": "2.1.0", "eslint-plugin-react": "7.35.0", "tsup": "8.2.3" diff --git a/packages/elements-react/src/components/card/card-two-step.tsx b/packages/elements-react/src/components/card/card-two-step.tsx index 6738c1689..38b1c81bf 100644 --- a/packages/elements-react/src/components/card/card-two-step.tsx +++ b/packages/elements-react/src/components/card/card-two-step.tsx @@ -3,8 +3,8 @@ import { OryForm } from "../form/form" import { OryCardValidationMessages } from "../form/messages" import { Node } from "../form/nodes/node" import { OryFormSocialButtons } from "../form/social" -import { useComponents, useNodeSorter } from "../../context/component" -import { useOryFlow } from "../../context/flow-context" +import { useComponents, useNodeSorter } from "../../context" +import { useOryFlow } from "../../context" import { isUiNodeInputAttributes, UiNode, diff --git a/packages/elements-react/src/components/card/header.tsx b/packages/elements-react/src/components/card/header.tsx index 63f1feabd..e63ff266e 100644 --- a/packages/elements-react/src/components/card/header.tsx +++ b/packages/elements-react/src/components/card/header.tsx @@ -1,4 +1,4 @@ -import { useComponents } from "../../context/component" +import { useComponents } from "../../context" export type OryCardHeaderProps = Record diff --git a/packages/elements-react/src/components/card/index.tsx b/packages/elements-react/src/components/card/index.tsx index bfd8f8d56..cb15fe3dc 100644 --- a/packages/elements-react/src/components/card/index.tsx +++ b/packages/elements-react/src/components/card/index.tsx @@ -2,7 +2,7 @@ import { OryForm } from "../form/form" import { OryFormGroups } from "../form/groups" import { OryCardValidationMessages } from "../form/messages" import { OryFormSocialButtons } from "../form/social" -import { useComponents } from "../../context/component" +import { useComponents } from "../../context" import { ComponentType, PropsWithChildren } from "react" import { OryCardHeader, OryCardHeaderProps } from "./header" diff --git a/packages/elements-react/src/components/form/form.tsx b/packages/elements-react/src/components/form/form.tsx index 80336bc6e..79d771cd4 100644 --- a/packages/elements-react/src/components/form/form.tsx +++ b/packages/elements-react/src/components/form/form.tsx @@ -8,8 +8,7 @@ import { import { ComponentType, PropsWithChildren } from "react" import { FormProvider, SubmitHandler, useForm } from "react-hook-form" import { useIntl } from "react-intl" -import { useComponents } from "../../context/component" -import { useOryFlow } from "../../context/flow-context" +import { useOryFlow, useComponents } from "../../context" import { FormValues, HeadlessAuthMethodListItemProps, diff --git a/packages/elements-react/src/components/form/groups.tsx b/packages/elements-react/src/components/form/groups.tsx index d397f020b..7183bd18e 100644 --- a/packages/elements-react/src/components/form/groups.tsx +++ b/packages/elements-react/src/components/form/groups.tsx @@ -1,5 +1,5 @@ -import { useComponents, useNodeSorter } from "../../context/component" -import { useOryFlow } from "../../context/flow-context" +import { useComponents, useNodeSorter } from "../../context" +import { useOryFlow } from "../../context" import { UiNodeGroupEnum } from "@ory/client-fetch" import { PropsWithChildren } from "react" import { Node } from "./nodes/node" diff --git a/packages/elements-react/src/components/form/messages.tsx b/packages/elements-react/src/components/form/messages.tsx index fce830f0f..9b592ab07 100644 --- a/packages/elements-react/src/components/form/messages.tsx +++ b/packages/elements-react/src/components/form/messages.tsx @@ -1,5 +1,4 @@ -import { useComponents } from "../../context/component" -import { useOryFlow } from "../../context/flow-context" +import { useOryFlow, useComponents } from "../../context" import { UiText } from "@ory/client-fetch" import { DetailedHTMLProps, HTMLAttributes } from "react" diff --git a/packages/elements-react/src/components/form/nodes/input.tsx b/packages/elements-react/src/components/form/nodes/input.tsx index ea27084a2..96d578451 100644 --- a/packages/elements-react/src/components/form/nodes/input.tsx +++ b/packages/elements-react/src/components/form/nodes/input.tsx @@ -1,5 +1,5 @@ import { NodeProps } from "./node" -import { useComponents } from "../../../context/component" +import { useComponents } from "../../../context" import { triggerToWindowCall } from "../../../util/ui" import { UiNodeInputAttributes, diff --git a/packages/elements-react/src/components/form/nodes/node.tsx b/packages/elements-react/src/components/form/nodes/node.tsx index 0c4f439cb..cfb77de09 100644 --- a/packages/elements-react/src/components/form/nodes/node.tsx +++ b/packages/elements-react/src/components/form/nodes/node.tsx @@ -8,7 +8,7 @@ import { isUiNodeTextAttributes, } from "@ory/client-fetch" import { MouseEventHandler, ReactNode } from "react" -import { useComponents } from "../../../context/component" +import { useComponents } from "../../../context" export type NodeProps = { node: UiNode diff --git a/packages/elements-react/src/components/form/social.tsx b/packages/elements-react/src/components/form/social.tsx index 2253a3d62..e145d0bfc 100644 --- a/packages/elements-react/src/components/form/social.tsx +++ b/packages/elements-react/src/components/form/social.tsx @@ -1,5 +1,5 @@ -import { useComponents } from "../../context/component" -import { useOryFlow } from "../../context/flow-context" +import { useComponents } from "../../context" +import { useOryFlow } from "../../context" import { UiNode, UiNodeInputAttributes } from "@ory/client-fetch" import { PropsWithChildren } from "react" import { Node } from "./nodes/node" diff --git a/packages/elements-react/src/components/generic/divider.tsx b/packages/elements-react/src/components/generic/divider.tsx index d9f67c4f6..4feae2729 100644 --- a/packages/elements-react/src/components/generic/divider.tsx +++ b/packages/elements-react/src/components/generic/divider.tsx @@ -1,5 +1,5 @@ -import { useComponents } from "../../context/component" -import { useOryFlow } from "../../context/flow-context" +import { useComponents } from "../../context" +import { useOryFlow } from "../../context" export type HorizontalDividerProps = Record diff --git a/packages/elements-react/src/context/intl-context.tsx b/packages/elements-react/src/context/intl-context.tsx index bb3278a0c..b81e6f30e 100644 --- a/packages/elements-react/src/context/intl-context.tsx +++ b/packages/elements-react/src/context/intl-context.tsx @@ -192,6 +192,7 @@ export const IntlProvider = < let translation = locales.en if (props.locale && props.locale in locales) { + // @ts-expect-error asdasd translation = locales[props.locale as Locale] } diff --git a/packages/elements-react/src/theme/default/components/card/auth-methods.tsx b/packages/elements-react/src/theme/default/components/card/auth-methods.tsx index 9acefd450..9e5129f99 100644 --- a/packages/elements-react/src/theme/default/components/card/auth-methods.tsx +++ b/packages/elements-react/src/theme/default/components/card/auth-methods.tsx @@ -1,4 +1,4 @@ -import { HeadlessAuthMethodListItemProps } from "../../../../types" +import { HeadlessAuthMethodListItemProps } from "@ory/elements-react" import { FunctionComponent, SVGAttributes } from "react" import code from "../../assets/icons/code.svg" diff --git a/packages/elements-react/src/theme/default/components/card/content.tsx b/packages/elements-react/src/theme/default/components/card/content.tsx index d043dafde..219c77420 100644 --- a/packages/elements-react/src/theme/default/components/card/content.tsx +++ b/packages/elements-react/src/theme/default/components/card/content.tsx @@ -1,4 +1,4 @@ -import { OryCardContentProps } from "../../../../components" +import { OryCardContentProps } from "@ory/elements-react" export function DefaultCardContent({ children }: OryCardContentProps) { return children diff --git a/packages/elements-react/src/theme/default/components/card/current-identifier-button.tsx b/packages/elements-react/src/theme/default/components/card/current-identifier-button.tsx index 38a0de9d7..f86b2ca1c 100644 --- a/packages/elements-react/src/theme/default/components/card/current-identifier-button.tsx +++ b/packages/elements-react/src/theme/default/components/card/current-identifier-button.tsx @@ -1,4 +1,4 @@ -import { HeadlessButtonProps } from "../../../../types" +import { HeadlessButtonProps } from "@ory/elements-react" import { DefaultInput } from "../form/input" export function DefaultCurrentIdentifierButton({ diff --git a/packages/elements-react/src/theme/default/components/card/footer.tsx b/packages/elements-react/src/theme/default/components/card/footer.tsx index f3ee3d4c1..5b18d9895 100644 --- a/packages/elements-react/src/theme/default/components/card/footer.tsx +++ b/packages/elements-react/src/theme/default/components/card/footer.tsx @@ -1,6 +1,6 @@ import { FlowType } from "@ory/client-fetch" import { useIntl } from "react-intl" -import { useOryFlow } from "../../../../context" +import { useOryFlow } from "@ory/elements-react" export function DefaultCardFooter() { const { flowType } = useOryFlow() diff --git a/packages/elements-react/src/theme/default/components/card/header.tsx b/packages/elements-react/src/theme/default/components/card/header.tsx index 24ce3fc32..21a624434 100644 --- a/packages/elements-react/src/theme/default/components/card/header.tsx +++ b/packages/elements-react/src/theme/default/components/card/header.tsx @@ -1,6 +1,5 @@ import { FlowType, isUiNodeInputAttributes } from "@ory/client-fetch" -import { useComponents, useOryFlow } from "../../../../context" -import { FlowContainer } from "../../../../util/flowContainer" +import { FlowContainer, useComponents, useOryFlow } from "@ory/elements-react" function joinWithCommaOr(list: string[]): string { if (list.length === 0) { diff --git a/packages/elements-react/src/theme/default/components/card/index.tsx b/packages/elements-react/src/theme/default/components/card/index.tsx index b1a469e01..32b25ecf4 100644 --- a/packages/elements-react/src/theme/default/components/card/index.tsx +++ b/packages/elements-react/src/theme/default/components/card/index.tsx @@ -1,4 +1,4 @@ -import { OryCardProps } from "../../../../components" +import { OryCardProps } from "@ory/elements-react" import { Badge } from "./badge" import { DefaultCardContent } from "./content" import { DefaultCardFooter } from "./footer" diff --git a/packages/elements-react/src/theme/default/components/card/logo.tsx b/packages/elements-react/src/theme/default/components/card/logo.tsx index 1091015d0..9c9e61009 100644 --- a/packages/elements-react/src/theme/default/components/card/logo.tsx +++ b/packages/elements-react/src/theme/default/components/card/logo.tsx @@ -1,4 +1,4 @@ -import { useOryFlow } from "../../../../context" +import { useOryFlow } from "@ory/elements-react" export function DefaultCardLogo() { const flow = useOryFlow() diff --git a/packages/elements-react/src/theme/default/components/default-components.tsx b/packages/elements-react/src/theme/default/components/default-components.tsx index a9b62108b..f791f16f0 100644 --- a/packages/elements-react/src/theme/default/components/default-components.tsx +++ b/packages/elements-react/src/theme/default/components/default-components.tsx @@ -26,7 +26,7 @@ import { } from "./form/social" import { DefaultText } from "./form/text" import { DefaultCurrentIdentifierButton } from "./card/current-identifier-button" -import { OryFlowComponents } from "../../../types" +import { OryFlowComponents } from "@ory/elements-react" export const OryDefaultComponents: OryFlowComponents = { Card: DefaultCard, diff --git a/packages/elements-react/src/theme/default/components/form/button.tsx b/packages/elements-react/src/theme/default/components/form/button.tsx index 1f0c5dd4a..b1517f20d 100644 --- a/packages/elements-react/src/theme/default/components/form/button.tsx +++ b/packages/elements-react/src/theme/default/components/form/button.tsx @@ -2,8 +2,7 @@ import { useFormContext } from "react-hook-form" import { useIntl } from "react-intl" import { Spinner } from "./spinner" import { cn } from "../../utils/cn" -import { HeadlessButtonProps } from "../../../../types" -import { formatMessage } from "../../../../util" +import { formatMessage, HeadlessButtonProps } from "@ory/elements-react" import { getNodeLabel } from "@ory/client-fetch" export const DefaultButton = ({ diff --git a/packages/elements-react/src/theme/default/components/form/checkbox.tsx b/packages/elements-react/src/theme/default/components/form/checkbox.tsx index 92dc6f499..025f58283 100644 --- a/packages/elements-react/src/theme/default/components/form/checkbox.tsx +++ b/packages/elements-react/src/theme/default/components/form/checkbox.tsx @@ -3,8 +3,8 @@ import { useState } from "react" import { useForm } from "react-hook-form" import { useIntl } from "react-intl" import { cn } from "../../utils/cn" -import { HeadlessInputProps } from "../../../../types" -import { formatMessage, messageTestId } from "../../../../util" +import { HeadlessInputProps } from "@ory/elements-react" +import { formatMessage, messageTestId } from "@ory/elements-react" import { getNodeLabel } from "@ory/client-fetch" function CheckboxSVG() { diff --git a/packages/elements-react/src/theme/default/components/form/group-container.tsx b/packages/elements-react/src/theme/default/components/form/group-container.tsx index f87bf1678..cd80950a6 100644 --- a/packages/elements-react/src/theme/default/components/form/group-container.tsx +++ b/packages/elements-react/src/theme/default/components/form/group-container.tsx @@ -1,4 +1,4 @@ -import { HeadlessGroupContainerProps } from "../../../../components" +import { HeadlessGroupContainerProps } from "@ory/elements-react" export function DefaultGroupContainer({ children, diff --git a/packages/elements-react/src/theme/default/components/form/image.tsx b/packages/elements-react/src/theme/default/components/form/image.tsx index 84cd7adbc..2812217f9 100644 --- a/packages/elements-react/src/theme/default/components/form/image.tsx +++ b/packages/elements-react/src/theme/default/components/form/image.tsx @@ -1,4 +1,4 @@ -import { HeadlessImageProps } from "../../../../types" +import { HeadlessImageProps } from "@ory/elements-react" export function DefaultImage({ attributes }: HeadlessImageProps) { // const intl = useIntl() diff --git a/packages/elements-react/src/theme/default/components/form/index.tsx b/packages/elements-react/src/theme/default/components/form/index.tsx index 2af154336..f2ec56377 100644 --- a/packages/elements-react/src/theme/default/components/form/index.tsx +++ b/packages/elements-react/src/theme/default/components/form/index.tsx @@ -1,7 +1,7 @@ import { PropsWithChildren } from "react" import { cn } from "../../utils/cn" -import { HeadlessFormProps } from "../../../../types" -import { HeadlessMessageProps } from "../../../../components" +import { HeadlessFormProps } from "@ory/elements-react" +import { HeadlessMessageProps } from "@ory/elements-react" export function DefaultFormContainer({ children, diff --git a/packages/elements-react/src/theme/default/components/form/input.tsx b/packages/elements-react/src/theme/default/components/form/input.tsx index 3dd43470b..a4e34d932 100644 --- a/packages/elements-react/src/theme/default/components/form/input.tsx +++ b/packages/elements-react/src/theme/default/components/form/input.tsx @@ -1,5 +1,5 @@ import { useFormContext } from "react-hook-form" -import { HeadlessInputProps } from "../../../../types" +import { HeadlessInputProps } from "@ory/elements-react" import { getNodeLabel } from "@ory/client-fetch" export const DefaultInput = ({ diff --git a/packages/elements-react/src/theme/default/components/form/label.tsx b/packages/elements-react/src/theme/default/components/form/label.tsx index 75afe35f6..6fbf10b36 100644 --- a/packages/elements-react/src/theme/default/components/form/label.tsx +++ b/packages/elements-react/src/theme/default/components/form/label.tsx @@ -1,8 +1,8 @@ import { FlowType, getNodeLabel } from "@ory/client-fetch" import { useIntl } from "react-intl" -import { useOryFlow } from "../../../../context" -import { HeadlessLabelProps } from "../../../../types" -import { formatMessage, messageTestId } from "../../../../util" +import { useOryFlow } from "@ory/elements-react" +import { HeadlessLabelProps } from "@ory/elements-react" +import { formatMessage, messageTestId } from "@ory/elements-react" import { cn } from "../../utils/cn" export function DefaultLabel({ diff --git a/packages/elements-react/src/theme/default/components/form/link-button.tsx b/packages/elements-react/src/theme/default/components/form/link-button.tsx index 9f1a94c9b..2a680ac33 100644 --- a/packages/elements-react/src/theme/default/components/form/link-button.tsx +++ b/packages/elements-react/src/theme/default/components/form/link-button.tsx @@ -1,8 +1,8 @@ import { forwardRef } from "react" import { useIntl } from "react-intl" import { cn } from "../../utils/cn" -import { HeadlessLinkButtonProps } from "../../../../types" -import { formatMessage } from "../../../../util" +import { HeadlessLinkButtonProps } from "@ory/elements-react" +import { formatMessage } from "@ory/elements-react" import { getNodeLabel } from "@ory/client-fetch" export const DefaultLinkButton = forwardRef< diff --git a/packages/elements-react/src/theme/default/components/form/pin-code-input.tsx b/packages/elements-react/src/theme/default/components/form/pin-code-input.tsx index e30840c31..dfbcef108 100644 --- a/packages/elements-react/src/theme/default/components/form/pin-code-input.tsx +++ b/packages/elements-react/src/theme/default/components/form/pin-code-input.tsx @@ -1,7 +1,7 @@ "use client" import { useFormContext } from "react-hook-form" import { InputOTP, InputOTPGroup, InputOTPSlot } from "./shadcn/otp-input" -import { HeadlessInputProps } from "../../../../types" +import { HeadlessInputProps } from "@ory/elements-react" export const DefaultPinCodeInput = ({ attributes }: HeadlessInputProps) => { const { setValue, watch } = useFormContext() diff --git a/packages/elements-react/src/theme/default/components/form/social.tsx b/packages/elements-react/src/theme/default/components/form/social.tsx index f32d16b7b..11926fc6f 100644 --- a/packages/elements-react/src/theme/default/components/form/social.tsx +++ b/packages/elements-react/src/theme/default/components/form/social.tsx @@ -1,8 +1,8 @@ import { HeadlessSocialButtonContainerProps, HeadlessSocialButtonProps, -} from "../../../../components" -import { useOryFlow } from "../../../../context" +} from "@ory/elements-react" +import { useOryFlow } from "@ory/elements-react" import logos from "../../provider-logos" import { cn } from "../../utils/cn" diff --git a/packages/elements-react/src/theme/default/components/form/text.tsx b/packages/elements-react/src/theme/default/components/form/text.tsx index cfc9b2dfa..47b0d06b4 100644 --- a/packages/elements-react/src/theme/default/components/form/text.tsx +++ b/packages/elements-react/src/theme/default/components/form/text.tsx @@ -1,7 +1,7 @@ import { UiText } from "@ory/client-fetch" import { useIntl } from "react-intl" -import { HeadlessTextProps } from "../../../../types" -import { formatMessage } from "../../../../util" +import { HeadlessTextProps } from "@ory/elements-react" +import { formatMessage } from "@ory/elements-react" export function DefaultText({ node, attributes }: HeadlessTextProps) { const intl = useIntl() diff --git a/packages/elements-react/src/theme/default/flows/error.tsx b/packages/elements-react/src/theme/default/flows/error.tsx index 887dc86aa..86ab275e0 100644 --- a/packages/elements-react/src/theme/default/flows/error.tsx +++ b/packages/elements-react/src/theme/default/flows/error.tsx @@ -1,8 +1,7 @@ "use client" import { FlowError } from "@ory/client-fetch" import { PropsWithChildren } from "react" -import { OryFlowComponents } from "../../../types" -import { OryClientConfiguration } from "../../../util/clientConfiguration" +import { OryClientConfiguration, OryFlowComponents } from "@ory/elements-react" export type ErrorFlowContextProps = { error: FlowError diff --git a/packages/elements-react/src/theme/default/flows/login.tsx b/packages/elements-react/src/theme/default/flows/login.tsx index b51c35e3e..1e43f2ed6 100644 --- a/packages/elements-react/src/theme/default/flows/login.tsx +++ b/packages/elements-react/src/theme/default/flows/login.tsx @@ -2,10 +2,12 @@ import { FlowType, LoginFlow } from "@ory/client-fetch" import { PropsWithChildren } from "react" import { OryDefaultComponents } from "../components" -import { OryFlowComponents } from "../../../types" -import { OryProvider } from "../../../context" -import { OryCard } from "../../../components" -import { OryClientConfiguration } from "../../../util/clientConfiguration" +import { + OryFlowComponents, + OryCard, + OryClientConfiguration, + OryProvider, +} from "@ory/elements-react" export type LoginFlowContextProps = { flow: LoginFlow diff --git a/packages/elements-react/src/theme/default/flows/recovery.tsx b/packages/elements-react/src/theme/default/flows/recovery.tsx index 0b6c37862..41e688c81 100644 --- a/packages/elements-react/src/theme/default/flows/recovery.tsx +++ b/packages/elements-react/src/theme/default/flows/recovery.tsx @@ -2,10 +2,12 @@ import { FlowType, RecoveryFlow } from "@ory/client-fetch" import { PropsWithChildren } from "react" import { OryDefaultComponents } from "../components" -import { OryFlowComponents } from "../../../types" -import { OryProvider } from "../../../context" -import { OryCard } from "../../../components" -import { OryClientConfiguration } from "../../../util/clientConfiguration" +import { + OryCard, + OryFlowComponents, + OryProvider, + OryClientConfiguration, +} from "@ory/elements-react" export type RecoveryFlowContextProps = { flow: RecoveryFlow diff --git a/packages/elements-react/src/theme/default/flows/registration.tsx b/packages/elements-react/src/theme/default/flows/registration.tsx index 6637c93d8..39842ffc0 100644 --- a/packages/elements-react/src/theme/default/flows/registration.tsx +++ b/packages/elements-react/src/theme/default/flows/registration.tsx @@ -2,10 +2,12 @@ import { FlowType, RegistrationFlow } from "@ory/client-fetch" import { PropsWithChildren } from "react" import { OryDefaultComponents } from "../components" -import { OryFlowComponents } from "../../../types" -import { OryProvider } from "../../../context" -import { OryCard } from "../../../components" -import { OryClientConfiguration } from "../../../util/clientConfiguration" +import { + OryClientConfiguration, + OryFlowComponents, + OryCard, + OryProvider, +} from "@ory/elements-react" type RegistrationFlowContextProps = { flow: RegistrationFlow diff --git a/packages/elements-react/src/theme/default/flows/settings.tsx b/packages/elements-react/src/theme/default/flows/settings.tsx index c571b3356..095e6e46e 100644 --- a/packages/elements-react/src/theme/default/flows/settings.tsx +++ b/packages/elements-react/src/theme/default/flows/settings.tsx @@ -2,10 +2,12 @@ import { FlowType, SettingsFlow } from "@ory/client-fetch" import { PropsWithChildren } from "react" import { OryDefaultComponents } from "../components" -import { OryFlowComponents } from "../../../types" -import { OryProvider } from "../../../context" -import { OryCard } from "../../../components" -import { OryClientConfiguration } from "../../../util/clientConfiguration" +import { + OryFlowComponents, + OryClientConfiguration, + OryProvider, + OryCard, +} from "@ory/elements-react" export type SettingsFlowContextProps = { flow: SettingsFlow diff --git a/packages/elements-react/src/theme/default/flows/verification.tsx b/packages/elements-react/src/theme/default/flows/verification.tsx index 58258c2f5..70d58804e 100644 --- a/packages/elements-react/src/theme/default/flows/verification.tsx +++ b/packages/elements-react/src/theme/default/flows/verification.tsx @@ -2,10 +2,12 @@ import { FlowType, VerificationFlow } from "@ory/client-fetch" import { PropsWithChildren } from "react" import { OryDefaultComponents } from "../components" -import { OryFlowComponents } from "../../../types" -import { OryProvider } from "../../../context" -import { OryCard } from "../../../components" -import { OryClientConfiguration } from "../../../util/clientConfiguration" +import { + OryCard, + OryProvider, + OryClientConfiguration, + OryFlowComponents, +} from "@ory/elements-react" export type VerificationFlowContextProps = { flow: VerificationFlow diff --git a/packages/elements-react/src/util/onSubmitLogin.ts b/packages/elements-react/src/util/onSubmitLogin.ts index d5e663cf7..ad37576df 100644 --- a/packages/elements-react/src/util/onSubmitLogin.ts +++ b/packages/elements-react/src/util/onSubmitLogin.ts @@ -54,7 +54,6 @@ export async function onSubmitLogin( setFlowContainer({ flow: body, flowType: FlowType.Login, - config, }) }, onRedirect, diff --git a/packages/elements-react/tsconfig.json b/packages/elements-react/tsconfig.json index d5b54a4a2..04ec34130 100644 --- a/packages/elements-react/tsconfig.json +++ b/packages/elements-react/tsconfig.json @@ -17,7 +17,10 @@ "declarationDir": "dist/types", "jsx": "react-jsx", "lib": ["ES6", "DOM", "WebWorker"], - "rootDir": "src" + "rootDir": "src", + "paths": { + "@ory/elements-react": ["./src/index.ts"] + } }, "exclude": ["node_modules"], "include": [ diff --git a/packages/elements-react/tsup.config.ts b/packages/elements-react/tsup.config.ts index 99436f654..08f122de8 100644 --- a/packages/elements-react/tsup.config.ts +++ b/packages/elements-react/tsup.config.ts @@ -5,7 +5,7 @@ import svgr from "esbuild-plugin-svgr" import { defineConfig, type Options } from "tsup" const baseConfig: Options = { - dts: false, + dts: true, minify: false, sourcemap: true, bundle: true, @@ -17,6 +17,7 @@ export default defineConfig([ ...baseConfig, entry: ["src/index.ts"], outDir: "dist/", + dts: true, treeshake: true, external: [ "react", @@ -34,6 +35,7 @@ export default defineConfig([ "react-dom", "@ory/client-helpers", "@ory/client-fetch", + "@ory/elements-react", ], /* @ts-ignore -- the types of the plugin are wrong? it still works.. */