diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql index 7b80988fd8..4bb660e7f4 100644 --- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql +++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql @@ -964,6 +964,7 @@ type Workspace { billingSubscriptions: [BillingSubscription!]! installedApplications: [Application!]! currentBillingSubscription: BillingSubscription + billingCustomer: BillingCustomer billingEntitlements: [BillingEntitlement!]! hasValidSignedEnterpriseKey: Boolean! hasValidEnterpriseValidityToken: Boolean! @@ -1554,6 +1555,11 @@ type BillingSubscriptionItem { billingProduct: BillingProductDTO! } +type BillingCustomer { + id: UUID! + hasPaymentMethod: Boolean +} + type BillingSubscription { id: UUID! status: SubscriptionStatus! @@ -3029,7 +3035,7 @@ type Query { apiKey(input: GetApiKeyInput!): ApiKey getInviteSuggestions: [InviteSuggestion!]! applicationConnectionProviders(applicationId: UUID!): [ApplicationConnectionProvider!]! - billingPortalSession(returnUrlPath: String): BillingSession! + billingPortalSession(returnUrlPath: String, forPaymentMethodUpdate: Boolean): BillingSession! listPlans: [BillingPlan!]! getResourceCreditUsage: [BillingResourceCreditUsage!]! findWorkspaceInvitations: [WorkspaceInvitation!]! diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.ts index edabf23a18..22bceee3f8 100644 --- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts +++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts @@ -682,6 +682,7 @@ export interface Workspace { billingSubscriptions: BillingSubscription[] installedApplications: Application[] currentBillingSubscription?: BillingSubscription + billingCustomer?: BillingCustomer billingEntitlements: BillingEntitlement[] hasValidSignedEnterpriseKey: Scalars['Boolean'] hasValidEnterpriseValidityToken: Scalars['Boolean'] @@ -1212,6 +1213,12 @@ export interface BillingSubscriptionItem { __typename: 'BillingSubscriptionItem' } +export interface BillingCustomer { + id: Scalars['UUID'] + hasPaymentMethod?: Scalars['Boolean'] + __typename: 'BillingCustomer' +} + export interface BillingSubscription { id: Scalars['UUID'] status: SubscriptionStatus @@ -3691,6 +3698,7 @@ export interface WorkspaceGenqlSelection{ billingSubscriptions?: BillingSubscriptionGenqlSelection installedApplications?: ApplicationGenqlSelection currentBillingSubscription?: BillingSubscriptionGenqlSelection + billingCustomer?: BillingCustomerGenqlSelection billingEntitlements?: BillingEntitlementGenqlSelection hasValidSignedEnterpriseKey?: boolean | number hasValidEnterpriseValidityToken?: boolean | number @@ -4246,6 +4254,13 @@ export interface BillingSubscriptionItemGenqlSelection{ __scalar?: boolean | number } +export interface BillingCustomerGenqlSelection{ + id?: boolean | number + hasPaymentMethod?: boolean | number + __typename?: boolean | number + __scalar?: boolean | number +} + export interface BillingSubscriptionGenqlSelection{ id?: boolean | number status?: boolean | number @@ -5782,7 +5797,7 @@ export interface QueryGenqlSelection{ apiKey?: (ApiKeyGenqlSelection & { __args: {input: GetApiKeyInput} }) getInviteSuggestions?: InviteSuggestionGenqlSelection applicationConnectionProviders?: (ApplicationConnectionProviderGenqlSelection & { __args: {applicationId: Scalars['UUID']} }) - billingPortalSession?: (BillingSessionGenqlSelection & { __args?: {returnUrlPath?: (Scalars['String'] | null)} }) + billingPortalSession?: (BillingSessionGenqlSelection & { __args?: {returnUrlPath?: (Scalars['String'] | null), forPaymentMethodUpdate?: (Scalars['Boolean'] | null)} }) listPlans?: BillingPlanGenqlSelection getResourceCreditUsage?: BillingResourceCreditUsageGenqlSelection findWorkspaceInvitations?: WorkspaceInvitationGenqlSelection @@ -7272,6 +7287,14 @@ export interface LogicFunctionLogsInput {applicationId?: (Scalars['UUID'] | null + const BillingCustomer_possibleTypes: string[] = ['BillingCustomer'] + export const isBillingCustomer = (obj?: { __typename?: any } | null): obj is BillingCustomer => { + if (!obj?.__typename) throw new Error('__typename is missing in "isBillingCustomer"') + return BillingCustomer_possibleTypes.includes(obj.__typename) + } + + + const BillingSubscription_possibleTypes: string[] = ['BillingSubscription'] export const isBillingSubscription = (obj?: { __typename?: any } | null): obj is BillingSubscription => { if (!obj?.__typename) throw new Error('__typename is missing in "isBillingSubscription"') diff --git a/packages/twenty-client-sdk/src/metadata/generated/types.ts b/packages/twenty-client-sdk/src/metadata/generated/types.ts index e59fd6b6e5..b7ab046889 100644 --- a/packages/twenty-client-sdk/src/metadata/generated/types.ts +++ b/packages/twenty-client-sdk/src/metadata/generated/types.ts @@ -47,42 +47,42 @@ export default { 136, 137, 139, - 147, - 159, - 162, - 164, - 168, - 170, - 175, + 148, + 160, + 163, + 165, + 169, + 171, 176, - 183, - 186, - 189, - 202, - 217, - 229, - 235, - 271, - 273, + 177, + 184, + 187, + 190, + 203, + 218, + 230, + 236, + 272, 274, 275, 276, 277, 278, 279, - 286, - 324, + 280, + 287, 325, 326, 327, - 329, - 331, - 342, - 349, - 356, - 479, - 484, - 492 + 328, + 330, + 332, + 343, + 350, + 357, + 480, + 485, + 493 ], "types": { "BillingProductDTO": { @@ -962,10 +962,10 @@ export default { 3 ], "relation": [ - 201 + 202 ], "morphRelations": [ - 201 + 202 ], "object": [ 56 @@ -1027,7 +1027,7 @@ export default { 46 ], "objectMetadata": [ - 209, + 210, { "paging": [ 49, @@ -1040,7 +1040,7 @@ export default { } ], "indexFieldMetadatas": [ - 207, + 208, { "paging": [ 49, @@ -1294,7 +1294,7 @@ export default { 47 ], "fields": [ - 214, + 215, { "paging": [ 49, @@ -1307,7 +1307,7 @@ export default { } ], "indexMetadatas": [ - 212, + 213, { "paging": [ 49, @@ -1903,19 +1903,22 @@ export default { 59 ], "featureFlags": [ - 169 + 170 ], "billingSubscriptions": [ - 146 + 147 ], "installedApplications": [ 59 ], "currentBillingSubscription": [ + 147 + ], + "billingCustomer": [ 146 ], "billingEntitlements": [ - 228 + 229 ], "hasValidSignedEnterpriseKey": [ 6 @@ -1924,7 +1927,7 @@ export default { 6 ], "workspaceUrls": [ - 171 + 172 ], "workspaceCustomApplicationId": [ 1 @@ -2013,7 +2016,7 @@ export default { 20 ], "deletedWorkspaceMembers": [ - 227 + 228 ], "hasPassword": [ 6 @@ -2025,7 +2028,7 @@ export default { 17 ], "availableWorkspaces": [ - 226 + 227 ], "__typename": [ 1 @@ -3076,12 +3079,23 @@ export default { 1 ] }, + "BillingCustomer": { + "id": [ + 3 + ], + "hasPaymentMethod": [ + 6 + ], + "__typename": [ + 1 + ] + }, "BillingSubscription": { "id": [ 3 ], "status": [ - 147 + 148 ], "interval": [ 139 @@ -3105,7 +3119,7 @@ export default { "SubscriptionStatus": {}, "BillingEndTrialPeriod": { "status": [ - 147 + 148 ], "hasPaymentMethod": [ 6 @@ -3173,10 +3187,10 @@ export default { }, "BillingUpdate": { "currentBillingSubscription": [ - 146 + 147 ], "billingSubscriptions": [ - 146 + 147 ], "__typename": [ 1 @@ -3226,7 +3240,7 @@ export default { 1 ], "result": [ - 155 + 156 ], "__typename": [ 1 @@ -3263,7 +3277,7 @@ export default { 3 ], "type": [ - 159 + 160 ], "name": [ 1 @@ -3296,7 +3310,7 @@ export default { 4 ], "targetRecordIdentifier": [ - 157 + 158 ], "__typename": [ 1 @@ -3322,7 +3336,7 @@ export default { }, "MetadataEvent": { "type": [ - 162 + 163 ], "metadataName": [ 1 @@ -3331,7 +3345,7 @@ export default { 1 ], "properties": [ - 160 + 161 ], "updatedCollectionHash": [ 1 @@ -3343,7 +3357,7 @@ export default { "MetadataEventAction": {}, "ObjectRecordEvent": { "action": [ - 164 + 165 ], "objectNameSingular": [ 1 @@ -3358,7 +3372,7 @@ export default { 1 ], "properties": [ - 160 + 161 ], "__typename": [ 1 @@ -3370,7 +3384,7 @@ export default { 1 ], "objectRecordEvent": [ - 163 + 164 ], "__typename": [ 1 @@ -3381,10 +3395,10 @@ export default { 1 ], "objectRecordEventsWithQueryIds": [ - 165 + 166 ], "metadataEvents": [ - 161 + 162 ], "__typename": [ 1 @@ -3401,7 +3415,7 @@ export default { 11 ], "status": [ - 168 + 169 ], "error": [ 15 @@ -3413,7 +3427,7 @@ export default { "LogicFunctionExecutionStatus": {}, "FeatureFlag": { "key": [ - 170 + 171 ], "value": [ 6 @@ -3485,10 +3499,10 @@ export default { 1 ], "type": [ - 175 + 176 ], "status": [ - 176 + 177 ], "issuer": [ 1 @@ -3501,7 +3515,7 @@ export default { "SSOIdentityProviderStatus": {}, "AuthProviders": { "sso": [ - 174 + 175 ], "google": [ 6 @@ -3538,10 +3552,10 @@ export default { 3 ], "authProviders": [ - 177 + 178 ], "authBypassProviders": [ - 178 + 179 ], "logo": [ 1 @@ -3550,7 +3564,7 @@ export default { 1 ], "workspaceUrls": [ - 171 + 172 ], "__typename": [ 1 @@ -3589,7 +3603,7 @@ export default { 1 ], "modelFamily": [ - 183 + 184 ], "modelFamilyLabel": [ 1 @@ -3604,7 +3618,7 @@ export default { 11 ], "nativeCapabilities": [ - 181 + 182 ], "isDeprecated": [ 6 @@ -3640,7 +3654,7 @@ export default { 1 ], "trialPeriods": [ - 173 + 174 ], "__typename": [ 1 @@ -3648,7 +3662,7 @@ export default { }, "Support": { "supportDriver": [ - 186 + 187 ], "supportFrontChatId": [ 1 @@ -3674,7 +3688,7 @@ export default { }, "Captcha": { "provider": [ - 189 + 190 ], "siteKey": [ 1 @@ -3708,10 +3722,10 @@ export default { }, "PublicFeatureFlag": { "key": [ - 170 + 171 ], "metadata": [ - 191 + 192 ], "__typename": [ 1 @@ -3736,13 +3750,13 @@ export default { 1 ], "authProviders": [ - 177 + 178 ], "billing": [ - 184 + 185 ], "aiModels": [ - 182 + 183 ], "signInPrefilled": [ 6 @@ -3763,25 +3777,25 @@ export default { 6 ], "support": [ - 185 + 186 ], "isAttachmentPreviewEnabled": [ 6 ], "sentry": [ - 187 - ], - "captcha": [ 188 ], + "captcha": [ + 189 + ], "api": [ - 190 + 191 ], "canManageFeatureFlags": [ 6 ], "publicFeatureFlags": [ - 192 + 193 ], "isMicrosoftMessagingEnabled": [ 6 @@ -3820,7 +3834,7 @@ export default { 6 ], "maintenance": [ - 193 + 194 ], "__typename": [ 1 @@ -3859,7 +3873,7 @@ export default { 1 ], "versionDistribution": [ - 196 + 197 ], "__typename": [ 1 @@ -3906,7 +3920,7 @@ export default { }, "Relation": { "type": [ - 202 + 203 ], "sourceObjectMetadata": [ 56 @@ -3955,10 +3969,10 @@ export default { }, "IndexConnection": { "pageInfo": [ - 204 + 205 ], "edges": [ - 203 + 204 ], "__typename": [ 1 @@ -3977,10 +3991,10 @@ export default { }, "IndexIndexFieldMetadatasConnection": { "pageInfo": [ - 204 + 205 ], "edges": [ - 206 + 207 ], "__typename": [ 1 @@ -3999,10 +4013,10 @@ export default { }, "IndexObjectMetadataConnection": { "pageInfo": [ - 204 + 205 ], "edges": [ - 208 + 209 ], "__typename": [ 1 @@ -4021,10 +4035,10 @@ export default { }, "ObjectConnection": { "pageInfo": [ - 204 + 205 ], "edges": [ - 208 + 209 ], "__typename": [ 1 @@ -4032,10 +4046,10 @@ export default { }, "ObjectIndexMetadatasConnection": { "pageInfo": [ - 204 + 205 ], "edges": [ - 203 + 204 ], "__typename": [ 1 @@ -4054,10 +4068,10 @@ export default { }, "ObjectFieldsConnection": { "pageInfo": [ - 204 + 205 ], "edges": [ - 213 + 214 ], "__typename": [ 1 @@ -4065,10 +4079,10 @@ export default { }, "FieldConnection": { "pageInfo": [ - 204 + 205 ], "edges": [ - 213 + 214 ], "__typename": [ 1 @@ -4076,7 +4090,7 @@ export default { }, "AppConnection": { "id": [ - 217 + 218 ], "providerName": [ 1 @@ -4128,7 +4142,7 @@ export default { 3 ], "type": [ - 175 + 176 ], "issuer": [ 1 @@ -4137,7 +4151,7 @@ export default { 1 ], "status": [ - 176 + 177 ], "__typename": [ 1 @@ -4156,7 +4170,7 @@ export default { }, "FindAvailableSSOIDP": { "type": [ - 175 + 176 ], "id": [ 3 @@ -4168,10 +4182,10 @@ export default { 1 ], "status": [ - 176 + 177 ], "workspace": [ - 221 + 222 ], "__typename": [ 1 @@ -4182,7 +4196,7 @@ export default { 3 ], "type": [ - 175 + 176 ], "issuer": [ 1 @@ -4191,7 +4205,7 @@ export default { 1 ], "status": [ - 176 + 177 ], "__typename": [ 1 @@ -4199,7 +4213,7 @@ export default { }, "SSOConnection": { "type": [ - 175 + 176 ], "id": [ 3 @@ -4211,7 +4225,7 @@ export default { 1 ], "status": [ - 176 + 177 ], "__typename": [ 1 @@ -4234,13 +4248,13 @@ export default { 1 ], "workspaceUrls": [ - 171 + 172 ], "logo": [ 1 ], "sso": [ - 224 + 225 ], "__typename": [ 1 @@ -4248,10 +4262,10 @@ export default { }, "AvailableWorkspaces": { "availableWorkspacesForSignIn": [ - 225 + 226 ], "availableWorkspacesForSignUp": [ - 225 + 226 ], "__typename": [ 1 @@ -4279,7 +4293,7 @@ export default { }, "BillingEntitlement": { "key": [ - 229 + 230 ], "value": [ 6 @@ -4317,7 +4331,7 @@ export default { 1 ], "records": [ - 230 + 231 ], "__typename": [ 1 @@ -4353,7 +4367,7 @@ export default { 1 ], "connectionSecurity": [ - 235 + 236 ], "__typename": [ 1 @@ -4362,13 +4376,13 @@ export default { "EmailConnectionSecurity": {}, "PublicImapSmtpCaldavConnectionParameters": { "IMAP": [ - 234 + 235 ], "SMTP": [ - 234 + 235 ], "CALDAV": [ - 234 + 235 ], "__typename": [ 1 @@ -4424,7 +4438,7 @@ export default { 4 ], "connectionParameters": [ - 236 + 237 ], "__typename": [ 1 @@ -4475,10 +4489,10 @@ export default { }, "AvailableWorkspacesAndAccessTokens": { "tokens": [ - 242 + 243 ], "availableWorkspaces": [ - 226 + 227 ], "__typename": [ 1 @@ -4516,7 +4530,7 @@ export default { }, "WorkspaceUrlsAndId": { "workspaceUrls": [ - 171 + 172 ], "id": [ 3 @@ -4530,7 +4544,7 @@ export default { 32 ], "workspace": [ - 247 + 248 ], "__typename": [ 1 @@ -4563,7 +4577,7 @@ export default { 32 ], "workspaceUrls": [ - 171 + 172 ], "__typename": [ 1 @@ -4604,7 +4618,7 @@ export default { }, "AuthTokens": { "tokens": [ - 242 + 243 ], "__typename": [ 1 @@ -4645,7 +4659,7 @@ export default { 32 ], "workspace": [ - 247 + 248 ], "__typename": [ 1 @@ -4667,7 +4681,7 @@ export default { 1 ], "dailyUsage": [ - 260 + 261 ], "__typename": [ 1 @@ -4675,16 +4689,16 @@ export default { }, "UsageAnalytics": { "usageByUser": [ - 195 + 196 ], "usageByOperationType": [ - 195 + 196 ], "usageByModel": [ - 195 + 196 ], "timeSeries": [ - 260 + 261 ], "periodStart": [ 4 @@ -4693,7 +4707,7 @@ export default { 4 ], "userDailyUsage": [ - 261 + 262 ], "__typename": [ 1 @@ -4850,10 +4864,10 @@ export default { 1 ], "status": [ - 271 + 272 ], "verificationRecords": [ - 269 + 270 ], "verifiedAt": [ 4 @@ -4868,22 +4882,22 @@ export default { 3 ], "visibility": [ - 273 + 274 ], "handle": [ 1 ], "type": [ - 274 + 275 ], "isContactAutoCreationEnabled": [ 6 ], "contactAutoCreationPolicy": [ - 275 + 276 ], "messageFolderImportPolicy": [ - 276 + 277 ], "excludeNonProfessionalEmails": [ 6 @@ -4892,7 +4906,7 @@ export default { 6 ], "pendingGroupEmailsAction": [ - 277 + 278 ], "isSyncEnabled": [ 6 @@ -4901,10 +4915,10 @@ export default { 4 ], "syncStatus": [ - 278 + 279 ], "syncStage": [ - 279 + 280 ], "syncStageStartedAt": [ 4 @@ -4925,7 +4939,7 @@ export default { 4 ], "connectedAccount": [ - 237 + 238 ], "__typename": [ 1 @@ -4940,7 +4954,7 @@ export default { "MessageChannelSyncStage": {}, "CreateEmailGroupChannelOutput": { "messageChannel": [ - 272 + 273 ], "forwardingAddress": [ 1 @@ -5002,7 +5016,7 @@ export default { 21 ], "skipped": [ - 283 + 284 ], "__typename": [ 1 @@ -5025,7 +5039,7 @@ export default { 1 ], "visibility": [ - 286 + 287 ], "__typename": [ 1 @@ -5071,7 +5085,7 @@ export default { 1 ], "location": [ - 288 + 289 ], "__typename": [ 1 @@ -5088,7 +5102,7 @@ export default { 1 ], "connectionSecurity": [ - 235 + 236 ], "__typename": [ 1 @@ -5096,13 +5110,13 @@ export default { }, "ImapSmtpCaldavPublicConnectionParameters": { "IMAP": [ - 290 + 291 ], "SMTP": [ - 290 + 291 ], "CALDAV": [ - 290 + 291 ], "__typename": [ 1 @@ -5122,7 +5136,7 @@ export default { 3 ], "connectionParameters": [ - 291 + 292 ], "__typename": [ 1 @@ -5324,7 +5338,7 @@ export default { 1 ], "series": [ - 299 + 300 ], "xAxisLabel": [ 1 @@ -5373,7 +5387,7 @@ export default { 1 ], "data": [ - 301 + 302 ], "__typename": [ 1 @@ -5381,7 +5395,7 @@ export default { }, "LineChartData": { "series": [ - 302 + 303 ], "xAxisLabel": [ 1 @@ -5418,7 +5432,7 @@ export default { }, "PieChartData": { "data": [ - 304 + 305 ], "showLegend": [ 6 @@ -5520,13 +5534,13 @@ export default { }, "EventLogQueryResult": { "records": [ - 309 + 310 ], "totalCount": [ 21 ], "pageInfo": [ - 310 + 311 ], "__typename": [ 1 @@ -5590,7 +5604,7 @@ export default { 1 ], "parts": [ - 296 + 297 ], "processedAt": [ 4 @@ -5604,7 +5618,7 @@ export default { }, "AgentChatThread": { "id": [ - 217 + 218 ], "title": [ 1 @@ -5659,7 +5673,7 @@ export default { }, "AiSystemPromptPreview": { "sections": [ - 315 + 316 ], "estimatedTokenCount": [ 21 @@ -5735,10 +5749,10 @@ export default { 3 ], "evaluations": [ - 320 + 321 ], "messages": [ - 313 + 314 ], "createdAt": [ 4 @@ -5769,19 +5783,19 @@ export default { 1 ], "syncStatus": [ - 324 - ], - "syncStage": [ 325 ], - "visibility": [ + "syncStage": [ 326 ], + "visibility": [ + 327 + ], "isContactAutoCreationEnabled": [ 6 ], "contactAutoCreationPolicy": [ - 327 + 328 ], "isSyncEnabled": [ 6 @@ -5832,7 +5846,7 @@ export default { 1 ], "pendingSyncAction": [ - 329 + 330 ], "messageChannelId": [ 3 @@ -5850,7 +5864,7 @@ export default { "MessageFolderPendingSyncAction": {}, "CollectionHash": { "collectionName": [ - 331 + 332 ], "hash": [ 1 @@ -5917,13 +5931,13 @@ export default { }, "MinimalMetadata": { "objectMetadataItems": [ - 332 - ], - "views": [ 333 ], + "views": [ + 334 + ], "collectionHashes": [ - 330 + 331 ], "__typename": [ 1 @@ -5931,10 +5945,10 @@ export default { }, "Query": { "navigationMenuItems": [ - 158 + 159 ], "navigationMenuItem": [ - 158, + 159, { "id": [ 3, @@ -6076,13 +6090,13 @@ export default { 2, { "input": [ - 336, + 337, "GetApiKeyInput!" ] } ], "getInviteSuggestions": [ - 153 + 154 ], "applicationConnectionProviders": [ 127, @@ -6094,21 +6108,24 @@ export default { } ], "billingPortalSession": [ - 151, + 152, { "returnUrlPath": [ 1 + ], + "forPaymentMethodUpdate": [ + 6 ] } ], "listPlans": [ - 150 + 151 ], "getResourceCreditUsage": [ - 149 + 150 ], "findWorkspaceInvitations": [ - 155 + 156 ], "getApprovedAccessDomains": [ 130 @@ -6173,7 +6190,7 @@ export default { 41, { "input": [ - 337, + 338, "LogicFunctionIdInput!" ] } @@ -6185,7 +6202,7 @@ export default { 15, { "input": [ - 337, + 338, "LogicFunctionIdInput!" ] } @@ -6194,7 +6211,7 @@ export default { 1, { "input": [ - 337, + 338, "LogicFunctionIdInput!" ] } @@ -6224,7 +6241,7 @@ export default { } ], "objectRecordCounts": [ - 210 + 211 ], "object": [ 56, @@ -6236,7 +6253,7 @@ export default { } ], "objects": [ - 211, + 212, { "paging": [ 49, @@ -6258,7 +6275,7 @@ export default { } ], "indexMetadatas": [ - 205, + 206, { "paging": [ 49, @@ -6277,28 +6294,28 @@ export default { 25, { "input": [ - 338, + 339, "AgentIdInput!" ] } ], "previewMessageCampaignAudience": [ - 281, + 282, { "input": [ - 339, + 340, "PreviewMessageCampaignAudienceInput!" ] } ], "unsubscribeTopics": [ - 285 + 286 ], "unsubscribePagePreviewUrl": [ 1 ], "myMessageChannels": [ - 272, + 273, { "connectedAccountId": [ 3 @@ -6306,16 +6323,16 @@ export default { } ], "getEmailingDomains": [ - 270 + 271 ], "myConnectedAccounts": [ - 237 + 238 ], "getRoles": [ 29 ], "getToolIndex": [ - 295 + 296 ], "getToolInputSchema": [ 15, @@ -6327,10 +6344,10 @@ export default { } ], "webhooks": [ - 294 + 295 ], "webhook": [ - 294, + 295, { "id": [ 3, @@ -6348,7 +6365,7 @@ export default { } ], "fields": [ - 215, + 216, { "paging": [ 49, @@ -6378,7 +6395,7 @@ export default { } ], "myMessageFolders": [ - 328, + 329, { "messageChannelId": [ 3 @@ -6386,7 +6403,7 @@ export default { } ], "myCalendarChannels": [ - 323, + 324, { "connectedAccountId": [ 3 @@ -6394,33 +6411,33 @@ export default { } ], "minimalMetadata": [ - 334 + 335 ], "appConnections": [ - 216, + 217, { "filter": [ - 340 + 341 ] } ], "appConnection": [ - 216, + 217, { "id": [ - 217, + 218, "ID!" ] } ], "findWorkspaceAiStats": [ - 322 + 323 ], "chatThreads": [ - 314 + 315 ], "chatThread": [ - 314, + 315, { "id": [ 3, @@ -6429,7 +6446,7 @@ export default { } ], "chatMessages": [ - 313, + 314, { "threadId": [ 3, @@ -6438,7 +6455,7 @@ export default { } ], "chatStreamCatchupChunks": [ - 317, + 318, { "threadId": [ 3, @@ -6447,13 +6464,13 @@ export default { } ], "getAiSystemPromptPreview": [ - 316 + 317 ], "skills": [ - 312 + 313 ], "skill": [ - 312, + 313, { "id": [ 3, @@ -6462,7 +6479,7 @@ export default { } ], "agentTurns": [ - 321, + 322, { "agentId": [ 3, @@ -6471,7 +6488,7 @@ export default { } ], "checkUserExists": [ - 257, + 258, { "email": [ 1, @@ -6483,7 +6500,7 @@ export default { } ], "checkWorkspaceInviteHashIsValid": [ - 258, + 259, { "inviteHash": [ 1, @@ -6501,7 +6518,7 @@ export default { } ], "checkWorkspaceSubdomainAvailability": [ - 252, + 253, { "subdomain": [ 1, @@ -6510,10 +6527,10 @@ export default { } ], "getWorkspaceCreationDefaults": [ - 253 + 254 ], "validatePasswordResetToken": [ - 250, + 251, { "passwordResetToken": [ 1, @@ -6522,7 +6539,7 @@ export default { } ], "findApplicationRegistrationByClientId": [ - 199, + 200, { "clientId": [ 1, @@ -6552,7 +6569,7 @@ export default { } ], "findApplicationRegistrationStats": [ - 197, + 198, { "id": [ 1, @@ -6561,7 +6578,7 @@ export default { } ], "findApplicationRegistrationVariables": [ - 172, + 173, { "applicationRegistrationId": [ 1, @@ -6585,7 +6602,7 @@ export default { 76 ], "getPublicWorkspaceDataByDomain": [ - 179, + 180, { "origin": [ 1 @@ -6593,7 +6610,7 @@ export default { } ], "getPublicWorkspaceDataById": [ - 180, + 181, { "id": [ 3, @@ -6616,46 +6633,46 @@ export default { } ], "getSSOIdentityProviders": [ - 222 + 223 ], "eventLogs": [ - 311, + 312, { "input": [ - 341, + 342, "EventLogQueryInput!" ] } ], "pieChartData": [ - 305, + 306, { "input": [ - 345, + 346, "PieChartDataInput!" ] } ], "lineChartData": [ - 303, + 304, { "input": [ - 346, + 347, "LineChartDataInput!" ] } ], "barChartData": [ - 300, + 301, { "input": [ - 347, + 348, "BarChartDataInput!" ] } ], "getConnectedImapSmtpCaldavAccount": [ - 292, + 293, { "id": [ 3, @@ -6664,7 +6681,7 @@ export default { } ], "getAutoCompleteAddress": [ - 287, + 288, { "address": [ 1, @@ -6683,7 +6700,7 @@ export default { } ], "getAddressDetails": [ - 289, + 290, { "placeId": [ 1, @@ -6696,21 +6713,21 @@ export default { } ], "getUsageAnalytics": [ - 262, + 263, { "input": [ - 348 + 349 ] } ], "findManyPublicDomains": [ - 268 + 269 ], "findManyMarketplaceApps": [ - 266 + 267 ], "findMarketplaceAppDetail": [ - 267, + 268, { "universalIdentifier": [ 1, @@ -6732,7 +6749,7 @@ export default { }, "LogicFunctionIdInput": { "id": [ - 217 + 218 ], "__typename": [ 1 @@ -6773,10 +6790,10 @@ export default { }, "EventLogQueryInput": { "table": [ - 342 + 343 ], "filters": [ - 343 + 344 ], "first": [ 21 @@ -6797,7 +6814,7 @@ export default { 1 ], "dateRange": [ - 344 + 345 ], "recordId": [ 1 @@ -6864,7 +6881,7 @@ export default { 1 ], "operationTypes": [ - 349 + 350 ], "__typename": [ 1 @@ -6876,7 +6893,7 @@ export default { 6, { "input": [ - 351, + 352, "AddQuerySubscriptionInput!" ] } @@ -6885,49 +6902,49 @@ export default { 6, { "input": [ - 352, + 353, "RemoveQueryFromEventStreamInput!" ] } ], "createManyNavigationMenuItems": [ - 158, + 159, { "inputs": [ - 353, + 354, "[CreateNavigationMenuItemInput!]!" ] } ], "createNavigationMenuItem": [ - 158, + 159, { "input": [ - 353, + 354, "CreateNavigationMenuItemInput!" ] } ], "updateManyNavigationMenuItems": [ - 158, + 159, { "inputs": [ - 354, + 355, "[UpdateOneNavigationMenuItemInput!]!" ] } ], "updateNavigationMenuItem": [ - 158, + 159, { "input": [ - 354, + 355, "UpdateOneNavigationMenuItemInput!" ] } ], "deleteManyNavigationMenuItems": [ - 158, + 159, { "ids": [ 3, @@ -6936,7 +6953,7 @@ export default { } ], "deleteNavigationMenuItem": [ - 158, + 159, { "id": [ 3, @@ -6948,7 +6965,7 @@ export default { 131, { "file": [ - 356, + 357, "Upload!" ] } @@ -6969,7 +6986,7 @@ export default { 131, { "file": [ - 356, + 357, "Upload!" ] } @@ -6978,7 +6995,7 @@ export default { 131, { "file": [ - 356, + 357, "Upload!" ] } @@ -6987,7 +7004,7 @@ export default { 131, { "file": [ - 356, + 357, "Upload!" ] } @@ -6996,7 +7013,7 @@ export default { 131, { "file": [ - 356, + 357, "Upload!" ] } @@ -7005,7 +7022,7 @@ export default { 131, { "file": [ - 356, + 357, "Upload!" ], "fieldMetadataId": [ @@ -7018,7 +7035,7 @@ export default { 131, { "file": [ - 356, + 357, "Upload!" ], "fieldMetadataUniversalIdentifier": [ @@ -7031,7 +7048,7 @@ export default { 62, { "input": [ - 357, + 358, "CreateViewFilterGroupInput!" ] } @@ -7044,7 +7061,7 @@ export default { "String!" ], "input": [ - 358, + 359, "UpdateViewFilterGroupInput!" ] } @@ -7071,7 +7088,7 @@ export default { 64, { "input": [ - 359, + 360, "CreateViewFilterInput!" ] } @@ -7080,7 +7097,7 @@ export default { 64, { "input": [ - 360, + 361, "UpdateViewFilterInput!" ] } @@ -7089,7 +7106,7 @@ export default { 64, { "input": [ - 362, + 363, "DeleteViewFilterInput!" ] } @@ -7098,7 +7115,7 @@ export default { 64, { "input": [ - 363, + 364, "DestroyViewFilterInput!" ] } @@ -7107,7 +7124,7 @@ export default { 70, { "input": [ - 364, + 365, "CreateViewInput!" ] } @@ -7120,7 +7137,7 @@ export default { "String!" ], "input": [ - 365, + 366, "UpdateViewInput!" ] } @@ -7147,7 +7164,7 @@ export default { 70, { "input": [ - 366, + 367, "UpsertViewWidgetInput!" ] } @@ -7156,7 +7173,7 @@ export default { 67, { "input": [ - 371, + 372, "CreateViewSortInput!" ] } @@ -7165,7 +7182,7 @@ export default { 67, { "input": [ - 372, + 373, "UpdateViewSortInput!" ] } @@ -7174,7 +7191,7 @@ export default { 6, { "input": [ - 374, + 375, "DeleteViewSortInput!" ] } @@ -7183,7 +7200,7 @@ export default { 6, { "input": [ - 375, + 376, "DestroyViewSortInput!" ] } @@ -7192,7 +7209,7 @@ export default { 60, { "input": [ - 376, + 377, "UpdateViewFieldInput!" ] } @@ -7201,7 +7218,7 @@ export default { 60, { "input": [ - 378, + 379, "CreateViewFieldInput!" ] } @@ -7210,7 +7227,7 @@ export default { 60, { "inputs": [ - 378, + 379, "[CreateViewFieldInput!]!" ] } @@ -7219,7 +7236,7 @@ export default { 60, { "input": [ - 379, + 380, "DeleteViewFieldInput!" ] } @@ -7228,7 +7245,7 @@ export default { 60, { "input": [ - 380, + 381, "DestroyViewFieldInput!" ] } @@ -7237,7 +7254,7 @@ export default { 69, { "input": [ - 381, + 382, "UpdateViewFieldGroupInput!" ] } @@ -7246,7 +7263,7 @@ export default { 69, { "input": [ - 383, + 384, "CreateViewFieldGroupInput!" ] } @@ -7255,7 +7272,7 @@ export default { 69, { "inputs": [ - 383, + 384, "[CreateViewFieldGroupInput!]!" ] } @@ -7264,7 +7281,7 @@ export default { 69, { "input": [ - 384, + 385, "DeleteViewFieldGroupInput!" ] } @@ -7273,7 +7290,7 @@ export default { 69, { "input": [ - 385, + 386, "DestroyViewFieldGroupInput!" ] } @@ -7282,7 +7299,7 @@ export default { 70, { "input": [ - 386, + 387, "UpsertFieldsWidgetInput!" ] } @@ -7291,7 +7308,7 @@ export default { 2, { "input": [ - 389, + 390, "CreateApiKeyInput!" ] } @@ -7300,7 +7317,7 @@ export default { 2, { "input": [ - 390, + 391, "UpdateApiKeyInput!" ] } @@ -7309,7 +7326,7 @@ export default { 2, { "input": [ - 391, + 392, "RevokeApiKeyInput!" ] } @@ -7328,10 +7345,10 @@ export default { } ], "skipSyncEmailOnboardingStep": [ - 154 + 155 ], "skipBookOnboardingStep": [ - 154 + 155 ], "updateOneApplicationVariable": [ 6, @@ -7351,7 +7368,7 @@ export default { } ], "checkoutSession": [ - 151, + 152, { "recurringInterval": [ 139, @@ -7371,19 +7388,19 @@ export default { } ], "switchSubscriptionInterval": [ - 152 + 153 ], "switchBillingPlan": [ - 152 + 153 ], "cancelSwitchBillingPlan": [ - 152 + 153 ], "cancelSwitchBillingInterval": [ - 152 + 153 ], "setResourceCreditSubscriptionPrice": [ - 152, + 153, { "priceId": [ 1, @@ -7392,10 +7409,10 @@ export default { } ], "endSubscriptionTrialPeriod": [ - 148 + 149 ], "cancelSwitchResourceCreditPrice": [ - 152 + 153 ], "deleteWorkspaceInvitation": [ 1, @@ -7407,7 +7424,7 @@ export default { } ], "resendWorkspaceInvitation": [ - 156, + 157, { "appTokenId": [ 1, @@ -7416,7 +7433,7 @@ export default { } ], "sendInvitations": [ - 156, + 157, { "emails": [ 1, @@ -7431,7 +7448,7 @@ export default { 130, { "input": [ - 392, + 393, "CreateApprovedAccessDomainInput!" ] } @@ -7440,7 +7457,7 @@ export default { 6, { "input": [ - 393, + 394, "DeleteApprovedAccessDomainInput!" ] } @@ -7449,7 +7466,7 @@ export default { 130, { "input": [ - 394, + 395, "ValidateApprovedAccessDomainInput!" ] } @@ -7458,7 +7475,7 @@ export default { 123, { "input": [ - 395, + 396, "CreatePageLayoutTabInput!" ] } @@ -7471,7 +7488,7 @@ export default { "String!" ], "input": [ - 396, + 397, "UpdatePageLayoutTabInput!" ] } @@ -7489,7 +7506,7 @@ export default { 124, { "input": [ - 397, + 398, "CreatePageLayoutInput!" ] } @@ -7502,7 +7519,7 @@ export default { "String!" ], "input": [ - 398, + 399, "UpdatePageLayoutInput!" ] } @@ -7524,7 +7541,7 @@ export default { "String!" ], "input": [ - 399, + 400, "UpdatePageLayoutWithTabsInput!" ] } @@ -7560,7 +7577,7 @@ export default { 85, { "input": [ - 403, + 404, "CreatePageLayoutWidgetInput!" ] } @@ -7573,7 +7590,7 @@ export default { "String!" ], "input": [ - 404, + 405, "UpdatePageLayoutWidgetInput!" ] } @@ -7591,7 +7608,7 @@ export default { 41, { "input": [ - 337, + 338, "LogicFunctionIdInput!" ] } @@ -7600,16 +7617,16 @@ export default { 41, { "input": [ - 405, + 406, "CreateLogicFunctionFromSourceInput!" ] } ], "executeOneLogicFunction": [ - 167, + 168, { "input": [ - 406, + 407, "ExecuteOneLogicFunctionInput!" ] } @@ -7618,7 +7635,7 @@ export default { 6, { "input": [ - 407, + 408, "UpdateLogicFunctionFromSourceInput!" ] } @@ -7627,7 +7644,7 @@ export default { 35, { "input": [ - 409, + 410, "CreateCommandMenuItemInput!" ] } @@ -7636,7 +7653,7 @@ export default { 35, { "input": [ - 410, + 411, "UpdateCommandMenuItemInput!" ] } @@ -7663,7 +7680,7 @@ export default { 34, { "input": [ - 411, + 412, "CreateFrontComponentInput!" ] } @@ -7672,7 +7689,7 @@ export default { 34, { "input": [ - 412, + 413, "UpdateFrontComponentInput!" ] } @@ -7690,7 +7707,7 @@ export default { 56, { "input": [ - 414, + 415, "CreateOneObjectInput!" ] } @@ -7699,7 +7716,7 @@ export default { 56, { "input": [ - 416, + 417, "DeleteOneObjectInput!" ] } @@ -7708,7 +7725,7 @@ export default { 56, { "input": [ - 417, + 418, "UpdateOneObjectInput!" ] } @@ -7717,7 +7734,7 @@ export default { 47, { "input": [ - 419, + 420, "CreateOneIndexInput!" ] } @@ -7726,7 +7743,7 @@ export default { 47, { "input": [ - 422, + 423, "DeleteOneIndexInput!" ] } @@ -7735,7 +7752,7 @@ export default { 25, { "input": [ - 423, + 424, "CreateAgentInput!" ] } @@ -7744,7 +7761,7 @@ export default { 25, { "input": [ - 424, + 425, "UpdateAgentInput!" ] } @@ -7753,43 +7770,43 @@ export default { 25, { "input": [ - 338, + 339, "AgentIdInput!" ] } ], "sendEmailViaEmailingDomain": [ - 282, + 283, { "input": [ - 425, + 426, "SendEmailViaDomainInput!" ] } ], "sendMessageCampaign": [ - 284, + 285, { "input": [ - 426, + 427, "SendMessageCampaignInput!" ] } ], "createUnsubscribeTopic": [ - 285, + 286, { "input": [ - 427, + 428, "CreateUnsubscribeTopicInput!" ] } ], "updateUnsubscribeTopic": [ - 285, + 286, { "input": [ - 428, + 429, "UpdateUnsubscribeTopicInput!" ] } @@ -7804,25 +7821,25 @@ export default { } ], "updateMessageChannel": [ - 272, + 273, { "input": [ - 429, + 430, "UpdateMessageChannelInput!" ] } ], "createEmailGroupChannel": [ - 280, + 281, { "input": [ - 431, + 432, "CreateEmailGroupChannelInput!" ] } ], "deleteEmailGroupChannel": [ - 272, + 273, { "id": [ 3, @@ -7831,10 +7848,10 @@ export default { } ], "createEmailingDomain": [ - 270, + 271, { "input": [ - 432, + 433, "CreateEmailingDomainInput!" ] } @@ -7849,7 +7866,7 @@ export default { } ], "verifyEmailingDomain": [ - 270, + 271, { "id": [ 1, @@ -7858,7 +7875,7 @@ export default { } ], "deleteConnectedAccount": [ - 237, + 238, { "id": [ 3, @@ -7883,7 +7900,7 @@ export default { 29, { "createRoleInput": [ - 433, + 434, "CreateRoleInput!" ] } @@ -7892,7 +7909,7 @@ export default { 29, { "updateRoleInput": [ - 434, + 435, "UpdateRoleInput!" ] } @@ -7910,7 +7927,7 @@ export default { 16, { "upsertObjectPermissionsInput": [ - 436, + 437, "UpsertObjectPermissionsInput!" ] } @@ -7919,7 +7936,7 @@ export default { 27, { "upsertPermissionFlagsInput": [ - 438, + 439, "UpsertPermissionFlagsInput!" ] } @@ -7928,16 +7945,16 @@ export default { 26, { "upsertFieldPermissionsInput": [ - 439, + 440, "UpsertFieldPermissionsInput!" ] } ], "upsertRowLevelPermissionPredicates": [ - 232, + 233, { "input": [ - 441, + 442, "UpsertRowLevelPermissionPredicatesInput!" ] } @@ -7965,34 +7982,34 @@ export default { } ], "runAgent": [ - 297, + 298, { "input": [ - 444, + 445, "RunAgentInput!" ] } ], "createWebhook": [ - 294, + 295, { "input": [ - 445, + 446, "CreateWebhookInput!" ] } ], "updateWebhook": [ - 294, + 295, { "input": [ - 446, + 447, "UpdateWebhookInput!" ] } ], "deleteWebhook": [ - 294, + 295, { "id": [ 3, @@ -8004,7 +8021,7 @@ export default { 44, { "input": [ - 448, + 449, "CreateOneFieldMetadataInput!" ] } @@ -8013,7 +8030,7 @@ export default { 44, { "input": [ - 450, + 451, "UpdateOneFieldMetadataInput!" ] } @@ -8022,7 +8039,7 @@ export default { 44, { "input": [ - 452, + 453, "DeleteOneFieldInput!" ] } @@ -8031,7 +8048,7 @@ export default { 66, { "input": [ - 453, + 454, "CreateViewGroupInput!" ] } @@ -8040,7 +8057,7 @@ export default { 66, { "inputs": [ - 453, + 454, "[CreateViewGroupInput!]!" ] } @@ -8049,7 +8066,7 @@ export default { 66, { "input": [ - 454, + 455, "UpdateViewGroupInput!" ] } @@ -8058,7 +8075,7 @@ export default { 66, { "inputs": [ - 454, + 455, "[UpdateViewGroupInput!]!" ] } @@ -8067,7 +8084,7 @@ export default { 66, { "input": [ - 456, + 457, "DeleteViewGroupInput!" ] } @@ -8076,43 +8093,43 @@ export default { 66, { "input": [ - 457, + 458, "DestroyViewGroupInput!" ] } ], "updateMessageFolder": [ - 328, + 329, { "input": [ - 458, + 459, "UpdateMessageFolderInput!" ] } ], "updateMessageFolders": [ - 328, + 329, { "input": [ - 460, + 461, "UpdateMessageFoldersInput!" ] } ], "updateCalendarChannel": [ - 323, + 324, { "input": [ - 461, + 462, "UpdateCalendarChannelInput!" ] } ], "createChatThread": [ - 314 + 315 ], "sendChatMessage": [ - 318, + 319, { "threadId": [ 3, @@ -8133,7 +8150,7 @@ export default { 1 ], "fileAttachments": [ - 463, + 464, "[FileAttachmentInput!]" ] } @@ -8148,7 +8165,7 @@ export default { } ], "renameChatThread": [ - 314, + 315, { "id": [ 3, @@ -8161,7 +8178,7 @@ export default { } ], "archiveChatThread": [ - 314, + 315, { "id": [ 3, @@ -8170,7 +8187,7 @@ export default { } ], "unarchiveChatThread": [ - 314, + 315, { "id": [ 3, @@ -8197,25 +8214,25 @@ export default { } ], "createSkill": [ - 312, + 313, { "input": [ - 464, + 465, "CreateSkillInput!" ] } ], "updateSkill": [ - 312, + 313, { "input": [ - 465, + 466, "UpdateSkillInput!" ] } ], "deleteSkill": [ - 312, + 313, { "id": [ 3, @@ -8224,7 +8241,7 @@ export default { } ], "activateSkill": [ - 312, + 313, { "id": [ 3, @@ -8233,7 +8250,7 @@ export default { } ], "deactivateSkill": [ - 312, + 313, { "id": [ 3, @@ -8242,7 +8259,7 @@ export default { } ], "evaluateAgentTurn": [ - 320, + 321, { "turnId": [ 3, @@ -8251,7 +8268,7 @@ export default { } ], "runEvaluationInput": [ - 321, + 322, { "agentId": [ 3, @@ -8264,16 +8281,16 @@ export default { } ], "getAuthorizationUrlForSSO": [ - 245, + 246, { "input": [ - 466, + 467, "GetAuthorizationUrlForSSOInput!" ] } ], "getLoginTokenFromCredentials": [ - 256, + 257, { "email": [ 1, @@ -8299,7 +8316,7 @@ export default { } ], "signIn": [ - 243, + 244, { "email": [ 1, @@ -8321,7 +8338,7 @@ export default { } ], "verifyEmailAndGetLoginToken": [ - 251, + 252, { "emailVerificationToken": [ 1, @@ -8341,7 +8358,7 @@ export default { } ], "verifyEmailAndGetWorkspaceAgnosticToken": [ - 243, + 244, { "emailVerificationToken": [ 1, @@ -8357,7 +8374,7 @@ export default { } ], "getAuthTokensFromOTP": [ - 255, + 256, { "otp": [ 1, @@ -8377,7 +8394,7 @@ export default { } ], "signUp": [ - 243, + 244, { "email": [ 1, @@ -8399,7 +8416,7 @@ export default { } ], "signUpInWorkspace": [ - 248, + 249, { "email": [ 1, @@ -8430,18 +8447,18 @@ export default { } ], "signUpInNewWorkspace": [ - 248, + 249, { "input": [ - 467 + 468 ] } ], "generateTransientToken": [ - 249 + 250 ], "getAuthTokensFromLoginToken": [ - 255, + 256, { "loginToken": [ 1, @@ -8454,7 +8471,7 @@ export default { } ], "authorizeApp": [ - 241, + 242, { "clientId": [ 1, @@ -8476,7 +8493,7 @@ export default { } ], "renewToken": [ - 255, + 256, { "appToken": [ 1, @@ -8485,7 +8502,7 @@ export default { } ], "generateApiKeyToken": [ - 254, + 255, { "apiKeyId": [ 3, @@ -8501,7 +8518,7 @@ export default { 32 ], "emailPasswordResetLink": [ - 244, + 245, { "email": [ 1, @@ -8513,7 +8530,7 @@ export default { } ], "updatePasswordViaResetToken": [ - 246, + 247, { "passwordResetToken": [ 1, @@ -8526,10 +8543,10 @@ export default { } ], "createApplicationRegistration": [ - 198, + 199, { "input": [ - 468, + 469, "CreateApplicationRegistrationInput!" ] } @@ -8538,7 +8555,7 @@ export default { 7, { "input": [ - 469, + 470, "UpdateApplicationRegistrationInput!" ] } @@ -8553,7 +8570,7 @@ export default { } ], "rotateApplicationRegistrationClientSecret": [ - 200, + 201, { "id": [ 1, @@ -8565,7 +8582,7 @@ export default { 5, { "input": [ - 471, + 472, "CreateApplicationRegistrationVariableInput!" ] } @@ -8574,7 +8591,7 @@ export default { 5, { "input": [ - 472, + 473, "UpdateApplicationRegistrationVariableInput!" ] } @@ -8592,7 +8609,7 @@ export default { 7, { "file": [ - 356, + 357, "Upload!" ], "universalIdentifier": [ @@ -8614,7 +8631,7 @@ export default { } ], "initiateOTPProvisioning": [ - 239, + 240, { "loginToken": [ 1, @@ -8627,10 +8644,10 @@ export default { } ], "initiateOTPProvisioningForAuthenticatedUser": [ - 239 + 240 ], "deleteTwoFactorAuthenticationMethod": [ - 238, + 239, { "twoFactorAuthenticationMethodId": [ 3, @@ -8639,7 +8656,7 @@ export default { } ], "verifyTwoFactorAuthenticationMethodForAuthenticatedUser": [ - 240, + 241, { "otp": [ 1, @@ -8663,7 +8680,7 @@ export default { 6, { "input": [ - 474, + 475, "UpdateWorkspaceMemberSettingsInput!" ] } @@ -8681,7 +8698,7 @@ export default { } ], "resendEmailVerificationToken": [ - 218, + 219, { "email": [ 1, @@ -8697,7 +8714,7 @@ export default { 76, { "data": [ - 475, + 476, "ActivateWorkspaceInput!" ] } @@ -8706,7 +8723,7 @@ export default { 76, { "data": [ - 476, + 477, "UpdateWorkspaceInput!" ] } @@ -8715,13 +8732,13 @@ export default { 76 ], "checkCustomDomainValidRecords": [ - 231 + 232 ], "runWorkspaceMigration": [ 6, { "workspaceMigration": [ - 477, + 478, "WorkspaceMigrationInput!" ] } @@ -8736,43 +8753,43 @@ export default { } ], "createOIDCIdentityProvider": [ - 223, + 224, { "input": [ - 480, + 481, "SetupOIDCSsoInput!" ] } ], "createSAMLIdentityProvider": [ - 223, + 224, { "input": [ - 481, + 482, "SetupSAMLSsoInput!" ] } ], "deleteSSOIdentityProvider": [ - 219, + 220, { "input": [ - 482, + 483, "DeleteSsoInput!" ] } ], "editSSOIdentityProvider": [ - 220, + 221, { "input": [ - 483, + 484, "EditSsoInput!" ] } ], "createObjectEvent": [ - 308, + 309, { "event": [ 1, @@ -8792,10 +8809,10 @@ export default { } ], "trackAnalytics": [ - 308, + 309, { "type": [ - 484, + 485, "AnalyticsType!" ], "name": [ @@ -8810,7 +8827,7 @@ export default { } ], "duplicateDashboard": [ - 306, + 307, { "id": [ 3, @@ -8819,7 +8836,7 @@ export default { } ], "impersonate": [ - 259, + 260, { "userId": [ 3, @@ -8832,16 +8849,16 @@ export default { } ], "sendEmail": [ - 307, + 308, { "input": [ - 485, + 486, "SendEmailInput!" ] } ], "startChannelSync": [ - 298, + 299, { "connectedAccountId": [ 3, @@ -8850,14 +8867,14 @@ export default { } ], "saveImapSmtpCaldavAccount": [ - 293, + 294, { "handle": [ 1, "String!" ], "connectionParameters": [ - 487, + 488, "EmailAccountConnectionParameters!" ], "id": [ @@ -8866,16 +8883,16 @@ export default { } ], "updateLabPublicFeatureFlag": [ - 169, + 170, { "input": [ - 489, + 490, "UpdateLabPublicFeatureFlagInput!" ] } ], "createPublicDomain": [ - 268, + 269, { "domain": [ 1, @@ -8887,7 +8904,7 @@ export default { } ], "updatePublicDomain": [ - 268, + 269, { "domain": [ 1, @@ -8908,7 +8925,7 @@ export default { } ], "checkPublicDomainValidRecords": [ - 231, + 232, { "domain": [ 1, @@ -8920,7 +8937,7 @@ export default { 78, { "input": [ - 490, + 491, "CreateOneAppTokenInput!" ] } @@ -8953,7 +8970,7 @@ export default { 6 ], "createDevelopmentApplication": [ - 263, + 264, { "universalIdentifier": [ 1, @@ -8975,7 +8992,7 @@ export default { } ], "syncApplication": [ - 264, + 265, { "manifest": [ 15, @@ -8987,10 +9004,10 @@ export default { } ], "uploadApplicationFile": [ - 265, + 266, { "file": [ - 356, + 357, "Upload!" ], "applicationUniversalIdentifier": [ @@ -8998,7 +9015,7 @@ export default { "String!" ], "fileFolder": [ - 492, + 493, "FileFolder!" ], "filePath": [ @@ -9075,7 +9092,7 @@ export default { 3 ], "type": [ - 159 + 160 ], "name": [ 1 @@ -9107,7 +9124,7 @@ export default { 3 ], "update": [ - 355 + 356 ], "__typename": [ 1 @@ -9217,7 +9234,7 @@ export default { 3 ], "update": [ - 361 + 362 ], "__typename": [ 1 @@ -9376,17 +9393,17 @@ export default { 3 ], "viewFields": [ - 367 - ], - "viewFilters": [ 368 ], - "viewFilterGroups": [ + "viewFilters": [ 369 ], - "viewSorts": [ + "viewFilterGroups": [ 370 ], + "viewSorts": [ + 371 + ], "__typename": [ 1 ] @@ -9496,7 +9513,7 @@ export default { 3 ], "update": [ - 373 + 374 ], "__typename": [ 1 @@ -9534,7 +9551,7 @@ export default { 3 ], "update": [ - 377 + 378 ], "__typename": [ 1 @@ -9610,7 +9627,7 @@ export default { 3 ], "update": [ - 382 + 383 ], "__typename": [ 1 @@ -9674,10 +9691,10 @@ export default { 3 ], "groups": [ - 387 + 388 ], "fields": [ - 388 + 389 ], "__typename": [ 1 @@ -9697,7 +9714,7 @@ export default { 6 ], "fields": [ - 388 + 389 ], "__typename": [ 1 @@ -9865,7 +9882,7 @@ export default { 3 ], "tabs": [ - 400 + 401 ], "__typename": [ 1 @@ -9888,7 +9905,7 @@ export default { 89 ], "widgets": [ - 401 + 402 ], "__typename": [ 1 @@ -9911,7 +9928,7 @@ export default { 3 ], "gridPosition": [ - 402 + 403 ], "position": [ 15 @@ -9960,7 +9977,7 @@ export default { 3 ], "gridPosition": [ - 402 + 403 ], "position": [ 15 @@ -9986,7 +10003,7 @@ export default { 3 ], "gridPosition": [ - 402 + 403 ], "position": [ 15 @@ -10058,7 +10075,7 @@ export default { 3 ], "update": [ - 408 + 409 ], "__typename": [ 1 @@ -10218,7 +10235,7 @@ export default { 3 ], "update": [ - 413 + 414 ], "__typename": [ 1 @@ -10237,7 +10254,7 @@ export default { }, "CreateOneObjectInput": { "object": [ - 415 + 416 ], "__typename": [ 1 @@ -10297,7 +10314,7 @@ export default { }, "UpdateOneObjectInput": { "update": [ - 418 + 419 ], "id": [ 3 @@ -10352,7 +10369,7 @@ export default { }, "CreateOneIndexInput": { "index": [ - 420 + 421 ], "__typename": [ 1 @@ -10363,7 +10380,7 @@ export default { 3 ], "fields": [ - 421 + 422 ], "indexType": [ 48 @@ -10524,7 +10541,7 @@ export default { 1 ], "visibility": [ - 286 + 287 ], "__typename": [ 1 @@ -10541,7 +10558,7 @@ export default { 1 ], "visibility": [ - 286 + 287 ], "__typename": [ 1 @@ -10552,7 +10569,7 @@ export default { 3 ], "update": [ - 430 + 431 ], "__typename": [ 1 @@ -10560,16 +10577,16 @@ export default { }, "UpdateMessageChannelInputUpdates": { "visibility": [ - 273 + 274 ], "isContactAutoCreationEnabled": [ 6 ], "contactAutoCreationPolicy": [ - 275 + 276 ], "messageFolderImportPolicy": [ - 276 + 277 ], "isSyncEnabled": [ 6 @@ -10646,7 +10663,7 @@ export default { }, "UpdateRoleInput": { "update": [ - 435 + 436 ], "id": [ 3 @@ -10701,7 +10718,7 @@ export default { 3 ], "objectPermissions": [ - 437 + 438 ], "__typename": [ 1 @@ -10743,7 +10760,7 @@ export default { 3 ], "fieldPermissions": [ - 440 + 441 ], "__typename": [ 1 @@ -10774,10 +10791,10 @@ export default { 3 ], "predicates": [ - 442 + 443 ], "predicateGroups": [ - 443 + 444 ], "__typename": [ 1 @@ -10871,7 +10888,7 @@ export default { 3 ], "update": [ - 447 + 448 ], "__typename": [ 1 @@ -10896,7 +10913,7 @@ export default { }, "CreateOneFieldMetadataInput": { "field": [ - 449 + 450 ], "__typename": [ 1 @@ -10972,7 +10989,7 @@ export default { 3 ], "update": [ - 451 + 452 ], "__typename": [ 1 @@ -11067,7 +11084,7 @@ export default { 3 ], "update": [ - 455 + 456 ], "__typename": [ 1 @@ -11111,7 +11128,7 @@ export default { 3 ], "update": [ - 459 + 460 ], "__typename": [ 1 @@ -11130,7 +11147,7 @@ export default { 3 ], "update": [ - 459 + 460 ], "__typename": [ 1 @@ -11141,7 +11158,7 @@ export default { 3 ], "update": [ - 462 + 463 ], "__typename": [ 1 @@ -11149,13 +11166,13 @@ export default { }, "UpdateCalendarChannelInputUpdates": { "visibility": [ - 326 + 327 ], "isContactAutoCreationEnabled": [ 6 ], "contactAutoCreationPolicy": [ - 327 + 328 ], "isSyncEnabled": [ 6 @@ -11268,7 +11285,7 @@ export default { 1 ], "update": [ - 470 + 471 ], "__typename": [ 1 @@ -11316,7 +11333,7 @@ export default { 1 ], "update": [ - 473 + 474 ], "__typename": [ 1 @@ -11434,7 +11451,7 @@ export default { }, "WorkspaceMigrationInput": { "actions": [ - 478 + 479 ], "__typename": [ 1 @@ -11442,10 +11459,10 @@ export default { }, "WorkspaceMigrationDeleteActionInput": { "type": [ - 479 + 480 ], "metadataName": [ - 331 + 332 ], "universalIdentifier": [ 1 @@ -11508,7 +11525,7 @@ export default { 3 ], "status": [ - 176 + 177 ], "__typename": [ 1 @@ -11538,7 +11555,7 @@ export default { 1 ], "files": [ - 486 + 487 ], "__typename": [ 1 @@ -11557,13 +11574,13 @@ export default { }, "EmailAccountConnectionParameters": { "IMAP": [ - 488 + 489 ], "SMTP": [ - 488 + 489 ], "CALDAV": [ - 488 + 489 ], "__typename": [ 1 @@ -11583,7 +11600,7 @@ export default { 1 ], "connectionSecurity": [ - 235 + 236 ], "__typename": [ 1 @@ -11602,7 +11619,7 @@ export default { }, "CreateOneAppTokenInput": { "appToken": [ - 491 + 492 ], "__typename": [ 1 @@ -11619,7 +11636,7 @@ export default { "FileFolder": {}, "Subscription": { "onEventSubscription": [ - 166, + 167, { "eventStreamId": [ 1, @@ -11628,16 +11645,16 @@ export default { } ], "logicFunctionLogs": [ - 233, + 234, { "input": [ - 494, + 495, "LogicFunctionLogsInput!" ] } ], "onAgentChatEvent": [ - 319, + 320, { "threadId": [ 3, @@ -11646,10 +11663,10 @@ export default { } ], "eventLogsLive": [ - 309, + 310, { "table": [ - 342, + 343, "EventLogTable!" ] } diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts index eb8e6f63c9..492ff57154 100644 --- a/packages/twenty-front/src/generated-metadata/graphql.ts +++ b/packages/twenty-front/src/generated-metadata/graphql.ts @@ -568,6 +568,12 @@ export type Billing = { trialPeriods: Array; }; +export type BillingCustomer = { + __typename?: 'BillingCustomer'; + hasPaymentMethod?: Maybe; + id: Scalars['UUID']['output']; +}; + export type BillingEndTrialPeriod = { __typename?: 'BillingEndTrialPeriod'; /** Billing portal URL for payment method update (returned when no payment method exists) */ @@ -4377,6 +4383,7 @@ export type QueryBarChartDataArgs = { export type QueryBillingPortalSessionArgs = { + forPaymentMethodUpdate?: InputMaybe; returnUrlPath?: InputMaybe; }; @@ -6123,6 +6130,7 @@ export type Workspace = { activationStatus: WorkspaceActivationStatus; aiAdditionalInstructions?: Maybe; allowImpersonation: Scalars['Boolean']['output']; + billingCustomer?: Maybe; billingEntitlements: Array; billingSubscriptions: Array; createdAt: Scalars['DateTime']['output']; @@ -7730,6 +7738,7 @@ export type SwitchSubscriptionIntervalMutation = { __typename?: 'Mutation', swit export type BillingPortalSessionQueryVariables = Exact<{ returnUrlPath?: InputMaybe; + forPaymentMethodUpdate?: InputMaybe; }>; @@ -8136,7 +8145,7 @@ export type CurrentBillingSubscriptionFragmentFragment = { __typename?: 'Billing export type UserQueryFragmentFragment = { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, hasPassword: boolean, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, userWorkspaceId?: string | null, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, numberFormat?: WorkspaceMemberNumberFormatEnum | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, userWorkspaceId?: string | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', id: string, permissionFlags?: Array | null, objectsPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null, rowLevelPermissionPredicates?: Array<{ __typename?: 'RowLevelPermissionPredicate', id: string, fieldMetadataId: string, objectMetadataId: string, operand: RowLevelPermissionPredicateOperand, subFieldName?: string | null, workspaceMemberFieldMetadataId?: string | null, workspaceMemberSubFieldName?: string | null, rowLevelPermissionPredicateGroupId?: string | null, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, value?: any | null }> | null, rowLevelPermissionPredicateGroups?: Array<{ __typename?: 'RowLevelPermissionPredicateGroup', id: string, parentRowLevelPermissionPredicateGroupId?: string | null, logicalOperator: RowLevelPermissionPredicateGroupLogicalOperator, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, objectMetadataId: string }> | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodSummary', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, isGoogleAuthBypassEnabled: boolean, isMicrosoftAuthBypassEnabled: boolean, isPasswordAuthBypassEnabled: boolean, subdomain: string, customDomain?: string | null, hasValidSignedEnterpriseKey: boolean, hasValidEnterpriseValidityToken: boolean, isCustomDomainEnabled: boolean, metadataVersion: number, workspaceMembersCount?: number | null, fastModel: string, smartModel: string, aiAdditionalInstructions?: string | null, enabledAiModelIds?: Array | null, useRecommendedModels: boolean, isTwoFactorAuthenticationEnforced: boolean, trashRetentionDays: number, eventLogRetentionDays: number, editableProfileFields?: Array | null, isInternalMessagesImportEnabled: boolean, workspaceCustomApplication?: { __typename?: 'Application', id: string } | null, installedApplications: Array<{ __typename?: 'Application', id: string, name: string, universalIdentifier: string, logo?: string | null }>, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlag', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, currentPeriodEnd?: string | null, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }>, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, stripePriceId: string, billingProduct: | { __typename?: 'BillingLicensedProduct', name: string, description: string, images?: Array | null, metadata: { __typename?: 'BillingProductMetadata', productKey: BillingProductKey, planKey: BillingPlanKey, priceUsageBased: BillingUsageType } } | { __typename?: 'BillingMeteredProduct', name: string, description: string, images?: Array | null, metadata: { __typename?: 'BillingProductMetadata', productKey: BillingProductKey, planKey: BillingPlanKey, priceUsageBased: BillingUsageType } } - }> | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }> }>, billingEntitlements: Array<{ __typename?: 'BillingEntitlement', key: BillingEntitlementKey, value: boolean }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean, canBeAssignedToUsers: boolean, canBeAssignedToAgents: boolean, canBeAssignedToApiKeys: boolean } | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } }; + }> | null } | null, billingCustomer?: { __typename?: 'BillingCustomer', id: string, hasPaymentMethod?: boolean | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }> }>, billingEntitlements: Array<{ __typename?: 'BillingEntitlement', key: BillingEntitlementKey, value: boolean }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean, canBeAssignedToUsers: boolean, canBeAssignedToAgents: boolean, canBeAssignedToApiKeys: boolean } | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } }; export type WorkspaceUrlsFragmentFragment = { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }; @@ -8158,7 +8167,7 @@ export type GetCurrentUserQueryVariables = Exact<{ [key: string]: never; }>; export type GetCurrentUserQuery = { __typename?: 'Query', currentUser: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, hasPassword: boolean, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, userWorkspaceId?: string | null, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, numberFormat?: WorkspaceMemberNumberFormatEnum | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, userWorkspaceId?: string | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', id: string, permissionFlags?: Array | null, objectsPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null, rowLevelPermissionPredicates?: Array<{ __typename?: 'RowLevelPermissionPredicate', id: string, fieldMetadataId: string, objectMetadataId: string, operand: RowLevelPermissionPredicateOperand, subFieldName?: string | null, workspaceMemberFieldMetadataId?: string | null, workspaceMemberSubFieldName?: string | null, rowLevelPermissionPredicateGroupId?: string | null, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, value?: any | null }> | null, rowLevelPermissionPredicateGroups?: Array<{ __typename?: 'RowLevelPermissionPredicateGroup', id: string, parentRowLevelPermissionPredicateGroupId?: string | null, logicalOperator: RowLevelPermissionPredicateGroupLogicalOperator, positionInRowLevelPermissionPredicateGroup?: number | null, roleId: string, objectMetadataId: string }> | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodSummary', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, isGoogleAuthBypassEnabled: boolean, isMicrosoftAuthBypassEnabled: boolean, isPasswordAuthBypassEnabled: boolean, subdomain: string, customDomain?: string | null, hasValidSignedEnterpriseKey: boolean, hasValidEnterpriseValidityToken: boolean, isCustomDomainEnabled: boolean, metadataVersion: number, workspaceMembersCount?: number | null, fastModel: string, smartModel: string, aiAdditionalInstructions?: string | null, enabledAiModelIds?: Array | null, useRecommendedModels: boolean, isTwoFactorAuthenticationEnforced: boolean, trashRetentionDays: number, eventLogRetentionDays: number, editableProfileFields?: Array | null, isInternalMessagesImportEnabled: boolean, workspaceCustomApplication?: { __typename?: 'Application', id: string } | null, installedApplications: Array<{ __typename?: 'Application', id: string, name: string, universalIdentifier: string, logo?: string | null }>, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlag', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, currentPeriodEnd?: string | null, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }>, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, stripePriceId: string, billingProduct: | { __typename?: 'BillingLicensedProduct', name: string, description: string, images?: Array | null, metadata: { __typename?: 'BillingProductMetadata', productKey: BillingProductKey, planKey: BillingPlanKey, priceUsageBased: BillingUsageType } } | { __typename?: 'BillingMeteredProduct', name: string, description: string, images?: Array | null, metadata: { __typename?: 'BillingProductMetadata', productKey: BillingProductKey, planKey: BillingPlanKey, priceUsageBased: BillingUsageType } } - }> | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }> }>, billingEntitlements: Array<{ __typename?: 'BillingEntitlement', key: BillingEntitlementKey, value: boolean }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean, canBeAssignedToUsers: boolean, canBeAssignedToAgents: boolean, canBeAssignedToApiKeys: boolean } | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } } }; + }> | null } | null, billingCustomer?: { __typename?: 'BillingCustomer', id: string, hasPaymentMethod?: boolean | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any, phases: Array<{ __typename?: 'BillingSubscriptionSchedulePhase', start_date: number, end_date: number, items: Array<{ __typename?: 'BillingSubscriptionSchedulePhaseItem', price: string, quantity?: number | null }> }> }>, billingEntitlements: Array<{ __typename?: 'BillingEntitlement', key: BillingEntitlementKey, value: boolean }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean, canBeAssignedToUsers: boolean, canBeAssignedToAgents: boolean, canBeAssignedToApiKeys: boolean } | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } } }; export type ViewFieldFragmentFragment = { __typename?: 'ViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, viewFieldGroupId?: string | null, isActive: boolean, createdAt: string, updatedAt: string, deletedAt?: string | null }; @@ -8620,7 +8629,7 @@ export const BillingSubscriptionFragmentFragmentDoc = {"kind":"Document","defini export const RoleFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}}]} as unknown as DocumentNode; export const AvailableWorkspaceFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]} as unknown as DocumentNode; export const AvailableWorkspacesFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]} as unknown as DocumentNode; -export const UserQueryFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"hasPassword"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessFullAdminPanel"}},{"kind":"Field","name":{"kind":"Name","value":"canImpersonate"}},{"kind":"Field","name":{"kind":"Name","value":"supportUserHash"}},{"kind":"Field","name":{"kind":"Name","value":"onboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMember"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"deletedWorkspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentUserWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"permissionFlags"}},{"kind":"Field","name":{"kind":"Name","value":"objectsPermissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectPermissionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"strategy"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"allowImpersonation"}},{"kind":"Field","name":{"kind":"Name","value":"activationStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isPublicInviteLinkEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}},{"kind":"Field","name":{"kind":"Name","value":"customDomain"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidSignedEnterpriseKey"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidEnterpriseValidityToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceCustomApplication"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"installedApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isCustomDomainEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceUrlsFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"featureFlags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"metadataVersion"}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingEntitlements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembersCount"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RoleFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fastModel"}},{"kind":"Field","name":{"kind":"Name","value":"smartModel"}},{"kind":"Field","name":{"kind":"Name","value":"aiAdditionalInstructions"}},{"kind":"Field","name":{"kind":"Name","value":"enabledAiModelIds"}},{"kind":"Field","name":{"kind":"Name","value":"useRecommendedModels"}},{"kind":"Field","name":{"kind":"Name","value":"isTwoFactorAuthenticationEnforced"}},{"kind":"Field","name":{"kind":"Name","value":"trashRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"eventLogRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"editableProfileFields"}},{"kind":"Field","name":{"kind":"Name","value":"isInternalMessagesImportEnabled"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspacesFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"userVars"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberSubFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"parentRowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"logicalOperator"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"colorScheme"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"locale"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","name":{"kind":"Name","value":"dateFormat"}},{"kind":"Field","name":{"kind":"Name","value":"timeFormat"}},{"kind":"Field","name":{"kind":"Name","value":"calendarStartDay"}},{"kind":"Field","name":{"kind":"Name","value":"numberFormat"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DeletedWorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectPermissionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ObjectPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"canReadObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"restrictedFields"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceUrlsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUrls"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}}]} as unknown as DocumentNode; +export const UserQueryFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"hasPassword"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessFullAdminPanel"}},{"kind":"Field","name":{"kind":"Name","value":"canImpersonate"}},{"kind":"Field","name":{"kind":"Name","value":"supportUserHash"}},{"kind":"Field","name":{"kind":"Name","value":"onboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMember"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"deletedWorkspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentUserWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"permissionFlags"}},{"kind":"Field","name":{"kind":"Name","value":"objectsPermissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectPermissionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"strategy"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"allowImpersonation"}},{"kind":"Field","name":{"kind":"Name","value":"activationStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isPublicInviteLinkEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}},{"kind":"Field","name":{"kind":"Name","value":"customDomain"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidSignedEnterpriseKey"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidEnterpriseValidityToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceCustomApplication"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"installedApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isCustomDomainEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceUrlsFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"featureFlags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"metadataVersion"}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasPaymentMethod"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingEntitlements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembersCount"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RoleFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fastModel"}},{"kind":"Field","name":{"kind":"Name","value":"smartModel"}},{"kind":"Field","name":{"kind":"Name","value":"aiAdditionalInstructions"}},{"kind":"Field","name":{"kind":"Name","value":"enabledAiModelIds"}},{"kind":"Field","name":{"kind":"Name","value":"useRecommendedModels"}},{"kind":"Field","name":{"kind":"Name","value":"isTwoFactorAuthenticationEnforced"}},{"kind":"Field","name":{"kind":"Name","value":"trashRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"eventLogRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"editableProfileFields"}},{"kind":"Field","name":{"kind":"Name","value":"isInternalMessagesImportEnabled"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspacesFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"userVars"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberSubFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"parentRowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"logicalOperator"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"colorScheme"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"locale"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","name":{"kind":"Name","value":"dateFormat"}},{"kind":"Field","name":{"kind":"Name","value":"timeFormat"}},{"kind":"Field","name":{"kind":"Name","value":"calendarStartDay"}},{"kind":"Field","name":{"kind":"Name","value":"numberFormat"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DeletedWorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectPermissionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ObjectPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"canReadObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"restrictedFields"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceUrlsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUrls"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}}]} as unknown as DocumentNode; export const ViewFieldFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"aggregateOperation"}},{"kind":"Field","name":{"kind":"Name","value":"viewFieldGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode; export const ViewFieldGroupFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewFieldGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewFields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFieldFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"aggregateOperation"}},{"kind":"Field","name":{"kind":"Name","value":"viewFieldGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode; export const ViewFilterFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFilterFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewFilter"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"viewFilterGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInViewFilterGroup"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"relationTargetFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode; @@ -8785,7 +8794,7 @@ export const EndSubscriptionTrialPeriodDocument = {"kind":"Document","definition export const SetResourceCreditSubscriptionPriceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetResourceCreditSubscriptionPrice"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"priceId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setResourceCreditSubscriptionPrice"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"priceId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"priceId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}}]} as unknown as DocumentNode; export const SwitchBillingPlanDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SwitchBillingPlan"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"switchBillingPlan"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}}]} as unknown as DocumentNode; export const SwitchSubscriptionIntervalDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SwitchSubscriptionInterval"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"switchSubscriptionInterval"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}}]} as unknown as DocumentNode; -export const BillingPortalSessionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"BillingPortalSession"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"returnUrlPath"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"billingPortalSession"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"returnUrlPath"},"value":{"kind":"Variable","name":{"kind":"Name","value":"returnUrlPath"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]} as unknown as DocumentNode; +export const BillingPortalSessionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"BillingPortalSession"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"returnUrlPath"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"forPaymentMethodUpdate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"billingPortalSession"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"returnUrlPath"},"value":{"kind":"Variable","name":{"kind":"Name","value":"returnUrlPath"}}},{"kind":"Argument","name":{"kind":"Name","value":"forPaymentMethodUpdate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"forPaymentMethodUpdate"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]} as unknown as DocumentNode; export const GetResourceCreditUsageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetResourceCreditUsage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getResourceCreditUsage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"usedCredits"}},{"kind":"Field","name":{"kind":"Name","value":"grantedCredits"}},{"kind":"Field","name":{"kind":"Name","value":"rolloverCredits"}},{"kind":"Field","name":{"kind":"Name","value":"totalGrantedCredits"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceCents"}}]}}]}}]} as unknown as DocumentNode; export const ListPlansDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"listPlans"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"listPlans"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"baseProducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingLicensedProduct"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingPriceLicensedFragment"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"resourceCreditProducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingLicensedProduct"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingPriceLicensedFragment"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"meteredProducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingMeteredProduct"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingPriceMeteredFragment"}}]}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingPriceLicensedFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingPriceLicensed"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"unitAmount"}},{"kind":"Field","name":{"kind":"Name","value":"recurringInterval"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageType"}},{"kind":"Field","name":{"kind":"Name","value":"creditAmount"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingPriceMeteredFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingPriceMetered"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceUsageType"}},{"kind":"Field","name":{"kind":"Name","value":"recurringInterval"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"tiers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"flatAmount"}},{"kind":"Field","name":{"kind":"Name","value":"unitAmount"}},{"kind":"Field","name":{"kind":"Name","value":"upTo"}}]}}]}}]} as unknown as DocumentNode; export const AssignRoleToApiKeyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AssignRoleToApiKey"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"apiKeyId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"roleId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignRoleToApiKey"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"apiKeyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"apiKeyId"}}},{"kind":"Argument","name":{"kind":"Name","value":"roleId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"roleId"}}}]}]}}]} as unknown as DocumentNode; @@ -8844,7 +8853,7 @@ export const UnsubscribePagePreviewUrlDocument = {"kind":"Document","definitions export const GetUsageAnalyticsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetUsageAnalytics"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"UsageAnalyticsInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getUsageAnalytics"},"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":"usageByUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"creditsUsed"}}]}},{"kind":"Field","name":{"kind":"Name","value":"usageByOperationType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"creditsUsed"}}]}},{"kind":"Field","name":{"kind":"Name","value":"usageByModel"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"creditsUsed"}}]}},{"kind":"Field","name":{"kind":"Name","value":"timeSeries"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"creditsUsed"}}]}},{"kind":"Field","name":{"kind":"Name","value":"periodStart"}},{"kind":"Field","name":{"kind":"Name","value":"periodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"userDailyUsage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"dailyUsage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"creditsUsed"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const DeleteUserAccountDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteUserAccount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; export const DeleteUserWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteUserWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceMemberIdToDelete"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteUserFromWorkspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"workspaceMemberIdToDelete"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceMemberIdToDelete"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; -export const GetCurrentUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCurrentUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserQueryFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"colorScheme"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"locale"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","name":{"kind":"Name","value":"dateFormat"}},{"kind":"Field","name":{"kind":"Name","value":"timeFormat"}},{"kind":"Field","name":{"kind":"Name","value":"calendarStartDay"}},{"kind":"Field","name":{"kind":"Name","value":"numberFormat"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DeletedWorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberSubFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"parentRowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"logicalOperator"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectPermissionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ObjectPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"canReadObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"restrictedFields"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceUrlsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUrls"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"hasPassword"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessFullAdminPanel"}},{"kind":"Field","name":{"kind":"Name","value":"canImpersonate"}},{"kind":"Field","name":{"kind":"Name","value":"supportUserHash"}},{"kind":"Field","name":{"kind":"Name","value":"onboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMember"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"deletedWorkspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentUserWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"permissionFlags"}},{"kind":"Field","name":{"kind":"Name","value":"objectsPermissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectPermissionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"strategy"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"allowImpersonation"}},{"kind":"Field","name":{"kind":"Name","value":"activationStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isPublicInviteLinkEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}},{"kind":"Field","name":{"kind":"Name","value":"customDomain"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidSignedEnterpriseKey"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidEnterpriseValidityToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceCustomApplication"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"installedApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isCustomDomainEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceUrlsFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"featureFlags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"metadataVersion"}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingEntitlements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembersCount"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RoleFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fastModel"}},{"kind":"Field","name":{"kind":"Name","value":"smartModel"}},{"kind":"Field","name":{"kind":"Name","value":"aiAdditionalInstructions"}},{"kind":"Field","name":{"kind":"Name","value":"enabledAiModelIds"}},{"kind":"Field","name":{"kind":"Name","value":"useRecommendedModels"}},{"kind":"Field","name":{"kind":"Name","value":"isTwoFactorAuthenticationEnforced"}},{"kind":"Field","name":{"kind":"Name","value":"trashRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"eventLogRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"editableProfileFields"}},{"kind":"Field","name":{"kind":"Name","value":"isInternalMessagesImportEnabled"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspacesFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"userVars"}}]}}]} as unknown as DocumentNode; +export const GetCurrentUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCurrentUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"UserQueryFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"colorScheme"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"locale"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","name":{"kind":"Name","value":"dateFormat"}},{"kind":"Field","name":{"kind":"Name","value":"timeFormat"}},{"kind":"Field","name":{"kind":"Name","value":"calendarStartDay"}},{"kind":"Field","name":{"kind":"Name","value":"numberFormat"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}},{"kind":"Field","name":{"kind":"Name","value":"userWorkspaceId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DeletedWorkspaceMember"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"userEmail"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"operand"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMemberSubFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"parentRowLevelPermissionPredicateGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"logicalOperator"}},{"kind":"Field","name":{"kind":"Name","value":"positionInRowLevelPermissionPredicateGroup"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectPermissionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ObjectPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"canReadObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"restrictedFields"}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rowLevelPermissionPredicateGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RowLevelPermissionPredicateGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"WorkspaceUrlsFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUrls"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItem"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhase"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start_date"}},{"kind":"Field","name":{"kind":"Name","value":"end_date"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseItemFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"interval"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"currentPeriodEnd"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptionItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasReachedCurrentPeriodCap"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"stripePriceId"}},{"kind":"Field","name":{"kind":"Name","value":"billingProduct"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"images"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productKey"}},{"kind":"Field","name":{"kind":"Name","value":"planKey"}},{"kind":"Field","name":{"kind":"Name","value":"priceUsageBased"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BillingSubscriptionFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BillingSubscription"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"phases"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionSchedulePhaseFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RoleFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllSettings"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllTools"}},{"kind":"Field","name":{"kind":"Name","value":"isEditable"}},{"kind":"Field","name":{"kind":"Name","value":"canReadAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canUpdateAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canSoftDeleteAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canDestroyAllObjectRecords"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToUsers"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToAgents"}},{"kind":"Field","name":{"kind":"Name","value":"canBeAssignedToApiKeys"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspaceFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"loginToken"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"personalInviteToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subdomainUrl"}},{"kind":"Field","name":{"kind":"Name","value":"customUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"sso"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableWorkspacesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AvailableWorkspaces"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignIn"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspacesForSignUp"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspaceFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UserQueryFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"hasPassword"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessFullAdminPanel"}},{"kind":"Field","name":{"kind":"Name","value":"canImpersonate"}},{"kind":"Field","name":{"kind":"Name","value":"supportUserHash"}},{"kind":"Field","name":{"kind":"Name","value":"onboardingStatus"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMember"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PartialWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"deletedWorkspaceMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"DeletedWorkspaceMemberQueryFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentUserWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"permissionFlags"}},{"kind":"Field","name":{"kind":"Name","value":"objectsPermissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectPermissionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"twoFactorAuthenticationMethodId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"strategy"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"inviteHash"}},{"kind":"Field","name":{"kind":"Name","value":"allowImpersonation"}},{"kind":"Field","name":{"kind":"Name","value":"activationStatus"}},{"kind":"Field","name":{"kind":"Name","value":"isPublicInviteLinkEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isGoogleAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isMicrosoftAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"isPasswordAuthBypassEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"subdomain"}},{"kind":"Field","name":{"kind":"Name","value":"customDomain"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidSignedEnterpriseKey"}},{"kind":"Field","name":{"kind":"Name","value":"hasValidEnterpriseValidityToken"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceCustomApplication"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"installedApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isCustomDomainEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceUrls"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"WorkspaceUrlsFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"featureFlags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"metadataVersion"}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingSubscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentBillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hasPaymentMethod"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingSubscriptions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BillingSubscriptionFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingEntitlements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspaceMembersCount"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RoleFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fastModel"}},{"kind":"Field","name":{"kind":"Name","value":"smartModel"}},{"kind":"Field","name":{"kind":"Name","value":"aiAdditionalInstructions"}},{"kind":"Field","name":{"kind":"Name","value":"enabledAiModelIds"}},{"kind":"Field","name":{"kind":"Name","value":"useRecommendedModels"}},{"kind":"Field","name":{"kind":"Name","value":"isTwoFactorAuthenticationEnforced"}},{"kind":"Field","name":{"kind":"Name","value":"trashRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"eventLogRetentionDays"}},{"kind":"Field","name":{"kind":"Name","value":"editableProfileFields"}},{"kind":"Field","name":{"kind":"Name","value":"isInternalMessagesImportEnabled"}}]}},{"kind":"Field","name":{"kind":"Name","value":"availableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AvailableWorkspacesFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"userVars"}}]}}]} as unknown as DocumentNode; export const CreateManyViewFieldGroupsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateManyViewFieldGroups"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateViewFieldGroupInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createManyViewFieldGroups"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"inputs"},"value":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFieldGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"aggregateOperation"}},{"kind":"Field","name":{"kind":"Name","value":"viewFieldGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewFieldGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewFields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFieldFragment"}}]}}]}}]} as unknown as DocumentNode; export const CreateManyViewFieldsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateManyViewFields"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateViewFieldInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createManyViewFields"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"inputs"},"value":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewFieldFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewFieldFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"aggregateOperation"}},{"kind":"Field","name":{"kind":"Name","value":"viewFieldGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode; export const CreateManyViewGroupsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateManyViewGroups"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateViewGroupInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createManyViewGroups"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"inputs"},"value":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ViewGroupFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ViewGroupFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ViewGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isVisible"}},{"kind":"Field","name":{"kind":"Name","value":"fieldValue"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"viewId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}}]}}]} as unknown as DocumentNode; diff --git a/packages/twenty-front/src/modules/ai/components/AIChatNoMoreBillingCreditsBanner.tsx b/packages/twenty-front/src/modules/ai/components/AIChatNoMoreBillingCreditsBanner.tsx index 60ffe45ef9..96f6b97a56 100644 --- a/packages/twenty-front/src/modules/ai/components/AIChatNoMoreBillingCreditsBanner.tsx +++ b/packages/twenty-front/src/modules/ai/components/AIChatNoMoreBillingCreditsBanner.tsx @@ -1,21 +1,15 @@ import { AiChatBanner } from '@/ai/components/AiChatBanner'; -import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useNumberFormat } from '@/localization/hooks/useNumberFormat'; -import { useEndSubscriptionTrialPeriod } from '@/settings/billing/hooks/useEndSubscriptionTrialPeriod'; -import { useGetNextResourceCreditPrice } from '@/settings/billing/hooks/useGetNextResourceCreditPrice'; +import { useAiChatEndTrialPeriod } from '@/ai/hooks/useAiChatEndTrialPeriod'; +import { StartSubscriptionConfirmationModal } from '@/settings/billing/components/StartSubscriptionConfirmationModal'; +import { useCreditUpgradeAction } from '@/settings/billing/hooks/useCreditUpgradeAction'; import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap'; -import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; -import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus'; -import { useMutation } from '@apollo/client/react'; -import { t } from '@lingui/core/macro'; +import { useLingui } from '@lingui/react/macro'; import { isDefined } from 'twenty-shared/utils'; import { PermissionFlagType, - SetResourceCreditSubscriptionPriceDocument, - SubscriptionInterval, SubscriptionStatus, } from '~/generated-metadata/graphql'; @@ -24,50 +18,32 @@ const AI_CHAT_UPGRADE_CREDIT_PLAN_MODAL_ID = 'ai-chat-upgrade-credit-plan-modal'; export const AIChatNoMoreBillingCreditsBanner = () => { + const { t } = useLingui(); const subscriptionStatus = useSubscriptionStatus(); const { openModal } = useModal(); - const { endTrialPeriod, isLoading: isEndTrialLoading } = - useEndSubscriptionTrialPeriod(); - const nextPrice = useGetNextResourceCreditPrice(); - - const { formatNumber } = useNumberFormat(); - const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar(); - - const [currentWorkspace, setCurrentWorkspace] = useAtomState( - currentWorkspaceState, - ); - - const [setResourceCreditSubscriptionPrice, { loading: isUpgrading }] = - useMutation(SetResourceCreditSubscriptionPriceDocument); - - const { [PermissionFlagType.WORKSPACE]: hasPermissionToManageBilling } = + const { [PermissionFlagType.BILLING]: hasPermissionToManageBilling } = usePermissionFlagMap(); + const isTrialing = subscriptionStatus === SubscriptionStatus.Trialing; + + const { endTrialPeriodFromAiChat, isEndTrialLoading, hasPaymentMethod } = + useAiChatEndTrialPeriod(); + + const { + nextPrice, + nextResourceCreditsAmount, + nextResourceCreditPrice, + nextTierInterval, + upgradeCreditPlan, + isUpgrading, + } = useCreditUpgradeAction(); + if (!hasPermissionToManageBilling) { return null; } - const isTrialing = subscriptionStatus === SubscriptionStatus.Trialing; - - const nextResourceCreditsAmount = isDefined(nextPrice) - ? formatNumber(nextPrice.creditAmount ?? 0, { - abbreviate: true, - decimals: 2, - }) - : null; - - const nextResourceCreditPrice = isDefined(nextPrice) - ? formatNumber((nextPrice.unitAmount ?? 0) / 100) - : null; - - const nextTierInterval = isDefined(nextPrice) - ? nextPrice.recurringInterval === SubscriptionInterval.Month - ? t`month` - : t`year` - : null; - const message = isTrialing ? t`You've hit your usage limit. Subscribe for more usage.` : isDefined(nextPrice) @@ -75,7 +51,9 @@ export const AIChatNoMoreBillingCreditsBanner = () => { : t`You've hit your usage limit. \nReach to our support team to upgrade.`; const buttonTitle = isTrialing - ? t`Subscribe Now` + ? hasPaymentMethod === false + ? t`Add Credit Card` + : t`Subscribe Now` : isDefined(nextPrice) ? t`Upgrade` : undefined; @@ -86,32 +64,6 @@ export const AIChatNoMoreBillingCreditsBanner = () => { ? () => openModal(AI_CHAT_UPGRADE_CREDIT_PLAN_MODAL_ID) : undefined; - const handleUpgradeConfirm = async () => { - if (!isDefined(nextPrice)) return; - try { - const { data } = await setResourceCreditSubscriptionPrice({ - variables: { priceId: nextPrice.stripePriceId }, - }); - if ( - isDefined( - data?.setResourceCreditSubscriptionPrice.currentBillingSubscription, - ) && - isDefined(currentWorkspace) - ) { - setCurrentWorkspace({ - ...currentWorkspace, - currentBillingSubscription: - data.setResourceCreditSubscriptionPrice.currentBillingSubscription, - billingSubscriptions: - data.setResourceCreditSubscriptionPrice.billingSubscriptions, - }); - } - enqueueSuccessSnackBar({ message: t`Credit plan upgraded.` }); - } catch { - enqueueErrorSnackBar({ message: t`Failed to upgrade credit plan.` }); - } - }; - return ( <> { } /> {isTrialing && ( - )} @@ -139,7 +88,7 @@ export const AIChatNoMoreBillingCreditsBanner = () => { modalInstanceId={AI_CHAT_UPGRADE_CREDIT_PLAN_MODAL_ID} title={t`Get more credits`} subtitle={t`Upgrade to ${nextResourceCreditsAmount ?? ''} credits for $${nextResourceCreditPrice ?? ''}/${nextTierInterval ?? ''}.`} - onConfirmClick={handleUpgradeConfirm} + onConfirmClick={upgradeCreditPlan} confirmButtonText={t`Upgrade`} confirmButtonAccent="blue" loading={isUpgrading} diff --git a/packages/twenty-front/src/modules/ai/components/AiChatCreditsExhaustedMessage.tsx b/packages/twenty-front/src/modules/ai/components/AiChatCreditsExhaustedMessage.tsx deleted file mode 100644 index 4258c03e54..0000000000 --- a/packages/twenty-front/src/modules/ai/components/AiChatCreditsExhaustedMessage.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { AiChatBanner } from '@/ai/components/AiChatBanner'; -import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap'; -import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus'; -import { t } from '@lingui/core/macro'; -import { SettingsPath } from 'twenty-shared/types'; -import { IconSparkles } from 'twenty-ui/display'; -import { - PermissionFlagType, - SubscriptionStatus, -} from '~/generated-metadata/graphql'; -import { useNavigateSettings } from '~/hooks/useNavigateSettings'; - -export const AiChatCreditsExhaustedMessage = () => { - const navigateSettings = useNavigateSettings(); - const subscriptionStatus = useSubscriptionStatus(); - - const isTrialing = subscriptionStatus === SubscriptionStatus.Trialing; - - const { [PermissionFlagType.WORKSPACE]: hasPermissionToManageBilling } = - usePermissionFlagMap(); - - const handleUpgradeClick = () => { - navigateSettings(SettingsPath.Billing); - }; - - const message = hasPermissionToManageBilling - ? isTrialing - ? t`Free trial credits exhausted. Subscribe now to continue using AI features.` - : t`Credits exhausted. Upgrade your plan to get more credits.` - : t`Credits exhausted. Please contact your workspace admin to upgrade.`; - - const buttonTitle = isTrialing ? t`Subscribe Now` : t`Upgrade Plan`; - - return ( - - ); -}; diff --git a/packages/twenty-front/src/modules/ai/components/AiChatErrorRenderer.tsx b/packages/twenty-front/src/modules/ai/components/AiChatErrorRenderer.tsx index 4f6cfc358c..cf3a6b01a1 100644 --- a/packages/twenty-front/src/modules/ai/components/AiChatErrorRenderer.tsx +++ b/packages/twenty-front/src/modules/ai/components/AiChatErrorRenderer.tsx @@ -1,5 +1,4 @@ import { AiChatApiKeyNotConfiguredMessage } from '@/ai/components/AiChatApiKeyNotConfiguredMessage'; -import { AiChatCreditsExhaustedMessage } from '@/ai/components/AiChatCreditsExhaustedMessage'; import { AiChatErrorMessage } from '@/ai/components/AiChatErrorMessage'; import { type AiChatError } from '@/ai/types/AiChatError'; import { AiChatErrorCode } from '@/ai/utils/aiChatErrorCode'; @@ -11,7 +10,8 @@ type AiChatErrorRendererProps = { export const AiChatErrorRenderer = ({ error }: AiChatErrorRendererProps) => { if (isGraphqlErrorOfType(error, AiChatErrorCode.BILLING_CREDITS_EXHAUSTED)) { - return ; + //Handle by AIChatNoMoreBillingCreditsBanner + return null; } if (isGraphqlErrorOfType(error, AiChatErrorCode.API_KEY_NOT_CONFIGURED)) { diff --git a/packages/twenty-front/src/modules/ai/components/AiChatTabMessageList.tsx b/packages/twenty-front/src/modules/ai/components/AiChatTabMessageList.tsx index 8256c0c0ac..ae4d57387c 100644 --- a/packages/twenty-front/src/modules/ai/components/AiChatTabMessageList.tsx +++ b/packages/twenty-front/src/modules/ai/components/AiChatTabMessageList.tsx @@ -17,11 +17,16 @@ const StyledScrollWrapperContainer = styled.div` display: flex; flex: 1; flex-direction: column; - gap: ${themeCssVariables.spacing[2]}; overflow-y: auto; - padding: ${themeCssVariables.spacing[3]}; position: relative; - width: calc(100% - 24px); + width: 100%; +`; + +const StyledMessageListContent = styled.div` + display: flex; + flex-direction: column; + gap: ${themeCssVariables.spacing[2]}; + padding: ${themeCssVariables.spacing[4]}; `; export const AiChatTabMessageList = () => { @@ -46,9 +51,11 @@ export const AiChatTabMessageList = () => { }} > - - - + + + + + diff --git a/packages/twenty-front/src/modules/ai/constants/AskAiThreadIdQueryParam.ts b/packages/twenty-front/src/modules/ai/constants/AskAiThreadIdQueryParam.ts new file mode 100644 index 0000000000..230ce404fb --- /dev/null +++ b/packages/twenty-front/src/modules/ai/constants/AskAiThreadIdQueryParam.ts @@ -0,0 +1 @@ +export const ASK_AI_THREAD_ID_QUERY_PARAM = 'askAiThreadId'; diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChatSubscription.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChatSubscription.ts index 7ad977eebd..d17d96351d 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useAgentChatSubscription.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChatSubscription.ts @@ -20,10 +20,12 @@ import { agentChatMessagesComponentFamilyState } from '@/ai/states/agentChatMess import { agentChatUsageComponentFamilyState } from '@/ai/states/agentChatUsageComponentFamilyState'; import { currentAiChatThreadTitleComponentFamilyState } from '@/ai/states/currentAiChatThreadTitleComponentFamilyState'; import { AiChatErrorCode } from '@/ai/utils/aiChatErrorCode'; +import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { dispatchBrowserEvent } from '@/browser-event/utils/dispatchBrowserEvent'; import { sseClientState } from '@/sse-db-event/states/sseClientState'; import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { BillingProductKey } from '~/generated-metadata/graphql'; const THROTTLE_MS = 100; @@ -324,6 +326,35 @@ export const useAgentChatSubscription = (threadId: string | null) => { } case 'credits-exhausted': { + //TODO : add real time on currentUser + store.set(currentWorkspaceState.atom, (currentWorkspace) => { + const currentBillingSubscription = + currentWorkspace?.currentBillingSubscription; + const billingSubscriptionItems = + currentBillingSubscription?.billingSubscriptionItems; + + if ( + !isDefined(currentWorkspace) || + !isDefined(currentBillingSubscription) || + !isDefined(billingSubscriptionItems) + ) { + return currentWorkspace; + } + + return { + ...currentWorkspace, + currentBillingSubscription: { + ...currentBillingSubscription, + billingSubscriptionItems: billingSubscriptionItems.map((item) => + item.billingProduct.metadata?.['productKey'] === + BillingProductKey.RESOURCE_CREDIT + ? { ...item, hasReachedCurrentPeriodCap: true } + : item, + ), + }, + }; + }); + const noMoreCreditsError = new Error( 'Chat stopped: no more available credits.', ) as Error & { code?: string }; diff --git a/packages/twenty-front/src/modules/ai/hooks/useAiChatEndTrialPeriod.ts b/packages/twenty-front/src/modules/ai/hooks/useAiChatEndTrialPeriod.ts new file mode 100644 index 0000000000..5900822862 --- /dev/null +++ b/packages/twenty-front/src/modules/ai/hooks/useAiChatEndTrialPeriod.ts @@ -0,0 +1,32 @@ +import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState'; +import { buildAskAiThreadRedirectPath } from '@/ai/utils/buildAskAiThreadRedirectPath'; +import { billingHasPaymentMethodSelector } from '@/settings/billing/states/billingHasPaymentMethodSelector'; +import { useEndSubscriptionTrialPeriod } from '@/settings/billing/hooks/useEndSubscriptionTrialPeriod'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useLocation } from 'react-router-dom'; + +export const useAiChatEndTrialPeriod = () => { + const location = useLocation(); + const currentAiChatThread = useAtomStateValue(currentAiChatThreadState); + + const { endTrialPeriod, isLoading } = useEndSubscriptionTrialPeriod(); + const billingHasPaymentMethod = useAtomStateValue( + billingHasPaymentMethodSelector, + ); + + const endTrialPeriodFromAiChat = async () => { + await endTrialPeriod({ + finalRedirectPath: buildAskAiThreadRedirectPath({ + pathname: location.pathname, + search: location.search, + threadId: currentAiChatThread, + }), + }); + }; + + return { + endTrialPeriodFromAiChat, + isEndTrialLoading: isLoading, + hasPaymentMethod: billingHasPaymentMethod, + }; +}; diff --git a/packages/twenty-front/src/modules/ai/hooks/useAiChatThreadClick.ts b/packages/twenty-front/src/modules/ai/hooks/useAiChatThreadClick.ts index 749e6daffc..6bb16e0def 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useAiChatThreadClick.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useAiChatThreadClick.ts @@ -1,12 +1,9 @@ -import { agentChatDraftsByThreadIdState } from '@/ai/states/agentChatDraftsByThreadIdState'; -import { agentChatInputState } from '@/ai/states/agentChatInputState'; import { agentChatUsageComponentFamilyState } from '@/ai/states/agentChatUsageComponentFamilyState'; -import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState'; import { currentAiChatThreadTitleComponentFamilyState } from '@/ai/states/currentAiChatThreadTitleComponentFamilyState'; import { threadIdCreatedFromDraftState } from '@/ai/states/threadIdCreatedFromDraftState'; +import { useSwitchAgentChatThreadWithDraft } from '@/ai/hooks/useSwitchAgentChatThreadWithDraft'; import { useOpenAskAiPageInSidePanel } from '@/side-panel/hooks/useOpenAskAiPageInSidePanel'; import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; -import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useStore } from 'jotai'; import { isDefined } from 'twenty-shared/utils'; @@ -23,13 +20,7 @@ export const useAiChatThreadClick = ( const setThreadIdCreatedFromDraft = useSetAtomState( threadIdCreatedFromDraftState, ); - const [currentAiChatThread, setCurrentAiChatThread] = useAtomState( - currentAiChatThreadState, - ); - const setAgentChatInput = useSetAtomState(agentChatInputState); - const setAgentChatDraftsByThreadId = useSetAtomState( - agentChatDraftsByThreadIdState, - ); + const { switchThreadWithDraft } = useSwitchAgentChatThreadWithDraft(); const threadTitleFamilyCallback = useAtomComponentFamilyStateCallbackState( currentAiChatThreadTitleComponentFamilyState, ); @@ -41,21 +32,8 @@ export const useAiChatThreadClick = ( const handleThreadClick = (thread: AgentChatThread) => { setThreadIdCreatedFromDraft(null); - const isSameThread = thread.id === currentAiChatThread; - if (currentAiChatThread !== null) { - setAgentChatDraftsByThreadId((prev) => ({ - ...prev, - [currentAiChatThread]: store.get(agentChatInputState.atom), - })); - } - setCurrentAiChatThread(thread.id); - - if (!isSameThread) { - const newDraft = - store.get(agentChatDraftsByThreadIdState.atom)[thread.id] ?? ''; - setAgentChatInput(newDraft); - } + switchThreadWithDraft(thread.id); const clickedFamilyKey = { threadId: thread.id }; diff --git a/packages/twenty-front/src/modules/ai/hooks/useOpenAskAiThread.ts b/packages/twenty-front/src/modules/ai/hooks/useOpenAskAiThread.ts new file mode 100644 index 0000000000..e935cdb5f7 --- /dev/null +++ b/packages/twenty-front/src/modules/ai/hooks/useOpenAskAiThread.ts @@ -0,0 +1,37 @@ +import { useAiChatThreadClick } from '@/ai/hooks/useAiChatThreadClick'; +import { useSwitchAgentChatThreadWithDraft } from '@/ai/hooks/useSwitchAgentChatThreadWithDraft'; +import { agentChatVisibleThreadsSelector } from '@/ai/states/selectors/agentChatVisibleThreadsSelector'; +import { useOpenAskAiPageInSidePanel } from '@/side-panel/hooks/useOpenAskAiPageInSidePanel'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { isDefined, isValidUuid } from 'twenty-shared/utils'; + +export const useOpenAskAiThread = () => { + const agentChatVisibleThreads = useAtomStateValue( + agentChatVisibleThreadsSelector, + ); + const { switchThreadWithDraft } = useSwitchAgentChatThreadWithDraft(); + + const { handleThreadClick } = useAiChatThreadClick({ + resetNavigationStack: true, + }); + const { openAskAiPage } = useOpenAskAiPageInSidePanel(); + + const openAskAiThread = (threadId: string) => { + const thread = agentChatVisibleThreads.find( + (visibleThread) => visibleThread.id === threadId, + ); + + if (isDefined(thread)) { + handleThreadClick(thread); + return; + } + + if (isValidUuid(threadId)) { + switchThreadWithDraft(threadId); + } + + openAskAiPage({ resetNavigationStack: true }); + }; + + return { openAskAiThread }; +}; diff --git a/packages/twenty-front/src/modules/ai/hooks/useSwitchAgentChatThreadWithDraft.ts b/packages/twenty-front/src/modules/ai/hooks/useSwitchAgentChatThreadWithDraft.ts new file mode 100644 index 0000000000..d7d7835c5f --- /dev/null +++ b/packages/twenty-front/src/modules/ai/hooks/useSwitchAgentChatThreadWithDraft.ts @@ -0,0 +1,39 @@ +import { agentChatDraftsByThreadIdState } from '@/ai/states/agentChatDraftsByThreadIdState'; +import { agentChatInputState } from '@/ai/states/agentChatInputState'; +import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; +import { useStore } from 'jotai'; +import { isDefined } from 'twenty-shared/utils'; + +export const useSwitchAgentChatThreadWithDraft = () => { + const [currentAiChatThread, setCurrentAiChatThread] = useAtomState( + currentAiChatThreadState, + ); + const setAgentChatInput = useSetAtomState(agentChatInputState); + const setAgentChatDraftsByThreadId = useSetAtomState( + agentChatDraftsByThreadIdState, + ); + const store = useStore(); + + const switchThreadWithDraft = (toThreadId: string) => { + const isSameThread = toThreadId === currentAiChatThread; + + if (isDefined(currentAiChatThread)) { + setAgentChatDraftsByThreadId((prev) => ({ + ...prev, + [currentAiChatThread]: store.get(agentChatInputState.atom), + })); + } + + setCurrentAiChatThread(toThreadId); + + if (!isSameThread) { + const destinationDraft = + store.get(agentChatDraftsByThreadIdState.atom)[toThreadId] ?? ''; + setAgentChatInput(destinationDraft); + } + }; + + return { switchThreadWithDraft }; +}; diff --git a/packages/twenty-front/src/modules/ai/hooks/useSwitchToNewAiChat.ts b/packages/twenty-front/src/modules/ai/hooks/useSwitchToNewAiChat.ts index 4279fb274b..501431a0ef 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useSwitchToNewAiChat.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useSwitchToNewAiChat.ts @@ -1,47 +1,25 @@ import { useStore } from 'jotai'; -import { - AGENT_CHAT_NEW_THREAD_DRAFT_KEY, - agentChatDraftsByThreadIdState, -} from '@/ai/states/agentChatDraftsByThreadIdState'; -import { agentChatInputState } from '@/ai/states/agentChatInputState'; -import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState'; +import { useSwitchAgentChatThreadWithDraft } from '@/ai/hooks/useSwitchAgentChatThreadWithDraft'; +import { AGENT_CHAT_NEW_THREAD_DRAFT_KEY } from '@/ai/states/agentChatDraftsByThreadIdState'; import { shouldFocusChatEditorState } from '@/ai/states/shouldFocusChatEditorState'; import { hasTriggeredCreateForDraftState } from '@/ai/states/hasTriggeredCreateForDraftState'; import { threadIdCreatedFromDraftState } from '@/ai/states/threadIdCreatedFromDraftState'; import { useOpenAskAiPageInSidePanel } from '@/side-panel/hooks/useOpenAskAiPageInSidePanel'; -import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useSwitchToNewAiChat = () => { const setThreadIdCreatedFromDraft = useSetAtomState( threadIdCreatedFromDraftState, ); - const [currentAiChatThread, setCurrentAiChatThread] = useAtomState( - currentAiChatThreadState, - ); - const setAgentChatInput = useSetAtomState(agentChatInputState); - const setAgentChatDraftsByThreadId = useSetAtomState( - agentChatDraftsByThreadIdState, - ); + const { switchThreadWithDraft } = useSwitchAgentChatThreadWithDraft(); const store = useStore(); const { openAskAiPage } = useOpenAskAiPageInSidePanel(); const switchToNewChat = () => { setThreadIdCreatedFromDraft(null); - const newChatDraft = - store.get(agentChatDraftsByThreadIdState.atom)[ - AGENT_CHAT_NEW_THREAD_DRAFT_KEY - ] ?? ''; - if (currentAiChatThread !== null) { - setAgentChatDraftsByThreadId((prev) => ({ - ...prev, - [currentAiChatThread]: store.get(agentChatInputState.atom), - })); - } store.set(hasTriggeredCreateForDraftState.atom, false); - setCurrentAiChatThread(AGENT_CHAT_NEW_THREAD_DRAFT_KEY); - setAgentChatInput(newChatDraft); + switchThreadWithDraft(AGENT_CHAT_NEW_THREAD_DRAFT_KEY); openAskAiPage(); store.set(shouldFocusChatEditorState.atom, true); }; diff --git a/packages/twenty-front/src/modules/ai/utils/buildAskAiThreadRedirectPath.ts b/packages/twenty-front/src/modules/ai/utils/buildAskAiThreadRedirectPath.ts new file mode 100644 index 0000000000..da2e9c96cb --- /dev/null +++ b/packages/twenty-front/src/modules/ai/utils/buildAskAiThreadRedirectPath.ts @@ -0,0 +1,22 @@ +import { ASK_AI_THREAD_ID_QUERY_PARAM } from '@/ai/constants/AskAiThreadIdQueryParam'; +import { isNonEmptyString } from '@sniptt/guards'; + +export const buildAskAiThreadRedirectPath = ({ + pathname, + search, + threadId, +}: { + pathname: string; + search: string; + threadId: string | null; +}): string => { + const searchParams = new URLSearchParams(search); + + if (isNonEmptyString(threadId)) { + searchParams.set(ASK_AI_THREAD_ID_QUERY_PARAM, threadId); + } + + const queryString = searchParams.toString(); + + return queryString.length > 0 ? `${pathname}?${queryString}` : pathname; +}; diff --git a/packages/twenty-front/src/modules/app/components/AppRouterProviders.tsx b/packages/twenty-front/src/modules/app/components/AppRouterProviders.tsx index 73ad2f5a8f..df4b5e8be1 100644 --- a/packages/twenty-front/src/modules/app/components/AppRouterProviders.tsx +++ b/packages/twenty-front/src/modules/app/components/AppRouterProviders.tsx @@ -19,6 +19,7 @@ import { UserMetadataProviderInitialEffect } from '@/metadata-store/effect-compo import { ApolloCoreProvider } from '@/object-metadata/components/ApolloCoreProvider'; import { PreComputedChipGeneratorsProvider } from '@/object-metadata/components/PreComputedChipGeneratorsProvider'; import { ApolloAdminProvider } from '@/settings/admin-panel/apollo/components/ApolloAdminProvider'; +import { EndTrialAfterPaymentMethodGater } from '@/settings/billing/components/EndTrialAfterPaymentMethodGater'; import { CommandRunner } from '@/command-menu-item/engine-command/components/CommandRunner'; import { SSEProvider } from '@/sse-db-event/components/SSEProvider'; @@ -66,6 +67,7 @@ export const AppRouterProviders = () => { + diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts index e6382bc043..2ed35db3d3 100644 --- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts +++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts @@ -16,6 +16,7 @@ export type CurrentWorkspace = Pick< | 'activationStatus' | 'billingSubscriptions' | 'billingEntitlements' + | 'billingCustomer' | 'currentBillingSubscription' | 'workspaceMembersCount' | 'isPublicInviteLinkEnabled' diff --git a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerEndTrialPeriod.tsx b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerEndTrialPeriod.tsx index d30c5d4b4b..8aaaab490a 100644 --- a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerEndTrialPeriod.tsx +++ b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerEndTrialPeriod.tsx @@ -1,31 +1,61 @@ import { InformationBanner } from '@/information-banner/components/InformationBanner'; +import { StartSubscriptionConfirmationModal } from '@/settings/billing/components/StartSubscriptionConfirmationModal'; +import { billingHasPaymentMethodSelector } from '@/settings/billing/states/billingHasPaymentMethodSelector'; import { useEndSubscriptionTrialPeriod } from '@/settings/billing/hooks/useEndSubscriptionTrialPeriod'; import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap'; +import { useModal } from '@/ui/layout/modal/hooks/useModal'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { PermissionFlagType } from '~/generated-metadata/graphql'; +const INFORMATION_BANNER_END_TRIAL_PERIOD_MODAL_ID = + 'information-banner-end-trial-period-modal'; + export const InformationBannerEndTrialPeriod = () => { const { endTrialPeriod, isLoading } = useEndSubscriptionTrialPeriod(); const { t } = useLingui(); + const { openModal } = useModal(); - const { [PermissionFlagType.WORKSPACE]: hasPermissionToEndTrialPeriod } = + const { [PermissionFlagType.BILLING]: hasPermissionToEndTrialPeriod } = usePermissionFlagMap(); + const billingHasPaymentMethod = useAtomStateValue( + billingHasPaymentMethodSelector, + ); + return ( - await endTrialPeriod()} - isButtonDisabled={isLoading} - /> + <> + + openModal(INFORMATION_BANNER_END_TRIAL_PERIOD_MODAL_ID) + } + isButtonDisabled={isLoading} + /> + {hasPermissionToEndTrialPeriod && ( + { + await endTrialPeriod(); + }} + loading={isLoading} + /> + )} + ); }; diff --git a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerNoMoreCredits.tsx b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerNoMoreCredits.tsx index b1a18cf0da..91809bff6d 100644 --- a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerNoMoreCredits.tsx +++ b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerNoMoreCredits.tsx @@ -1,30 +1,72 @@ import { InformationBanner } from '@/information-banner/components/InformationBanner'; +import { useCreditUpgradeAction } from '@/settings/billing/hooks/useCreditUpgradeAction'; import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap'; +import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; +import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { useLingui } from '@lingui/react/macro'; import { SettingsPath } from 'twenty-shared/types'; +import { isDefined } from 'twenty-shared/utils'; import { PermissionFlagType } from '~/generated-metadata/graphql'; import { useNavigateSettings } from '~/hooks/useNavigateSettings'; +const INFORMATION_BANNER_UPGRADE_CREDIT_PLAN_MODAL_ID = + 'information-banner-upgrade-credit-plan-modal'; + export const InformationBannerNoMoreCredits = () => { const { t } = useLingui(); - const { [PermissionFlagType.WORKSPACE]: hasPermissionToUpdateCreditPlan } = + const { [PermissionFlagType.BILLING]: hasPermissionToUpdateCreditPlan } = usePermissionFlagMap(); const navigateSettings = useNavigateSettings(); + const { openModal } = useModal(); + + const { + nextPrice, + nextResourceCreditsAmount, + nextResourceCreditPrice, + nextTierInterval, + upgradeCreditPlan, + isUpgrading, + } = useCreditUpgradeAction(); + + const canUpgradeInline = + hasPermissionToUpdateCreditPlan && isDefined(nextPrice); + + const buttonOnClick = !hasPermissionToUpdateCreditPlan + ? undefined + : canUpgradeInline + ? () => openModal(INFORMATION_BANNER_UPGRADE_CREDIT_PLAN_MODAL_ID) + : () => navigateSettings(SettingsPath.Billing); return ( - navigateSettings(SettingsPath.Billing)} - /> + <> + + {canUpgradeInline && ( + + )} + ); }; diff --git a/packages/twenty-front/src/modules/settings/billing/components/EndTrialAfterPaymentMethodGater.tsx b/packages/twenty-front/src/modules/settings/billing/components/EndTrialAfterPaymentMethodGater.tsx new file mode 100644 index 0000000000..d1fc02b0eb --- /dev/null +++ b/packages/twenty-front/src/modules/settings/billing/components/EndTrialAfterPaymentMethodGater.tsx @@ -0,0 +1,20 @@ +import { billingState } from '@/client-config/states/billingState'; +import { START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM } from '@/settings/billing/constants/StartSubscriptionAfterPaymentMethodQueryParam'; +import { EndTrialAfterPaymentMethodEffect } from '@/settings/billing/effect-components/EndTrialAfterPaymentMethodEffect'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSearchParams } from 'react-router-dom'; + +export const EndTrialAfterPaymentMethodGater = () => { + const billing = useAtomStateValue(billingState); + const [searchParams] = useSearchParams(); + + const shouldRun = + (billing?.isBillingEnabled ?? false) && + searchParams.has(START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM); + + if (!shouldRun) { + return null; + } + + return ; +}; diff --git a/packages/twenty-front/src/modules/settings/billing/components/StartSubscriptionConfirmationModal.tsx b/packages/twenty-front/src/modules/settings/billing/components/StartSubscriptionConfirmationModal.tsx new file mode 100644 index 0000000000..527eabf7c7 --- /dev/null +++ b/packages/twenty-front/src/modules/settings/billing/components/StartSubscriptionConfirmationModal.tsx @@ -0,0 +1,36 @@ +import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; +import { t } from '@lingui/core/macro'; + +type StartSubscriptionConfirmationModalProps = { + modalInstanceId: string; + hasPaymentMethod: boolean | null | undefined; + onConfirmClick: () => Promise; + loading: boolean; +}; + +export const StartSubscriptionConfirmationModal = ({ + modalInstanceId, + hasPaymentMethod, + onConfirmClick, + loading, +}: StartSubscriptionConfirmationModalProps) => { + const needsCreditCard = hasPaymentMethod === false; + + return ( + + ); +}; diff --git a/packages/twenty-front/src/modules/settings/billing/constants/StartSubscriptionAfterPaymentMethodQueryParam.ts b/packages/twenty-front/src/modules/settings/billing/constants/StartSubscriptionAfterPaymentMethodQueryParam.ts new file mode 100644 index 0000000000..fbf1abea8e --- /dev/null +++ b/packages/twenty-front/src/modules/settings/billing/constants/StartSubscriptionAfterPaymentMethodQueryParam.ts @@ -0,0 +1,2 @@ +export const START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM = + 'startSubscriptionAfterPaymentMethod'; diff --git a/packages/twenty-front/src/modules/settings/billing/effect-components/EndTrialAfterPaymentMethodEffect.tsx b/packages/twenty-front/src/modules/settings/billing/effect-components/EndTrialAfterPaymentMethodEffect.tsx new file mode 100644 index 0000000000..545fad567e --- /dev/null +++ b/packages/twenty-front/src/modules/settings/billing/effect-components/EndTrialAfterPaymentMethodEffect.tsx @@ -0,0 +1,87 @@ +import { ASK_AI_THREAD_ID_QUERY_PARAM } from '@/ai/constants/AskAiThreadIdQueryParam'; +import { useOpenAskAiThread } from '@/ai/hooks/useOpenAskAiThread'; +import { START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM } from '@/settings/billing/constants/StartSubscriptionAfterPaymentMethodQueryParam'; +import { useEndSubscriptionTrialPeriod } from '@/settings/billing/hooks/useEndSubscriptionTrialPeriod'; +import { isEndingSubscriptionTrialPeriodState } from '@/settings/billing/states/isEndingSubscriptionTrialPeriodState'; +import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; +import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; +import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus'; +import { isNonEmptyString } from '@sniptt/guards'; +import { t } from '@lingui/core/macro'; +import { useEffect } from 'react'; +import { useLocation, useNavigate } from 'react-router-dom'; +import { isDefined } from 'twenty-shared/utils'; +import { SubscriptionStatus } from '~/generated-metadata/graphql'; + +export const EndTrialAfterPaymentMethodEffect = () => { + const location = useLocation(); + const navigate = useNavigate(); + const subscriptionStatus = useSubscriptionStatus(); + const { endTrialPeriod } = useEndSubscriptionTrialPeriod(); + const { openAskAiThread } = useOpenAskAiThread(); + const { enqueueErrorSnackBar } = useSnackBar(); + + const searchParams = new URLSearchParams(location.search); + const askAiThreadId = searchParams.get(ASK_AI_THREAD_ID_QUERY_PARAM); + + const cleanUpQueryParams = () => { + searchParams.delete(START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM); + searchParams.delete(ASK_AI_THREAD_ID_QUERY_PARAM); + + const cleanedSearch = searchParams.toString(); + + navigate( + `${location.pathname}${cleanedSearch.length > 0 ? `?${cleanedSearch}` : ''}${location.hash}`, + { replace: true }, + ); + }; + + const startSubscription = async () => { + if (subscriptionStatus !== SubscriptionStatus.Trialing) { + cleanUpQueryParams(); + return; + } + + if (jotaiStore.get(isEndingSubscriptionTrialPeriodState.atom) === true) { + return; + } + jotaiStore.set(isEndingSubscriptionTrialPeriodState.atom, true); + + try { + const { success, hasPaymentMethod } = await endTrialPeriod({ + skipPaymentMethodRedirect: true, + }); + + if (success) { + if (isNonEmptyString(askAiThreadId)) { + openAskAiThread(askAiThreadId); + } + } else if (hasPaymentMethod === false) { + enqueueErrorSnackBar({ + message: t`No payment method found. Please update your billing details.`, + }); + } + } finally { + cleanUpQueryParams(); + jotaiStore.set(isEndingSubscriptionTrialPeriodState.atom, false); + } + }; + + useEffect(() => { + if (!isDefined(subscriptionStatus)) { + return; + } + void startSubscription(); + }, [ + location.search, + location.pathname, + location.hash, + navigate, + subscriptionStatus, + endTrialPeriod, + openAskAiThread, + enqueueErrorSnackBar, + ]); + + return null; +}; diff --git a/packages/twenty-front/src/modules/settings/billing/graphql/queries/billingPortalSession.ts b/packages/twenty-front/src/modules/settings/billing/graphql/queries/billingPortalSession.ts index ba4f9ff3a1..2f0a56cb85 100644 --- a/packages/twenty-front/src/modules/settings/billing/graphql/queries/billingPortalSession.ts +++ b/packages/twenty-front/src/modules/settings/billing/graphql/queries/billingPortalSession.ts @@ -1,8 +1,14 @@ import { gql } from '@apollo/client'; export const BILLING_PORTAL_SESSION = gql` - query BillingPortalSession($returnUrlPath: String) { - billingPortalSession(returnUrlPath: $returnUrlPath) { + query BillingPortalSession( + $returnUrlPath: String + $forPaymentMethodUpdate: Boolean + ) { + billingPortalSession( + returnUrlPath: $returnUrlPath + forPaymentMethodUpdate: $forPaymentMethodUpdate + ) { url } } diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/useCreditUpgradeAction.ts b/packages/twenty-front/src/modules/settings/billing/hooks/useCreditUpgradeAction.ts new file mode 100644 index 0000000000..4b9c6f750e --- /dev/null +++ b/packages/twenty-front/src/modules/settings/billing/hooks/useCreditUpgradeAction.ts @@ -0,0 +1,96 @@ +import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; +import { useNumberFormat } from '@/localization/hooks/useNumberFormat'; +import { useGetNextResourceCreditPrice } from '@/settings/billing/hooks/useGetNextResourceCreditPrice'; +import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useMutation } from '@apollo/client/react'; +import { t } from '@lingui/core/macro'; +import { isDefined } from 'twenty-shared/utils'; +import { + SetResourceCreditSubscriptionPriceDocument, + SubscriptionInterval, +} from '~/generated-metadata/graphql'; + +export const useCreditUpgradeAction = () => { + const nextPrice = useGetNextResourceCreditPrice(); + const { formatNumber } = useNumberFormat(); + const { enqueueSuccessSnackBar, enqueueErrorSnackBar, enqueueInfoSnackBar } = + useSnackBar(); + + const [currentWorkspace, setCurrentWorkspace] = useAtomState( + currentWorkspaceState, + ); + + const [setResourceCreditSubscriptionPrice, { loading: isUpgrading }] = + useMutation(SetResourceCreditSubscriptionPriceDocument); + + const nextResourceCreditsAmount = isDefined(nextPrice) + ? formatNumber(nextPrice.creditAmount ?? 0, { + abbreviate: true, + decimals: 2, + }) + : null; + + const nextResourceCreditPrice = isDefined(nextPrice) + ? formatNumber((nextPrice.unitAmount ?? 0) / 100) + : null; + + const nextTierInterval = isDefined(nextPrice) + ? nextPrice.recurringInterval === SubscriptionInterval.Month + ? t`month` + : t`year` + : null; + + const upgradeCreditPlan = async () => { + if (!isDefined(nextPrice)) { + return; + } + + try { + enqueueInfoSnackBar({ + message: t`Upgrading subscription...`, + }); + + const { data } = await setResourceCreditSubscriptionPrice({ + variables: { priceId: nextPrice.stripePriceId }, + }); + + if ( + isDefined( + data?.setResourceCreditSubscriptionPrice.currentBillingSubscription, + ) && + isDefined(currentWorkspace) + ) { + setCurrentWorkspace({ + ...currentWorkspace, + currentBillingSubscription: { + ...data.setResourceCreditSubscriptionPrice + .currentBillingSubscription, + billingSubscriptionItems: + data.setResourceCreditSubscriptionPrice.currentBillingSubscription?.billingSubscriptionItems?.map( + (item) => ({ + ...item, + hasReachedCurrentPeriodCap: false, + }), + ), + }, + billingSubscriptions: + data.setResourceCreditSubscriptionPrice.billingSubscriptions, + }); + } + + enqueueSuccessSnackBar({ message: t`Credit plan upgraded.` }); + } catch { + enqueueErrorSnackBar({ message: t`Failed to upgrade credit plan.` }); + } + }; + + return { + nextPrice, + nextResourceCreditsAmount, + nextResourceCreditPrice, + nextTierInterval, + upgradeCreditPlan, + isUpgrading, + }; +}; diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/useEndSubscriptionTrialPeriod.ts b/packages/twenty-front/src/modules/settings/billing/hooks/useEndSubscriptionTrialPeriod.ts index ee07a8d580..de978ffbbc 100644 --- a/packages/twenty-front/src/modules/settings/billing/hooks/useEndSubscriptionTrialPeriod.ts +++ b/packages/twenty-front/src/modules/settings/billing/hooks/useEndSubscriptionTrialPeriod.ts @@ -1,47 +1,99 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { useRedirect } from '@/domain-manager/hooks/useRedirect'; +import { START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM } from '@/settings/billing/constants/StartSubscriptionAfterPaymentMethodQueryParam'; import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { t } from '@lingui/core/macro'; import { useState } from 'react'; +import { useLocation } from 'react-router-dom'; import { isDefined } from 'twenty-shared/utils'; -import { useMutation } from '@apollo/client/react'; -import { EndSubscriptionTrialPeriodDocument } from '~/generated-metadata/graphql'; +import { useLazyQuery, useMutation } from '@apollo/client/react'; +import { + BillingPortalSessionDocument, + EndSubscriptionTrialPeriodDocument, +} from '~/generated-metadata/graphql'; export const useEndSubscriptionTrialPeriod = () => { - const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar(); + const { enqueueSuccessSnackBar, enqueueErrorSnackBar, enqueueInfoSnackBar } = + useSnackBar(); const [endSubscriptionTrialPeriod] = useMutation( EndSubscriptionTrialPeriodDocument, ); + const [getBillingPortalSession] = useLazyQuery(BillingPortalSessionDocument); const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); const [isLoading, setIsLoading] = useState(false); const { redirect } = useRedirect(); + const location = useLocation(); - const endTrialPeriod = async () => { + const redirectToPaymentMethodUpdate = async ( + fallbackUrl: string | null | undefined, + finalRedirectPath: string, + ) => { + const returnUrl = new URL(finalRedirectPath, 'https://placeholder.invalid'); + returnUrl.searchParams.set( + START_SUBSCRIPTION_AFTER_PAYMENT_METHOD_QUERY_PARAM, + 'true', + ); + const confirmReturnPath = `${returnUrl.pathname}${returnUrl.search}${returnUrl.hash}`; + + try { + const { data } = await getBillingPortalSession({ + variables: { + returnUrlPath: confirmReturnPath, + forPaymentMethodUpdate: true, + }, + }); + + const portalUrl = data?.billingPortalSession.url ?? fallbackUrl; + + if (isDefined(portalUrl)) { + redirect(portalUrl); + return; + } + } catch { + if (isDefined(fallbackUrl)) { + redirect(fallbackUrl); + return; + } + } + + enqueueErrorSnackBar({ + message: t`No payment method found. Please update your billing details.`, + }); + }; + + const endTrialPeriod = async (options?: { + finalRedirectPath?: string; + skipPaymentMethodRedirect?: boolean; + }): Promise<{ success: boolean; hasPaymentMethod?: boolean }> => { try { setIsLoading(true); + if (options?.skipPaymentMethodRedirect === true) { + enqueueInfoSnackBar({ + message: t`Activating subscription...`, + }); + } + + const finalRedirectPath = + options?.finalRedirectPath ?? `${location.pathname}${location.search}`; + const { data } = await endSubscriptionTrialPeriod(); const endTrialPeriodOutput = data?.endSubscriptionTrialPeriod; const hasPaymentMethod = endTrialPeriodOutput?.hasPaymentMethod; if (isDefined(hasPaymentMethod) && hasPaymentMethod === false) { - const billingPortalUrl = endTrialPeriodOutput?.billingPortalUrl; - - if (isDefined(billingPortalUrl)) { - redirect(billingPortalUrl); - - return { success: false }; + if (options?.skipPaymentMethodRedirect !== true) { + await redirectToPaymentMethodUpdate( + endTrialPeriodOutput?.billingPortalUrl, + finalRedirectPath, + ); } - enqueueErrorSnackBar({ - message: t`No payment method found. Please update your billing details.`, - }); - - return { success: false }; + return { success: false, hasPaymentMethod: false }; } const updatedSubscriptionStatus = endTrialPeriodOutput?.status; @@ -54,6 +106,13 @@ export const useEndSubscriptionTrialPeriod = () => { currentBillingSubscription: { ...currentWorkspace?.currentBillingSubscription, status: updatedSubscriptionStatus, + billingSubscriptionItems: + currentWorkspace?.currentBillingSubscription?.billingSubscriptionItems?.map( + (item) => ({ + ...item, + hasReachedCurrentPeriodCap: false, + }), + ), }, }); } @@ -62,7 +121,7 @@ export const useEndSubscriptionTrialPeriod = () => { message: t`Subscription activated.`, }); - return { success: true }; + return { success: true, hasPaymentMethod: true }; } catch { enqueueErrorSnackBar({ message: t`Error while ending trial period. Please contact Twenty team.`, diff --git a/packages/twenty-front/src/modules/settings/billing/states/billingHasPaymentMethodSelector.ts b/packages/twenty-front/src/modules/settings/billing/states/billingHasPaymentMethodSelector.ts new file mode 100644 index 0000000000..31f19a957c --- /dev/null +++ b/packages/twenty-front/src/modules/settings/billing/states/billingHasPaymentMethodSelector.ts @@ -0,0 +1,8 @@ +import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; + +export const billingHasPaymentMethodSelector = createAtomSelector({ + key: 'billingHasPaymentMethodSelector', + get: ({ get }) => + get(currentWorkspaceState)?.billingCustomer?.hasPaymentMethod, +}); diff --git a/packages/twenty-front/src/modules/settings/billing/states/isEndingSubscriptionTrialPeriodState.ts b/packages/twenty-front/src/modules/settings/billing/states/isEndingSubscriptionTrialPeriodState.ts new file mode 100644 index 0000000000..d387d20c92 --- /dev/null +++ b/packages/twenty-front/src/modules/settings/billing/states/isEndingSubscriptionTrialPeriodState.ts @@ -0,0 +1,6 @@ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; + +export const isEndingSubscriptionTrialPeriodState = createAtomState({ + key: 'billing/isEndingSubscriptionTrialPeriodState', + defaultValue: false, +}); diff --git a/packages/twenty-front/src/modules/users/graphql/fragments/userQueryFragment.ts b/packages/twenty-front/src/modules/users/graphql/fragments/userQueryFragment.ts index ec45cf3213..23b2c2e06a 100644 --- a/packages/twenty-front/src/modules/users/graphql/fragments/userQueryFragment.ts +++ b/packages/twenty-front/src/modules/users/graphql/fragments/userQueryFragment.ts @@ -83,6 +83,10 @@ export const USER_QUERY_FRAGMENT = gql` currentBillingSubscription { ...CurrentBillingSubscriptionFragment } + billingCustomer { + id + hasPaymentMethod + } billingSubscriptions { ...BillingSubscriptionFragment } diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-15/2-15-instance-command-fast-1781280240009-add-has-payment-method-to-billing-customer.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-15/2-15-instance-command-fast-1781280240009-add-has-payment-method-to-billing-customer.ts new file mode 100644 index 0000000000..ce268226d4 --- /dev/null +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-15/2-15-instance-command-fast-1781280240009-add-has-payment-method-to-billing-customer.ts @@ -0,0 +1,37 @@ +import { QueryRunner } from 'typeorm'; + +import { RegisteredInstanceCommand } from 'src/engine/core-modules/upgrade/decorators/registered-instance-command.decorator'; +import { FastInstanceCommand } from 'src/engine/core-modules/upgrade/interfaces/fast-instance-command.interface'; + +@RegisteredInstanceCommand('2.15.0', 1781280240009) +export class AddHasPaymentMethodToBillingCustomerFastInstanceCommand + implements FastInstanceCommand +{ + public async up(queryRunner: QueryRunner): Promise { + const tableExists = await queryRunner.query( + `SELECT 1 FROM pg_tables WHERE schemaname = 'core' AND tablename = 'billingCustomer'`, + ); + + if (tableExists.length === 0) { + return; + } + + await queryRunner.query( + `ALTER TABLE "core"."billingCustomer" ADD COLUMN IF NOT EXISTS "hasPaymentMethod" boolean`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + const tableExists = await queryRunner.query( + `SELECT 1 FROM pg_tables WHERE schemaname = 'core' AND tablename = 'billingCustomer'`, + ); + + if (tableExists.length === 0) { + return; + } + + await queryRunner.query( + `ALTER TABLE "core"."billingCustomer" DROP COLUMN IF EXISTS "hasPaymentMethod"`, + ); + } +} diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts index 71a68c5f16..dcf29fcdce 100644 --- a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts @@ -72,6 +72,7 @@ import { EmailingDomainTenantStatusAndGlobalUniquenessFastInstanceCommand } from import { AddLogicFunctionExecutionModeFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-9/2-9-instance-command-fast-1799000030000-add-logic-function-execution-mode'; import { EncryptNonSecretApplicationVariableSlowInstanceCommand } from 'src/database/commands/upgrade-version-command/2-9/2-9-instance-command-slow-1798400000000-encrypt-non-secret-application-variable'; import { MigrateAiModelPreferencesSlowInstanceCommand } from 'src/database/commands/upgrade-version-command/2-9/2-9-instance-command-slow-1799000010000-migrate-ai-model-preferences'; +import { AddHasPaymentMethodToBillingCustomerFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-15/2-15-instance-command-fast-1781280240009-add-has-payment-method-to-billing-customer'; export const INSTANCE_COMMANDS = [ AddViewFieldGroupIdIndexOnViewFieldFastInstanceCommand, @@ -135,6 +136,7 @@ export const INSTANCE_COMMANDS = [ EncryptNonSecretApplicationVariableSlowInstanceCommand, DropIsCustomFromObjectAndFieldMetadataFastInstanceCommand, DropEmailingDomainDriverColumnFastInstanceCommand, + AddHasPaymentMethodToBillingCustomerFastInstanceCommand, AddEmailingDomainUnsubscribeHostFastInstanceCommand, ViewOverridableEntityFastInstanceCommand, CreateMessageSuppressionCoreTableFastInstanceCommand, diff --git a/packages/twenty-server/src/engine/core-modules/billing-webhook/billing-webhook.controller.ts b/packages/twenty-server/src/engine/core-modules/billing-webhook/billing-webhook.controller.ts index 64a5ac0499..6bede63ad4 100644 --- a/packages/twenty-server/src/engine/core-modules/billing-webhook/billing-webhook.controller.ts +++ b/packages/twenty-server/src/engine/core-modules/billing-webhook/billing-webhook.controller.ts @@ -123,8 +123,10 @@ export class BillingWebhookController { ); case BillingWebhookEvent.CUSTOMER_CREATED: + case BillingWebhookEvent.PAYMENT_METHOD_ATTACHED: + case BillingWebhookEvent.PAYMENT_METHOD_DETACHED: return await this.billingWebhookCustomerService.processStripeEvent( - event.data, + event, ); case BillingWebhookEvent.CUSTOMER_SUBSCRIPTION_CREATED: diff --git a/packages/twenty-server/src/engine/core-modules/billing-webhook/services/billing-webhook-customer.service.ts b/packages/twenty-server/src/engine/core-modules/billing-webhook/services/billing-webhook-customer.service.ts index 56839d1a1a..5e59353b1e 100644 --- a/packages/twenty-server/src/engine/core-modules/billing-webhook/services/billing-webhook-customer.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing-webhook/services/billing-webhook-customer.service.ts @@ -1,6 +1,9 @@ /* @license Enterprise */ import { Injectable, Logger } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; + +import { type Repository } from 'typeorm'; import type Stripe from 'stripe'; @@ -9,17 +12,44 @@ import { BillingExceptionCode, } from 'src/engine/core-modules/billing/billing.exception'; import { BillingCustomerEntity } from 'src/engine/core-modules/billing/entities/billing-customer.entity'; +import { BillingWebhookEvent } from 'src/engine/core-modules/billing/enums/billing-webhook-events.enum'; +import { StripeCustomerService } from 'src/engine/core-modules/billing/stripe/services/stripe-customer.service'; import { InjectWorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scoped-repository/inject-workspace-scoped-repository.decorator'; import { WorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scoped-repository/workspace-scoped-repository'; +import { isDefined } from 'twenty-shared/utils'; +import { isString } from '@sniptt/guards'; @Injectable() export class BillingWebhookCustomerService { protected readonly logger = new Logger(BillingWebhookCustomerService.name); constructor( @InjectWorkspaceScopedRepository(BillingCustomerEntity) private readonly billingCustomerRepository: WorkspaceScopedRepository, + // eslint-disable-next-line twenty/prefer-workspace-scoped-repository -- resolves workspaceId from a Stripe customerId before any workspace context exists + @InjectRepository(BillingCustomerEntity) + private readonly billingCustomerRepositoryUnscoped: Repository, + private readonly stripeCustomerService: StripeCustomerService, ) {} - async processStripeEvent(data: Stripe.CustomerCreatedEvent.Data) { + async processStripeEvent( + event: + | Stripe.CustomerCreatedEvent + | Stripe.PaymentMethodAttachedEvent + | Stripe.PaymentMethodDetachedEvent, + ) { + if (event.type === BillingWebhookEvent.CUSTOMER_CREATED) { + return this.processCustomerCreated(event.data); + } + + if (event.type === BillingWebhookEvent.PAYMENT_METHOD_ATTACHED) { + return this.processPaymentMethodAttachedEvent(event.data); + } + + if (event.type === BillingWebhookEvent.PAYMENT_METHOD_DETACHED) { + return this.processPaymentMethodDetachedEvent(event.data); + } + } + + private async processCustomerCreated(data: Stripe.CustomerCreatedEvent.Data) { const { id: stripeCustomerId, metadata } = data.object; const workspaceId = metadata?.workspaceId; @@ -40,4 +70,82 @@ export class BillingWebhookCustomerService { }, ); } + + private async processPaymentMethodAttachedEvent( + data: Stripe.PaymentMethodAttachedEvent.Data, + ) { + const stripeCustomerId = this.extractStripeCustomerId(data.object.customer); + + if (!stripeCustomerId) { + return {}; + } + + const workspaceId = + await this.getWorkspaceIdFromStripeCustomerId(stripeCustomerId); + + if (!workspaceId) { + return {}; + } + + await this.billingCustomerRepository.update( + workspaceId, + { stripeCustomerId }, + { hasPaymentMethod: true }, + ); + } + + private async processPaymentMethodDetachedEvent( + data: Stripe.PaymentMethodDetachedEvent.Data, + ) { + const stripeCustomerId = this.extractStripeCustomerId( + data.previous_attributes?.customer, + ); + + if (!isDefined(stripeCustomerId)) { + return; + } + + const workspaceId = + await this.getWorkspaceIdFromStripeCustomerId(stripeCustomerId); + + if (!isDefined(workspaceId)) { + return; + } + + const hasPaymentMethod = + await this.stripeCustomerService.hasPaymentMethod(stripeCustomerId); + + await this.billingCustomerRepository.update( + workspaceId, + { stripeCustomerId }, + { hasPaymentMethod }, + ); + } + + private async getWorkspaceIdFromStripeCustomerId( + stripeCustomerId: string, + ): Promise { + const billingCustomer = + await this.billingCustomerRepositoryUnscoped.findOne({ + where: { stripeCustomerId }, + select: { workspaceId: true }, + }); + + return billingCustomer?.workspaceId ?? null; + } + + private extractStripeCustomerId( + customer: + | string + | Stripe.Customer + | Stripe.DeletedCustomer + | null + | undefined, + ): string | null { + if (!customer) { + return null; + } + + return isString(customer) ? customer : customer.id; + } } diff --git a/packages/twenty-server/src/engine/core-modules/billing-webhook/services/billing-webhook-subscription.service.ts b/packages/twenty-server/src/engine/core-modules/billing-webhook/services/billing-webhook-subscription.service.ts index 76a669adf8..d5c4732e1c 100644 --- a/packages/twenty-server/src/engine/core-modules/billing-webhook/services/billing-webhook-subscription.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing-webhook/services/billing-webhook-subscription.service.ts @@ -23,7 +23,7 @@ import { BillingSubscriptionItemEntity } from 'src/engine/core-modules/billing/e import { BillingSubscriptionEntity } from 'src/engine/core-modules/billing/entities/billing-subscription.entity'; import { SubscriptionStatus } from 'src/engine/core-modules/billing/enums/billing-subscription-status.enum'; import { BillingWebhookEvent } from 'src/engine/core-modules/billing/enums/billing-webhook-events.enum'; -import { BillingUsageService } from 'src/engine/core-modules/billing/services/billing-usage.service'; +import { BillingUsageCacheService } from 'src/engine/core-modules/billing/services/billing-usage-cache.service'; import { StripeCustomerService } from 'src/engine/core-modules/billing/stripe/services/stripe-customer.service'; import { StripeSubscriptionScheduleService } from 'src/engine/core-modules/billing/stripe/services/stripe-subscription-schedule.service'; import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; @@ -61,7 +61,7 @@ export class BillingWebhookSubscriptionService { private readonly billingCustomerRepository: WorkspaceScopedRepository, private readonly workspaceService: WorkspaceService, private readonly stripeSubscriptionScheduleService: StripeSubscriptionScheduleService, - private readonly billingUsageService: BillingUsageService, + private readonly billingUsageCacheService: BillingUsageCacheService, private readonly workspaceCacheService: WorkspaceCacheService, ) {} @@ -145,7 +145,7 @@ export class BillingWebhookSubscriptionService { workspaceId, ); - await this.billingUsageService.flushAvailableCreditsFromCache(workspace.id); + await this.billingUsageCacheService.flushAvailableCredits(workspace.id); await this.workspaceCacheService.invalidateAndRecompute(workspace.id, [ 'currentBillingSubscription', ]); diff --git a/packages/twenty-server/src/engine/core-modules/billing/billing.module.ts b/packages/twenty-server/src/engine/core-modules/billing/billing.module.ts index 2b0f4584f3..b20aa44522 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/billing.module.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/billing.module.ts @@ -29,6 +29,7 @@ import { BillingSubscriptionItemService } from 'src/engine/core-modules/billing/ import { BillingSubscriptionPhaseService } from 'src/engine/core-modules/billing/services/billing-subscription-phase.service'; import { BillingSubscriptionUpdateService } from 'src/engine/core-modules/billing/services/billing-subscription-update.service'; import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service'; +import { BillingUsageCacheService } from 'src/engine/core-modules/billing/services/billing-usage-cache.service'; import { BillingUsageCapService } from 'src/engine/core-modules/billing/services/billing-usage-cap.service'; import { BillingUsageService } from 'src/engine/core-modules/billing/services/billing-usage.service'; import { BillingService } from 'src/engine/core-modules/billing/services/billing.service'; @@ -89,6 +90,7 @@ import { WorkspaceCacheModule } from 'src/engine/workspace-cache/workspace-cache BillingUpdateSubscriptionPriceCommand, BillingSyncPlansDataCommand, BillingUsageService, + BillingUsageCacheService, BillingUsageCapService, BillingPriceService, BillingCreditRolloverService, @@ -107,6 +109,7 @@ import { WorkspaceCacheModule } from 'src/engine/workspace-cache/workspace-cache BillingPortalWorkspaceService, BillingService, BillingUsageService, + BillingUsageCacheService, BillingUsageCapService, BillingCreditRolloverService, ResourceCreditService, diff --git a/packages/twenty-server/src/engine/core-modules/billing/billing.resolver.ts b/packages/twenty-server/src/engine/core-modules/billing/billing.resolver.ts index 9e7deb54a7..ccd5ce0bea 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/billing.resolver.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/billing.resolver.ts @@ -71,12 +71,13 @@ export class BillingResolver { ) async billingPortalSession( @AuthWorkspace() workspace: WorkspaceEntity, - @Args() { returnUrlPath }: BillingSessionInput, + @Args() { returnUrlPath, forPaymentMethodUpdate }: BillingSessionInput, ) { return { url: await this.billingPortalWorkspaceService.computeBillingPortalSessionURLOrThrow( workspace, returnUrlPath, + forPaymentMethodUpdate, ), }; } diff --git a/packages/twenty-server/src/engine/core-modules/billing/dtos/inputs/billing-session.input.ts b/packages/twenty-server/src/engine/core-modules/billing/dtos/inputs/billing-session.input.ts index cf22c5c364..ff98f4c874 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/dtos/inputs/billing-session.input.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/dtos/inputs/billing-session.input.ts @@ -2,7 +2,7 @@ import { ArgsType, Field } from '@nestjs/graphql'; -import { IsOptional, IsString } from 'class-validator'; +import { IsBoolean, IsOptional, IsString } from 'class-validator'; @ArgsType() export class BillingSessionInput { @@ -10,4 +10,9 @@ export class BillingSessionInput { @IsString() @IsOptional() returnUrlPath?: string; + + @Field(() => Boolean, { nullable: true }) + @IsBoolean() + @IsOptional() + forPaymentMethodUpdate?: boolean; } diff --git a/packages/twenty-server/src/engine/core-modules/billing/entities/billing-customer.entity.ts b/packages/twenty-server/src/engine/core-modules/billing/entities/billing-customer.entity.ts index d7f6514500..d9f7d3b3fe 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/entities/billing-customer.entity.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/entities/billing-customer.entity.ts @@ -1,6 +1,6 @@ /* @license Enterprise */ -import { ObjectType } from '@nestjs/graphql'; +import { Field, ObjectType } from '@nestjs/graphql'; import { IDField } from '@ptc-org/nestjs-query-graphql'; import { @@ -41,6 +41,11 @@ export class BillingCustomerEntity extends WorkspaceRelatedEntity { @Column({ nullable: false, unique: true }) stripeCustomerId: string; + // Null means unknown (customer created before the flag existed and not synced yet). + @Field(() => Boolean, { nullable: true }) + @Column({ nullable: true, type: 'boolean' }) + hasPaymentMethod: boolean | null; + @Column({ type: 'bigint', nullable: false, diff --git a/packages/twenty-server/src/engine/core-modules/billing/enums/billing-webhook-events.enum.ts b/packages/twenty-server/src/engine/core-modules/billing/enums/billing-webhook-events.enum.ts index eaeecaee9a..e971c61423 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/enums/billing-webhook-events.enum.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/enums/billing-webhook-events.enum.ts @@ -5,6 +5,8 @@ export enum BillingWebhookEvent { CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated', CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted', CUSTOMER_CREATED = 'customer.created', + PAYMENT_METHOD_ATTACHED = 'payment_method.attached', + PAYMENT_METHOD_DETACHED = 'payment_method.detached', SETUP_INTENT_SUCCEEDED = 'setup_intent.succeeded', CUSTOMER_ACTIVE_ENTITLEMENT_SUMMARY_UPDATED = 'entitlements.active_entitlement_summary.updated', PRODUCT_CREATED = 'product.created', diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts index 1ada61efe7..3bec9ff59f 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts @@ -183,6 +183,7 @@ export class BillingPortalWorkspaceService { async computeBillingPortalSessionURLOrThrow( workspace: WorkspaceEntity, returnUrlPath?: string, + forPaymentMethodUpdate?: boolean, ) { const lastSubscription = await this.billingSubscriptionRepository.findOne( workspace.id, @@ -202,20 +203,17 @@ export class BillingPortalWorkspaceService { throw new Error('Error: missing stripeCustomerId'); } - const frontBaseUrl = this.workspaceDomainsService.buildWorkspaceURL({ - workspace, - }); + const returnUrl = this.buildReturnUrl(workspace, returnUrlPath); - if (returnUrlPath) { - frontBaseUrl.pathname = returnUrlPath; - } - const returnUrl = frontBaseUrl.toString(); - - const session = - await this.stripeBillingPortalService.createBillingPortalSession( - stripeCustomerId, - returnUrl, - ); + const session = forPaymentMethodUpdate + ? await this.stripeBillingPortalService.createBillingPortalSessionForPaymentMethodUpdate( + stripeCustomerId, + returnUrl, + ) + : await this.stripeBillingPortalService.createBillingPortalSession( + stripeCustomerId, + returnUrl, + ); assertIsDefinedOrThrow( session.url, @@ -233,14 +231,7 @@ export class BillingPortalWorkspaceService { stripeCustomerId: string, returnUrlPath?: string, ) { - const frontBaseUrl = this.workspaceDomainsService.buildWorkspaceURL({ - workspace, - }); - - if (returnUrlPath) { - frontBaseUrl.pathname = returnUrlPath; - } - const returnUrl = frontBaseUrl.toString(); + const returnUrl = this.buildReturnUrl(workspace, returnUrlPath); const session = await this.stripeBillingPortalService.createBillingPortalSessionForPaymentMethodUpdate( @@ -259,6 +250,24 @@ export class BillingPortalWorkspaceService { return session.url; } + private buildReturnUrl(workspace: WorkspaceEntity, returnUrlPath?: string) { + const frontBaseUrl = this.workspaceDomainsService.buildWorkspaceURL({ + workspace, + }); + + if (!isDefined(returnUrlPath)) { + return frontBaseUrl.toString(); + } + + const resolvedUrl = new URL(returnUrlPath, frontBaseUrl); + + if (resolvedUrl.origin !== frontBaseUrl.origin) { + return frontBaseUrl.toString(); + } + + return resolvedUrl.toString(); + } + private getDefaultResourceCreditPrice( billingPricesPerPlan: BillingGetPricesPerPlanResult, ) { diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-subscription.service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-subscription.service.ts index 6d7c5155b3..c2b0b17a38 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-subscription.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-subscription.service.ts @@ -28,6 +28,7 @@ import { BillingEntitlementKey } from 'src/engine/core-modules/billing/enums/bil import { SubscriptionStatus } from 'src/engine/core-modules/billing/enums/billing-subscription-status.enum'; import { BillingPlanService } from 'src/engine/core-modules/billing/services/billing-plan.service'; import { BillingPriceService } from 'src/engine/core-modules/billing/services/billing-price.service'; +import { BillingUsageCacheService } from 'src/engine/core-modules/billing/services/billing-usage-cache.service'; import { StripeCustomerService } from 'src/engine/core-modules/billing/stripe/services/stripe-customer.service'; import { StripeSubscriptionScheduleService } from 'src/engine/core-modules/billing/stripe/services/stripe-subscription-schedule.service'; import { StripeSubscriptionService } from 'src/engine/core-modules/billing/stripe/services/stripe-subscription.service'; @@ -37,6 +38,7 @@ import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twent import { type WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity'; import { InjectWorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scoped-repository/inject-workspace-scoped-repository.decorator'; import { WorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scoped-repository/workspace-scoped-repository'; +import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service'; @Injectable() export class BillingSubscriptionService { protected readonly logger = new Logger(BillingSubscriptionService.name); @@ -62,12 +64,20 @@ export class BillingSubscriptionService { @InjectWorkspaceScopedRepository(BillingCustomerEntity) private readonly billingCustomerRepository: WorkspaceScopedRepository, private readonly enterprisePlanService: EnterprisePlanService, + private readonly workspaceCacheService: WorkspaceCacheService, + private readonly billingUsageCacheService: BillingUsageCacheService, ) {} async getBillingSubscriptions(workspaceId: string) { return await this.billingSubscriptionRepository.find(workspaceId); } + async getBillingCustomer( + workspaceId: string, + ): Promise { + return await this.billingCustomerRepository.findOneBy(workspaceId, {}); + } + async getCurrentBillingSubscription(criteria: { workspaceId?: string; stripeCustomerId?: string; @@ -267,11 +277,22 @@ export class BillingSubscriptionService { }, ); + await this.syncSubscriptionToDatabase( + billingSubscription.workspaceId, + updatedSubscription.id, + ); + await this.billingSubscriptionItemRepository.update( { stripeSubscriptionId: updatedSubscription.id }, { hasReachedCurrentPeriodCap: false }, ); + await this.billingUsageCacheService.flushAvailableCredits(workspace.id); + + await this.workspaceCacheService.invalidateAndRecompute(workspace.id, [ + 'currentBillingSubscription', + ]); + return { status: getSubscriptionStatus(updatedSubscription.status), hasPaymentMethod: true, diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage-cache.service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage-cache.service.ts new file mode 100644 index 0000000000..e813d2c67a --- /dev/null +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage-cache.service.ts @@ -0,0 +1,67 @@ +/* @license Enterprise */ + +import { Injectable } from '@nestjs/common'; + +import { buildBillingUsageAvailableCreditsCacheKey } from 'src/engine/core-modules/billing/utils/build-billing-usage-available-credits-cache-key.util'; +import { buildBillingUsageAvailableCreditsCachePattern } from 'src/engine/core-modules/billing/utils/build-billing-usage-available-credits-cache-pattern.util'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/services/cache-storage.service'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; + +@Injectable() +export class BillingUsageCacheService { + constructor( + @InjectCacheStorage(CacheStorageNamespace.EngineBillingUsage) + private readonly billingUsageCacheStorage: CacheStorageService, + ) {} + + async getAvailableCredits( + workspaceId: string, + periodStart: Date | string, + ): Promise { + return this.billingUsageCacheStorage.get( + buildBillingUsageAvailableCreditsCacheKey(workspaceId, periodStart), + ); + } + + async warmAvailableCredits( + workspaceId: string, + periodStart: Date | string, + periodEnd: Date | string, + availableCredits: number, + ): Promise { + const ttlMs = Math.max(new Date(periodEnd).getTime() - Date.now(), 0); + + await this.billingUsageCacheStorage.set( + buildBillingUsageAvailableCreditsCacheKey(workspaceId, periodStart), + availableCredits, + ttlMs, + ); + } + + async decrementAvailableCredits( + workspaceId: string, + periodStart: Date | string, + usedCredits: number, + ): Promise { + return this.billingUsageCacheStorage.incrBy( + buildBillingUsageAvailableCreditsCacheKey(workspaceId, periodStart), + -usedCredits, + ); + } + + async invalidateAvailableCredits( + workspaceId: string, + periodStart: Date | string, + ): Promise { + await this.billingUsageCacheStorage.del( + buildBillingUsageAvailableCreditsCacheKey(workspaceId, periodStart), + ); + } + + async flushAvailableCredits(workspaceId: string): Promise { + await this.billingUsageCacheStorage.flushByPattern( + buildBillingUsageAvailableCreditsCachePattern(workspaceId), + ); + } +} diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage.service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage.service.ts index cbd60c5dec..5e0f5728e2 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage.service.ts @@ -21,11 +21,8 @@ import { BillingProductKey } from 'src/engine/core-modules/billing/enums/billing import { SubscriptionStatus } from 'src/engine/core-modules/billing/enums/billing-subscription-status.enum'; import { BillingSubscriptionItemService } from 'src/engine/core-modules/billing/services/billing-subscription-item.service'; import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service'; +import { BillingUsageCacheService } from 'src/engine/core-modules/billing/services/billing-usage-cache.service'; import { BillingUsageCapService } from 'src/engine/core-modules/billing/services/billing-usage-cap.service'; -import { buildBillingUsageAvailableCreditsCacheKey } from 'src/engine/core-modules/billing/utils/build-billing-usage-available-credits-cache-key.util'; -import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageService } from 'src/engine/core-modules/cache-storage/services/cache-storage.service'; -import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service'; import { type WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity'; import { InjectWorkspaceScopedRepository } from 'src/engine/twenty-orm/workspace-scoped-repository/inject-workspace-scoped-repository.decorator'; @@ -45,8 +42,7 @@ export class BillingUsageService { private readonly billingSubscriptionService: BillingSubscriptionService, private readonly twentyConfigService: TwentyConfigService, private readonly billingSubscriptionItemService: BillingSubscriptionItemService, - @InjectCacheStorage(CacheStorageNamespace.EngineBillingUsage) - private readonly billingUsageCacheStorage: CacheStorageService, + private readonly billingUsageCacheService: BillingUsageCacheService, @InjectWorkspaceScopedRepository(BillingSubscriptionEntity) private readonly billingSubscriptionRepository: WorkspaceScopedRepository, private readonly workspaceCacheService: WorkspaceCacheService, @@ -167,36 +163,6 @@ export class BillingUsageService { }; } - async flushAvailableCreditsFromCache(workspaceId: string): Promise { - await this.billingUsageCacheStorage.flushByPattern( - `available-credits:${workspaceId}:*`, - ); - } - - private async warmAvailableCreditsInCache( - workspaceId: string, - periodStart: Date | string, - periodEnd: Date | string, - availableCredits: number, - ): Promise { - const ttlMs = Math.max(new Date(periodEnd).getTime() - Date.now(), 0); - - await this.billingUsageCacheStorage.set( - buildBillingUsageAvailableCreditsCacheKey(workspaceId, periodStart), - availableCredits, - ttlMs, - ); - } - - private async getAvailableCreditsFromCache( - workspaceId: string, - periodStart: Date | string, - ): Promise { - return this.billingUsageCacheStorage.get( - buildBillingUsageAvailableCreditsCacheKey(workspaceId, periodStart), - ); - } - private async getAvailableCreditsFromClickHouse({ workspaceId, currentPeriodStart, @@ -300,10 +266,11 @@ export class BillingUsageService { const { currentPeriodStart, currentPeriodEnd } = currentBillingSubscription; - const cachedAvailableCredits = await this.getAvailableCreditsFromCache( - workspaceId, - currentPeriodStart, - ); + const cachedAvailableCredits = + await this.billingUsageCacheService.getAvailableCredits( + workspaceId, + currentPeriodStart, + ); const availableCredits = isDefined(cachedAvailableCredits) ? cachedAvailableCredits @@ -313,7 +280,7 @@ export class BillingUsageService { }); if (!isDefined(cachedAvailableCredits)) { - await this.warmAvailableCreditsInCache( + await this.billingUsageCacheService.warmAvailableCredits( workspaceId, currentPeriodStart, currentPeriodEnd, @@ -322,12 +289,10 @@ export class BillingUsageService { } const decrementedAvailableCredits = - await this.billingUsageCacheStorage.incrBy( - buildBillingUsageAvailableCreditsCacheKey( - workspaceId, - currentPeriodStart, - ), - -usedCredits, + await this.billingUsageCacheService.decrementAvailableCredits( + workspaceId, + currentPeriodStart, + usedCredits, ); const hasJustReachedCap = @@ -343,15 +308,6 @@ export class BillingUsageService { return decrementedAvailableCredits; } - async invalidateAvailableCreditsInCache( - workspaceId: string, - periodStart: Date, - ): Promise { - await this.billingUsageCacheStorage.del( - buildBillingUsageAvailableCreditsCacheKey(workspaceId, periodStart), - ); - } - async hasAvailableCredits(workspaceId: string): Promise { if (!this.twentyConfigService.get('IS_BILLING_ENABLED')) { return true; @@ -380,7 +336,7 @@ export class BillingUsageService { const subscription = currentBillingSubscription; - const cached = await this.getAvailableCreditsFromCache( + const cached = await this.billingUsageCacheService.getAvailableCredits( subscription.workspaceId, subscription.currentPeriodStart, ); @@ -394,7 +350,7 @@ export class BillingUsageService { currentPeriodStart: subscription.currentPeriodStart, }); - await this.warmAvailableCreditsInCache( + await this.billingUsageCacheService.warmAvailableCredits( subscription.workspaceId, subscription.currentPeriodStart, subscription.currentPeriodEnd, diff --git a/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-customer.service.ts b/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-customer.service.ts index 5e41340489..55e50287cb 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-customer.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-customer.service.ts @@ -59,6 +59,7 @@ export class StripeCustomerService { await this.billingCustomerRepository.save(workspaceId, { stripeCustomerId: customer.id, + hasPaymentMethod: false, }); return customer; diff --git a/packages/twenty-server/src/engine/core-modules/billing/utils/build-billing-usage-available-credits-cache-pattern.util.ts b/packages/twenty-server/src/engine/core-modules/billing/utils/build-billing-usage-available-credits-cache-pattern.util.ts new file mode 100644 index 0000000000..b07ca6eb51 --- /dev/null +++ b/packages/twenty-server/src/engine/core-modules/billing/utils/build-billing-usage-available-credits-cache-pattern.util.ts @@ -0,0 +1,5 @@ +export const buildBillingUsageAvailableCreditsCachePattern = ( + workspaceId: string, +): string => { + return `available-credits:${workspaceId}:*`; +}; diff --git a/packages/twenty-server/src/engine/core-modules/workspace/workspace.resolver.ts b/packages/twenty-server/src/engine/core-modules/workspace/workspace.resolver.ts index 3ed60aa327..45f5d2eab1 100644 --- a/packages/twenty-server/src/engine/core-modules/workspace/workspace.resolver.ts +++ b/packages/twenty-server/src/engine/core-modules/workspace/workspace.resolver.ts @@ -21,6 +21,7 @@ import { ApplicationDTO } from 'src/engine/core-modules/application/dtos/applica import { fromFlatApplicationToApplicationDto } from 'src/engine/core-modules/application/utils/from-flat-application-to-application-dto.util'; import { type AuthContextUser } from 'src/engine/core-modules/auth/types/auth-context.type'; import { BillingEntitlementDTO } from 'src/engine/core-modules/billing/dtos/billing-entitlement.dto'; +import { BillingCustomerEntity } from 'src/engine/core-modules/billing/entities/billing-customer.entity'; import { BillingSubscriptionEntity } from 'src/engine/core-modules/billing/entities/billing-subscription.entity'; import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service'; import { DomainValidRecords } from 'src/engine/core-modules/dns-manager/dtos/domain-valid-records'; @@ -282,6 +283,17 @@ export class WorkspaceResolver { }); } + @ResolveField(() => BillingCustomerEntity, { nullable: true }) + async billingCustomer( + @Parent() workspace: WorkspaceEntity, + ): Promise { + if (!this.twentyConfigService.isBillingEnabled()) { + return null; + } + + return this.billingSubscriptionService.getBillingCustomer(workspace.id); + } + @ResolveField(() => Number) async workspaceMembersCount( @Parent() workspace: WorkspaceEntity, diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/utils/ai-graphql-api-exception-handler.util.ts b/packages/twenty-server/src/engine/metadata-modules/ai/utils/ai-graphql-api-exception-handler.util.ts index 34c9968478..1d42ec28d0 100644 --- a/packages/twenty-server/src/engine/metadata-modules/ai/utils/ai-graphql-api-exception-handler.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/ai/utils/ai-graphql-api-exception-handler.util.ts @@ -1,5 +1,7 @@ import { assertUnreachable } from 'twenty-shared/utils'; +import { BillingException } from 'src/engine/core-modules/billing/billing.exception'; +import { billingGraphqlApiExceptionHandler } from 'src/engine/core-modules/billing/utils/billing-graphql-api-exception-handler.util'; import { ConflictError, ForbiddenError, @@ -13,6 +15,10 @@ import { } from 'src/engine/metadata-modules/ai/ai.exception'; export const aiGraphqlApiExceptionHandler = (error: Error) => { + if (error instanceof BillingException) { + return billingGraphqlApiExceptionHandler(error); + } + if (error instanceof AiException) { switch (error.code) { case AiExceptionCode.AGENT_NOT_FOUND: