diff --git a/apps/browser/src/popup/extension-refresh-route-utils.ts b/apps/browser/src/popup/extension-refresh-route-utils.ts index 6960b650fa..3c2ca33f86 100644 --- a/apps/browser/src/popup/extension-refresh-route-utils.ts +++ b/apps/browser/src/popup/extension-refresh-route-utils.ts @@ -27,30 +27,6 @@ export function extensionRefreshSwap( ); } -/** - * Helper function to swap between two components based on the UnauthenticatedExtensionUIRefresh feature flag. - * We need this because the auth teams's authenticated UI will be refreshed as part of the MVP but the - * unauthenticated UIs will not necessarily make the cut. - * @param defaultComponent - The current non-refreshed component to render. - * @param refreshedComponent - The new refreshed component to render. - * @param options - The shared route options to apply to both components. - */ -export function unauthExtensionRefreshSwap( - defaultComponent: Type, - refreshedComponent: Type, - options: Route, -): Routes { - return componentRouteSwap( - defaultComponent, - refreshedComponent, - async () => { - const configService = inject(ConfigService); - return configService.getFeatureFlag(FeatureFlag.UnauthenticatedExtensionUIRefresh); - }, - options, - ); -} - /** * Helper function to redirect to a new URL based on the ExtensionRefresh feature flag. * @param redirectUrl - The URL to redirect to if the ExtensionRefresh flag is enabled. diff --git a/libs/angular/src/auth/functions/unauth-ui-refresh-route-swap.ts b/libs/angular/src/auth/functions/unauth-ui-refresh-route-swap.ts new file mode 100644 index 0000000000..45dad4a1a7 --- /dev/null +++ b/libs/angular/src/auth/functions/unauth-ui-refresh-route-swap.ts @@ -0,0 +1,33 @@ +import { Type, inject } from "@angular/core"; +import { Route, Routes } from "@angular/router"; + +import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; + +import { componentRouteSwap } from "../../utils/component-route-swap"; + +/** + * Helper function to swap between two components based on the UnauthenticatedExtensionUIRefresh feature flag. + * We need this because the auth teams's authenticated UI will be refreshed as part of the MVP but the + * unauthenticated UIs will not necessarily make the cut. + * Note: Even though this is primarily an extension refresh initiative, this will be used across clients + * as we are consolidating the unauthenticated UIs into single libs/auth components which affects all clients. + * @param defaultComponent - The current non-refreshed component to render. + * @param refreshedComponent - The new refreshed component to render. + * @param options - The shared route options to apply to both components. + */ +export function unauthUiRefreshSwap( + defaultComponent: Type, + refreshedComponent: Type, + options: Route, +): Routes { + return componentRouteSwap( + defaultComponent, + refreshedComponent, + async () => { + const configService = inject(ConfigService); + return configService.getFeatureFlag(FeatureFlag.UnauthenticatedExtensionUIRefresh); + }, + options, + ); +}