diff --git a/apps/browser/src/popup/extension-refresh-route-utils.ts b/apps/browser/src/popup/extension-refresh-route-utils.ts index 3c2ca33f86e..6960b650fa7 100644 --- a/apps/browser/src/popup/extension-refresh-route-utils.ts +++ b/apps/browser/src/popup/extension-refresh-route-utils.ts @@ -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, + 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/common/src/enums/feature-flag.enum.ts b/libs/common/src/enums/feature-flag.enum.ts index 08c8c35df3c..f077e5a554f 100644 --- a/libs/common/src/enums/feature-flag.enum.ts +++ b/libs/common/src/enums/feature-flag.enum.ts @@ -27,6 +27,7 @@ export enum FeatureFlag { AC2828_ProviderPortalMembersPage = "AC-2828_provider-portal-members-page", DeviceTrustLogging = "pm-8285-device-trust-logging", AuthenticatorTwoFactorToken = "authenticator-2fa-token", + UnauthenticatedExtensionUIRefresh = "unauth-ui-refresh", EnableUpgradePasswordManagerSub = "AC-2708-upgrade-password-manager-sub", } @@ -65,6 +66,7 @@ export const DefaultFeatureFlagValue = { [FeatureFlag.AC2828_ProviderPortalMembersPage]: FALSE, [FeatureFlag.DeviceTrustLogging]: FALSE, [FeatureFlag.AuthenticatorTwoFactorToken]: FALSE, + [FeatureFlag.UnauthenticatedExtensionUIRefresh]: FALSE, [FeatureFlag.EnableUpgradePasswordManagerSub]: FALSE, } satisfies Record;