1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 22:33:35 +00:00

PM-10069 - Refactor unauthExtensionRefreshSwap to be available in non-extension clients and rename. (#10518)

This commit is contained in:
Jared Snider
2024-08-14 15:15:23 -04:00
committed by GitHub
parent 7571c766e0
commit c5ae908fde
2 changed files with 33 additions and 24 deletions

View File

@@ -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.