Skip to content

Commit

Permalink
deprecate some growthbook code
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino committed Sep 10, 2024
1 parent da36714 commit cd58795
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 39 deletions.
19 changes: 19 additions & 0 deletions apps/graphql/test/queries/user_queries_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ defmodule GraphQl.UserQueriesTest do
assert length(me["boundRoles"]) == 1
end

test "it can fetch an intercom id" do
user = insert(:user)
insert(:role_binding, user: user, group_id: nil)

{:ok, %{data: %{"me" => me}}} = run_query("""
query {
me {
id
name
intercomId
}
}
""", %{}, %{current_user: Core.Services.Rbac.preload(user)})

assert me["id"] == user.id
assert me["name"] == user.name
assert me["intercomId"] && me["intercomId"] != user.id
end

test "It will mark user as demoed if demo_count reaches the limit" do
user = insert(:user, demo_count: 3)

Expand Down
29 changes: 1 addition & 28 deletions www/src/components/Plural.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Suspense, lazy, useEffect, useState } from 'react'
import { Suspense, lazy } from 'react'
import { Navigate, Outlet, Route, Routes, useMatch } from 'react-router-dom'
import { Toast } from '@pluralsh/design-system'

import { growthbook } from '../helpers/growthbook'
import { useHistory } from '../router'

import { WrapStripe } from './WrapStripe'
Expand Down Expand Up @@ -288,30 +286,6 @@ function OAuthOrFallback() {
)
}

function TestBanner() {
const [enable, setEnable] = useState(true)

useEffect(() => {
const timeout = setTimeout(() => setEnable(false), 5000)

return () => clearTimeout(timeout)
}, [])

if (growthbook.isOn('growthbook-test') && enable) {
return (
<Toast
severity="success"
marginBottom="medium"
marginRight="xxxxlarge"
>
Growthbook Test!
</Toast>
)
}

return null
}

