Improve "Open billing portal" logging

This commit is contained in:
andrewwallacespeckle
2025-03-14 10:12:57 +00:00
parent c49a76f87f
commit f734b179a9
@@ -48,9 +48,13 @@ export const useBillingActions = () => {
const { mutate: cancelCheckoutSessionMutation } = useMutation(
settingsBillingCancelCheckoutSessionMutation
)
const logger = useLogger()
const billingPortalRedirect = async (workspaceId: MaybeNullOrUndefined<string>) => {
if (!workspaceId) return
if (!workspaceId) {
logger.error('[Billing Portal] No workspaceId provided, returning early')
return
}
mixpanel.track('Workspace Billing Portal Button Clicked', {
// eslint-disable-next-line camelcase
@@ -66,6 +70,11 @@ export const useBillingActions = () => {
if (result.data?.workspace.customerPortalUrl) {
window.open(result.data.workspace.customerPortalUrl, '_blank')
} else {
logger.warn(
'[Billing Portal] No portal URL returned, full response:',
result.data
)
}
}