Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: Migrate to isTeamPlan GQ field #3592

Merged
merged 8 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/pages/AccountSettings/AccountSettings.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ describe('AccountSettings', () => {
value: planValue,
isEnterprisePlan: planValue === Plans.USERS_ENTERPRISEM,
isFreePlan: planValue === Plans.USERS_BASIC,
isTeamPlan:
planValue === Plans.USERS_TEAMM ||
planValue === Plans.USERS_TEAMY,
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions src/pages/AccountSettings/AccountSettingsSideMenu.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ describe('AccountSettingsSideMenu', () => {
value: planValue,
isEnterprisePlan: planValue === Plans.USERS_ENTERPRISEM,
isFreePlan: planValue === Plans.USERS_BASIC,
isTeamPlan:
planValue === Plans.USERS_TEAMM ||
planValue === Plans.USERS_TEAMY,
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions src/pages/DefaultOrgSelector/DefaultOrgSelector.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ describe('DefaultOrgSelector', () => {
...mockTrialData,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan:
value === Plans.USERS_TEAMM || value === Plans.USERS_TEAMY,
trialStatus,
value,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const mockedAccountDetails = {
const mockPlanData = {
isEnterprisePlan: false,
isFreePlan: true,
isTeamPlan: false,
baseUnitPrice: 10,
benefits: [],
billingRate: BillingRate.MONTHLY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const mockPlanData = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const server = setupServer()
Expand Down
3 changes: 3 additions & 0 deletions src/pages/MembersPage/MembersList/MembersList.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ describe('MembersList', () => {
...mockPlanData,
value: planName,
isFreePlan: planName === Plans.USERS_BASIC,
isTeamPlan:
planName === Plans.USERS_TEAMM ||
planName === Plans.USERS_TEAMY,
planUserCount,
hasSeatsLeft,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ describe('MembersTable', () => {
...mockPlanData,
value: planName,
isFreePlan: planName === Plans.USERS_BASIC,
isTeamPlan:
planName === Plans.USERS_TEAMM ||
planName === Plans.USERS_TEAMY,
planUserCount,
hasSeatsLeft,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const mockPlanDataResponse = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

beforeAll(() => {
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 @@ -42,6 +42,7 @@ const mockPlanDataResponse = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const mockPlanDataResponseNoUploadLimit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const mockPlanDataResponse = {
value: Plans.USERS_PR_INAPPM,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
trialStatus: TrialStatuses.NOT_STARTED,
trialStartDate: '',
trialEndDate: '',
Expand Down
3 changes: 3 additions & 0 deletions src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ describe('TrialReminder', () => {
trialEndDate,
value: planValue,
isFreePlan: planValue === Plans.USERS_BASIC,
isTeamPlan:
planValue === Plans.USERS_TEAMM ||
planValue === Plans.USERS_TEAMY,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const mockPlanData = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const queryClient = new QueryClient({
Expand Down Expand Up @@ -157,6 +158,9 @@ describe('CancelPlanPage', () => {
value: planValue,
isEnterprisePlan: planValue === Plans.USERS_ENTERPRISEM,
isFreePlan: planValue === Plans.USERS_BASIC,
isTeamPlan:
planValue === Plans.USERS_TEAMM ||
planValue === Plans.USERS_TEAMY,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const proPlanDetails = {
billingRate: null,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: true,
},
}

Expand All @@ -42,6 +43,7 @@ const freePlanDetails = {
],
isEnterprisePlan: false,
isFreePlan: true,
isTeamPlan: false,
},
}

Expand All @@ -58,6 +60,7 @@ const enterprisePlan = {
],
isEnterprisePlan: true,
isFreePlan: false,
isTeamPlan: false,
},
}

Expand All @@ -74,6 +77,7 @@ const usesInvoiceTeamPlan = {
],
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: true,
},
usesInvoice: true,
}
Expand All @@ -88,6 +92,7 @@ const trialPlanDetails = {
value: Plans.USERS_TRIAL,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: true,
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const freePlan = {
monthlyUploadLimit: null,
isFreePlan: true,
isEnterprisePlan: false,
isTeamPlan: false,
}

const scheduledPhase = {
Expand Down Expand Up @@ -224,6 +225,9 @@ describe('FreePlanCard', () => {
value: planValue,
planUserCount,
isFreePlan: planValue === Plans.USERS_BASIC,
isTeamPlan:
planValue === Plans.USERS_TEAMM ||
planValue === Plans.USERS_TEAMY,
},
pretrialPlan: mockPreTrialPlanInfo,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ vi.mock('shared/plan/BenefitList', () => ({ default: () => 'BenefitsList' }))
const mockPlanBasic = {
isEnterprisePlan: false,
isFreePlan: true,
isTeamPlan: false,
baseUnitPrice: 0,
benefits: ['Up to # user', 'Unlimited public repositories'],
billingRate: BillingRate.MONTHLY,
Expand All @@ -33,6 +34,7 @@ const mockPlanBasic = {
const mockPlanPro = {
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
baseUnitPrice: 10,
benefits: ['Up to # user', 'Unlimited public repositories'],
billingRate: BillingRate.MONTHLY,
Expand All @@ -51,6 +53,7 @@ const mockPlanPro = {
const mockPlanTrialing = {
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
baseUnitPrice: 10,
benefits: ['Up to # user', 'Unlimited public repositories'],
billingRate: BillingRate.MONTHLY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const mockResponse = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: true,
isTeamPlan: false,
}

const server = setupServer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ vi.mock('shared/plan/ScheduledPlanDetails', () => ({
const mockProPlan = {
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
marketingName: 'Pro',
value: Plans.USERS_PR_INAPPM,
billingRate: BillingRate.MONTHLY,
Expand All @@ -48,6 +49,7 @@ const mockProPlan = {
const mockTeamPlan = {
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: true,
marketingName: 'Team',
value: Plans.USERS_TEAMM,
billingRate: BillingRate.MONTHLY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { PlanPageDataQueryOpts } from 'pages/PlanPage/queries/PlanPageDataQueryO
import { useAccountDetails, usePlanData } from 'services/account'
import BenefitList from 'shared/plan/BenefitList'
import ScheduledPlanDetails from 'shared/plan/ScheduledPlanDetails'
import { isTeamPlan } from 'shared/utils/billing'

import ActionsBilling from '../shared/ActionsBilling/ActionsBilling'
import PlanPricing from '../shared/PlanPricing'
Expand Down Expand Up @@ -75,7 +74,7 @@ function PaidPlanCard() {
<ScheduledPlanDetails scheduledPhase={scheduledPhase} />
) : null}
</div>
{isNumber(numberOfUploads) && isTeamPlan(plan?.value) ? (
{isNumber(numberOfUploads) && plan?.isTeamPlan ? (
<div>
<p className="mb-2 text-xs font-semibold">Private repo uploads</p>
<p className="text-xs text-ds-gray-senary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ describe('Actions Billing', () => {
...trialPlanData.plan,
value: accountDetails.plan.value,
isFreePlan: accountDetails.plan.value === Plans.USERS_BASIC,
isTeamPlan:
accountDetails.plan.value === Plans.USERS_TEAMM ||
accountDetails.plan.value === Plans.USERS_TEAMY,
},
hasPrivateRepos,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ describe('ProPlanDetails', () => {
plan: {
...mockPlanData,
isFreePlan: !isProPlan && !isSentryPlan,
isTeamPlan: false,
trialStatus: isOngoingTrial
? TrialStatuses.ONGOING
: TrialStatuses.CANNOT_TRIAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ describe('SentryPlanDetails', () => {
plan: {
...mockPlanData,
isFreePlan: !isProPlan,
isTeamPlan: false,
trialStatus: isOngoingTrial
? TrialStatuses.ONGOING
: TrialStatuses.CANNOT_TRIAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const mockPlanData = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const server = setupServer()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { IndividualPlan } from 'services/account'
import { isSentryPlan, isTeamPlan } from 'shared/utils/billing'
import { isSentryPlan, Plans } from 'shared/utils/billing'

import ProPlanDetails from './ProPlanDetails'
import SentryPlanDetails from './SentryPlanDetails'
import TeamPlanDetails from './TeamPlanDetails'
import { IndividualPlan } from 'services/account'

function UpgradeDetails({ selectedPlan }: { selectedPlan: IndividualPlan }) {
if (isSentryPlan(selectedPlan.value)) {
return <SentryPlanDetails />
} else if (isTeamPlan(selectedPlan.value)) {
} else if (selectedPlan?.value === Plans.USERS_TEAMM || selectedPlan?.value === Plans.USERS_TEAMY) {
return <TeamPlanDetails />
} else {
return <ProPlanDetails />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { UseFormRegister, UseFormSetValue } from 'react-hook-form'

import { IndividualPlan } from 'services/account'
import { isSentryPlan, isTeamPlan } from 'shared/utils/billing'
import { isSentryPlan } from 'shared/utils/billing'
import { Plans } from 'shared/utils/billing'

import ProPlanController from './ProPlanController'
import SentryPlanController from './SentryPlanController'
Expand Down Expand Up @@ -30,7 +31,7 @@ const Controller: React.FC<BillingControlsProps> = ({
setFormValue,
setSelectedPlan,
}) => {
if (isTeamPlan(newPlan?.value)) {
if (newPlan?.value === Plans.USERS_TEAMM || newPlan?.value === Plans.USERS_TEAMY) {
return (
<TeamPlanController
newPlan={newPlan}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const mockPlanDataResponse = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: true,
}

const server = setupServer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const mockPlanDataResponseMonthly = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const mockPlanDataResponseYearly = {
Expand All @@ -148,6 +149,7 @@ const mockPlanDataResponseYearly = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const queryClient = new QueryClient({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const mockPlanDataResponse = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const server = setupServer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const mockPlanDataResponseMonthly = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const mockPlanDataResponseYearly = {
Expand All @@ -134,6 +135,7 @@ const mockPlanDataResponseYearly = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const queryClient = new QueryClient({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const mockPlanDataResponse = {
planUserCount: 1,
hasSeatsLeft: true,
isFreePlan: false,
isTeamPlan: true,
}

const server = setupServer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ describe('ErrorBanner', () => {
planUserCount: 1,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}
if (planValue === Plans.USERS_BASIC) {
return HttpResponse.json({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const mockPlanDataResponseMonthly = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const mockPlanDataResponseYearly = {
Expand All @@ -133,6 +134,7 @@ const mockPlanDataResponseYearly = {
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}

const queryClient = new QueryClient({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ describe('PlanTypeOptions', () => {
planUserCount: 1,
isEnterprisePlan: false,
isFreePlan: false,
isTeamPlan: false,
}
if (planValue === Plans.USERS_BASIC) {
return HttpResponse.json({
Expand Down
Loading
Loading