export function PluralInner() {
return (
<WrapStripe>
Expand All @@ -322,7 +296,6 @@ export function PluralInner() {
<LegacyExpirationNotice />
<VerifyEmailConfirmed />
<DeviceLoginNotif />
<TestBanner />
<Routes>
{/* --- OAUTH --- */}
{/* TODO: Enable if route will be used by the app */}
Expand Down
4 changes: 1 addition & 3 deletions www/src/components/marketplace/MarketplaceRepositories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import orderBy from 'lodash/orderBy'

import { upperFirst } from 'lodash'

import { growthbook } from '../../helpers/growthbook'

import { ResponsiveLayoutSidecarContainer } from '../utils/layout/ResponsiveLayoutSidecarContainer'
import { ResponsiveLayoutSpacer } from '../utils/layout/ResponsiveLayoutSpacer'

Expand Down Expand Up @@ -109,7 +107,7 @@ function MarketplaceRepositories({ publisher }: { publisher?: any }) {

const isFiltered = !isEmpty(categories) || !isEmpty(tags)
const isFilteredOrSearched = isFiltered || search
const shouldRenderStacks = growthbook.isOn('stacks') && !isFilteredOrSearched
const shouldRenderStacks = !isFilteredOrSearched

useEffect(() => {
const { current } = scrollRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { useContext, useEffect, useState } from 'react'

import { FormField, ListBoxItem, Select } from '@pluralsh/design-system'

import { growthbook } from '../../../../../helpers/growthbook'
import { CloudProvider, CloudProviderDisplayName } from '../../context/types'
import { OnboardingContext } from '../../context/onboarding'

import Provider from './provider/Provider'

const CLOUDS = Object.values(CloudProvider)
const GROWTHBOOK_AZURE_CLOUD_KEY = 'azure-cloud-shell'

interface ProviderItem {
key: string
Expand All @@ -21,11 +19,7 @@ function CloudCredentials() {
const [provider, setProvider] = useState<CloudProvider>(
cloud?.provider || CloudProvider.AWS
)
const providers = (
growthbook.isOn(GROWTHBOOK_AZURE_CLOUD_KEY)
? CLOUDS
: CLOUDS.filter((c) => c !== CloudProvider.Azure)
).map<ProviderItem>((c) => ({
const providers = CLOUDS.map<ProviderItem>((c) => ({
key: c,
label: CloudProviderDisplayName[c],
}))
Expand Down
2 changes: 1 addition & 1 deletion www/src/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5972,7 +5972,7 @@ export type EabCredentialFragment = { __typename?: 'EabCredential', id: string,
export type MeQueryVariables = Exact<{ [key: string]: never; }>;


export type MeQuery = { __typename?: 'RootQueryType', me?: { __typename?: 'User', demoing?: boolean | null, loginMethod?: LoginMethod | null, hasInstallations?: boolean | null, hasShell?: boolean | null, intercomId?: string | null, id: string, name: string, email: string, avatar?: string | null, provider?: Provider | null, demoed?: boolean | null, onboarding?: OnboardingState | null, emailConfirmed?: boolean | null, emailConfirmBy?: Date | null, backgroundColor?: string | null, serviceAccount?: boolean | null, account: { __typename?: 'Account', id: string, name?: string | null, billingCustomerId?: string | null, backgroundColor?: string | null, userCount?: string | null, trialed?: boolean | null, rootUser?: { __typename?: 'User', id: string, name: string, email: string } | null, domainMappings?: Array<{ __typename?: 'DomainMapping', id: string, domain: string, enableSso?: boolean | null } | null> | null }, publisher?: { __typename?: 'Publisher', billingAccountId?: string | null, id?: string | null, name: string, phone?: string | null, avatar?: string | null, description?: string | null, backgroundColor?: string | null, owner?: { __typename?: 'User', id: string, name: string, email: string, avatar?: string | null, provider?: Provider | null, demoed?: boolean | null, onboarding?: OnboardingState | null, emailConfirmed?: boolean | null, emailConfirmBy?: Date | null, backgroundColor?: string | null, serviceAccount?: boolean | null, hasInstallations?: boolean | null, hasShell?: boolean | null, onboardingChecklist?: { __typename?: 'OnboardingChecklist', dismissed?: boolean | null, status?: OnboardingChecklistState | null } | null, invites?: Array<{ __typename?: 'Invite', id: string, email?: string | null } | null> | null, roles?: { __typename?: 'Roles', admin?: boolean | null } | null, groups?: Array<{ __typename?: 'Group', id: string, name: string, global?: boolean | null, description?: string | null } | null> | null } | null, address?: { __typename?: 'Address', line1?: string | null, line2?: string | null, city?: string | null, country?: string | null, state?: string | null, zip?: string | null } | null } | null, boundRoles?: Array<{ __typename?: 'Role', id: string, name: string, description?: string | null, repositories?: Array<string | null> | null, permissions?: Array<Permission | null> | null, roleBindings?: Array<{ __typename?: 'RoleBinding', id: string, user?: { __typename?: 'User', id: string, name: string, email: string, avatar?: string | null, provider?: Provider | null, demoed?: boolean | null, onboarding?: OnboardingState | null, emailConfirmed?: boolean | null, emailConfirmBy?: Date | null, backgroundColor?: string | null, serviceAccount?: boolean | null, hasInstallations?: boolean | null, hasShell?: boolean | null, onboardingChecklist?: { __typename?: 'OnboardingChecklist', dismissed?: boolean | null, status?: OnboardingChecklistState | null } | null, invites?: Array<{ __typename?: 'Invite', id: string, email?: string | null } | null> | null, roles?: { __typename?: 'Roles', admin?: boolean | null } | null, groups?: Array<{ __typename?: 'Group', id: string, name: string, global?: boolean | null, description?: string | null } | null> | null } | null, group?: { __typename?: 'Group', id: string, name: string, global?: boolean | null, description?: string | null } | null } | null> | null } | null> | null, onboardingChecklist?: { __typename?: 'OnboardingChecklist', dismissed?: boolean | null, status?: OnboardingChecklistState | null } | null, invites?: Array<{ __typename?: 'Invite', id: string, email?: string | null } | null> | null, roles?: { __typename?: 'Roles', admin?: boolean | null } | null, groups?: Array<{ __typename?: 'Group', id: string, name: string, global?: boolean | null, description?: string | null } | null> | null } | null, configuration?: { __typename?: 'PluralConfiguration', stripeConnectId?: string | null, stripePublishableKey?: string | null, registry?: string | null, gitCommit?: string | null } | null };
export type MeQuery = { __typename?: 'RootQueryType', me?: { __typename?: 'User', demoing?: boolean | null, loginMethod?: LoginMethod | null, hasInstallations?: boolean | null, hasShell?: boolean | null, intercomId?: string | null, id: string, name: string, email: string, avatar?: string | null, provider?: Provider | null, demoed?: boolean | null, onboarding?: OnboardingState | null, emailConfirmed?: boolean | null, emailConfirmBy?: Date | null, backgroundColor?: string | null, serviceAccount?: boolean | null, account: { __typename?: 'Account', id: string, name?: string | null, billingCustomerId?: string | null, backgroundColor?: string | null, userCount?: string | null, trialed?: boolean | null, rootUser?: { __typename?: 'User', id: string, name: string, email: string } | null, domainMappings?: Array<{ __typename?: 'DomainMapping', id: string, domain: string, enableSso?: boolean | null } | null> | null }, publisher?: { __typename?: 'Publisher', billingAccountId?: string | null, id?: string | null, name: string, phone?: string | null, avatar?: string | null, description?: string | null, backgroundColor?: string | null, owner?: { __typename?: 'User', id: string, name: string, email: string, avatar?: string | null, provider?: Provider | null, demoed?: boolean | null, onboarding?: OnboardingState | null, emailConfirmed?: boolean | null, emailConfirmBy?: Date | null, backgroundColor?: string | null, serviceAccount?: boolean | null, hasInstallations?: boolean | null, hasShell?: boolean | null, onboardingChecklist?: { __typename?: 'OnboardingChecklist', dismissed?: boolean | null, status?: OnboardingChecklistState | null } | null, invites?: Array<{ __typename?: 'Invite', id: string, email?: string | null } | null> | null, roles?: { __typename?: 'Roles', admin?: boolean | null } | null, groups?: Array<{ __typename?: 'Group', id: string, name: string, global?: boolean | null, description?: string | null } | null> | null, impersonationPolicy?: { __typename?: 'ImpersonationPolicy', id: string, bindings?: Array<{ __typename?: 'ImpersonationPolicyBinding', id: string, group?: { __typename?: 'Group', id: string, name: string } | null, user?: { __typename?: 'User', id: string, name: string, email: string } | null } | null> | null } | null } | null, address?: { __typename?: 'Address', line1?: string | null, line2?: string | null, city?: string | null, country?: string | null, state?: string | null, zip?: string | null } | null } | null, boundRoles?: Array<{ __typename?: 'Role', id: string, name: string, description?: string | null, repositories?: Array<string | null> | null, permissions?: Array<Permission | null> | null, roleBindings?: Array<{ __typename?: 'RoleBinding', id: string, user?: { __typename?: 'User', id: string, name: string, email: string, avatar?: string | null, provider?: Provider | null, demoed?: boolean | null, onboarding?: OnboardingState | null, emailConfirmed?: boolean | null, emailConfirmBy?: Date | null, backgroundColor?: string | null, serviceAccount?: boolean | null, hasInstallations?: boolean | null, hasShell?: boolean | null, onboardingChecklist?: { __typename?: 'OnboardingChecklist', dismissed?: boolean | null, status?: OnboardingChecklistState | null } | null, invites?: Array<{ __typename?: 'Invite', id: string, email?: string | null } | null> | null, roles?: { __typename?: 'Roles', admin?: boolean | null } | null, groups?: Array<{ __typename?: 'Group', id: string, name: string, global?: boolean | null, description?: string | null } | null> | null, impersonationPolicy?: { __typename?: 'ImpersonationPolicy', id: string, bindings?: Array<{ __typename?: 'ImpersonationPolicyBinding', id: string, group?: { __typename?: 'Group', id: string, name: string } | null, user?: { __typename?: 'User', id: string, name: string, email: string } | null } | null> | null } | null } | null, group?: { __typename?: 'Group', id: string, name: string, global?: boolean | null, description?: string | null } | null } | null> | null } | null> | null, onboardingChecklist?: { __typename?: 'OnboardingChecklist', dismissed?: boolean | null, status?: OnboardingChecklistState | null } | null, invites?: Array<{ __typename?: 'Invite', id: string, email?: string | null } | null> | null, roles?: { __typename?: 'Roles', admin?: boolean | null } | null, groups?: Array<{ __typename?: 'Group', id: string, name: string, global?: boolean | null, description?: string | null } | null> | null, impersonationPolicy?: { __typename?: 'ImpersonationPolicy', id: string, bindings?: Array<{ __typename?: 'ImpersonationPolicyBinding', id: string, group?: { __typename?: 'Group', id: string, name: string } | null, user?: { __typename?: 'User', id: string, name: string, email: string } | null } | null> | null } | null } | null, configuration?: { __typename?: 'PluralConfiguration', stripeConnectId?: string | null, stripePublishableKey?: string | null, registry?: string | null, gitCommit?: string | null } | null };

export type GetLoginMethodQueryVariables = Exact<{
email: Scalars['String']['input'];
Expand Down

0 comments on commit cd58795

Please sign in to comment.