Skip to content

Commit

Permalink
chore: remove experimental check
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcarpenter committed Dec 16, 2024
1 parent dcd2f39 commit 8ed1cc9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/clerk-js/src/core/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export class Clerk implements ClerkInterface {
};

#isCombinedFlow(): boolean {
return this.#options.experimental?.combinedFlow && this.#options.signInUrl === this.#options.signUpUrl;
return this.#options.signInUrl === this.#options.signUpUrl;
}

public signOut: SignOut = async (callbackOrOptions?: SignOutCallback | SignOutOptions, options?: SignOutOptions) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/clerk-js/src/ui/common/redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function buildEmailLinkRedirectUrl(
baseUrl: string | undefined = '',
): string {
const { routing, authQueryString, path } = ctx;
const isCombinedFlow = '__experimental' in ctx && ctx.__experimental?.combinedProps;
const isCombinedFlow = 'isCombinedFlow' in ctx && ctx.isCombinedFlow;
return buildRedirectUrl({
routing,
baseUrl,
Expand Down
6 changes: 2 additions & 4 deletions packages/clerk-js/src/ui/components/SignIn/SignInStart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getClerkQueryParam, removeClerkQueryParam } from '../../../utils';
import type { SignInStartIdentifier } from '../../common';
import { getIdentifierControlDisplayValues, groupIdentifiers, withRedirectToAfterSignIn } from '../../common';
import { buildSSOCallbackURL } from '../../common/redirects';
import { useCoreSignIn, useEnvironment, useOptions, useSignInContext } from '../../contexts';
import { useCoreSignIn, useEnvironment, useSignInContext } from '../../contexts';
import { Col, descriptors, Flow, localizationKeys } from '../../customizables';
import {
Card,
Expand Down Expand Up @@ -66,10 +66,8 @@ export function _SignInStart(): JSX.Element {
const { displayConfig, userSettings } = useEnvironment();
const signIn = useCoreSignIn();
const { navigate } = useRouter();
const options = useOptions();
const ctx = useSignInContext();
const { afterSignInUrl, signUpUrl, waitlistUrl } = ctx;
const isCombinedFlow = !!options?.experimental?.combinedFlow;
const { afterSignInUrl, signUpUrl, waitlistUrl, isCombinedFlow } = ctx;
const supportEmail = useSupportEmail();
const identifierAttributes = useMemo<SignInStartIdentifier[]>(
() => groupIdentifiers(userSettings.enabledFirstFactorIdentifiers),
Expand Down
13 changes: 9 additions & 4 deletions packages/clerk-js/src/ui/components/SignUp/SignUpContinue.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useClerk } from '@clerk/shared/react';
import React, { useEffect, useMemo } from 'react';

import { SignInContext, useCoreSignUp, useEnvironment, useOptions, useSignUpContext } from '../../contexts';
import { SignInContext, useCoreSignUp, useEnvironment, useSignUpContext } from '../../contexts';
import { descriptors, Flex, Flow, localizationKeys } from '../../customizables';
import {
Card,
Expand Down Expand Up @@ -31,11 +31,16 @@ function _SignUpContinue() {
const { navigate } = useRouter();
const { displayConfig, userSettings } = useEnvironment();
const { attributes } = userSettings;
const { afterSignUpUrl, signInUrl, unsafeMetadata, initialValues = {} } = useSignUpContext();
const {
afterSignUpUrl,
signInUrl,
unsafeMetadata,
initialValues = {},
isCombinedFlow: _isCombinedFlow,
} = useSignUpContext();
const signUp = useCoreSignUp();
const options = useOptions();
const isWithinSignInContext = !!React.useContext(SignInContext);
const isCombinedFlow = !!(options.experimental?.combinedFlow && !!isWithinSignInContext);
const isCombinedFlow = !!(_isCombinedFlow && !!isWithinSignInContext);
const isProgressiveSignUp = userSettings.signUp.progressive;
const [activeCommIdentifierType, setActiveCommIdentifierType] = React.useState<ActiveIdentifier>(
getInitialActiveIdentifier(attributes, userSettings.signUp.progressive),
Expand Down
7 changes: 3 additions & 4 deletions packages/clerk-js/src/ui/components/SignUp/SignUpStart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import { ERROR_CODES, SIGN_UP_MODES } from '../../../core/constants';
import { getClerkQueryParam, removeClerkQueryParam } from '../../../utils/getClerkQueryParam';
import { buildSSOCallbackURL, withRedirectToAfterSignUp } from '../../common';
import { SignInContext, useCoreSignUp, useEnvironment, useOptions, useSignUpContext } from '../../contexts';
import { SignInContext, useCoreSignUp, useEnvironment, useSignUpContext } from '../../contexts';
import { descriptors, Flex, Flow, localizationKeys, useAppearance, useLocalizations } from '../../customizables';
import {
Card,
Expand Down Expand Up @@ -39,10 +39,9 @@ function _SignUpStart(): JSX.Element {
const { attributes } = userSettings;
const { setActive } = useClerk();
const ctx = useSignUpContext();
const options = useOptions();
const isWithinSignInContext = !!React.useContext(SignInContext);
const { afterSignUpUrl, signInUrl, unsafeMetadata } = ctx;
const isCombinedFlow = !!(options.experimental?.combinedFlow && !!isWithinSignInContext);
const { afterSignUpUrl, signInUrl, unsafeMetadata, isCombinedFlow: _isCombinedFlow } = ctx;
const isCombinedFlow = !!(_isCombinedFlow && !!isWithinSignInContext);
const [activeCommIdentifierType, setActiveCommIdentifierType] = React.useState<ActiveIdentifier>(
getInitialActiveIdentifier(attributes, userSettings.signUp.progressive),
);
Expand Down
3 changes: 3 additions & 0 deletions packages/clerk-js/src/ui/contexts/components/SignIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type SignInContextType = SignInCtx & {
afterSignInUrl: string;
transferable: boolean;
waitlistUrl: string;
isCombinedFlow: boolean;
};

export const SignInContext = createContext<SignInCtx | null>(null);
Expand All @@ -32,6 +33,7 @@ export const useSignInContext = (): SignInContextType => {
const { queryParams, queryString } = useRouter();
const options = useOptions();
const clerk = useClerk();
const isCombinedFlow = options.signInUrl === options.signUpUrl;

if (context === null || context.componentName !== 'SignIn') {
throw new Error(`Clerk: useSignInContext called outside of the mounted SignIn component.`);
Expand Down Expand Up @@ -96,5 +98,6 @@ export const useSignInContext = (): SignInContextType => {
queryParams,
initialValues: { ...ctx.initialValues, ...initialValuesFromQueryParams },
authQueryString: redirectUrls.toSearchParams().toString(),
isCombinedFlow,
};
};
3 changes: 3 additions & 0 deletions packages/clerk-js/src/ui/contexts/components/SignUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type SignUpContextType = SignUpCtx & {
afterSignUpUrl: string;
afterSignInUrl: string;
waitlistUrl: string;
isCombinedFlow: boolean;
};

export const SignUpContext = createContext<SignUpCtx | null>(null);
Expand All @@ -31,6 +32,7 @@ export const useSignUpContext = (): SignUpContextType => {
const { queryParams, queryString } = useRouter();
const options = useOptions();
const clerk = useClerk();
const isCombinedFlow = options.signInUrl === options.signUpUrl;

const initialValuesFromQueryParams = useMemo(
() => getInitialValuesFromQueryParams(queryString, SIGN_UP_INITIAL_VALUE_KEYS),
Expand Down Expand Up @@ -87,5 +89,6 @@ export const useSignUpContext = (): SignUpContextType => {
queryParams,
initialValues: { ...ctx.initialValues, ...initialValuesFromQueryParams },
authQueryString: redirectUrls.toSearchParams().toString(),
isCombinedFlow,
};
};

0 comments on commit 8ed1cc9

Please sign in to comment.