diff --git a/front/lib/plans/free_plans.ts b/front/lib/plans/free_plans.ts index da577abe784d..139d4e3f1472 100644 --- a/front/lib/plans/free_plans.ts +++ b/front/lib/plans/free_plans.ts @@ -73,7 +73,7 @@ const FREE_PLANS_DATA: PlanAttributes[] = [ maxDataSourcesDocumentsCount: 10, maxDataSourcesDocumentsSizeMb: 2, trialPeriodDays: 0, - canUseProduct: false, + canUseProduct: true, }, { code: FREE_UPGRADED_PLAN_CODE, diff --git a/front/lib/plans/stripe.ts b/front/lib/plans/stripe.ts index 66eb2bb93f07..132725099931 100644 --- a/front/lib/plans/stripe.ts +++ b/front/lib/plans/stripe.ts @@ -2,19 +2,16 @@ import type { BillingPeriod, LightWorkspaceType, Result, - SubscriptionType, WorkspaceType, } from "@dust-tt/types"; +import type { SubscriptionType } from "@dust-tt/types"; import { Err, isDevelopment, Ok } from "@dust-tt/types"; import { Stripe } from "stripe"; import config from "@app/lib/api/config"; import type { Authenticator } from "@app/lib/auth"; import { Plan, Subscription } from "@app/lib/models/plan"; -import { - isOldFreePlan, - PRO_PLAN_SEAT_29_CODE, -} from "@app/lib/plans/plan_codes"; +import { PRO_PLAN_SEAT_29_CODE } from "@app/lib/plans/plan_codes"; import { countActiveSeatsInWorkspace } from "@app/lib/plans/usage/seats"; import { isEnterpriseReportUsage, @@ -120,7 +117,7 @@ export const createProPlanCheckoutSession = async ({ workspaceId: owner.id, }, }); - if (existingSubscription && !isOldFreePlan(existingSubscription.plan.code)) { + if (existingSubscription) { trialAllowed = false; } diff --git a/front/migrations/20241205_free_test_plan_cant_use_product.sql b/front/migrations/20241205_free_test_plan_cant_use_product.sql deleted file mode 100644 index 8f8dce609f88..000000000000 --- a/front/migrations/20241205_free_test_plan_cant_use_product.sql +++ /dev/null @@ -1,3 +0,0 @@ -UPDATE plans -SET "canUseProduct" = false -WHERE "code" = 'FREE_TEST_PLAN'; \ No newline at end of file diff --git a/front/pages/w/[wId]/subscribe.tsx b/front/pages/w/[wId]/subscribe.tsx index 82ce9d09d0f7..7c7c0d5a919b 100644 --- a/front/pages/w/[wId]/subscribe.tsx +++ b/front/pages/w/[wId]/subscribe.tsx @@ -1,10 +1,5 @@ -import { - BarHeader, - Button, - LockIcon, - Page, - useSendNotification, -} from "@dust-tt/sparkle"; +import { BarHeader, Button, LockIcon, Page } from "@dust-tt/sparkle"; +import { useSendNotification } from "@dust-tt/sparkle"; import type { BillingPeriod, WorkspaceType } from "@dust-tt/types"; import { CreditCardIcon } from "@heroicons/react/20/solid"; import type { InferGetServerSidePropsType } from "next"; @@ -16,7 +11,6 @@ import { UserMenu } from "@app/components/UserMenu"; import WorkspacePicker from "@app/components/WorkspacePicker"; import { useSubmitFunction } from "@app/lib/client/utils"; import { withDefaultUserAuthPaywallWhitelisted } from "@app/lib/iam/session"; -import { isOldFreePlan } from "@app/lib/plans/plan_codes"; import { useUser } from "@app/lib/swr/user"; import { useWorkspaceSubscriptions } from "@app/lib/swr/workspaces"; @@ -55,11 +49,9 @@ export default function Subscribe({ React.useState("monthly"); // If you had another subscription before, you will not get the free trial again: we use this to show the correct message. - // Current plan is either FREE_NO_PLAN or FREE_TEST_PLAN if you're on this paywall. - //FREE_NO_PLAN is not on the database, checking it comes down to having at least 1 subscription. - const hasPreviouSubscription = - subscriptions?.length > 0 && - (subscriptions.length > 1 || !isOldFreePlan(subscriptions[0].plan.code)); // FREE_TEST_PLAN did not pay, they should be asked to start instead of resume + // Current plan is always FREE_NO_PLAN if you're on this paywall. + // Since FREE_NO_PLAN is not on the database, we check if there is at least 1 subscription. + const hasPreviouSubscription = subscriptions?.length > 0; const { submit: handleSubscribePlan } = useSubmitFunction( async (billingPeriod) => {