Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

ui: change delay and move example project to be in a constant

adilson6e6d40a0a24e
diff --git a/frontend/src/components/auth/UserInfoStep.tsx b/frontend/src/components/auth/UserInfoStep.tsx
index cda3114829..2db0c863a3 100644
--- a/frontend/src/components/auth/UserInfoStep.tsx
+++ b/frontend/src/components/auth/UserInfoStep.tsx
@@ -19,6 +19,7 @@ import {
InputGroupInput,
TextArea
} from "@app/components/v3";
+import { EXAMPLE_PROJECT_NAME } from "@app/const";
import { isInfisicalCloud } from "@app/helpers/platform";
import { initProjectHelper } from "@app/helpers/project";
import { getHubSpotUtk } from "@app/helpers/utmTracking";
@@ -148,7 +149,7 @@ export default function UserInfoStep({
if (!isInvite) {
await initProjectHelper({
- projectName: "Example Project"
+ projectName: EXAMPLE_PROJECT_NAME
});
}
diff --git a/frontend/src/const.ts b/frontend/src/const.ts
index 6c81ef12fc..7714e67482 100644
--- a/frontend/src/const.ts
+++ b/frontend/src/const.ts
@@ -57,6 +57,10 @@ export const plans = plansProd || plansDev;
export const leaveConfirmDefaultMessage =
"Your changes will be lost if you leave the page. Are you sure you want to continue?";
+// Name of the sample project created during onboarding (see UserInfoStep). Referenced when
+// excluding the demo project from growth nudges; use this constant instead of the bare literal.
+export const EXAMPLE_PROJECT_NAME = "Example Project";
+
export enum SessionStorageKeys {
CLI_TERMINAL_TOKEN = "CLI_TERMINAL_TOKEN",
ORG_LOGIN_SUCCESS_REDIRECT_URL = "ORG_LOGIN_SUCCESS_REDIRECT_URL",
diff --git a/frontend/src/hooks/useSecretsActivationNudge.tsx b/frontend/src/hooks/useSecretsActivationNudge.tsx
index b02a7ab065..2209edd2c6 100644
--- a/frontend/src/hooks/useSecretsActivationNudge.tsx
+++ b/frontend/src/hooks/useSecretsActivationNudge.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useMemo, useRef } from "react";
+import { useCallback, useEffect, useRef } from "react";
import { useQueryClient } from "@tanstack/react-query";
import {
@@ -12,13 +12,9 @@ import { fetchSecretsActivationStatus, userActivationKeys } from "@app/hooks/api
import { usePopUp } from "./usePopUp";
-// Mirrors ORG_MAX_AGE_MONTHS in the backend user-activation service. This is only a cheap
-// client-side pre-filter to avoid needless calls; the backend gates remain authoritative.
-const USER_ACTIVATION_MAX_AGE_MONTHS = 2;
-
// Small delay before opening the modal so it doesn't pop the instant the page settles or a
// secret is created, which reads as abrupt. Tunable.
-const ACTIVATION_NUDGE_DELAY_MS = 2000;
+const ACTIVATION_NUDGE_DELAY_MS = 1000;
// Growth nudge for the secret overview page. `checkActivation` can be called from multiple
// triggers (the project having secrets, or a secret being created), but it runs the request at
@@ -47,14 +43,9 @@ export const useSecretsActivationNudge = () => {
OrgPermissionSubjects.Member
);
- const isRecentUser = useMemo(() => {
- const cutoff = new Date();
- cutoff.setMonth(cutoff.getMonth() - USER_ACTIVATION_MAX_AGE_MONTHS);
- return new Date(user.createdAt).getTime() >= cutoff.getTime();
- }, [user.createdAt]);
const checkActivation = useCallback(async () => {
- if (!canInviteMembers || !isRecentUser || !currentOrg?.id) return;
+ if (!canInviteMembers || !currentOrg?.id) return;
const queryKey = userActivationKeys.secretsStatus(currentOrg.id, user.id);
// Already checked this session (cached): don't call again and don't re-open the modal.
@@ -77,7 +68,7 @@ export const useSecretsActivationNudge = () => {
} catch {
// Silent by design: a failed activation check must not disrupt the page.
}
- }, [canInviteMembers, isRecentUser, currentOrg?.id, user.id, queryClient, handlePopUpOpen]);
+ }, [canInviteMembers, currentOrg?.id, user.id, queryClient, handlePopUpOpen]);
return { popUp, handlePopUpToggle, checkActivation };
};
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index 6d6eea8487..1907eafe0d 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -94,6 +94,7 @@ import {
TooltipTrigger
} from "@app/components/v3";
import { apiRequest } from "@app/config/request";
+import { EXAMPLE_PROJECT_NAME } from "@app/const";
import { ROUTE_PATHS } from "@app/const/routes";
import {
ProjectPermissionActions,
@@ -706,7 +707,7 @@ const OverviewPageContent = () => {
useEffect(() => {
const projectName = currentProject?.name;
- const isExampleProject = projectName === "Example Project";
+ const isExampleProject = projectName === EXAMPLE_PROJECT_NAME;
if (hasSecrets && !isExampleProject) {
checkSecretsActivation();