Skip to content

Commit

Permalink
white label capture
Browse files Browse the repository at this point in the history
  • Loading branch information
surbhi-posthog committed Dec 23, 2024
1 parent 1323e66 commit 6510357
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions frontend/src/lib/components/Sharing/SharingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function SharingModalContent({
iframeProperties,
shareLink,
} = useValues(sharingLogic(logicProps))
const { setIsEnabled, togglePreview } = useActions(sharingLogic(logicProps))
const { setIsEnabled, togglePreview, captureWhitelabelToggled } = useActions(sharingLogic(logicProps))
const { guardAvailableFeature } = useValues(upgradeModalLogic)

const [iframeLoaded, setIframeLoaded] = useState(false)
Expand Down Expand Up @@ -174,9 +174,10 @@ export function SharingModalContent({
</div>
}
onChange={() =>
guardAvailableFeature(AvailableFeature.WHITE_LABELLING, () =>
guardAvailableFeature(AvailableFeature.WHITE_LABELLING, () => {
onChange(!value)
)
captureWhitelabelToggled(!value)
})
}
checked={!value}
/>
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/lib/components/Sharing/sharingLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { forms } from 'kea-forms'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import posthog from 'posthog-js'
import { getInsightId } from 'scenes/insights/utils'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { urls } from 'scenes/urls'
Expand Down Expand Up @@ -57,6 +58,7 @@ export const sharingLogic = kea<sharingLogicType>([

actions({
togglePreview: true,
captureWhitelabelToggled: (enabled: boolean) => ({ enabled }),
}),
reducers({
showPreview: [true, { togglePreview: (state) => !state }],
Expand Down Expand Up @@ -86,8 +88,10 @@ export const sharingLogic = kea<sharingLogicType>([
dashboardsModel.actions.loadDashboards()
}
},
captureWhitelabelToggled: ({ enabled }) => {
posthog.capture('sharing whitelabel toggled', { enabled })
},
})),

forms({
embedConfig: {
defaults: defaultEmbedConfig,
Expand Down

0 comments on commit 6510357

Please sign in to comment.