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

627 upgrade page multi choice selector #2376

Merged
merged 3 commits into from
Nov 3, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { useParams } from 'react-router-dom'

import {
useAccountDetails,
useAvailablePlans,
usePlanData,
} from 'services/account'
import BenefitList from 'shared/plan/BenefitList'
import ScheduledPlanDetails from 'shared/plan/ScheduledPlanDetails'
import { useProPlans } from 'shared/utils/billing'
import { shouldRenderCancelLink } from 'shared/utils/upgradeForm'
import A from 'ui/A'
import Icon from 'ui/Icon'

function ProPlanDetails() {
const { provider, owner } = useParams()
const { data: planData } = usePlanData({ provider, owner })
const { data: accountDetails } = useAccountDetails({ provider, owner })
const { data: plans } = useAvailablePlans({ provider, owner })
const { proPlanMonth, proPlanYear } = useProPlans({ plans })

Check warning on line 20 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L15-L20

Added lines #L15 - L20 were not covered by tests

Check warning on line 20 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L15-L20

Added lines #L15 - L20 were not covered by tests

Check warning on line 20 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L15-L20

Added lines #L15 - L20 were not covered by tests

const plan = accountDetails?.rootOrganization?.plan ?? accountDetails?.plan
const scheduledPhase = accountDetails?.scheduleDetail?.scheduledPhase

Check warning on line 23 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L23

Added line #L23 was not covered by tests

Check warning on line 23 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L23

Added line #L23 was not covered by tests

Check warning on line 23 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L23

Added line #L23 was not covered by tests

const cancelAtPeriodEnd =
accountDetails?.subscriptionDetail?.cancelAtPeriodEnd
const trialStatus = planData?.plan?.trialStatus

Check warning on line 27 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L26-L27

Added lines #L26 - L27 were not covered by tests

Check warning on line 27 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L26-L27

Added lines #L26 - L27 were not covered by tests

Check warning on line 27 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L26-L27

Added lines #L26 - L27 were not covered by tests

return (

Check warning on line 29 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L29

Added line #L29 was not covered by tests

Check warning on line 29 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L29

Added line #L29 was not covered by tests

Check warning on line 29 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L29

Added line #L29 was not covered by tests
<div className="h-fit border">
<h3 className="p-4 font-semibold">{proPlanYear?.marketingName} plan</h3>
<hr />
<div className="flex flex-col gap-4 p-4">
<BenefitList
iconName="check"
iconColor="text-ds-pink-quinary"
benefits={proPlanYear?.benefits}
/>
<div>
<p className="text-xs font-semibold">
<span className="text-2xl">${proPlanYear?.baseUnitPrice}</span>
/per user, per month
</p>
<p className="text-xs text-ds-gray-quaternary">
billed annually or ${proPlanMonth?.baseUnitPrice} for monthly
billing
</p>
</div>
{scheduledPhase && (
<ScheduledPlanDetails scheduledPhase={scheduledPhase} />

Check warning on line 50 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L50

Added line #L50 was not covered by tests

Check warning on line 50 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L50

Added line #L50 was not covered by tests

Check warning on line 50 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L50

Added line #L50 was not covered by tests
)}
{shouldRenderCancelLink(cancelAtPeriodEnd, plan, trialStatus) && (
<A

Check warning on line 53 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L53

Added line #L53 was not covered by tests

Check warning on line 53 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - Staging / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L53

Added line #L53 was not covered by tests

Check warning on line 53 in src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx

View check run for this annotation

Codecov - QA / codecov/patch

src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.jsx#L53

Added line #L53 was not covered by tests
to={{ pageName: 'cancelOrgPlan' }}
variant="black"
hook="cancel-plan"
>
Cancel
<Icon name="chevronRight" size="sm" variant="solid" />
</A>
)}
</div>
</div>
)
}

export default ProPlanDetails
Loading
Loading