feat(FN-214): extract brandLimit 999 magic number to FULL_PLAN_BRAND_LIMIT constant in @sase/shared (+1 more)
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
Commits merged: - fix(FN-214): add missing import for FULL_PLAN_BRAND_LIMIT in subscription/index.tsx - feat(FN-214): extract brandLimit 999 magic number to FULL_PLAN_BRAND_LIMIT constant in @sase/shared Files changed: apps/web/src/routes/dashboard/subscription/index.tsx | 16 +++++++++++----- apps/web/src/routes/pricing.tsx | 3 ++- packages/shared/src/constants/plans.ts | 3 +++ packages/shared/src/index.ts | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) Fusion-Task-Id: FN-214
This commit is contained in:
@@ -6,6 +6,7 @@ import { BRAND_SKELETON_KEYS } from "@/lib/keys";
|
||||
import { capture, setPeopleProperties } from "@/lib/posthog";
|
||||
import { toast } from "@/lib/toast";
|
||||
import { getUserSettings } from "@/lib/user-settings";
|
||||
import { FULL_PLAN_BRAND_LIMIT } from "@sase/shared";
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@sase/ui";
|
||||
import { Badge } from "@sase/ui";
|
||||
import { Button } from "@sase/ui";
|
||||
@@ -103,7 +104,7 @@ const plans = [
|
||||
},
|
||||
{
|
||||
key: "full",
|
||||
brandLimit: 999,
|
||||
brandLimit: FULL_PLAN_BRAND_LIMIT,
|
||||
priceMonthly: 99900,
|
||||
priceYearly: 999000,
|
||||
features: [
|
||||
@@ -352,7 +353,9 @@ export function SubscriptionPage() {
|
||||
if (downgradePlan) {
|
||||
const currentBrandIds = (subscription?.brands ?? []).map((b) => b.brandId);
|
||||
const limit =
|
||||
downgradePlan.brandLimit === 999 ? currentBrandIds.length : downgradePlan.brandLimit;
|
||||
downgradePlan.brandLimit === FULL_PLAN_BRAND_LIMIT
|
||||
? currentBrandIds.length
|
||||
: downgradePlan.brandLimit;
|
||||
const preselected = currentBrandIds.slice(0, limit);
|
||||
setDowngradeSelectedBrandIds(preselected);
|
||||
capture("downgrade_offer_shown", {
|
||||
@@ -680,7 +683,7 @@ export function SubscriptionPage() {
|
||||
</div>
|
||||
|
||||
{/* Brand selector — only for non-full plans */}
|
||||
{downgradePlan.brandLimit < 999 && (
|
||||
{downgradePlan.brandLimit < FULL_PLAN_BRAND_LIMIT && (
|
||||
<div className="space-y-2">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t("subscription.downgradeOffer.brandsHint")}
|
||||
@@ -722,13 +725,16 @@ export function SubscriptionPage() {
|
||||
}
|
||||
downgradeMutation.mutate({
|
||||
planId: targetPlanRecord.id,
|
||||
brandIds: downgradePlan.brandLimit === 999 ? [] : downgradeSelectedBrandIds,
|
||||
brandIds:
|
||||
downgradePlan.brandLimit === FULL_PLAN_BRAND_LIMIT
|
||||
? []
|
||||
: downgradeSelectedBrandIds,
|
||||
});
|
||||
}}
|
||||
disabled={
|
||||
downgradeMutation.isPending ||
|
||||
(downgradePlan !== null &&
|
||||
downgradePlan.brandLimit < 999 &&
|
||||
downgradePlan.brandLimit < FULL_PLAN_BRAND_LIMIT &&
|
||||
downgradeSelectedBrandIds.length !== downgradePlan.brandLimit)
|
||||
}
|
||||
>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { usePageMeta } from "@/hooks/use-page-meta";
|
||||
import { useTranslation } from "@/lib/i18n";
|
||||
import { FULL_PLAN_BRAND_LIMIT } from "@sase/shared";
|
||||
import { Button } from "@sase/ui";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@sase/ui";
|
||||
import { Badge } from "@sase/ui";
|
||||
@@ -35,7 +36,7 @@ const plans = [
|
||||
},
|
||||
{
|
||||
key: "full",
|
||||
brandLimit: 999,
|
||||
brandLimit: FULL_PLAN_BRAND_LIMIT,
|
||||
priceMonthly: 99900,
|
||||
priceYearly: 999000,
|
||||
features: [
|
||||
|
||||
Reference in New Issue
Block a user