Skip to content

Commit

Permalink
show alert when we automatically apply billing limit upon subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
Bianca Yang committed Nov 16, 2023
1 parent 422e8f8 commit 7e4bff9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions frontend/src/scenes/billing/billingLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ export const billingLogic = kea<billingLogicType>([
billingAlert: [
(s) => [s.billing, s.preflight, s.projectedTotalAmountUsd],
(billing, preflight, projectedTotalAmountUsd): BillingAlertConfig | undefined => {
if (router.values.searchParams['products']) {
let upgradedProducts = router.values.searchParams['products'].split(',')
upgradedProducts = billing?.products.filter((product) => upgradedProducts.includes(product.type))
upgradedProducts?.forEach((product: BillingProductV2Type) => {
const currentPlan = product.plans.find((plan) => plan.current_plan)
if (currentPlan?.initial_billing_limit) {
lemonToast.info(
`Automatically added ${currentPlan?.initial_billing_limit} billing limit for ${product.name}`
)
}
})
}
if (!billing || !preflight?.cloud) {
return
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,7 @@ export interface BillingV2PlanType {
current_plan?: any
tiers?: BillingV2TierType[]
included_if?: 'no_active_subscription' | 'has_subscription' | null
initial_billing_limit?: number
}

export interface PlanInterface {
Expand Down

0 comments on commit 7e4bff9

Please sign in to comment.