diff --git a/src/components/hooks/usePosthog.tsx b/src/components/hooks/usePosthog.tsx index 40eead07..76a094cc 100644 --- a/src/components/hooks/usePosthog.tsx +++ b/src/components/hooks/usePosthog.tsx @@ -9,9 +9,11 @@ function setAllowTracking(on?: boolean) { // opt_in_capturing() or opt_out_capturing() without having run // posthog.init() first. This generally only occurs when running locally. if (window && process.env.NEXT_PUBLIC_POSTHOG_API_KEY) { - if (on) { + if (on && !posthog.has_opted_in_capturing()) { posthog.opt_in_capturing() - } else { + // Make sure to capture initial page view after opting in + posthog.capture('$pageview') + } else if (!on && !posthog.has_opted_out_capturing()) { posthog.opt_out_capturing() } } @@ -26,8 +28,7 @@ export function usePosthog() { api_host: process.env.NEXT_PUBLIC_POSTHOG_API_HOST || 'https://posthog.plural.sh', - opt_out_capturing_by_default: - window.Cookiebot?.consent?.statistics ?? false, + opt_out_capturing_by_default: !window.Cookiebot?.consent?.statistics, loaded: () => { setAllowTracking(window.Cookiebot?.consent?.statistics) }, diff --git a/src/generated/graphqlPlural.ts b/src/generated/graphqlPlural.ts index 2e948f6c..a45bc803 100644 --- a/src/generated/graphqlPlural.ts +++ b/src/generated/graphqlPlural.ts @@ -847,6 +847,10 @@ export type EntityAttributes = { userId?: InputMaybe; }; +export enum ExternalOidcProvider { + GithubActions = 'GITHUB_ACTIONS' +} + export type File = { __typename?: 'File'; blob: Scalars['String']['output']; @@ -1772,6 +1776,16 @@ export type OidcStepResponse = { repository?: Maybe; }; +export type OidcTrustRelationship = { + __typename?: 'OidcTrustRelationship'; + id: Scalars['ID']['output']; + insertedAt?: Maybe; + issuer: Scalars['String']['output']; + scopes?: Maybe>; + trust: Scalars['String']['output']; + updatedAt?: Maybe; +}; + export type OnboardingChecklist = { __typename?: 'OnboardingChecklist'; dismissed?: Maybe; @@ -2680,6 +2694,7 @@ export type RootMutationType = { createTerraform?: Maybe; createTest?: Maybe; createToken?: Maybe; + createTrustRelationship?: Maybe; createUpgrade?: Maybe; createUserEvent?: Maybe; createWebhook?: Maybe; @@ -2714,6 +2729,7 @@ export type RootMutationType = { deleteStack?: Maybe; deleteTerraform?: Maybe; deleteToken?: Maybe; + deleteTrustRelationship?: Maybe; deleteUser?: Maybe; destroyCluster?: Maybe; deviceLogin?: Maybe; @@ -3007,6 +3023,11 @@ export type RootMutationTypeCreateTestArgs = { }; +export type RootMutationTypeCreateTrustRelationshipArgs = { + attributes: TrustRelationshipAttributes; +}; + + export type RootMutationTypeCreateUpgradeArgs = { attributes: UpgradeAttributes; queue: Scalars['String']['input']; @@ -3163,6 +3184,11 @@ export type RootMutationTypeDeleteTokenArgs = { }; +export type RootMutationTypeDeleteTrustRelationshipArgs = { + id: Scalars['ID']['input']; +}; + + export type RootMutationTypeDeleteUserArgs = { id: Scalars['ID']['input']; }; @@ -3594,6 +3620,7 @@ export type RootQueryType = { oidcConsent?: Maybe; oidcLogin?: Maybe; oidcLogins?: Maybe; + oidcToken?: Maybe; platformMetrics?: Maybe; platformPlans?: Maybe>>; platformSubscription?: Maybe; @@ -3935,6 +3962,13 @@ export type RootQueryTypeOidcLoginsArgs = { }; +export type RootQueryTypeOidcTokenArgs = { + email: Scalars['String']['input']; + idToken: Scalars['String']['input']; + provider: ExternalOidcProvider; +}; + + export type RootQueryTypePublicKeysArgs = { after?: InputMaybe; before?: InputMaybe; @@ -4634,6 +4668,12 @@ export enum TestType { Git = 'GIT' } +export type TrustRelationshipAttributes = { + issuer: Scalars['String']['input']; + scopes?: InputMaybe>; + trust: Scalars['String']['input']; +}; + export type UpdatablePlanAttributes = { default?: InputMaybe; serviceLevels?: InputMaybe>>; @@ -4785,6 +4825,7 @@ export type User = { publisher?: Maybe; roles?: Maybe; serviceAccount?: Maybe; + trustRelationships?: Maybe; updatedAt?: Maybe; };