:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { MakeLogicType, afterMount, connect, kea, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { organizationLogic } from 'scenes/organizationLogic'
import * as api from '~/generated/core/api'
import type { IdentityProviderConfigApi } from '~/generated/core/api.schemas'
const IDENTITY_PROVIDER_CONFIGS_PAGE_SIZE = 100
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface identityProviderConfigsLogicValues {
currentOrganizationId: string // organizationLogic
identityProviderConfigs: IdentityProviderConfigApi[] | null
identityProviderConfigsLoadFailed: boolean
identityProviderConfigsLoading: boolean
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface identityProviderConfigsLogicActions {
loadIdentityProviderConfigs: () => any
loadIdentityProviderConfigsFailure: (
error: string,
errorObject?: any
) => {
error: string
errorObject?: any
}
loadIdentityProviderConfigsSuccess: (
identityProviderConfigs: IdentityProviderConfigApi[],
payload?: any
) => {
identityProviderConfigs: IdentityProviderConfigApi[]
payload?: any
}
}
export type identityProviderConfigsLogicType = MakeLogicType<
identityProviderConfigsLogicValues,
identityProviderConfigsLogicActions
>
export const identityProviderConfigsLogic = kea<identityProviderConfigsLogicType>([
path(['scenes', 'settings', 'organization', 'identityProviderConfig', 'identityProviderConfigsLogic']),
connect(() => ({ values: [organizationLogic, ['currentOrganizationId']] })),
loaders(({ values }) => ({
identityProviderConfigs: [
null as IdentityProviderConfigApi[] | null,
{
loadIdentityProviderConfigs: async () => {
const identityProviderConfigs: IdentityProviderConfigApi[] = []
let offset = 0
let next: string | null | undefined
do {
const page = await api.identityProviderConfigsList(values.currentOrganizationId, {
limit: IDENTITY_PROVIDER_CONFIGS_PAGE_SIZE,
offset,
})
identityProviderConfigs.push(...page.results)
offset += IDENTITY_PROVIDER_CONFIGS_PAGE_SIZE
next = page.next
} while (next)
return identityProviderConfigs
},
},
],
})),
reducers({
identityProviderConfigsLoadFailed: [
false,
{
loadIdentityProviderConfigs: () => false,
loadIdentityProviderConfigsFailure: () => true,
},
],
}),
afterMount(({ actions }) => {
actions.loadIdentityProviderConfigs()
}),
])