Skip to content

Commit

Permalink
feat: Add cta on billing for >20k annual spend customers (#19508)
Browse files Browse the repository at this point in the history
* add cta on billing for >20k annual spend customers

* Update UI snapshots for `chromium` (1)

* tweak the bullets, add dismissal logic, handle small screen sizes

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

* give it a box, update wording, improve spacing

* fix spacing so it lines up across the top properly

* fix

* Update UI snapshots for `chromium` (1)

* address pr feedback

* auto-dismiss on annual plan
* remove unused hedgehog png
* slight tweak to css for smaller screens

* Update UI snapshots for `chromium` (1)

* lint

* Update UI snapshots for `chromium` (1)

* fix dark mode

* Update UI snapshots for `chromium` (1)

---------

Co-authored-by: Bianca Yang <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Raquel Smith <[email protected]>
  • Loading branch information
4 people authored and fuziontech committed Jan 4, 2024
1 parent ab4d0eb commit b0d4816
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 119 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
267 changes: 165 additions & 102 deletions frontend/src/scenes/billing/Billing.tsx

Large diffs are not rendered by default.

42 changes: 25 additions & 17 deletions frontend/src/scenes/billing/billingLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,32 @@ export const billingLogic = kea<billingLogicType>([
return projectedTotal
},
],
over20kAnnual: [
(s) => [s.billing, s.preflight, s.projectedTotalAmountUsd],
(billing, preflight, projectedTotalAmountUsd) => {
if (!billing || !preflight?.cloud) {
return
}
if (
billing.current_total_amount_usd_after_discount &&
(parseFloat(billing.current_total_amount_usd_after_discount) > 1666 ||
projectedTotalAmountUsd > 1666) &&
billing.billing_period?.interval === 'month'
) {
return true
}
return
},
],
isAnnualPlan: [
(s) => [s.billing],
(billing) => {
return billing?.billing_period?.interval === 'year'
},
],
billingAlert: [
(s) => [s.billing, s.preflight, s.projectedTotalAmountUsd, s.productSpecificAlert],
(billing, preflight, projectedTotalAmountUsd, productSpecificAlert): BillingAlertConfig | undefined => {
(s) => [s.billing, s.preflight, s.productSpecificAlert],
(billing, preflight, productSpecificAlert): BillingAlertConfig | undefined => {
if (productSpecificAlert) {
return productSpecificAlert
}
Expand Down Expand Up @@ -228,21 +251,6 @@ export const billingLogic = kea<billingLogicType>([
} allocation.`,
}
}

if (
billing.current_total_amount_usd_after_discount &&
(parseFloat(billing.current_total_amount_usd_after_discount) > 1000 ||
projectedTotalAmountUsd > 1000) &&
billing.billing_period?.interval === 'month'
) {
return {
status: 'info',
title: `Switch to annual up-front billing to save up to 20% on your bill.`,
contactSupport: true,
buttonCTA: 'Contact sales',
dismissKey: 'annual-billing-cta',
}
}
},
],
}),
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/styles/utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1408,3 +1408,7 @@ $decorations: underline, overline, line-through, no-underline;
.aspect-video {
aspect-ratio: 16 / 9;
}

.-scale-x-1 {
transform: scaleX(-1);
}

0 comments on commit b0d4816

Please sign in to comment.