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

feat: change planName to value for planData hook #2359

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/pages/DefaultOrgSelector/DefaultOrgSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function DefaultOrgSelector() {
updateDefaultOrg({ username: selectedOrg })

if (
isBasicPlan(planData?.plan?.planName) &&
isBasicPlan(planData?.plan?.value) &&
selectedOrg !== currentUser?.user?.username &&
isNewTrial
) {
Expand Down
12 changes: 6 additions & 6 deletions src/pages/DefaultOrgSelector/DefaultOrgSelector.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const mockTrialData = {
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
trialStatus: 'ONGOING',
trialStartDate: '2023-01-01T08:55:25',
trialEndDate: '2023-01-10T08:55:25',
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('DefaultOrgSelector', () => {
useUserData,
isValidUser = true,
trialStatus = 'NOT_STARTED',
planName = 'users-basic',
value = 'users-basic',
} = {}) {
const mockMutationVariables = jest.fn()
const mockTrialMutationVariables = jest.fn()
Expand Down Expand Up @@ -103,15 +103,15 @@ describe('DefaultOrgSelector', () => {
plan: {
...mockTrialData,
trialStatus,
planName,
value,
},
pretrialPlan: {
baseUnitPrice: 10,
benefits: [],
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
},
},
})
Expand Down Expand Up @@ -677,7 +677,7 @@ describe('DefaultOrgSelector', () => {
},
},
},
planName: 'users-free',
value: 'users-free',
myOrganizationsData: {
me: {
myOrganizations: {
Expand Down Expand Up @@ -956,7 +956,7 @@ describe('DefaultOrgSelector', () => {
},
},
},
planName: 'users-basic',
value: 'users-basic',
})

render(<DefaultOrgSelector />, { wrapper: wrapper() })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Activation() {
const planQuantity = accountDetails?.plan?.quantity || 0

if (
isTrialPlan(planData?.plan?.planName) &&
isTrialPlan(planData?.plan?.value) &&
planData?.plan?.trialStatus === TrialStatuses.ONGOING
) {
return (
Expand All @@ -42,7 +42,7 @@ function Activation() {
}

if (
isFreePlan(planData?.plan?.planName) &&
isFreePlan(planData?.plan?.value) &&
planData?.plan?.trialStatus === TrialStatuses.EXPIRED
) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const mockPlanData = {
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
trialStatus: TrialStatuses.NOT_STARTED,
trialStartDate: '',
trialEndDate: '',
Expand Down Expand Up @@ -85,7 +85,7 @@ describe('Activation', () => {
plan: {
...mockPlanData,
trialStatus,
planName: planValue,
value: planValue,
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

const showAutoActivate =
!isUndefined(planAutoActivate) &&
!isTrialPlan(planData?.plan?.planName) &&
!isTrialPlan(planData?.plan?.value) &&

Check warning on line 24 in src/pages/MembersPage/MembersActivation/MembersActivation.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/MembersPage/MembersActivation/MembersActivation.jsx#L24

Added line #L24 was not covered by tests

Check warning on line 24 in src/pages/MembersPage/MembersActivation/MembersActivation.jsx

View check run for this annotation

Codecov Public QA / codecov/patch

src/pages/MembersPage/MembersActivation/MembersActivation.jsx#L24

Added line #L24 was not covered by tests

Check warning on line 24 in src/pages/MembersPage/MembersActivation/MembersActivation.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/MembersPage/MembersActivation/MembersActivation.jsx#L24

Added line #L24 was not covered by tests

Check warning on line 24 in src/pages/MembersPage/MembersActivation/MembersActivation.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/MembersPage/MembersActivation/MembersActivation.jsx#L24

Added line #L24 was not covered by tests
planData?.plan?.trialStatus !== TrialStatuses.ONGOING

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const mockPlanData = {
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
trialStatus: TrialStatuses.NOT_STARTED,
trialStartDate: '',
trialEndDate: '',
Expand Down Expand Up @@ -82,7 +82,7 @@ describe('Members Activation', () => {
plan: {
...mockPlanData,
trialStatus,
planName: planValue,
value: planValue,
},
},
})
Expand Down
4 changes: 2 additions & 2 deletions src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const mockResponse = {
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
trialStatus: TrialStatuses.NOT_STARTED,
trialStartDate: '',
trialEndDate: '',
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('TrialReminder', () => {
trialStatus,
trialStartDate,
trialEndDate,
planName: planValue,
value: planValue,
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
})

const planValue = planData?.plan?.planName
const planValue = planData?.plan?.value

Check warning on line 53 in src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.tsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.tsx#L53

Added line #L53 was not covered by tests

Check warning on line 53 in src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.tsx

View check run for this annotation

Codecov Public QA / codecov/patch

src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.tsx#L53

Added line #L53 was not covered by tests

Check warning on line 53 in src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.tsx#L53

Added line #L53 was not covered by tests

Check warning on line 53 in src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.tsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.tsx#L53

Added line #L53 was not covered by tests

const { trialNotStarted, trialOngoing, trialExpired, cannotTrial } =
determineTrialStates({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function CancelPlanPage() {
const { data: planData } = usePlanData({ provider, owner })

const isOnTrial =
isTrialPlan(planData?.plan?.planName) &&
isTrialPlan(planData?.plan?.value) &&
planData?.plan?.trialStatus === TrialStatuses.ONGOING

// redirect right away if the user is on an enterprise plan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const mockPlanData = {
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
trialStatus: TrialStatuses.NOT_STARTED,
trialStartDate: '',
trialEndDate: '',
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('CancelPlanPage', () => {
plan: {
...mockPlanData,
trialStatus,
planName: planValue,
value: planValue,
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@

const uploadsNumber = ownerData?.numberOfUploads
const trialOngoing =
isTrialPlan(planData?.plan?.planName) &&
isTrialPlan(planData?.plan?.value) &&
planData?.plan.trialStatus === TrialStatuses.ONGOING

let benefits = plan?.benefits
let planName = plan?.value
let planValue = plan?.value

Check warning on line 131 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx#L131

Added line #L131 was not covered by tests

Check warning on line 131 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx

View check run for this annotation

Codecov Public QA / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx#L131

Added line #L131 was not covered by tests

Check warning on line 131 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx#L131

Added line #L131 was not covered by tests

Check warning on line 131 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx#L131

Added line #L131 was not covered by tests
let baseUnitPrice = plan?.baseUnitPrice
let marketingName = plan?.marketingName
if (trialOngoing) {
benefits = planData?.pretrialPlan?.benefits
planName = planData?.pretrialPlan?.planName
planValue = planData?.pretrialPlan?.value

Check warning on line 136 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx#L136

Added line #L136 was not covered by tests

Check warning on line 136 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx

View check run for this annotation

Codecov Public QA / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx#L136

Added line #L136 was not covered by tests

Check warning on line 136 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx#L136

Added line #L136 was not covered by tests

Check warning on line 136 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx#L136

Added line #L136 was not covered by tests
baseUnitPrice = planData?.pretrialPlan?.baseUnitPrice
marketingName = planData?.pretrialPlan?.marketingName
}
Expand Down Expand Up @@ -161,7 +161,7 @@
</div>
<div className="flex flex-col gap-3 border-t pt-2 sm:border-0 sm:p-0">
<p className="text-xs font-semibold">Pricing</p>
<PlanPricing value={planName} baseUnitPrice={baseUnitPrice} />
<PlanPricing value={planValue} baseUnitPrice={baseUnitPrice} />
<div>
{isNumber(uploadsNumber) && (
<p className="mt-4 text-xs text-ds-gray-senary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const mockPlanData = {
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
trialStatus: TrialStatuses.NOT_STARTED,
trialStartDate: '',
trialEndDate: '',
Expand All @@ -130,7 +130,7 @@ const mockPreTrialPlanInfo = {
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
}

const server = setupServer()
Expand Down Expand Up @@ -192,7 +192,7 @@ describe('FreePlanCard', () => {
plan: {
...mockPlanData,
trialStatus,
planName: planValue,
value: planValue,
},
pretrialPlan: mockPreTrialPlanInfo,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const mockResponse = {
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
trialStatus: TrialStatuses.NOT_STARTED,
trialStartDate: '',
trialEndDate: '',
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('ProPlanSubheading', () => {
plan: {
...mockResponse,
trialStatus,
planName: planValue,
value: planValue,
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function ProPlanSubheading() {
// - user on a free plan
// - trial status is not started
if (
isFreePlan(planData?.plan?.planName) &&
isFreePlan(planData?.plan?.value) &&
planData?.plan?.trialStatus === TrialStatuses.NOT_STARTED
) {
return (
Expand All @@ -36,7 +36,7 @@ function ProPlanSubheading() {
// - user is on a trial plan
// - trial status is currently ongoing
if (
isTrialPlan(planData?.plan?.planName) &&
isTrialPlan(planData?.plan?.value) &&
planData?.plan?.trialStatus === TrialStatuses.ONGOING
) {
return (
Expand All @@ -51,7 +51,7 @@ function ProPlanSubheading() {
// - user is currently on a free plan
// - trial status is expired
if (
isFreePlan(planData?.plan?.planName) &&
isFreePlan(planData?.plan?.value) &&
planData?.plan?.trialStatus === TrialStatuses.EXPIRED
) {
return <p className="text-ds-gray-quinary">Your org trialed this plan</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ describe('ProPlanCard', () => {
wrapper,
})

const planName = screen.getByText(/Pro Team plan/)
expect(planName).toBeInTheDocument()
const planValue = screen.getByText(/Pro Team plan/)
expect(planValue).toBeInTheDocument()
})

it('renders the benefits', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

const canStartTrial =
planData?.plan?.trialStatus === TrialStatuses.NOT_STARTED &&
isFreePlan(planData?.plan?.planName)
isFreePlan(planData?.plan?.value)

Check warning on line 34 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx#L34

Added line #L34 was not covered by tests

Check warning on line 34 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx

View check run for this annotation

Codecov Public QA / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx#L34

Added line #L34 was not covered by tests

Check warning on line 34 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx#L34

Added line #L34 was not covered by tests

Check warning on line 34 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx#L34

Added line #L34 was not covered by tests

if (canStartTrial) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const mockTrialData = {
billingRate: 'monthly',
marketingName: 'Users Basic',
monthlyUploadLimit: 250,
planName: 'users-basic',
value: 'users-basic',
trialStatus: 'ONGOING',
trialStartDate: '2023-01-01T08:55:25',
trialEndDate: '2023-01-10T08:55:25',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ const invoice = {
amount: -9449,
currency: 'usd',
period: { end: 1610473200, start: 1609298708 },
planName: 'users-pr-inappm',
value: 'users-pr-inappm',
quantity: 19,
},
{
description: null,
amount: 72000,
currency: 'usd',
period: { end: 1640834708, start: 1609298708 },
planName: 'users-pr-inappy',
value: 'users-pr-inappy',
quantity: 6,
},
{
description: null,
amount: 72000,
currency: 'usd',
period: { end: null, start: null },
planName: 'same period doesnt render date',
value: 'same period doesnt render date',
quantity: 1,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ const invoice = {
amount: -9449,
currency: 'usd',
period: { end: 1610473200, start: 1609298708 },
planName: 'users-pr-inappm',
value: 'users-pr-inappm',
quantity: 19,
},
{
description: null,
amount: 72000,
currency: 'usd',
period: { end: 1640834708, start: 1609298708 },
planName: 'users-pr-inappy',
value: 'users-pr-inappy',
quantity: 6,
},
{
description: null,
amount: 72000,
currency: 'usd',
period: { end: null, start: null },
planName: 'same period doesnt render date',
value: 'same period doesnt render date',
quantity: 1,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ const mockInvoice = ({ status = 'paid' } = {}) => {
amount: -9449,
currency: 'usd',
period: { end: 1610473200, start: 1609298708 },
planName: 'users-pr-inappm',
value: 'users-pr-inappm',
quantity: 19,
},
{
description: null,
amount: 72000,
currency: 'usd',
period: { end: 1640834708, start: 1609298708 },
planName: 'users-pr-inappy',
value: 'users-pr-inappy',
quantity: 6,
},
{
description: null,
amount: 72000,
currency: 'usd',
period: { end: null, start: null },
planName: 'same period doesnt render date',
value: 'same period doesnt render date',
quantity: 1,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ InvoiceItems.propTypes = {
quantity: PropTypes.number.isRequired,
amount: PropTypes.number.isRequired,
description: PropTypes.string,
planName: PropTypes.string,
value: PropTypes.string,
period: PropTypes.shape({
start: PropTypes.number,
end: PropTypes.number,
Expand Down
Loading
Loading