From a5604ea0c5e672fc921f7a17ab19d0b98c73f0f2 Mon Sep 17 00:00:00 2001 From: Zach Waterfield Date: Mon, 16 Sep 2024 14:15:04 -0400 Subject: [PATCH] chore: add credit modal events (#24973) --- frontend/src/scenes/billing/billingLogic.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontend/src/scenes/billing/billingLogic.tsx b/frontend/src/scenes/billing/billingLogic.tsx index d52a2664a7720..c3e86255cdadb 100644 --- a/frontend/src/scenes/billing/billingLogic.tsx +++ b/frontend/src/scenes/billing/billingLogic.tsx @@ -83,6 +83,8 @@ export const billingLogic = kea([ setShowLicenseDirectInput: (show: boolean) => ({ show }), reportBillingAlertShown: (alertConfig: BillingAlertConfig) => ({ alertConfig }), reportBillingAlertActionClicked: (alertConfig: BillingAlertConfig) => ({ alertConfig }), + reportCreditsFormSubmitted: (creditInput: number) => ({ creditInput }), + reportCreditsModalShown: true, reportBillingShown: true, registerInstrumentationProps: true, setRedirectPath: true, @@ -466,6 +468,7 @@ export const billingLogic = kea([ actions.showPurchaseCreditsModal(false) actions.loadCreditOverview() + actions.reportCreditsFormSubmitted(+creditInput) LemonDialog.open({ title: 'Your credit purchase has been submitted', @@ -521,6 +524,14 @@ export const billingLogic = kea([ ...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') && @@ -665,6 +676,11 @@ export const billingLogic = kea([ posthog.register(payload) } }, + showPurchaseCreditsModal: ({ isOpen }) => { + if (isOpen) { + actions.reportCreditsModalShown() + } + }, })), afterMount(({ actions }) => { actions.loadBilling()