- {value && baseUnitPrice ? (
-
+ {baseUnitPrice ? (
+
) : null}
{seats ? (
diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx
index 440b0ef4a2..8c06044699 100644
--- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx
+++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx
@@ -8,7 +8,7 @@ import {
usePlanData,
} from 'services/account'
import { useStartTrial } from 'services/trial'
-import { canApplySentryUpgrade, isSentryPlan } from 'shared/utils/billing'
+import { canApplySentryUpgrade } from 'shared/utils/billing'
import A from 'ui/A/A'
import Button from 'ui/Button'
@@ -56,7 +56,7 @@ function PlansActionsBilling() {
return (
)
diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx
index 0fc1b05d6a..5dbd067396 100644
--- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx
+++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx
@@ -34,6 +34,8 @@ const allPlans = [
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -47,6 +49,8 @@ const allPlans = [
'Priorty Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -60,6 +64,8 @@ const allPlans = [
'Priorty Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -73,6 +79,8 @@ const allPlans = [
'Priorty Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -86,6 +94,8 @@ const allPlans = [
'Priorty Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
]
@@ -97,6 +107,8 @@ const sentryPlans = [
monthlyUploadLimit: null,
value: Plans.USERS_SENTRYM,
billingRate: BillingRate.MONTHLY,
+ isTeamPlan: false,
+ isSentryPlan: true,
},
]
@@ -166,6 +178,7 @@ const mockTrialData = {
isEnterprisePlan: false,
isFreePlan: true,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
},
@@ -237,6 +250,7 @@ describe('Actions Billing', () => {
accountDetails.plan.value === Plans.USERS_TEAMM ||
accountDetails.plan.value === Plans.USERS_TEAMY,
isTrialPlan: accountDetails.plan.value === Plans.USERS_TRIAL,
+ isSentryPlan: accountDetails.plan.value === Plans.USERS_SENTRYM,
},
hasPrivateRepos,
},
diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx
index 2caa10e18a..a900c46fe2 100644
--- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx
+++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx
@@ -1,10 +1,8 @@
import PropTypes from 'prop-types'
-import { isSentryPlan } from 'shared/utils/billing'
-
const SENTRY_PRICE = 29
-function PlanPricing({ plan, value, baseUnitPrice }) {
+function PlanPricing({ plan, baseUnitPrice }) {
if (plan?.isFreePlan) {
return
Free
}
@@ -13,7 +11,7 @@ function PlanPricing({ plan, value, baseUnitPrice }) {
return
Custom pricing
}
- if (isSentryPlan(value)) {
+ if (plan?.isSentryPlan) {
return
${SENTRY_PRICE}
}
@@ -27,7 +25,6 @@ function PlanPricing({ plan, value, baseUnitPrice }) {
PlanPricing.propTypes = {
plan: PropTypes.object.isRequired,
- value: PropTypes.string.isRequired,
baseUnitPrice: PropTypes.number.isRequired,
}
diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.test.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.test.jsx
index 3d9854a479..3f9ce2bc1d 100644
--- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.test.jsx
+++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.test.jsx
@@ -1,7 +1,5 @@
import { render, screen } from '@testing-library/react'
-import { Plans } from 'shared/utils/billing'
-
import PlanPricing from './PlanPricing'
describe('PlanPricing', () => {
@@ -9,8 +7,11 @@ describe('PlanPricing', () => {
it('renders price is free', () => {
render(
)
@@ -20,116 +21,57 @@ describe('PlanPricing', () => {
})
})
- describe('user is on a basic plan', () => {
- it('renders price is free', () => {
+ describe('user is on a pro plan', () => {
+ it('renders the base unit price', () => {
render(
)
- const price = screen.getByText('Free')
+ const price = screen.getByText('$12')
expect(price).toBeInTheDocument()
})
})
- describe('user is on a pro plan', () => {
- describe('monthly pro plan', () => {
- describe('old pro plan', () => {
- it('renders the base unit price', () => {
- render(
)
-
- const price = screen.getByText('$12')
- expect(price).toBeInTheDocument()
- })
- })
-
- describe('new pro plan', () => {
- it('renders the base unit price', () => {
- render(
-
- )
-
- const price = screen.getByText('$12')
- expect(price).toBeInTheDocument()
- })
- })
- })
-
- describe('annual pro plan', () => {
- describe('old pro plan', () => {
- it('renders the base unit price', () => {
- render(
)
-
- const price = screen.getByText('$10')
- expect(price).toBeInTheDocument()
- })
- })
-
- describe('new pro plan', () => {
- it('renders the base unit price', () => {
- render(
-
- )
-
- const price = screen.getByText('$10')
- expect(price).toBeInTheDocument()
- })
- })
- })
- })
-
describe('users is on an enterprise plan', () => {
- describe('enterprise plan is monthly', () => {
- it('renders custom pricing', () => {
- render(
-
- )
-
- const price = screen.getByText('Custom pricing')
- expect(price).toBeInTheDocument()
- })
- })
-
- describe('enterprise plan is yearly', () => {
- it('renders custom pricing', () => {
- render(
-
- )
+ it('renders custom pricing', () => {
+ render(
+
+ )
- const price = screen.getByText('Custom pricing')
- expect(price).toBeInTheDocument()
- })
+ const price = screen.getByText('Custom pricing')
+ expect(price).toBeInTheDocument()
})
})
describe('user is on a sentry plan', () => {
- describe('annual sentry plan', () => {
- it('renders the base unit price', () => {
- render(
)
-
- const basePrice = screen.getByText(/\$29/)
- expect(basePrice).toBeInTheDocument()
- })
- })
-
- describe('monthly sentry plan', () => {
- it('renders the base unit price', () => {
- render(
)
+ it('renders the base unit price', () => {
+ render(
+
+ )
- const price = screen.getByText(/\$29/)
- expect(price).toBeInTheDocument()
- })
+ const price = screen.getByText(/\$29/)
+ expect(price).toBeInTheDocument()
})
})
})
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/PlanDetailsControls/PlanDetailsControls.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/PlanDetailsControls/PlanDetailsControls.test.tsx
index b4ffee777f..bc1282ddab 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/PlanDetailsControls/PlanDetailsControls.test.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/PlanDetailsControls/PlanDetailsControls.test.tsx
@@ -22,6 +22,8 @@ const proPlanMonth = {
'Priority Support',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanYear = {
@@ -36,6 +38,8 @@ const proPlanYear = {
'Priority Support',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const sentryPlanMonth = {
@@ -50,6 +54,8 @@ const sentryPlanMonth = {
'Priority Support',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const sentryPlanYear = {
@@ -64,6 +70,8 @@ const sentryPlanYear = {
'Priority Support',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const teamPlanMonth = {
@@ -73,6 +81,8 @@ const teamPlanMonth = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanYear = {
@@ -82,6 +92,8 @@ const teamPlanYear = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const server = setupServer()
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx
index 015a37aa14..125d56a8d6 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx
@@ -28,6 +28,8 @@ const proPlanYear = {
],
quantity: 10,
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const sentryPlanMonth = {
@@ -43,6 +45,8 @@ const sentryPlanMonth = {
],
trialDays: 14,
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const sentryPlanYear = {
@@ -58,6 +62,8 @@ const sentryPlanYear = {
],
monthlyUploadLimit: null,
trialDays: 14,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const allPlansWithoutSentry = [
@@ -72,6 +78,8 @@ const allPlansWithoutSentry = [
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro',
@@ -85,6 +93,8 @@ const allPlansWithoutSentry = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
proPlanYear,
{
@@ -99,6 +109,8 @@ const allPlansWithoutSentry = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro',
@@ -112,6 +124,8 @@ const allPlansWithoutSentry = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
]
@@ -131,6 +145,7 @@ const mockPlanData = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTrialPlan: false,
}
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx
index b22e8a65b6..c0b2a57bb4 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx
@@ -25,6 +25,8 @@ const sentryPlanMonth = {
],
trialDays: 14,
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const sentryPlanYear = {
@@ -40,6 +42,8 @@ const sentryPlanYear = {
],
monthlyUploadLimit: null,
trialDays: 14,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const allPlans = [
@@ -54,6 +58,8 @@ const allPlans = [
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro',
@@ -67,6 +73,8 @@ const allPlans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro',
@@ -81,6 +89,8 @@ const allPlans = [
],
quantity: 10,
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro',
@@ -94,6 +104,8 @@ const allPlans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro',
@@ -107,6 +119,8 @@ const allPlans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
sentryPlanMonth,
sentryPlanYear,
@@ -128,6 +142,7 @@ const mockPlanData = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTrialPlan: false,
}
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx
index 29130bedca..33a2d0ab5a 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx
@@ -22,6 +22,8 @@ const teamPlanMonth = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanYear = {
@@ -31,6 +33,8 @@ const teamPlanYear = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const allPlans = [
@@ -45,6 +49,8 @@ const allPlans = [
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro',
@@ -58,6 +64,8 @@ const allPlans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro',
@@ -72,6 +80,8 @@ const allPlans = [
],
quantity: 10,
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
teamPlanMonth,
teamPlanYear,
@@ -94,6 +104,7 @@ const mockPlanData = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.test.tsx
index 90f54a95bd..060ff04df7 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.test.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.test.tsx
@@ -28,6 +28,8 @@ const proPlanYear = {
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanMonth = {
@@ -42,6 +44,8 @@ const proPlanMonth = {
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const sentryPlanYear = {
@@ -56,6 +60,8 @@ const sentryPlanYear = {
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const sentryPlanMonth = {
@@ -70,6 +76,8 @@ const sentryPlanMonth = {
'Priority Support',
],
monthlyUploadLimit: null,
+ isSentryPlan: true,
+ isTeamPlan: false,
}
const teamPlanYear = {
@@ -79,6 +87,8 @@ const teamPlanYear = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanMonth = {
@@ -88,6 +98,8 @@ const teamPlanMonth = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
type WrapperClosure = (
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.tsx
index eb762823f5..36060c7add 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.tsx
@@ -1,17 +1,13 @@
import { IndividualPlan } from 'services/account'
-import { isSentryPlan, Plans } from 'shared/utils/billing'
import ProPlanDetails from './ProPlanDetails'
import SentryPlanDetails from './SentryPlanDetails'
import TeamPlanDetails from './TeamPlanDetails'
function UpgradeDetails({ selectedPlan }: { selectedPlan: IndividualPlan }) {
- if (isSentryPlan(selectedPlan.value)) {
+ if (selectedPlan.isSentryPlan) {
return
- } else if (
- selectedPlan?.value === Plans.USERS_TEAMM ||
- selectedPlan?.value === Plans.USERS_TEAMY
- ) {
+ } else if (selectedPlan.isTeamPlan) {
return
} else {
return
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.test.tsx
index 245e694f89..4eaa554bcb 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.test.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.test.tsx
@@ -25,6 +25,8 @@ const proPlanMonth = {
],
quantity: 10,
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanYear = {
@@ -40,6 +42,8 @@ const proPlanYear = {
],
monthlyUploadLimit: null,
quantity: 13,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const sentryPlanMonth = {
@@ -56,6 +60,8 @@ const sentryPlanMonth = {
monthlyUploadLimit: null,
trialDays: 14,
quantity: 10,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const sentryPlanYear = {
@@ -72,6 +78,8 @@ const sentryPlanYear = {
monthlyUploadLimit: null,
trialDays: 14,
quantity: 21,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const teamPlanMonth = {
@@ -81,6 +89,8 @@ const teamPlanMonth = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanYear = {
@@ -90,6 +100,8 @@ const teamPlanYear = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
describe('Controller', () => {
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.tsx
index 5153407e3c..bab642591c 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.tsx
@@ -1,7 +1,6 @@
import { UseFormRegister, UseFormSetValue } from 'react-hook-form'
import { IndividualPlan } from 'services/account'
-import { isSentryPlan, Plans } from 'shared/utils/billing'
import ProPlanController from './ProPlanController'
import SentryPlanController from './SentryPlanController'
@@ -30,10 +29,7 @@ const Controller: React.FC
= ({
setFormValue,
setSelectedPlan,
}) => {
- if (
- newPlan?.value === Plans.USERS_TEAMM ||
- newPlan?.value === Plans.USERS_TEAMY
- ) {
+ if (newPlan?.isTeamPlan) {
return (
= ({
errors={errors}
/>
)
- } else if (isSentryPlan(newPlan?.value)) {
+ } else if (newPlan?.isSentryPlan) {
return (
{
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/PriceCallout/PriceCallout.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/PriceCallout/PriceCallout.test.tsx
index 0f75c8b8ea..c558765653 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/PriceCallout/PriceCallout.test.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/PriceCallout/PriceCallout.test.tsx
@@ -21,6 +21,8 @@ const freePlan = {
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanMonthly = {
@@ -35,6 +37,8 @@ const proPlanMonthly = {
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const teamPlanMonthly = {
@@ -44,6 +48,8 @@ const teamPlanMonthly = {
baseUnitPrice: 5,
benefits: ['Patch coverage analysis'],
monthlyUploadLimit: null,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanYearly = {
@@ -53,6 +59,8 @@ const teamPlanYearly = {
baseUnitPrice: 4,
benefits: ['Patch coverage analysis'],
monthlyUploadLimit: null,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const availablePlans = [
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/TeamPlanController.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/TeamPlanController.test.tsx
index 3e411a1554..0cdb271017 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/TeamPlanController.test.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/TeamPlanController.test.tsx
@@ -37,6 +37,8 @@ const basicPlan = {
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const teamPlanMonth = {
@@ -47,6 +49,8 @@ const teamPlanMonth = {
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
quantity: 10,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanYear = {
@@ -56,6 +60,8 @@ const teamPlanYear = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const proPlanYear = {
@@ -65,6 +71,8 @@ const proPlanYear = {
billingRate: BillingRate.ANNUALLY,
marketingName: 'Users Pro',
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const mockAccountDetailsBasic = {
@@ -116,6 +124,7 @@ const mockPlanDataResponseMonthly = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
@@ -137,6 +146,7 @@ const mockPlanDataResponseYearly = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.test.tsx
index fea2fae8b9..83999c4760 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.test.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.test.tsx
@@ -23,6 +23,8 @@ const basicPlan = {
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanMonth = {
@@ -37,6 +39,8 @@ const proPlanMonth = {
'Priority Support',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanYear = {
@@ -51,6 +55,8 @@ const proPlanYear = {
'Priority Support',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const sentryPlanMonth = {
@@ -65,6 +71,8 @@ const sentryPlanMonth = {
'Priority Support',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const sentryPlanYear = {
@@ -79,6 +87,8 @@ const sentryPlanYear = {
'Priority Support',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const teamPlanMonth = {
@@ -88,6 +98,8 @@ const teamPlanMonth = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanYear = {
@@ -97,6 +109,8 @@ const teamPlanYear = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const trialPlan = {
@@ -106,6 +120,8 @@ const trialPlan = {
baseUnitPrice: 12,
benefits: ['Configurable # of users', 'Unlimited repos'],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const server = setupServer()
@@ -190,6 +206,7 @@ describe('PlanTypeOptions', () => {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.tsx
index 20b2fd42f3..5ab29e1a0f 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.tsx
@@ -14,7 +14,6 @@ import {
findProPlans,
findSentryPlans,
findTeamPlans,
- Plans,
shouldDisplayTeamCard,
} from 'shared/utils/billing'
import { TEAM_PLAN_MAX_ACTIVE_USERS } from 'shared/utils/upgradeForm'
@@ -58,11 +57,7 @@ const PlanTypeOptions: React.FC = ({
const monthlyPlan = newPlan?.billingRate === BillingRate.MONTHLY
let planOption = null
- if (
- (hasTeamPlans && planParam === TierNames.TEAM) ||
- newPlan?.value === Plans.USERS_TEAMM ||
- newPlan?.value === Plans.USERS_TEAMY
- ) {
+ if ((hasTeamPlans && planParam === TierNames.TEAM) || newPlan?.isTeamPlan) {
planOption = TierName.TEAM
} else {
planOption = TierName.PRO
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.test.tsx
index 9a89818d50..a954607627 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.test.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.test.tsx
@@ -16,6 +16,7 @@ const planChunk = {
planUserCount: 2,
isEnterprisePlan: false,
isFreePlan: false,
+ isSentryPlan: false,
isTeamPlan: true,
isTrialPlan: false,
hasSeatsLeft: true,
@@ -35,6 +36,7 @@ const proPlanYear = {
monthlyUploadLimit: null,
isProPlan: true,
isTeamPlan: false,
+ isSentryPlan: false,
}
const teamPlanYear = {
@@ -46,6 +48,7 @@ const teamPlanYear = {
value: Plans.USERS_TEAMY,
isProPlan: false,
isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanMonth = {
@@ -57,6 +60,7 @@ const teamPlanMonth = {
value: Plans.USERS_TEAMM,
isProPlan: false,
isTeamPlan: true,
+ isSentryPlan: false,
}
const freePlan = {
@@ -68,6 +72,7 @@ const freePlan = {
value: Plans.USERS_BASIC,
isProPlan: false,
isTeamPlan: false,
+ isSentryPlan: false,
}
type WrapperClosure = (
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.tsx
index 9b3d060112..a79172666e 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.tsx
@@ -1,5 +1,5 @@
import { IndividualPlan, Plan } from 'services/account'
-import { BillingRate, Plans } from 'shared/utils/billing'
+import { BillingRate } from 'shared/utils/billing'
const UpdateBlurb = ({
currentPlan,
@@ -14,8 +14,7 @@ const UpdateBlurb = ({
}) => {
const currentIsFree = currentPlan?.isFreePlan
const currentIsTeam = currentPlan?.isTeamPlan
- const selectedIsTeam =
- newPlan?.value === Plans.USERS_TEAMM || newPlan?.value === Plans.USERS_TEAMY
+ const selectedIsTeam = newPlan?.isTeamPlan
const diffPlanType = currentIsFree || currentIsTeam !== selectedIsTeam
const currentIsAnnual = currentPlan?.billingRate === BillingRate.ANNUALLY
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx
index a9837b5b14..785bbf59dd 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx
@@ -22,6 +22,8 @@ const freePlan = {
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanMonthly = {
@@ -36,6 +38,8 @@ const proPlanMonthly = {
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanYearly = {
@@ -50,6 +54,8 @@ const proPlanYearly = {
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const server = setupServer()
@@ -139,6 +145,7 @@ describe('UpdateButton', () => {
pretrialUsersCount: 0,
isEnterprisePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTrialPlan: false,
}
if (planValue.value === Plans.USERS_BASIC) {
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx
index 3dbe578316..4a7ad77ffd 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx
@@ -38,6 +38,8 @@ const basicPlan = {
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanMonth = {
@@ -53,6 +55,8 @@ const proPlanMonth = {
],
quantity: 10,
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const proPlanYear = {
@@ -68,6 +72,8 @@ const proPlanYear = {
],
monthlyUploadLimit: null,
quantity: 13,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const sentryPlanMonth = {
@@ -84,6 +90,8 @@ const sentryPlanMonth = {
monthlyUploadLimit: null,
trialDays: 14,
quantity: 10,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const sentryPlanYear = {
@@ -100,6 +108,8 @@ const sentryPlanYear = {
monthlyUploadLimit: null,
trialDays: 14,
quantity: 21,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const teamPlanMonth = {
@@ -109,6 +119,8 @@ const teamPlanMonth = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanYear = {
@@ -118,6 +130,8 @@ const teamPlanYear = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const trialPlan = {
@@ -127,6 +141,8 @@ const trialPlan = {
baseUnitPrice: 12,
benefits: ['Configurable # of users', 'Unlimited repos'],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
}
const mockAccountDetailsBasic = {
@@ -206,6 +222,7 @@ const mockPlanDataResponse = {
planUserCount: 10,
hasSeatsLeft: true,
isEnterprisePlan: false,
+ isSentryPlan: false,
}
const queryClient = new QueryClient({
@@ -356,6 +373,7 @@ describe('UpgradeForm', () => {
planValue === Plans.USERS_PR_INAPPY ||
planValue === Plans.USERS_SENTRYM ||
planValue === Plans.USERS_SENTRYY,
+ isSentryPlan: false,
isTeamPlan:
planValue === Plans.USERS_TEAMM ||
planValue === Plans.USERS_TEAMY,
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.tsx
index 08f60b1128..43d3245786 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.tsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.tsx
@@ -9,11 +9,7 @@ import {
useAvailablePlans,
usePlanData,
} from 'services/account'
-import {
- canApplySentryUpgrade,
- getNextBillingDate,
- Plans,
-} from 'shared/utils/billing'
+import { canApplySentryUpgrade, getNextBillingDate } from 'shared/utils/billing'
import {
getDefaultValuesUpgradeForm,
getSchema,
@@ -53,9 +49,7 @@ function UpgradeForm({ selectedPlan, setSelectedPlan }: UpgradeFormProps) {
plans,
})
const minSeats =
- isSentryUpgrade &&
- selectedPlan?.value !== Plans.USERS_TEAMM &&
- selectedPlan?.value !== Plans.USERS_TEAMY
+ isSentryUpgrade && !selectedPlan?.isTeamPlan
? MIN_SENTRY_SEATS
: MIN_NB_SEATS_PRO
diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx
index 12b0c4f17b..24ac959b52 100644
--- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx
+++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx
@@ -29,6 +29,8 @@ const plans = [
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -42,6 +44,8 @@ const plans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -55,6 +59,8 @@ const plans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -68,6 +74,8 @@ const plans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -81,6 +89,8 @@ const plans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
]
@@ -97,6 +107,8 @@ const sentryPlanMonth = {
],
monthlyUploadLimit: null,
trialDays: 14,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const sentryPlanYear = {
@@ -112,6 +124,8 @@ const sentryPlanYear = {
],
monthlyUploadLimit: null,
trialDays: 14,
+ isTeamPlan: false,
+ isSentryPlan: true,
}
const teamPlanMonth = {
@@ -121,6 +135,8 @@ const teamPlanMonth = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const teamPlanYear = {
@@ -130,6 +146,8 @@ const teamPlanYear = {
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
+ isTeamPlan: true,
+ isSentryPlan: false,
}
const mockPlanData = {
@@ -216,6 +234,9 @@ describe('UpgradePlanPage', () => {
isFreePlan: planValue === Plans.USERS_BASIC,
isProPlan: planValue === Plans.USERS_PR_INAPPY,
isTrialPlan: planValue === Plans.USERS_TRIAL,
+ isSentryPlan:
+ planValue === Plans.USERS_SENTRYY ||
+ planValue === Plans.USERS_SENTRYM,
value: planValue,
},
},
diff --git a/src/pages/RepoPage/ActivationAlert/ActivationAlert.test.tsx b/src/pages/RepoPage/ActivationAlert/ActivationAlert.test.tsx
index 126107396b..cc4bb987ae 100644
--- a/src/pages/RepoPage/ActivationAlert/ActivationAlert.test.tsx
+++ b/src/pages/RepoPage/ActivationAlert/ActivationAlert.test.tsx
@@ -65,6 +65,7 @@ const mockTrialData = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTrialPlan: false,
}
diff --git a/src/pages/RepoPage/CoverageOnboarding/ActivationBanner/ActivationBanner.test.tsx b/src/pages/RepoPage/CoverageOnboarding/ActivationBanner/ActivationBanner.test.tsx
index f0a02b14f2..2804f891de 100644
--- a/src/pages/RepoPage/CoverageOnboarding/ActivationBanner/ActivationBanner.test.tsx
+++ b/src/pages/RepoPage/CoverageOnboarding/ActivationBanner/ActivationBanner.test.tsx
@@ -65,6 +65,7 @@ const mockTrialData = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTrialPlan: false,
}
diff --git a/src/services/account/useAvailablePlans.test.tsx b/src/services/account/useAvailablePlans.test.tsx
index 66d5c1cca8..eed1f1e2c4 100644
--- a/src/services/account/useAvailablePlans.test.tsx
+++ b/src/services/account/useAvailablePlans.test.tsx
@@ -19,6 +19,8 @@ const mockAvailablePlans = [
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -32,6 +34,8 @@ const mockAvailablePlans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -45,6 +49,8 @@ const mockAvailablePlans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Sentry Pro Team',
@@ -58,6 +64,8 @@ const mockAvailablePlans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: true,
},
{
marketingName: 'Pro Team',
@@ -71,6 +79,8 @@ const mockAvailablePlans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Pro Team',
@@ -84,6 +94,8 @@ const mockAvailablePlans = [
'Priority Support',
],
monthlyUploadLimit: null,
+ isTeamPlan: false,
+ isSentryPlan: false,
},
{
marketingName: 'Team',
@@ -92,6 +104,8 @@ const mockAvailablePlans = [
baseUnitPrice: 6,
benefits: ['Patch coverage analysis'],
monthlyUploadLimit: null,
+ isTeamPlan: true,
+ isSentryPlan: false,
},
]
diff --git a/src/services/account/useAvailablePlans.ts b/src/services/account/useAvailablePlans.ts
index 591fce58ce..ad3389c290 100644
--- a/src/services/account/useAvailablePlans.ts
+++ b/src/services/account/useAvailablePlans.ts
@@ -8,6 +8,8 @@ const IndividualPlanSchema = z.object({
baseUnitPrice: z.number(),
benefits: z.array(z.string()),
billingRate: z.nativeEnum(BillingRate).nullish(),
+ isTeamPlan: z.boolean(),
+ isSentryPlan: z.boolean(),
marketingName: z.string(),
monthlyUploadLimit: z.number().nullable(),
value: z.nativeEnum(Plans),
@@ -32,6 +34,8 @@ const query = `
baseUnitPrice
benefits
billingRate
+ isSentryPlan
+ isTeamPlan
marketingName
monthlyUploadLimit
value
diff --git a/src/services/account/usePlanData.test.tsx b/src/services/account/usePlanData.test.tsx
index be8dbc00d6..17f00434ef 100644
--- a/src/services/account/usePlanData.test.tsx
+++ b/src/services/account/usePlanData.test.tsx
@@ -26,6 +26,7 @@ const mockTrialData = {
isEnterprisePlan: false,
isFreePlan: true,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
},
@@ -95,6 +96,7 @@ describe('usePlanData', () => {
isEnterprisePlan: false,
isFreePlan: true,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
marketingName: 'Users Basic',
diff --git a/src/services/account/usePlanData.ts b/src/services/account/usePlanData.ts
index b44ab9e291..3b1c2a85b4 100644
--- a/src/services/account/usePlanData.ts
+++ b/src/services/account/usePlanData.ts
@@ -32,6 +32,7 @@ const PlanSchema = z.object({
isProPlan: z.boolean(),
isTeamPlan: z.boolean(),
isTrialPlan: z.boolean(),
+ isSentryPlan: z.boolean(),
})
export type Plan = z.infer
@@ -88,6 +89,7 @@ export const query = `
isEnterprisePlan
isFreePlan
isProPlan
+ isSentryPlan
isTeamPlan
isTrialPlan
}
diff --git a/src/shared/GlobalTopBanners/ProPlanFeedbackBanner/ProPlanFeedbackBanner.test.tsx b/src/shared/GlobalTopBanners/ProPlanFeedbackBanner/ProPlanFeedbackBanner.test.tsx
index e576ff5061..bf9688a923 100644
--- a/src/shared/GlobalTopBanners/ProPlanFeedbackBanner/ProPlanFeedbackBanner.test.tsx
+++ b/src/shared/GlobalTopBanners/ProPlanFeedbackBanner/ProPlanFeedbackBanner.test.tsx
@@ -17,6 +17,7 @@ const mockTrialData = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: true,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
baseUnitPrice: 10,
diff --git a/src/shared/GlobalTopBanners/TrialBanner/TrialBanner.test.tsx b/src/shared/GlobalTopBanners/TrialBanner/TrialBanner.test.tsx
index 188fa8e7cd..d49088fc89 100644
--- a/src/shared/GlobalTopBanners/TrialBanner/TrialBanner.test.tsx
+++ b/src/shared/GlobalTopBanners/TrialBanner/TrialBanner.test.tsx
@@ -33,6 +33,7 @@ const proPlanMonth = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: true,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
@@ -55,6 +56,7 @@ const trialPlan = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: true,
}
@@ -76,6 +78,7 @@ const basicPlan = {
planUserCount: 1,
isFreePlan: true,
isProPlan: false,
+ isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
@@ -169,6 +172,7 @@ describe('TrialBanner', () => {
isProPlan: plan.isProPlan,
isTeamPlan: plan.isTeamPlan,
isTrialPlan: plan.isTrialPlan,
+ isSentryPlan: plan.isSentryPlan,
},
},
},
diff --git a/src/shared/utils/billing.test.ts b/src/shared/utils/billing.test.ts
index 3091913eb7..975f7a6271 100644
--- a/src/shared/utils/billing.test.ts
+++ b/src/shared/utils/billing.test.ts
@@ -9,7 +9,6 @@ import {
formatNumberToUSD,
formatTimestampToCalendarDate,
getNextBillingDate,
- isSentryPlan,
lastTwoDigits,
Plans,
shouldDisplayTeamCard,
@@ -40,9 +39,11 @@ function getPlans() {
'Unlimited public repositories',
'Unlimited private repositories',
],
+ isSentryPlan: false,
+ isTeamPlan: false,
},
{
- marketingName: 'Pro Team',
+ marketingName: 'Pro',
value: Plans.USERS_PR_INAPPM,
billingRate: BillingRate.MONTHLY,
baseUnitPrice: 12,
@@ -53,9 +54,11 @@ function getPlans() {
'Unlimited private repositories',
'Priorty Support',
],
+ isSentryPlan: false,
+ isTeamPlan: false,
},
{
- marketingName: 'Pro Team',
+ marketingName: 'Pro',
value: Plans.USERS_PR_INAPPY,
billingRate: BillingRate.ANNUALLY,
baseUnitPrice: 10,
@@ -66,9 +69,11 @@ function getPlans() {
'Unlimited private repositories',
'Priorty Support',
],
+ isSentryPlan: false,
+ isTeamPlan: false,
},
{
- marketingName: 'Pro Team',
+ marketingName: 'Enterprise',
value: Plans.USERS_ENTERPRISEM,
billingRate: BillingRate.MONTHLY,
baseUnitPrice: 12,
@@ -79,6 +84,8 @@ function getPlans() {
'Unlimited private repositories',
'Priorty Support',
],
+ isSentryPlan: false,
+ isTeamPlan: false,
},
{
marketingName: 'Pro Team',
@@ -92,6 +99,8 @@ function getPlans() {
'Unlimited private repositories',
'Priorty Support',
],
+ isSentryPlan: false,
+ isTeamPlan: false,
},
{
marketingName: 'Sentry Pro Team',
@@ -106,6 +115,8 @@ function getPlans() {
'Priority Support',
],
trialTotalDays: 14,
+ isSentryPlan: true,
+ isTeamPlan: false,
},
{
marketingName: 'Sentry Pro Team',
@@ -120,6 +131,8 @@ function getPlans() {
'Priority Support',
],
trialTotalDays: 14,
+ isSentryPlan: true,
+ isTeamPlan: false,
},
{
marketingName: 'Team',
@@ -134,6 +147,8 @@ function getPlans() {
'Patch coverage analysis',
],
trialTotalDays: null,
+ isSentryPlan: false,
+ isTeamPlan: true,
},
{
marketingName: 'Team',
@@ -148,6 +163,8 @@ function getPlans() {
'Patch coverage analysis',
],
trialTotalDays: null,
+ isSentryPlan: false,
+ isTeamPlan: true,
},
]
}
@@ -172,6 +189,8 @@ describe('shouldDisplayTeamCard', () => {
'Unlimited private repositories',
'Priorty Support',
],
+ isSentryPlan: false,
+ isTeamPlan: false,
},
{
marketingName: 'Pro Team',
@@ -185,6 +204,8 @@ describe('shouldDisplayTeamCard', () => {
'Unlimited private repositories',
'Priorty Support',
],
+ isSentryPlan: false,
+ isTeamPlan: false,
},
]
expect(shouldDisplayTeamCard({ plans })).toBe(false)
@@ -254,23 +275,6 @@ describe('getNextBillingDate', () => {
})
})
-describe('isSentryPlan', () => {
- it('supports monthly plan', () => {
- expect(isSentryPlan('users-sentrym')).toBe(true)
- expect(isSentryPlan(Plans.USERS_SENTRYM)).toBe(true)
- })
-
- it('supports annual plan', () => {
- expect(isSentryPlan('users-sentryy')).toBe(true)
- expect(isSentryPlan(Plans.USERS_SENTRYY)).toBe(true)
- })
-
- it('Defaults to false otherwise', () => {
- expect(isSentryPlan('users-inappy')).toBe(false)
- expect(isSentryPlan(undefined)).toBe(false)
- })
-})
-
describe('findSentryPlans', () => {
it('contains monthly plan', () => {
const plans = getPlans()
@@ -289,6 +293,8 @@ describe('findSentryPlans', () => {
'Priority Support',
],
trialTotalDays: 14,
+ isSentryPlan: true,
+ isTeamPlan: false,
}
expect(sentryPlanMonth).toStrictEqual(expectedResult)
@@ -311,6 +317,8 @@ describe('findSentryPlans', () => {
'Priority Support',
],
trialTotalDays: 14,
+ isSentryPlan: true,
+ isTeamPlan: false,
}
expect(sentryPlanYear).toStrictEqual(expectedResult)
@@ -323,7 +331,7 @@ describe('findProPlans', () => {
const { proPlanMonth } = findProPlans({ plans })
const expectedResult = {
- marketingName: 'Pro Team',
+ marketingName: 'Pro',
value: Plans.USERS_PR_INAPPM,
billingRate: BillingRate.MONTHLY,
baseUnitPrice: 12,
@@ -334,6 +342,8 @@ describe('findProPlans', () => {
'Unlimited private repositories',
'Priorty Support',
],
+ isSentryPlan: false,
+ isTeamPlan: false,
}
expect(proPlanMonth).toStrictEqual(expectedResult)
@@ -344,7 +354,7 @@ describe('findProPlans', () => {
const { proPlanYear } = findProPlans({ plans })
const expectedResult = {
- marketingName: 'Pro Team',
+ marketingName: 'Pro',
value: Plans.USERS_PR_INAPPY,
billingRate: BillingRate.ANNUALLY,
baseUnitPrice: 10,
@@ -355,6 +365,8 @@ describe('findProPlans', () => {
'Unlimited private repositories',
'Priorty Support',
],
+ isSentryPlan: false,
+ isTeamPlan: false,
}
expect(proPlanYear).toStrictEqual(expectedResult)
@@ -379,6 +391,8 @@ describe('findTeamPlans', () => {
'Patch coverage analysis',
],
trialTotalDays: null,
+ isSentryPlan: false,
+ isTeamPlan: true,
}
expect(teamPlanMonth).toStrictEqual(expectedResult)
@@ -401,6 +415,8 @@ describe('findTeamPlans', () => {
'Patch coverage analysis',
],
trialTotalDays: null,
+ isSentryPlan: false,
+ isTeamPlan: true,
}
expect(teamPlanYear).toStrictEqual(expectedResult)
@@ -411,7 +427,9 @@ describe('canApplySentryUpgrade', () => {
it('returns true when list contains monthly plan', () => {
const result = canApplySentryUpgrade({
isEnterprisePlan: false,
- plans: [{ value: Plans.USERS_SENTRYM }] as IndividualPlan[],
+ plans: [
+ { value: Plans.USERS_SENTRYM, isSentryPlan: true },
+ ] as IndividualPlan[],
})
expect(result).toBeTruthy()
@@ -420,7 +438,9 @@ describe('canApplySentryUpgrade', () => {
it('returns true when list contains annual plan', () => {
const result = canApplySentryUpgrade({
isEnterprisePlan: false,
- plans: [{ value: Plans.USERS_SENTRYY }] as IndividualPlan[],
+ plans: [
+ { value: Plans.USERS_SENTRYY, isSentryPlan: true },
+ ] as IndividualPlan[],
})
expect(result).toBeTruthy()
@@ -428,7 +448,9 @@ describe('canApplySentryUpgrade', () => {
it('returns false when plans are not in list', () => {
const result = canApplySentryUpgrade({
- plans: [{ value: Plans.USERS_FREE }] as IndividualPlan[],
+ plans: [
+ { value: Plans.USERS_FREE, isSentryPlan: false },
+ ] as IndividualPlan[],
})
expect(result).toBeFalsy()
@@ -437,7 +459,9 @@ describe('canApplySentryUpgrade', () => {
it('returns false when user has enterprise plan', () => {
const result = canApplySentryUpgrade({
isEnterprisePlan: true,
- plans: [{ value: Plans.USERS_SENTRYY }] as IndividualPlan[],
+ plans: [
+ { value: Plans.USERS_SENTRYY, isSentryPlan: true },
+ ] as IndividualPlan[],
})
expect(result).toBeFalsy()
diff --git a/src/shared/utils/billing.ts b/src/shared/utils/billing.ts
index 9af36c2435..f6b0140306 100644
--- a/src/shared/utils/billing.ts
+++ b/src/shared/utils/billing.ts
@@ -1,6 +1,5 @@
import { format, fromUnixTime } from 'date-fns'
import isArray from 'lodash/isArray'
-import isString from 'lodash/isString'
import isUndefined from 'lodash/isUndefined'
import { z } from 'zod'
@@ -35,13 +34,6 @@ export const CollectionMethods = Object.freeze({
AUTOMATICALLY_CHARGED_METHOD: 'charge_automatically',
})
-export function isSentryPlan(plan?: PlanName | null) {
- if (isString(plan)) {
- return plan === Plans.USERS_SENTRYM || plan === Plans.USERS_SENTRYY
- }
- return false
-}
-
export const findProPlans = ({
plans,
}: {
diff --git a/src/shared/utils/upgradeForm.test.ts b/src/shared/utils/upgradeForm.test.ts
index a451f3c944..10572099d5 100644
--- a/src/shared/utils/upgradeForm.test.ts
+++ b/src/shared/utils/upgradeForm.test.ts
@@ -175,6 +175,7 @@ describe('getDefaultValuesUpgradeForm', () => {
value: Plans.USERS_SENTRYY,
planUserCount: 1,
isTeamPlan: false,
+ isSentryPlan: true,
} as Plan,
})
@@ -184,6 +185,7 @@ describe('getDefaultValuesUpgradeForm', () => {
value: Plans.USERS_SENTRYY,
planUserCount: 1,
isTeamPlan: false,
+ isSentryPlan: true,
},
seats: 5,
})
@@ -311,6 +313,8 @@ describe('getSchema', () => {
accountDetails,
selectedPlan: {
value: Plans.USERS_TEAMY,
+ isTeamPlan: true,
+ isTrialPlan: false,
} as Plan,
})
@@ -375,24 +379,24 @@ describe('extractSeats', () => {
describe('user on free plan and can upgrade to sentry plan', () => {
it('returns min seats when members are less than min', () => {
const seats = extractSeats({
- value: Plans.USERS_BASIC,
quantity: 1,
isSentryUpgrade: true,
activatedUserCount: 0,
inactiveUserCount: 0,
isFreePlan: true,
+ isTrialPlan: false,
})
expect(seats).toEqual(5)
})
it('returns members number as seats when members are greater than min', () => {
const seats = extractSeats({
- value: Plans.USERS_BASIC,
quantity: 1,
isSentryUpgrade: true,
activatedUserCount: 10,
inactiveUserCount: 2,
isFreePlan: true,
+ isTrialPlan: false,
})
expect(seats).toEqual(12)
})
@@ -401,24 +405,24 @@ describe('extractSeats', () => {
describe('user on free plan and can not upgrade to sentry plan', () => {
it('returns min seats when members are less than min', () => {
const seats = extractSeats({
- value: Plans.USERS_BASIC,
quantity: 1,
isSentryUpgrade: false,
activatedUserCount: 0,
inactiveUserCount: 0,
isFreePlan: true,
+ isTrialPlan: false,
})
expect(seats).toEqual(2)
})
it('returns members number as seats when members are greater than min', () => {
const seats = extractSeats({
- value: Plans.USERS_BASIC,
quantity: 1,
activatedUserCount: 10,
inactiveUserCount: 2,
isSentryUpgrade: false,
isFreePlan: true,
+ isTrialPlan: false,
})
expect(seats).toEqual(12)
})
@@ -427,11 +431,12 @@ describe('extractSeats', () => {
describe('user on paid plan', () => {
it('returns members number as seats', () => {
const seats = extractSeats({
- value: Plans.USERS_PR_INAPPM,
quantity: 8,
activatedUserCount: 12,
inactiveUserCount: 0,
isSentryUpgrade: false,
+ isFreePlan: false,
+ isTrialPlan: false,
})
expect(seats).toEqual(8)
})
@@ -440,12 +445,12 @@ describe('extractSeats', () => {
describe('user on sentry plan', () => {
it('returns members number as seats', () => {
const seats = extractSeats({
- value: Plans.USERS_SENTRYM,
quantity: 8,
activatedUserCount: 12,
inactiveUserCount: 0,
isSentryUpgrade: false,
isFreePlan: false,
+ isTrialPlan: false,
})
expect(seats).toEqual(8)
})
@@ -454,22 +459,22 @@ describe('extractSeats', () => {
describe('user on paid plan and can upgrade to sentry plan', () => {
it('returns members number as seats if greater than min', () => {
const seats = extractSeats({
- value: Plans.USERS_PR_INAPPM,
quantity: 8,
activatedUserCount: 12,
inactiveUserCount: 0,
isSentryUpgrade: true,
isFreePlan: false,
+ isTrialPlan: false,
})
expect(seats).toEqual(8)
})
it('returns min seats if less than min', () => {
const seats = extractSeats({
- value: Plans.USERS_PR_INAPPM,
quantity: 2,
isSentryUpgrade: true,
isFreePlan: false,
+ isTrialPlan: false,
})
expect(seats).toEqual(5)
})
@@ -479,13 +484,13 @@ describe('extractSeats', () => {
describe('user has access to sentry upgrade', () => {
it('returns sentry plan base seat count as seats', () => {
const seats = extractSeats({
- value: Plans.USERS_TRIAL,
quantity: 8,
activatedUserCount: 12,
inactiveUserCount: 0,
isSentryUpgrade: true,
trialStatus: TrialStatuses.ONGOING,
isFreePlan: false,
+ isTrialPlan: true,
})
expect(seats).toEqual(5)
@@ -495,13 +500,13 @@ describe('extractSeats', () => {
describe('user does not have access to sentry upgrade', () => {
it('returns pro plan base seat count as seats', () => {
const seats = extractSeats({
- value: Plans.USERS_TRIAL,
quantity: 8,
activatedUserCount: 12,
inactiveUserCount: 0,
isSentryUpgrade: false,
trialStatus: TrialStatuses.ONGOING,
isFreePlan: false,
+ isTrialPlan: true,
})
expect(seats).toEqual(2)
@@ -515,7 +520,7 @@ describe('shouldRenderCancelLink', () => {
// eslint-disable-next-line testing-library/render-result-naming-convention
const value = shouldRenderCancelLink({
cancelAtPeriodEnd: false,
- plan: { value: Plans.USERS_PR_INAPPY, isFreePlan: false } as Plan,
+ plan: { isFreePlan: false, isTrialPlan: false } as Plan,
trialStatus: TrialStatuses.NOT_STARTED,
})
@@ -527,7 +532,7 @@ describe('shouldRenderCancelLink', () => {
// eslint-disable-next-line testing-library/render-result-naming-convention
const cancelLinkResult = shouldRenderCancelLink({
cancelAtPeriodEnd: false,
- plan: { value: Plans.USERS_BASIC, isFreePlan: true } as Plan,
+ plan: { isFreePlan: true, isTrialPlan: false } as Plan,
trialStatus: TrialStatuses.NOT_STARTED,
})
@@ -577,6 +582,8 @@ describe('shouldRenderCancelLink', () => {
billingRate: BillingRate.ANNUALLY,
value: Plans.USERS_TEAMY,
planUserCount: 1,
+ isTeamPlan: true,
+ isSentryPlan: false,
} as Plan,
})
diff --git a/src/shared/utils/upgradeForm.ts b/src/shared/utils/upgradeForm.ts
index 312baed038..4c3dc1f920 100644
--- a/src/shared/utils/upgradeForm.ts
+++ b/src/shared/utils/upgradeForm.ts
@@ -14,9 +14,6 @@ import {
findProPlans,
findSentryPlans,
findTeamPlans,
- isSentryPlan,
- PlanName,
- Plans,
} from 'shared/utils/billing'
export const MIN_NB_SEATS_PRO = 2
@@ -28,20 +25,20 @@ export const UPGRADE_FORM_TOO_MANY_SEATS_MESSAGE = `Team plan is only available
export function extractSeats({
quantity,
- value,
activatedUserCount = 0,
inactiveUserCount = 0,
isSentryUpgrade,
trialStatus,
isFreePlan,
+ isTrialPlan,
}: {
quantity: number
- value?: PlanName
activatedUserCount?: number
inactiveUserCount?: number
isSentryUpgrade: boolean
trialStatus?: TrialStatus
isFreePlan?: boolean
+ isTrialPlan?: boolean
}) {
const totalMembers = inactiveUserCount + activatedUserCount
const minPlansSeats = isSentryUpgrade ? MIN_SENTRY_SEATS : MIN_NB_SEATS_PRO
@@ -50,7 +47,7 @@ export function extractSeats({
// if their on trial their seat count is around 1000 so this resets the
// value to the minium value they would be going on if sentry or pro
- if (trialStatus === TrialStatuses.ONGOING && value === Plans.USERS_TRIAL) {
+ if (trialStatus === TrialStatuses.ONGOING && isTrialPlan) {
return minPlansSeats
}
@@ -81,21 +78,14 @@ export const getSchema = ({
message: `You cannot purchase a per user plan for less than ${minSeats} users`,
})
.transform((val, ctx) => {
- if (
- (selectedPlan?.value === Plans.USERS_TEAMM ||
- selectedPlan?.value === Plans.USERS_TEAMY) &&
- val > TEAM_PLAN_MAX_ACTIVE_USERS
- ) {
+ if (selectedPlan?.isTeamPlan && val > TEAM_PLAN_MAX_ACTIVE_USERS) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: UPGRADE_FORM_TOO_MANY_SEATS_MESSAGE,
})
}
- if (
- trialStatus === TrialStatuses.ONGOING &&
- plan?.value === Plans.USERS_TRIAL
- ) {
+ if (trialStatus === TrialStatuses.ONGOING && plan?.isTrialPlan) {
return val
}
@@ -240,26 +230,22 @@ export const getDefaultValuesUpgradeForm = ({
const isPaidPlan = !!plan?.billingRate // If the plan has a billing rate, it's a paid plan
let newPlan = proPlanYear
- if (isSentryUpgrade && !isSentryPlan(plan?.value)) {
+ if (isSentryUpgrade && !plan?.isSentryPlan) {
newPlan = isMonthlyPlan ? sentryPlanMonth : sentryPlanYear
- } else if (
- plan?.isTeamPlan ||
- selectedPlan?.value === Plans.USERS_TEAMM ||
- selectedPlan?.value === Plans.USERS_TEAMY
- ) {
+ } else if (plan?.isTeamPlan || selectedPlan?.isTeamPlan) {
newPlan = isMonthlyPlan ? teamPlanMonth : teamPlanYear
} else if (isPaidPlan) {
newPlan = plan
}
const seats = extractSeats({
- value: plan?.value,
quantity: plan?.planUserCount ?? 0,
activatedUserCount,
inactiveUserCount,
trialStatus,
isSentryUpgrade,
isFreePlan: plan?.isFreePlan,
+ isTrialPlan: plan?.isTrialPlan,
})
return {