mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-22 16:29:09 +01:00
PM-10069 - Refactor unauthExtensionRefreshSwap to be available in non-extension clients and rename. (#10518)
This commit is contained in:
parent
7571c766e0
commit
c5ae908fde
@ -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<any>,
|
||||
refreshedComponent: Type<any>,
|
||||
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.
|
||||
|
@ -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<any>,
|
||||
refreshedComponent: Type<any>,
|
||||
options: Route,
|
||||
): Routes {
|
||||
return componentRouteSwap(
|
||||
defaultComponent,
|
||||
refreshedComponent,
|
||||
async () => {
|
||||
const configService = inject(ConfigService);
|
||||
return configService.getFeatureFlag(FeatureFlag.UnauthenticatedExtensionUIRefresh);
|
||||
},
|
||||
options,
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user