Merge branch 'main' into andrew/specklecon-banner-dismissable

This commit is contained in:
andrewwallacespeckle
2025-05-21 11:49:54 +02:00
8 changed files with 52 additions and 16 deletions
@@ -56,7 +56,6 @@ const props = defineProps<{
const { mutateActiveWorkspaceSlug, mutateIsProjectsActive, activeWorkspaceSlug } =
useNavigation()
const { $intercom } = useNuxtApp()
const formattedName = computed(() => props.name || props.workspace?.name || '')
const tag = computed(() => {
@@ -73,7 +72,6 @@ const onClick = () => {
if (props.workspace) {
navigateTo(workspaceRoute(props.workspace.slug))
mutateActiveWorkspaceSlug(props.workspace.slug)
$intercom.updateCompany()
} else {
mutateIsProjectsActive(true)
navigateTo(projectsRoute)
@@ -50,6 +50,7 @@ export const useBillingActions = () => {
settingsBillingCancelCheckoutSessionMutation
)
const logger = useLogger()
const { $intercom } = useNuxtApp()
const billingPortalRedirect = async (workspaceId: MaybeNullOrUndefined<string>) => {
if (!workspaceId) {
@@ -156,12 +157,18 @@ export const useBillingActions = () => {
.catch(convertThrowIntoFetchResult)
if (result.data) {
mixpanel.track('Workspace Upgraded', {
const metaData = {
plan,
cycle,
// eslint-disable-next-line camelcase
workspace_id: workspaceId
}
mixpanel.track('Workspace Upgraded', metaData)
$intercom.track('Workspace Upgraded', {
...metaData,
isExistingSubscription: false
})
$intercom.updateCompany()
triggerNotification({
type: ToastNotificationType.Success,
@@ -212,12 +219,19 @@ export const useBillingActions = () => {
title: 'Your workspace plan was successfully updated'
})
mixpanel.track('Workspace Upgraded', {
const metaData = {
plan: workspace.plan?.name,
cycle: workspace.subscription?.billingInterval,
// eslint-disable-next-line camelcase
workspace_id: workspace.id
}
mixpanel.track('Workspace Upgraded', metaData)
$intercom.track('Workspace Upgraded', {
...metaData,
isExistingSubscription: false
})
$intercom.updateCompany()
}
const currentQueryParams = { ...route.query }
@@ -204,7 +204,7 @@ type Documents = {
"\n query GendoAIRenders($versionId: String!, $projectId: String!) {\n project(id: $projectId) {\n id\n version(id: $versionId) {\n id\n gendoAIRenders {\n totalCount\n items {\n id\n createdAt\n updatedAt\n status\n gendoGenerationId\n prompt\n camera\n }\n }\n }\n }\n }\n": typeof types.GendoAiRendersDocument,
"\n subscription ProjectVersionGendoAIRenderCreated($id: String!, $versionId: String!) {\n projectVersionGendoAIRenderCreated(id: $id, versionId: $versionId) {\n id\n createdAt\n updatedAt\n status\n gendoGenerationId\n prompt\n camera\n }\n }\n": typeof types.ProjectVersionGendoAiRenderCreatedDocument,
"\n subscription ProjectVersionGendoAIRenderUpdated($id: String!, $versionId: String!) {\n projectVersionGendoAIRenderUpdated(id: $id, versionId: $versionId) {\n id\n projectId\n modelId\n versionId\n createdAt\n updatedAt\n gendoGenerationId\n status\n prompt\n camera\n responseImage\n }\n }\n": typeof types.ProjectVersionGendoAiRenderUpdatedDocument,
"\n query IntercomActiveWorkspace($slug: String!) {\n workspaceBySlug(slug: $slug) {\n id\n name\n plan {\n name\n status\n }\n subscription {\n createdAt\n updatedAt\n currentBillingCycleEnd\n }\n team {\n totalCount\n }\n }\n }\n": typeof types.IntercomActiveWorkspaceDocument,
"\n query IntercomActiveWorkspace($slug: String!) {\n workspaceBySlug(slug: $slug) {\n id\n name\n plan {\n name\n status\n }\n subscription {\n createdAt\n updatedAt\n currentBillingCycleEnd\n }\n team {\n totalCount\n }\n projects {\n totalCount\n }\n }\n }\n": typeof types.IntercomActiveWorkspaceDocument,
"\n query InviteUserSearch($input: UsersRetrievalInput!) {\n users(input: $input) {\n items {\n id\n name\n avatar\n }\n }\n }\n": typeof types.InviteUserSearchDocument,
"\n mutation CreateNewRegion($input: CreateServerRegionInput!) {\n serverInfoMutations {\n multiRegion {\n create(input: $input) {\n id\n ...SettingsServerRegionsAddEditDialog_ServerRegionItem\n ...SettingsServerRegionsTable_ServerRegionItem\n }\n }\n }\n }\n": typeof types.CreateNewRegionDocument,
"\n mutation UpdateRegion($input: UpdateServerRegionInput!) {\n serverInfoMutations {\n multiRegion {\n update(input: $input) {\n id\n ...SettingsServerRegionsAddEditDialog_ServerRegionItem\n ...SettingsServerRegionsTable_ServerRegionItem\n }\n }\n }\n }\n": typeof types.UpdateRegionDocument,
@@ -619,7 +619,7 @@ const documents: Documents = {
"\n query GendoAIRenders($versionId: String!, $projectId: String!) {\n project(id: $projectId) {\n id\n version(id: $versionId) {\n id\n gendoAIRenders {\n totalCount\n items {\n id\n createdAt\n updatedAt\n status\n gendoGenerationId\n prompt\n camera\n }\n }\n }\n }\n }\n": types.GendoAiRendersDocument,
"\n subscription ProjectVersionGendoAIRenderCreated($id: String!, $versionId: String!) {\n projectVersionGendoAIRenderCreated(id: $id, versionId: $versionId) {\n id\n createdAt\n updatedAt\n status\n gendoGenerationId\n prompt\n camera\n }\n }\n": types.ProjectVersionGendoAiRenderCreatedDocument,
"\n subscription ProjectVersionGendoAIRenderUpdated($id: String!, $versionId: String!) {\n projectVersionGendoAIRenderUpdated(id: $id, versionId: $versionId) {\n id\n projectId\n modelId\n versionId\n createdAt\n updatedAt\n gendoGenerationId\n status\n prompt\n camera\n responseImage\n }\n }\n": types.ProjectVersionGendoAiRenderUpdatedDocument,
"\n query IntercomActiveWorkspace($slug: String!) {\n workspaceBySlug(slug: $slug) {\n id\n name\n plan {\n name\n status\n }\n subscription {\n createdAt\n updatedAt\n currentBillingCycleEnd\n }\n team {\n totalCount\n }\n }\n }\n": types.IntercomActiveWorkspaceDocument,
"\n query IntercomActiveWorkspace($slug: String!) {\n workspaceBySlug(slug: $slug) {\n id\n name\n plan {\n name\n status\n }\n subscription {\n createdAt\n updatedAt\n currentBillingCycleEnd\n }\n team {\n totalCount\n }\n projects {\n totalCount\n }\n }\n }\n": types.IntercomActiveWorkspaceDocument,
"\n query InviteUserSearch($input: UsersRetrievalInput!) {\n users(input: $input) {\n items {\n id\n name\n avatar\n }\n }\n }\n": types.InviteUserSearchDocument,
"\n mutation CreateNewRegion($input: CreateServerRegionInput!) {\n serverInfoMutations {\n multiRegion {\n create(input: $input) {\n id\n ...SettingsServerRegionsAddEditDialog_ServerRegionItem\n ...SettingsServerRegionsTable_ServerRegionItem\n }\n }\n }\n }\n": types.CreateNewRegionDocument,
"\n mutation UpdateRegion($input: UpdateServerRegionInput!) {\n serverInfoMutations {\n multiRegion {\n update(input: $input) {\n id\n ...SettingsServerRegionsAddEditDialog_ServerRegionItem\n ...SettingsServerRegionsTable_ServerRegionItem\n }\n }\n }\n }\n": types.UpdateRegionDocument,
@@ -1621,7 +1621,7 @@ export function graphql(source: "\n subscription ProjectVersionGendoAIRenderUpd
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query IntercomActiveWorkspace($slug: String!) {\n workspaceBySlug(slug: $slug) {\n id\n name\n plan {\n name\n status\n }\n subscription {\n createdAt\n updatedAt\n currentBillingCycleEnd\n }\n team {\n totalCount\n }\n }\n }\n"): (typeof documents)["\n query IntercomActiveWorkspace($slug: String!) {\n workspaceBySlug(slug: $slug) {\n id\n name\n plan {\n name\n status\n }\n subscription {\n createdAt\n updatedAt\n currentBillingCycleEnd\n }\n team {\n totalCount\n }\n }\n }\n"];
export function graphql(source: "\n query IntercomActiveWorkspace($slug: String!) {\n workspaceBySlug(slug: $slug) {\n id\n name\n plan {\n name\n status\n }\n subscription {\n createdAt\n updatedAt\n currentBillingCycleEnd\n }\n team {\n totalCount\n }\n projects {\n totalCount\n }\n }\n }\n"): (typeof documents)["\n query IntercomActiveWorkspace($slug: String!) {\n workspaceBySlug(slug: $slug) {\n id\n name\n plan {\n name\n status\n }\n subscription {\n createdAt\n updatedAt\n currentBillingCycleEnd\n }\n team {\n totalCount\n }\n projects {\n totalCount\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@@ -5769,7 +5769,7 @@ export type IntercomActiveWorkspaceQueryVariables = Exact<{
}>;
export type IntercomActiveWorkspaceQuery = { __typename?: 'Query', workspaceBySlug: { __typename?: 'Workspace', id: string, name: string, plan?: { __typename?: 'WorkspacePlan', name: WorkspacePlans, status: WorkspacePlanStatuses } | null, subscription?: { __typename?: 'WorkspaceSubscription', createdAt: string, updatedAt: string, currentBillingCycleEnd: string } | null, team: { __typename?: 'WorkspaceCollaboratorCollection', totalCount: number } } };
export type IntercomActiveWorkspaceQuery = { __typename?: 'Query', workspaceBySlug: { __typename?: 'Workspace', id: string, name: string, plan?: { __typename?: 'WorkspacePlan', name: WorkspacePlans, status: WorkspacePlanStatuses } | null, subscription?: { __typename?: 'WorkspaceSubscription', createdAt: string, updatedAt: string, currentBillingCycleEnd: string } | null, team: { __typename?: 'WorkspaceCollaboratorCollection', totalCount: number }, projects: { __typename?: 'ProjectCollection', totalCount: number } } };
export type InviteUserSearchQueryVariables = Exact<{
input: UsersRetrievalInput;
@@ -7387,7 +7387,7 @@ export const GendoAiRenderDocument = {"kind":"Document","definitions":[{"kind":"
export const GendoAiRendersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GendoAIRenders"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"versionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"projectId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"project"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"projectId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"version"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"versionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"gendoAIRenders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"gendoGenerationId"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"camera"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GendoAiRendersQuery, GendoAiRendersQueryVariables>;
export const ProjectVersionGendoAiRenderCreatedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"ProjectVersionGendoAIRenderCreated"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"versionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projectVersionGendoAIRenderCreated"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"versionId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"versionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"gendoGenerationId"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"camera"}}]}}]}}]} as unknown as DocumentNode<ProjectVersionGendoAiRenderCreatedSubscription, ProjectVersionGendoAiRenderCreatedSubscriptionVariables>;
export const ProjectVersionGendoAiRenderUpdatedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"ProjectVersionGendoAIRenderUpdated"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"versionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projectVersionGendoAIRenderUpdated"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"versionId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"versionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"versionId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"gendoGenerationId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"camera"}},{"kind":"Field","name":{"kind":"Name","value":"responseImage"}}]}}]}}]} as unknown as DocumentNode<ProjectVersionGendoAiRenderUpdatedSubscription, ProjectVersionGendoAiRenderUpdatedSubscriptionVariables>;
export const IntercomActiveWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IntercomActiveWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaceBySlug"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"plan"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingCycleEnd"}}]}},{"kind":"Field","name":{"kind":"Name","value":"team"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]}}]} as unknown as DocumentNode<IntercomActiveWorkspaceQuery, IntercomActiveWorkspaceQueryVariables>;
export const IntercomActiveWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IntercomActiveWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaceBySlug"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"plan"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingCycleEnd"}}]}},{"kind":"Field","name":{"kind":"Name","value":"team"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}},{"kind":"Field","name":{"kind":"Name","value":"projects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]}}]} as unknown as DocumentNode<IntercomActiveWorkspaceQuery, IntercomActiveWorkspaceQueryVariables>;
export const InviteUserSearchDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"InviteUserSearch"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UsersRetrievalInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"users"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatar"}}]}}]}}]}}]} as unknown as DocumentNode<InviteUserSearchQuery, InviteUserSearchQueryVariables>;
export const CreateNewRegionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateNewRegion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateServerRegionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"serverInfoMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"multiRegion"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"create"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SettingsServerRegionsAddEditDialog_ServerRegionItem"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SettingsServerRegionsTable_ServerRegionItem"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SettingsServerRegionsAddEditDialog_ServerRegionItem"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ServerRegionItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"key"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SettingsServerRegionsTable_ServerRegionItem"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ServerRegionItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode<CreateNewRegionMutation, CreateNewRegionMutationVariables>;
export const UpdateRegionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateRegion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateServerRegionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"serverInfoMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"multiRegion"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"update"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SettingsServerRegionsAddEditDialog_ServerRegionItem"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SettingsServerRegionsTable_ServerRegionItem"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SettingsServerRegionsAddEditDialog_ServerRegionItem"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ServerRegionItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"key"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SettingsServerRegionsTable_ServerRegionItem"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ServerRegionItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode<UpdateRegionMutation, UpdateRegionMutationVariables>;
@@ -17,6 +17,9 @@ export const intercomActiveWorkspaceQuery = graphql(`
team {
totalCount
}
projects {
totalCount
}
}
}
`)
@@ -13,6 +13,7 @@ export const useNavigationState = () =>
export const useNavigation = () => {
const state = useNavigationState()
const { mutate } = useMutation(setActiveWorkspaceMutation)
const { $intercom } = useNuxtApp()
const activeWorkspaceSlug = computed({
get: () => state.value.activeWorkspaceSlug,
@@ -28,6 +29,7 @@ export const useNavigation = () => {
state.value.activeWorkspaceSlug = newVal
state.value.isProjectsActive = false
await mutate({ slug: newVal, isProjectsActive: false })
$intercom.updateCompany()
}
const mutateIsProjectsActive = async (isActive: boolean) => {
@@ -66,6 +66,7 @@ export const useWorkspacesWizard = () => {
updateWorkspaceCreationStateMutation
)
const { mutateActiveWorkspaceSlug } = useNavigation()
const { $intercom } = useNuxtApp()
const isLoading = computed({
get: () => wizardState.value.isLoading,
@@ -272,18 +273,23 @@ export const useWorkspacesWizard = () => {
).catch(convertThrowIntoFetchResult)
if (result?.data?.workspaceMutations.updateCreationState) {
mixpanel.track('Workspace Created', {
const metaPayload = {
plan: state.plan,
billingInterval: state.billingInterval,
source: 'wizard',
// eslint-disable-next-line camelcase
workspace_id: workspaceId
}
mixpanel.track('Workspace Created', {
...metaPayload,
fields: Object.keys(state).filter(
(key) =>
key !== 'id' &&
(key !== 'invites' || (state.invites && state.invites.length > 0))
) as Array<keyof WorkspaceWizardState>,
// eslint-disable-next-line camelcase
workspace_id: workspaceId
) as Array<keyof WorkspaceWizardState>
})
$intercom.track('Workspace Created', metaPayload)
}
if (
+16 -3
View File
@@ -2,7 +2,13 @@ import { useOnAuthStateChange } from '~/lib/auth/composables/auth'
import { useIsWorkspacesEnabled } from '~/composables/globals'
import { useNavigation } from '~/lib/navigation/composables/navigation'
import { watch, computed, ref } from 'vue'
import Intercom, { shutdown, show, hide, update } from '@intercom/messenger-js-sdk'
import Intercom, {
shutdown,
show,
hide,
update,
trackEvent
} from '@intercom/messenger-js-sdk'
import { useApolloClient } from '@vue/apollo-composable'
import { intercomActiveWorkspaceQuery } from '~~/lib/intercom/graphql/queries'
@@ -78,9 +84,14 @@ export const useIntercom = () => {
isInitialized.value = false
}
const trackIntercom = (event: string, metadata?: Record<string, unknown>) => {
if (!isInitialized.value) return
trackEvent(event, metadata)
}
// Fetch active workspace and add to the user as a company
const updateCompany = async () => {
if (!activeWorkspaceSlug.value) return
if (!activeWorkspaceSlug.value || !isInitialized.value) return
const workspace = await apollo.query({
query: intercomActiveWorkspaceQuery,
@@ -95,8 +106,9 @@ export const useIntercom = () => {
company: {
id: workspace.data?.workspaceBySlug.id,
name: workspace.data?.workspaceBySlug.name,
people: workspace.data?.workspaceBySlug.team?.totalCount,
/* eslint-disable camelcase */
project_count: workspace.data?.workspaceBySlug.projects?.totalCount,
team_count: workspace.data?.workspaceBySlug.team?.totalCount,
plan_name: workspace.data?.workspaceBySlug.plan?.name,
plan_status: workspace.data?.workspaceBySlug.plan?.status,
subscription_created_at:
@@ -131,6 +143,7 @@ export const useIntercom = () => {
show: showIntercom,
hide: hideIntercom,
shutdown: shutdownIntercom,
track: trackIntercom,
updateCompany
}
}