The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Billing - Adapt to new unit (#19886)
Etienne117909e10a6b
diff --git a/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx b/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsxindex b0324eb2b54..7f2dcdb75df 100644--- a/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx+++ b/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx@@ -3,18 +3,18 @@ import { SubTitle } from '@/auth/components/SubTitle';import { Title } from '@/auth/components/Title';import { useAuth } from '@/auth/hooks/useAuth';import { billingCheckoutSessionState } from '@/auth/states/billingCheckoutSessionState';+import { calendarBookingPageIdState } from '@/client-config/states/calendarBookingPageIdState';import { SubscriptionBenefit } from '@/settings/billing/components/SubscriptionBenefit';import { SubscriptionPrice } from '@/settings/billing/components/SubscriptionPrice';import { TrialCard } from '@/settings/billing/components/TrialCard';import { useBaseLicensedPriceByPlanKeyAndInterval } from '@/settings/billing/hooks/useBaseLicensedPriceByPlanKeyAndInterval';import { useBaseProductByPlanKey } from '@/settings/billing/hooks/useBaseProductByPlanKey';import { useHandleCheckoutSession } from '@/settings/billing/hooks/useHandleCheckoutSession';-import { calendarBookingPageIdState } from '@/client-config/states/calendarBookingPageIdState';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { styled } from '@linaria/react';import { Trans, useLingui } from '@lingui/react/macro';-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { AppPath } from 'twenty-shared/types';-import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { isDefined } from 'twenty-shared/utils';import { Loader } from 'twenty-ui/feedback';import { CardPicker, MainButton } from 'twenty-ui/input';@@ -140,7 +140,7 @@ export const ChooseYourPlanContent = ({ billing }: { billing: Billing }) => {t`Email integration`,t`Custom objects`,t`API & Webhooks`,- t`10,000 workflow node executions`,+ t`50,000 workflow node executions`,],};};diff --git a/packages/twenty-server/src/engine/core-modules/logic-function/logic-function-executor/logic-function-executor.service.ts b/packages/twenty-server/src/engine/core-modules/logic-function/logic-function-executor/logic-function-executor.service.tsindex 0edbe115f80..58f751debfd 100644--- a/packages/twenty-server/src/engine/core-modules/logic-function/logic-function-executor/logic-function-executor.service.ts+++ b/packages/twenty-server/src/engine/core-modules/logic-function/logic-function-executor/logic-function-executor.service.ts@@ -14,10 +14,10 @@ import {type LogicFunctionTranspileResult,} from 'src/engine/core-modules/logic-function/logic-function-drivers/interfaces/logic-function-driver.interface';-import { FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';-import type { FlatApplicationVariable } from 'src/engine/core-modules/application/application-variable/types/flat-application-variable.type';import { ApplicationLogsService } from 'src/engine/core-modules/application-logs/application-logs.service';import { parseApplicationLogLines } from 'src/engine/core-modules/application-logs/utils/parse-application-log-lines';+import type { FlatApplicationVariable } from 'src/engine/core-modules/application/application-variable/types/flat-application-variable.type';+import { FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';import { AuditService } from 'src/engine/core-modules/audit/services/audit.service';import { LOGIC_FUNCTION_EXECUTED_EVENT } from 'src/engine/core-modules/audit/utils/events/workspace-event/logic-function/logic-function-executed';import { ApplicationTokenService } from 'src/engine/core-modules/auth/token/services/application-token.service';@@ -288,7 +288,7 @@ export class LogicFunctionExecutorService {{resourceType: UsageResourceType.LOGIC_FUNCTION,operationType: UsageOperationType.CODE_EXECUTION,- creditsUsedMicro: 1,+ creditsUsedMicro: 100,quantity: 1,unit: UsageUnit.INVOCATION,resourceId: flatLogicFunction.id,diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/__tests__/workflow-executor.workspace-service.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/__tests__/workflow-executor.workspace-service.spec.tsindex 907c96bbaf3..98530e865dc 100644--- a/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/__tests__/workflow-executor.workspace-service.spec.ts+++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/__tests__/workflow-executor.workspace-service.spec.ts@@ -3,14 +3,14 @@ import { Test, type TestingModule } from '@nestjs/testing';import { getWorkflowRunContext, StepStatus } from 'twenty-shared/workflow';import { BILLING_WORKFLOW_EXECUTION_ERROR_MESSAGE } from 'src/engine/core-modules/billing/constants/billing-workflow-execution-error-message.constant';-import { USAGE_RECORDED } from 'src/engine/core-modules/usage/constants/usage-recorded.constant';-import { UsageOperationType } from 'src/engine/core-modules/usage/enums/usage-operation-type.enum';-import { UsageResourceType } from 'src/engine/core-modules/usage/enums/usage-resource-type.enum';-import { UsageUnit } from 'src/engine/core-modules/usage/enums/usage-unit.enum';import { BillingService } from 'src/engine/core-modules/billing/services/billing.service';import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants';import { MetricsService } from 'src/engine/core-modules/metrics/metrics.service';+import { USAGE_RECORDED } from 'src/engine/core-modules/usage/constants/usage-recorded.constant';+import { UsageOperationType } from 'src/engine/core-modules/usage/enums/usage-operation-type.enum';+import { UsageResourceType } from 'src/engine/core-modules/usage/enums/usage-resource-type.enum';+import { UsageUnit } from 'src/engine/core-modules/usage/enums/usage-unit.enum';import { WorkspaceEventEmitter } from 'src/engine/workspace-event-emitter/workspace-event-emitter';import { WorkflowActionFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-action.factory';import { shouldExecuteStep } from 'src/modules/workflow/workflow-executor/utils/should-execute-step.util';@@ -213,7 +213,7 @@ describe('WorkflowExecutorWorkspaceService', () => {{resourceType: UsageResourceType.WORKFLOW,operationType: UsageOperationType.WORKFLOW_EXECUTION,- creditsUsedMicro: 1,+ creditsUsedMicro: 100,quantity: 1,unit: UsageUnit.INVOCATION,resourceId: 'workflow-id',@@ -728,7 +728,7 @@ describe('WorkflowExecutorWorkspaceService', () => {{resourceType: UsageResourceType.WORKFLOW,operationType: UsageOperationType.WORKFLOW_EXECUTION,- creditsUsedMicro: 1,+ creditsUsedMicro: 100,quantity: 1,unit: UsageUnit.INVOCATION,resourceId: 'workflow-id',diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.tsindex 3d7a7470235..d036667c48d 100644--- a/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.ts+++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.ts@@ -10,19 +10,19 @@ import {} from 'twenty-shared/workflow';import { BILLING_WORKFLOW_EXECUTION_ERROR_MESSAGE } from 'src/engine/core-modules/billing/constants/billing-workflow-execution-error-message.constant';-import { USAGE_RECORDED } from 'src/engine/core-modules/usage/constants/usage-recorded.constant';import { BillingProductKey } from 'src/engine/core-modules/billing/enums/billing-product-key.enum';-import { UsageOperationType } from 'src/engine/core-modules/usage/enums/usage-operation-type.enum';-import { UsageResourceType } from 'src/engine/core-modules/usage/enums/usage-resource-type.enum';-import { UsageUnit } from 'src/engine/core-modules/usage/enums/usage-unit.enum';import { BillingService } from 'src/engine/core-modules/billing/services/billing.service';-import { type UsageEvent } from 'src/engine/core-modules/usage/types/usage-event.type';import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator';import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants';import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service';import { MetricsService } from 'src/engine/core-modules/metrics/metrics.service';import { MetricsKeys } from 'src/engine/core-modules/metrics/types/metrics-keys.type';+import { USAGE_RECORDED } from 'src/engine/core-modules/usage/constants/usage-recorded.constant';+import { UsageOperationType } from 'src/engine/core-modules/usage/enums/usage-operation-type.enum';+import { UsageResourceType } from 'src/engine/core-modules/usage/enums/usage-resource-type.enum';+import { UsageUnit } from 'src/engine/core-modules/usage/enums/usage-unit.enum';+import { type UsageEvent } from 'src/engine/core-modules/usage/types/usage-event.type';import { WorkspaceEventEmitter } from 'src/engine/workspace-event-emitter/workspace-event-emitter';import { WorkflowRunStatus } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity';import { workflowHasRunningSteps } from 'src/modules/workflow/common/utils/workflow-has-running-steps.util';@@ -366,7 +366,7 @@ export class WorkflowExecutorWorkspaceService {{resourceType: UsageResourceType.WORKFLOW,operationType: UsageOperationType.WORKFLOW_EXECUTION,- creditsUsedMicro: 1,+ creditsUsedMicro: 100,quantity: 1,unit: UsageUnit.INVOCATION,resourceId: workflowId,