fix(billing): key SOC-2 eligibility off selfService, not plan group

D5's answer to the customer in the support thread was explicit: Pro
doesn't include SOC-2, "you need the custom plan" — not Scale. The
previous gate OR'd in `planHasGroup(Scale)`, which was inferred from
planComparisonBox's marketing copy rather than any real entitlement,
and would have wrongly let a self-service Scale org through.

Checked plans.php in the cloud repo: every self-service plan (Pro,
Scale) sets `selfService: true`, and every negotiated Custom/Enterprise
contract plan sets it `false` — `supportedAddons` doesn't distinguish
them for anything SOC-2-shaped (it only carries the paid, self-service
BAA/premiumGeoDB addons). `selfService` is already a real field the
API returns per plan today, so gating on `selfService === false` alone
needs no backend change and matches support's stated policy exactly,
instead of guessing at a group boundary.

Also swapped the ineligible-state CTA from the self-service change-plan
wizard to the existing Enterprise contact-sales link, since there's no
self-service upgrade path onto a plan that actually unlocks this.
This commit is contained in:
harsh mahajan committed 2026-08-24 12:22:14 +05:30
1 parent 294c0eb15f
commit 96ac9f8f49
2 files changed
+16 -18

No files matched your search

+4 -3
View File
@@ -142,9 +142,10 @@ export function planSupportsSoc2(
return false;
}
// no SOC-2 entitlement exists on the plan model, so infer it: Scale is the
// lowest group that advertises SOC-2, and contract plans sit above it.
return planHasGroup(billingPlan, BillingPlanGroup.Scale) || billingPlan.selfService === false;
// no SOC-2 entitlement exists on the plan model, so key off a real API field
// instead of guessing: SOC-2 is only offered on negotiated/custom contracts,
// never on a self-service plan (including self-service Scale).
return billingPlan.selfService === false;
}
export function canUpgrade(
@@ -2,9 +2,9 @@
import { Box, CardGrid } from '$lib/components';
import { Button } from '$lib/elements/forms';
import Soc2Modal from './Soc2Modal.svelte';
import { getBasePlanFromGroup, getChangePlanUrl, planSupportsSoc2 } from '$lib/stores/billing';
import { currentPlan, organization } from '$lib/stores/organization';
import { BillingPlanGroup, type Models } from '@appwrite.io/console';
import { planSupportsSoc2 } from '$lib/stores/billing';
import { currentPlan } from '$lib/stores/organization';
import type { Models } from '@appwrite.io/console';
let {
locale,
@@ -17,7 +17,6 @@
let show = $state(false);
const supportsSoc2 = $derived(planSupportsSoc2($currentPlan));
const upgradePlanName = $derived(getBasePlanFromGroup(BillingPlanGroup.Scale)?.name);
</script>
<CardGrid>
@@ -44,18 +43,16 @@
</Button>
{:else}
<p class="text u-margin-block-start-8">
SOC-2 is not available on your current plan.{upgradePlanName
? ` Upgrade to ${upgradePlanName} to request a SOC-2 report for your organization.`
: ''}
SOC-2 reports are only available on an Enterprise contract. Contact our sales
team to discuss upgrading your organization.
</p>
{#if upgradePlanName}
<Button
secondary
class="u-margin-block-start-16"
href={getChangePlanUrl($organization?.$id)}>
<span class="text">Upgrade plan</span>
</Button>
{/if}
<Button
secondary
external
class="u-margin-block-start-16"
href="https://appwrite.io/contact-us/enterprise">
<span class="text">Contact sales</span>
</Button>
{/if}
</Box>
</svelte:fragment>