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: Add cta on billing for >20k annual spend customers #19508

Merged
merged 20 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
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);
}
Loading