Skip to content

Commit

Permalink
ref: Update useAvailablePlans to have isSentry/TeamPlan AND remove is…
Browse files Browse the repository at this point in the history
…SentryPlan helper for GQL field (#3610)
  • Loading branch information
ajay-sentry authored Jan 6, 2025
1 parent f7044f2 commit 113a97f
Show file tree
Hide file tree
Showing 64 changed files with 485 additions and 213 deletions.
1 change: 1 addition & 0 deletions src/pages/AccountSettings/AccountSettings.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ describe('AccountSettings', () => {
planValue === Plans.USERS_TEAMM ||
planValue === Plans.USERS_TEAMY,
isTrialPlan: false,
isSentryPlan: false,
},
},
},
Expand Down
1 change: 1 addition & 0 deletions src/pages/AccountSettings/AccountSettingsSideMenu.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ describe('AccountSettingsSideMenu', () => {
planValue === Plans.USERS_TEAMM ||
planValue === Plans.USERS_TEAMY,
isTrialPlan: false,
isSentryPlan: false,
},
},
},
Expand Down
1 change: 1 addition & 0 deletions src/pages/DefaultOrgSelector/DefaultOrgSelector.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ describe('DefaultOrgSelector', () => {
isTeamPlan:
value === Plans.USERS_TEAMM || value === Plans.USERS_TEAMY,
isTrialPlan: value === Plans.USERS_TRIAL,
isSentryPlan: false,
trialStatus,
value,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const mockPlanData = {
isEnterprisePlan: false,
isFreePlan: true,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
baseUnitPrice: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const mockPlanData = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
Expand Down
1 change: 1 addition & 0 deletions src/pages/MembersPage/MembersList/MembersList.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const mockActiveUserRequest = {
const mockPlanData = {
isEnterprisePlan: false,
isProPlan: false,
isSentryPlan: false,
isTrialPlan: false,
baseUnitPrice: 10,
benefits: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const queryClient = new QueryClient({
const mockPlanData = {
isEnterprisePlan: false,
isProPlan: false,
isSentryPlan: false,
isTrialPlan: false,
baseUnitPrice: 10,
benefits: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const mockPlanDataResponse = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
Expand Down
1 change: 1 addition & 0 deletions src/pages/OwnerPage/HeaderBanners/HeaderBanners.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const mockPlanDataResponse = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const mockPlanDataResponse = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
trialStatus: TrialStatuses.NOT_STARTED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const mockResponse = {
planUserCount: 1,
hasSeatsLeft: true,
isEnterprisePlan: false,
isSentryPlan: false,
isProPlan: false,
isTrialPlan: false,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const teamPlans = [
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
isTeamPlan: true,
isSentryPlan: false,
},
{
baseUnitPrice: 5,
Expand All @@ -32,6 +34,8 @@ const teamPlans = [
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
isTeamPlan: true,
isSentryPlan: false,
},
]

Expand All @@ -47,6 +51,8 @@ const mockAvailablePlans = ({ hasTeamPlans }: { hasTeamPlans: boolean }) => [
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
isTeamPlan: false,
isSentryPlan: false,
},
{
marketingName: 'Pro Team',
Expand All @@ -60,6 +66,8 @@ const mockAvailablePlans = ({ hasTeamPlans }: { hasTeamPlans: boolean }) => [
'Priority Support',
],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: false,
},
...(hasTeamPlans ? teamPlans : []),
]
Expand All @@ -81,6 +89,7 @@ const mockPlanData = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const mockPlanData = {
isEnterprisePlan: false,
isFreePlan: true,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
baseUnitPrice: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const mockAvailablePlans = [
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
isTeamPlan: false,
isSentryPlan: false,
},
{
marketingName: 'Pro Team',
Expand All @@ -35,6 +37,8 @@ const mockAvailablePlans = [
'Priority Support',
],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: false,
},
{
marketingName: 'Pro Team',
Expand All @@ -48,6 +52,8 @@ const mockAvailablePlans = [
'Priority Support',
],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: false,
},
{
marketingName: 'Pro Team',
Expand All @@ -61,6 +67,8 @@ const mockAvailablePlans = [
'Priority Support',
],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: false,
},
{
marketingName: 'Pro Team',
Expand All @@ -74,6 +82,8 @@ const mockAvailablePlans = [
'Priority Support',
],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: false,
},
{
baseUnitPrice: 6,
Expand All @@ -82,6 +92,8 @@ const mockAvailablePlans = [
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
isTeamPlan: true,
isSentryPlan: false,
},
{
baseUnitPrice: 5,
Expand All @@ -90,6 +102,8 @@ const mockAvailablePlans = [
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
isTeamPlan: true,
isSentryPlan: false,
},
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const mockPlanDataResponse = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const proPlanDetails = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: true,
isSentryPlan: false,
isTeamPlan: true,
isTrialPlan: false,
},
Expand All @@ -46,6 +47,7 @@ const freePlanDetails = {
isEnterprisePlan: false,
isFreePlan: true,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
},
Expand All @@ -65,6 +67,7 @@ const enterprisePlan = {
isEnterprisePlan: true,
isFreePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
},
Expand All @@ -84,6 +87,7 @@ const usesInvoiceTeamPlan = {
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: true,
isTrialPlan: false,
},
Expand All @@ -103,6 +107,7 @@ const trialPlanDetails = {
isProPlan: false,
isTeamPlan: true,
isTrialPlan: true,
isSentryPlan: false,
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ function FreePlanCard({ plan, scheduledPhase }) {
planData?.plan?.trialStatus === TrialStatuses.ONGOING

let benefits = plan?.benefits
let planValue = plan?.value
let baseUnitPrice = plan?.baseUnitPrice
let marketingName = plan?.marketingName

if (trialOngoing) {
benefits = planData?.pretrialPlan?.benefits
planValue = planData?.pretrialPlan?.value
baseUnitPrice = planData?.pretrialPlan?.baseUnitPrice
marketingName = planData?.pretrialPlan?.marketingName
}
Expand Down Expand Up @@ -77,7 +75,6 @@ function FreePlanCard({ plan, scheduledPhase }) {
<div className="mb-4">
<PlanPricing
plan={planData?.plan}
value={planValue}
baseUnitPrice={baseUnitPrice}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const allPlans = [
'Unlimited private repositories',
],
monthlyUploadLimit: 250,
isTeamPlan: false,
isSentryPlan: false,
},
{
marketingName: 'Pro Team',
Expand All @@ -41,6 +43,8 @@ const allPlans = [
'Priority Support',
],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: false,
},
{
marketingName: 'Pro Team',
Expand All @@ -54,6 +58,8 @@ const allPlans = [
'Priority Support',
],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: false,
},
{
marketingName: 'Pro Team',
Expand All @@ -67,6 +73,8 @@ const allPlans = [
'Priority Support',
],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: false,
},
{
marketingName: 'Pro Team',
Expand All @@ -80,6 +88,8 @@ const allPlans = [
'Priority Support',
],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: false,
},
{
baseUnitPrice: 6,
Expand All @@ -88,6 +98,8 @@ const allPlans = [
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMM,
isTeamPlan: true,
isSentryPlan: false,
},
{
baseUnitPrice: 5,
Expand All @@ -96,6 +108,8 @@ const allPlans = [
marketingName: 'Users Team',
monthlyUploadLimit: 2500,
value: Plans.USERS_TEAMY,
isTeamPlan: true,
isSentryPlan: false,
},
]

Expand All @@ -107,6 +121,8 @@ const sentryPlans = [
baseUnitPrice: 0,
benefits: ['Includes 5 seats', 'Unlimited public repositories'],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: true,
},
{
marketingName: 'Sentry',
Expand All @@ -115,6 +131,8 @@ const sentryPlans = [
baseUnitPrice: 10,
benefits: ['Includes 5 seats', 'Unlimited private repositories'],
monthlyUploadLimit: null,
isTeamPlan: false,
isSentryPlan: true,
},
]

Expand All @@ -128,6 +146,7 @@ const freePlan = {
isFreePlan: true,
isEnterprisePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}
Expand All @@ -154,6 +173,7 @@ const mockPlanData = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isProPlan: false,
isSentryPlan: false,
isTrialPlan: false,
}

Expand Down
Loading

0 comments on commit 113a97f

Please sign in to comment.