diff --git a/.changeset/spotty-pens-cry.md b/.changeset/spotty-pens-cry.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/spotty-pens-cry.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/ui/src/components/sign-in/sign-in.tsx b/packages/ui/src/components/sign-in/sign-in.tsx index cf48926968..37e95f3a87 100644 --- a/packages/ui/src/components/sign-in/sign-in.tsx +++ b/packages/ui/src/components/sign-in/sign-in.tsx @@ -15,6 +15,7 @@ import { UsernameField } from '~/common/username-field'; import { useAttributes } from '~/hooks/use-attributes'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useEnabledConnections } from '~/hooks/use-enabled-connections'; +import { useEnvironment } from '~/hooks/use-environment'; import { useLocalizations } from '~/hooks/use-localizations'; import { Alert } from '~/primitives/alert'; import { Button } from '~/primitives/button'; @@ -36,6 +37,7 @@ export function SignInComponentLoaded() { const clerk = useClerk(); const locationBasedCountryIso = (clerk as any)?.__internal_country; const enabledConnections = useEnabledConnections(); + const { isDevelopmentOrStaging } = useEnvironment(); const { t } = useLocalizations(); const { enabled: usernameEnabled } = useAttributes('username'); const { enabled: phoneNumberEnabled } = useAttributes('phone_number'); @@ -45,6 +47,7 @@ export function SignInComponentLoaded() { const hasConnection = enabledConnections.length > 0; const hasIdentifier = emailAddressEnabled || usernameEnabled || phoneNumberEnabled; + const isDev = isDevelopmentOrStaging(); return ( @@ -171,6 +174,7 @@ export function SignInComponentLoaded() { ) : null } + {isDev ? Development mode : null} @@ -456,6 +460,7 @@ export function SignInComponentLoaded() { + {isDev ? Development mode : null} @@ -509,6 +514,7 @@ export function SignInComponentLoaded() { {t('backButton')} + {isDev ? Development mode : null} @@ -588,6 +594,7 @@ export function SignInComponentLoaded() { + {isDev ? Development mode : null} @@ -658,6 +665,7 @@ export function SignInComponentLoaded() { + {isDev ? Development mode : null} diff --git a/packages/ui/src/components/sign-up/sign-up.tsx b/packages/ui/src/components/sign-up/sign-up.tsx index 52e511b631..b4f3000175 100644 --- a/packages/ui/src/components/sign-up/sign-up.tsx +++ b/packages/ui/src/components/sign-up/sign-up.tsx @@ -13,6 +13,7 @@ import { UsernameField } from '~/common/username-field'; import { useAttributes } from '~/hooks/use-attributes'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useEnabledConnections } from '~/hooks/use-enabled-connections'; +import { useEnvironment } from '~/hooks/use-environment'; import { useLocalizations } from '~/hooks/use-localizations'; import { Alert } from '~/primitives/alert'; import { Button } from '~/primitives/button'; @@ -34,6 +35,7 @@ export function SignUpComponent() { function SignUpComponentLoaded() { const clerk = useClerk(); const enabledConnections = useEnabledConnections(); + const { isDevelopmentOrStaging } = useEnvironment(); const locationBasedCountryIso = (clerk as any)?.__internal_country; const { t } = useLocalizations(); const { enabled: firstNameEnabled, required: firstNameRequired } = useAttributes('first_name'); @@ -46,6 +48,7 @@ function SignUpComponentLoaded() { const hasConnection = enabledConnections.length > 0; const hasIdentifier = emailAddressEnabled || usernameEnabled || phoneNumberEnabled; + const isDev = isDevelopmentOrStaging(); return ( @@ -153,6 +156,7 @@ function SignUpComponentLoaded() { ) : null} + {isDev ? Development mode : null} @@ -353,6 +357,7 @@ function SignUpComponentLoaded() { + {isDev ? Development mode : null} @@ -438,6 +443,7 @@ function SignUpComponentLoaded() { }} + {isDev ? Development mode : null} diff --git a/packages/ui/src/hooks/use-attributes.ts b/packages/ui/src/hooks/use-attributes.ts index f76abce294..07e517998a 100644 --- a/packages/ui/src/hooks/use-attributes.ts +++ b/packages/ui/src/hooks/use-attributes.ts @@ -1,9 +1,11 @@ -import { useClerk } from '@clerk/clerk-react'; -import type { Attribute, AttributeData, EnvironmentResource } from '@clerk/types'; +import type { Attribute, AttributeData } from '@clerk/types'; + +import { useEnvironment } from './use-environment'; export function useAttributes(attribute: Attribute): AttributeData { - const clerk = useClerk(); - const userSettingsAttributes = ((clerk as any)?.__unstable__environment as EnvironmentResource)?.userSettings - .attributes; + const environment = useEnvironment(); + + const userSettingsAttributes = environment.userSettings.attributes; + return userSettingsAttributes[attribute]; } diff --git a/packages/ui/src/hooks/use-environment.ts b/packages/ui/src/hooks/use-environment.ts new file mode 100644 index 0000000000..c824b3a703 --- /dev/null +++ b/packages/ui/src/hooks/use-environment.ts @@ -0,0 +1,7 @@ +import { useClerk } from '@clerk/clerk-react'; +import type { EnvironmentResource } from '@clerk/types'; + +export function useEnvironment() { + const clerk = useClerk(); + return (clerk as any)?.__unstable__environment as EnvironmentResource; +} diff --git a/packages/ui/src/primitives/card.tsx b/packages/ui/src/primitives/card.tsx index 611218ada0..8c6a591629 100644 --- a/packages/ui/src/primitives/card.tsx +++ b/packages/ui/src/primitives/card.tsx @@ -3,15 +3,16 @@ import * as React from 'react'; import { ClerkLogo } from './clerk-logo'; -export const Root = React.forwardRef>(function Root( - { children, className, ...props }, - forwardedRef, +export const Root = React.forwardRef(function CardRoot( + { children, className, ...props }: React.HTMLAttributes, + forwardedRef: React.ForwardedRef, ) { return (
@@ -47,7 +48,7 @@ export const Header = React.forwardRef {children}
@@ -73,7 +74,7 @@ export const Logo = React.forwardRef(function Logo( /> ); return ( -