fix(subscriptions): free-niva 5 AI-skanningar (beslut Johan)

Free 10->5 i kod, test, paywall-copy (12 sprak) och docs. Full trappa: free 5 / trial 14d 25 skann / premium 100/200/400.
This commit is contained in:
Claude
2026-08-17 17:34:55 +00:00
parent 97c913a25c
commit 75591bb294
19 changed files with 24 additions and 24 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ export const PLAN_DEFINITIONS: Record<SubscriptionPlan, PlanDefinition> = {
priceMinorPerMonth: 0,
currency: "SEK",
maxHouseholdMembers: 1,
aiScansPerMonth: 10,
aiScansPerMonth: 5,
weekPlanning: false,
advancedNutrition: false,
communityPublish: false,
@@ -59,12 +59,12 @@ describe("entitlements (spec §4547)", () => {
expect(ent.status).toBe("trial");
expect(ent.weekPlanning).toBe(true);
});
it("free tier: 10 skanningar och användbar grund (spec §46)", () => {
const ent = computeEntitlements(null, null, { aiScansUsedThisMonth: 9 }, NOW);
it("free tier: 5 skanningar och användbar grund (spec §46)", () => {
const ent = computeEntitlements(null, null, { aiScansUsedThisMonth: 4 }, NOW);
expect(ent.plan).toBe("free");
expect(ent.aiScansPerMonth).toBe(10);
expect(ent.aiScansPerMonth).toBe(5);
expect(canUseAiScan(ent)).toBe(true);
expect(canUseAiScan({ ...ent, aiScansUsedThisMonth: 10 })).toBe(false);
expect(canUseAiScan({ ...ent, aiScansUsedThisMonth: 5 })).toBe(false);
});
it("mappar productId → plan (härlett ur brand-konfig, aldrig hårdkodat)", () => {
expect(resolvePlanFromProductId(PLAN_DEFINITIONS.family.appleProductId)).toBe("family");