Skip to content

Commit

Permalink
feat: show the cancel trial UI (#25967)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlwaterfield authored Nov 4, 2024
1 parent 87562c5 commit ef5fa18
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
26 changes: 15 additions & 11 deletions frontend/src/scenes/billing/BillingProductAddon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const BillingProductAddon = ({ addon }: { addon: BillingProductV2AddonTyp
initiateProductUpgrade,
setTrialModalOpen,
activateTrial,
cancelTrial,
} = useActions(billingProductLogic({ product: addon }))
const { openSupportForm } = useActions(supportLogic)

Expand Down Expand Up @@ -190,16 +191,15 @@ export const BillingProductAddon = ({ addon }: { addon: BillingProductV2AddonTyp
You're on a trial for this add-on
</LemonTag>
</Tooltip>
{/* Comment out until we can make sure a customer can't activate a trial multiple times */}
{/* <LemonButton
<LemonButton
type="primary"
size="small"
onClick={cancelTrial}
loading={trialLoading}
className="mt-1"
>
Cancel trial
</LemonButton> */}
</LemonButton>
</div>
) : addon.included_with_main_product ? (
<LemonTag type="completion" icon={<IconCheckCircle />}>
Expand Down Expand Up @@ -275,14 +275,18 @@ export const BillingProductAddon = ({ addon }: { addon: BillingProductV2AddonTyp
</>
)}
</div>
{!addon.inclusion_only && !addon.trial && isProrated && !addon.contact_support && (
<p className="mt-2 text-xs text-muted text-right">
Pay ~${prorationAmount} today (prorated) and
<br />
{formatFlatRate(Number(upgradePlan?.unit_amount_usd), upgradePlan?.unit)} every month
thereafter.
</p>
)}
{!addon.inclusion_only &&
!addon.trial &&
isProrated &&
!addon.contact_support &&
!billing?.trial && (
<p className="mt-2 text-xs text-muted text-right">
Pay ~${prorationAmount} today (prorated) and
<br />
{formatFlatRate(Number(upgradePlan?.unit_amount_usd), upgradePlan?.unit)} every month
thereafter.
</p>
)}
{!!addon.trial && !!trialExperiment && !billing?.trial && (
<p className="mt-2 text-xs text-muted text-right">
You'll have {addon.trial.length} days to try it out. Then you'll be charged{' '}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/billing/billingProductLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ export const billingProductLogic = kea<billingProductLogicType>([
lemonToast.error('There was an error cancelling your trial. Please try again or contact support.')
} finally {
actions.loadBilling()
window.location.reload()
actions.setTrialLoading(false)
}
},
Expand Down

0 comments on commit ef5fa18

Please sign in to comment.