Skip to content

Commit

Permalink
chore: add credit modal events (#24973)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlwaterfield authored Sep 16, 2024
1 parent 68fe7dd commit a5604ea
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions frontend/src/scenes/billing/billingLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export const billingLogic = kea<billingLogicType>([
setShowLicenseDirectInput: (show: boolean) => ({ show }),
reportBillingAlertShown: (alertConfig: BillingAlertConfig) => ({ alertConfig }),
reportBillingAlertActionClicked: (alertConfig: BillingAlertConfig) => ({ alertConfig }),
reportCreditsFormSubmitted: (creditInput: number) => ({ creditInput }),
reportCreditsModalShown: true,
reportBillingShown: true,
registerInstrumentationProps: true,
setRedirectPath: true,
Expand Down Expand Up @@ -466,6 +468,7 @@ export const billingLogic = kea<billingLogicType>([

actions.showPurchaseCreditsModal(false)
actions.loadCreditOverview()
actions.reportCreditsFormSubmitted(+creditInput)

LemonDialog.open({
title: 'Your credit purchase has been submitted',
Expand Down Expand Up @@ -521,6 +524,14 @@ export const billingLogic = kea<billingLogicType>([
...alertConfig,
})
},
reportCreditsModalShown: () => {
posthog.capture('credits modal shown')
},
reportCreditsFormSubmitted: ({ creditInput }) => {
posthog.capture('credits modal credit form submitted', {
creditInput,
})
},
loadBillingSuccess: () => {
if (
router.values.location.pathname.includes('/organization/billing') &&
Expand Down Expand Up @@ -665,6 +676,11 @@ export const billingLogic = kea<billingLogicType>([
posthog.register(payload)
}
},
showPurchaseCreditsModal: ({ isOpen }) => {
if (isOpen) {
actions.reportCreditsModalShown()
}
},
})),
afterMount(({ actions }) => {
actions.loadBilling()
Expand Down

0 comments on commit a5604ea

Please sign in to comment.