1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

Auth/PM-10069 - Unauthenticated UI Extension Refresh Swap Utility (#10327)

* PM-3515 - Lock component - remove isUnlocked check on lock comp load b/c lock guard should cover all cases with its existing logic for all clients.

* PM-9685 - Add new feature flag

* PM-10069 - ExtensionRefreshRouteUtils - Add unauthExtensionRefreshSwap helper

* Restore lock component
This commit is contained in:
Jared Snider
2024-07-30 14:41:10 -04:00
committed by GitHub
parent 84ee01caee
commit d915bd8c86
2 changed files with 26 additions and 0 deletions

View File

@@ -27,6 +27,30 @@ 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.