Skip to content

The open alternative to Salesforce, designed for AI.

Remove IS_TRANSCRIPT_IMPORT_RELEASED feature flag (#28409)

nitin6007d934c7df
diff --git a/packages/twenty-apps/public/teams/README.md b/packages/twenty-apps/public/teams/README.md
index 5a9e74172b2..f2c7148e042 100644
--- a/packages/twenty-apps/public/teams/README.md
+++ b/packages/twenty-apps/public/teams/README.md
@@ -7,7 +7,7 @@
- **A Microsoft connection** for your work or school account
- **List My Teams Transcripts**, an AI and workflow action for the meetings you organized
- **Sync Teams Transcript**, an AI and workflow action that imports one of those transcripts into a Call Recording
-- **AI summary** of each imported transcript, written on its Call Recording and turned off from the app settings
+- **AI summary** of each imported transcript, written on its Call Recording once turned on in the app settings
- **Generate call summary**, a command on Call Recordings and calendar events that writes or rewrites the summary of their Teams recordings
## 📌 Heads up
diff --git a/packages/twenty-apps/public/teams/SETUP.md b/packages/twenty-apps/public/teams/SETUP.md
index 1b0b3c08b42..9940b9830e0 100644
--- a/packages/twenty-apps/public/teams/SETUP.md
+++ b/packages/twenty-apps/public/teams/SETUP.md
@@ -109,25 +109,23 @@ hours after the meeting or whose import keeps failing.
Transcripts link to the meeting's calendar event when that calendar is synced in
Twenty. An occurrence of a recurring meeting links to the series' event.
-Each Call Recording that Microsoft Teams imports gets an AI summary, including
-the 31-day import on connect. Each summary uses AI credits; turn off **Enable
-transcript summaries** in **Settings > Applications > Microsoft Teams >
-Settings** to stop them. Run **Generate call summary** on selected Call
+AI summaries are off by default. Turn on **Enable transcript summaries** in
+**Settings > Applications > Microsoft Teams > Settings** to summarize each Call
+Recording that Microsoft Teams imports, including the 31-day import on connect.
+Each summary uses AI credits. Run **Generate call summary** on selected Call
Recordings, or on calendar events for the latest Teams recording of each, to
write or rewrite their summary, up to 20 calls at a time.
## Test the transcript actions
-1. For a development build, set `IS_TRANSCRIPT_IMPORT_RELEASED` to `true`, then
- rebuild and deploy the app.
-2. Schedule a Teams meeting with the connected account, join it at its
+1. Schedule a Teams meeting with the connected account, join it at its
scheduled time, start transcription, speak, and end the meeting. Microsoft
publishes the transcript a few minutes later.
-3. Ask the Twenty AI assistant to list your Teams transcripts, or add the
+2. Ask the Twenty AI assistant to list your Teams transcripts, or add the
**List My Teams Transcripts** action to a workflow. The result carries one
entry per transcript with the meeting subject, the Graph meeting ID, and the
transcript ID.
-4. Ask the assistant to sync one of them, or add **Sync Teams Transcript** to
+3. Ask the assistant to sync one of them, or add **Sync Teams Transcript** to
the workflow with that `meetingId` and `transcriptId`. The transcript appears
as a Call Recording named after the meeting subject, linked to the meeting's
calendar event when Twenty has synced it.
@@ -153,7 +151,7 @@ plus [Teams transcript API access settings](https://learn.microsoft.com/en-us/mi
`TEAMS_TRANSCRIPTS_ENABLED` and `TEAMS_TRANSCRIPT_SUMMARY_ENABLED` are Boolean
application variables. **Settings → Applications → Microsoft Teams →
Settings** manages chat and transcript summaries; transcripts are on by
- default and have no switch. Updates use the metadata API, which requires
+ default and have no switch, and summaries are off by default. Updates use the metadata API, which requires
permission to manage applications.
- **Release flags** are developer-controlled release decisions, defined in
`src/constants/release-flags.ts` and bundled with the app. They are not the
@@ -161,18 +159,18 @@ plus [Teams transcript API access settings](https://learn.microsoft.com/en-us/mi
them requires a new build and deployment; a workspace setting cannot override
them.
-`IS_CHAT_ASSISTANT_RELEASED` controls availability of chat in this scaffold,
-`IS_TRANSCRIPT_IMPORT_RELEASED` controls transcript imports and summaries, and
-`IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED` shows the Import history section. All
+`IS_CHAT_ASSISTANT_RELEASED` controls availability of chat in this scaffold, and
+`IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED` shows the Import history section. Both
start as `false`. Settings hides chat and Import history until their flags are
-on, and shows transcript summaries as unavailable until transcripts are,
-retaining any saved workspace preference.
+on, retaining any saved workspace preference. Transcript imports and summaries
+have no release flag.
The frontend and handlers share
`isFeatureEnabled({ isAvailable, settingValue })`. Pass the feature's release
flag as `isAvailable`; the serialized workspace setting must also be `'true'`.
-In a logic function, use `process.env[CHAT_ENABLED_APPLICATION_VARIABLE_KEY]` or
-`process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY]` as `settingValue`.
+In a logic function, use `process.env[CHAT_ENABLED_APPLICATION_VARIABLE_KEY]` as
+`settingValue`. Transcript handlers call `isTeamsTranscriptImportEnabled()`
+instead.
The settings page initializes from `getApplicationVariable` and updates its
local value after a successful save. Changes made by another client require a
page refresh. Live updates need shared host/SDK support for application-variable
@@ -189,13 +187,8 @@ section; the app's single uninstall hook will compose their cleanup.
Release flags gate behavior at runtime, not installation. The build puts every
file that default-exports a `define…` call in the manifest, so a disabled
feature's objects, fields, indexes, roles, agents and logic functions are still
-installed, and its handlers return before doing any work. The only definitions
-a flag changes are the transcript summary functions: they declare their Call
-Recording triggers only while `IS_TRANSCRIPT_IMPORT_RELEASED` is on, so they are
-not invoked before release. Disabled features must still pass typecheck and
-build. The Microsoft OAuth connection remains available independently of the
-transcript release flag; connecting an account only stores its credentials for
-future use.
+installed, and its handlers return before doing any work. Disabled features
+must still pass typecheck and build.
## Development
diff --git a/packages/twenty-apps/public/teams/src/application.config.ts b/packages/twenty-apps/public/teams/src/application.config.ts
index 4c59078f619..2d92cc4c9bb 100644
--- a/packages/twenty-apps/public/teams/src/application.config.ts
+++ b/packages/twenty-apps/public/teams/src/application.config.ts
@@ -52,7 +52,7 @@ export default defineApplication({
'Write an AI summary on each Call Recording imported from Microsoft Teams. Each summary uses AI credits.',
type: FieldType.BOOLEAN,
isSecret: false,
- value: true,
+ value: false,
},
},
serverVariables: {
diff --git a/packages/twenty-apps/public/teams/src/constants/release-flags.ts b/packages/twenty-apps/public/teams/src/constants/release-flags.ts
index 8a43eefd7b1..ece99af7104 100644
--- a/packages/twenty-apps/public/teams/src/constants/release-flags.ts
+++ b/packages/twenty-apps/public/teams/src/constants/release-flags.ts
@@ -1,5 +1,4 @@
export const RELEASE_FLAGS = {
IS_CHAT_ASSISTANT_RELEASED: false,
- IS_TRANSCRIPT_IMPORT_RELEASED: false,
IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED: false,
} as const;
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/TranscriptSettings.tsx b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/TranscriptSettings.tsx
index c999dec7d3d..9b6ba86ce44 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/front-components/TranscriptSettings.tsx
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/front-components/TranscriptSettings.tsx
@@ -5,14 +5,13 @@ import { TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/feature
import { TranscriptImportHistorySection } from 'src/features/transcripts/front-components/TranscriptImportHistorySection';
import { FeatureSettingsSection } from 'src/front-components/components/FeatureSettingsSection';
import { useFeatureSetting } from 'src/front-components/hooks/use-feature-setting';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
export const TranscriptSettings = () => {
const { t } = useTranslate();
const { settingValue, isSaving, hasSaveError, updateSetting } =
useFeatureSetting({
variableKey: TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY,
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
+ isAvailable: true,
});
const handleChange = (isEnabled: boolean) => {
@@ -27,19 +26,15 @@ export const TranscriptSettings = () => {
description={t(
'Write an AI summary on each Call Recording imported from Microsoft Teams. Each summary uses AI credits.',
)}
- isAvailable={RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED}
- isEnabled={isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue,
- })}
+ isAvailable
+ isEnabled={settingValue === 'true'}
isSaving={isSaving}
hasSaveError={hasSaveError}
onChange={handleChange}
/>
- {RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED &&
- RELEASE_FLAGS.IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED && (
- <TranscriptImportHistorySection />
- )}
+ {RELEASE_FLAGS.IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED && (
+ <TranscriptImportHistorySection />
+ )}
</>
);
};
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/__tests__/teams-transcript-history-routes.test.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/__tests__/teams-transcript-history-routes.test.ts
index 89aaee00603..349a5596235 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/__tests__/teams-transcript-history-routes.test.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/__tests__/teams-transcript-history-routes.test.ts
@@ -8,7 +8,6 @@ import { teamsTranscriptHistoryStatusHandler } from 'src/features/transcripts/lo
const { releaseFlags, kvStore, listConnectionsMock, enqueueJobsMock } =
vi.hoisted(() => ({
releaseFlags: {
- IS_TRANSCRIPT_IMPORT_RELEASED: true,
IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED: true,
},
kvStore: new Map<string, unknown>(),
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-import-transcript.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-import-transcript.ts
index f7ba51d28fb..db10023cd44 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-import-transcript.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-import-transcript.ts
@@ -3,14 +3,12 @@ import { defineLogicFunction } from 'twenty-sdk/define';
import { kv } from 'twenty-sdk/logic-function';
import { isDefined } from 'twenty-sdk/utils';
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
import { TEAMS_IMPORT_TRANSCRIPT_UNIVERSAL_IDENTIFIER } from 'src/features/transcripts/constants/universal-identifiers';
import { type TeamsTranscriptImportOutcome } from 'src/features/transcripts/logic-functions/types/teams-transcript-import-outcome.type';
import { type TeamsTranscriptSubscription } from 'src/features/transcripts/logic-functions/types/teams-transcript-subscription.type';
import { buildTeamsTranscriptSubscriptionKvKey } from 'src/features/transcripts/logic-functions/utils/build-teams-transcript-subscription-kv-key';
import { importTeamsTranscriptOrScheduleRetry } from 'src/features/transcripts/logic-functions/utils/import-teams-transcript-or-schedule-retry';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
+import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
type TeamsImportTranscriptResult =
| { success: true; outcome: TeamsTranscriptImportOutcome }
@@ -34,12 +32,7 @@ export const teamsImportTranscriptHandler = async (payload: {
return { success: false, error: 'Invalid Teams transcript import job' };
}
- if (
- !isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
- })
- ) {
+ if (!isTeamsTranscriptImportEnabled()) {
return {
success: true,
skipped: true,
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-list-organizer-transcripts.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-list-organizer-transcripts.ts
index bb4d28bb906..7c163c142b1 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-list-organizer-transcripts.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-list-organizer-transcripts.ts
@@ -6,8 +6,6 @@ import {
jsonSchemaToInputSchema,
} from 'twenty-sdk/logic-function';
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
import { TEAMS_LIST_ORGANIZER_TRANSCRIPTS_UNIVERSAL_IDENTIFIER } from 'src/features/transcripts/constants/universal-identifiers';
import { buildTeamsCalendarViewUrl } from 'src/features/transcripts/logic-functions/utils/build-teams-calendar-view-url';
import { getTeamsConnectionForRequestOrThrow } from 'src/features/transcripts/logic-functions/utils/get-teams-connection-for-request-or-throw';
@@ -15,8 +13,8 @@ import { listTeamsCalendarPage } from 'src/features/transcripts/logic-functions/
import { listTeamsOccurrenceTranscripts } from 'src/features/transcripts/logic-functions/utils/list-teams-occurrence-transcripts';
import { resolveTeamsCalendarNextPageUrlOrThrow } from 'src/features/transcripts/logic-functions/utils/resolve-teams-calendar-next-page-url-or-throw';
import { resolveTeamsMeetingWindowOrThrow } from 'src/features/transcripts/logic-functions/utils/resolve-teams-meeting-window-or-throw';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
import { toErrorMessage } from 'src/utils/to-error-message';
+import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
const teamsListOrganizerTranscriptsInputSchema: InputJsonSchema = {
type: 'object',
@@ -66,12 +64,7 @@ export const teamsListOrganizerTranscriptsHandler = async (
},
context: Pick<LogicFunctionExecutionContext, 'userWorkspaceId'>,
): Promise<TeamsListOrganizerTranscriptsResult> => {
- if (
- !isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
- })
- ) {
+ if (!isTeamsTranscriptImportEnabled()) {
return { success: false, error: 'Teams transcripts are not enabled.' };
}
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-summarize-created-call-recordings.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-summarize-created-call-recordings.ts
index d37b1f96995..15abbf854fa 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-summarize-created-call-recordings.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-summarize-created-call-recordings.ts
@@ -4,7 +4,6 @@ import {
type ObjectRecordCreateEvent,
} from 'twenty-sdk/logic-function';
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
import { TEAMS_SUMMARIZE_CREATED_CALL_RECORDINGS_UNIVERSAL_IDENTIFIER } from 'src/features/transcripts/constants/universal-identifiers';
import { type TeamsCallRecordingEventRecord } from 'src/features/transcripts/logic-functions/types/teams-call-recording-event-record.type';
import { enqueueTeamsTranscriptSummariesOrThrow } from 'src/features/transcripts/logic-functions/utils/enqueue-teams-transcript-summaries-or-throw';
@@ -22,12 +21,8 @@ export default defineLogicFunction({
description:
'Queues an AI summary for each Call Recording that Microsoft Teams created with a transcript.',
handler: teamsSummarizeCreatedCallRecordingsHandler,
- ...(RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED
- ? {
- databaseEventTriggerSettings: {
- eventName: 'callRecording.created',
- batchMode: true,
- },
- }
- : {}),
+ databaseEventTriggerSettings: {
+ eventName: 'callRecording.created',
+ batchMode: true,
+ },
});
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-summarize-updated-call-recordings.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-summarize-updated-call-recordings.ts
index 5de6d456f8b..e56af4f2c36 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-summarize-updated-call-recordings.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-summarize-updated-call-recordings.ts
@@ -4,7 +4,6 @@ import {
type ObjectRecordUpdateEvent,
} from 'twenty-sdk/logic-function';
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
import { TEAMS_SUMMARIZE_UPDATED_CALL_RECORDINGS_UNIVERSAL_IDENTIFIER } from 'src/features/transcripts/constants/universal-identifiers';
import { type TeamsCallRecordingEventRecord } from 'src/features/transcripts/logic-functions/types/teams-call-recording-event-record.type';
import { enqueueTeamsTranscriptSummariesOrThrow } from 'src/features/transcripts/logic-functions/utils/enqueue-teams-transcript-summaries-or-throw';
@@ -22,13 +21,9 @@ export default defineLogicFunction({
description:
'Queues an AI summary for each Microsoft Teams Call Recording whose transcript changed.',
handler: teamsSummarizeUpdatedCallRecordingsHandler,
- ...(RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED
- ? {
- databaseEventTriggerSettings: {
- eventName: 'callRecording.updated',
- updatedFields: ['transcript'],
- batchMode: true,
- },
- }
- : {}),
+ databaseEventTriggerSettings: {
+ eventName: 'callRecording.updated',
+ updatedFields: ['transcript'],
+ batchMode: true,
+ },
});
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-sync-transcript.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-sync-transcript.ts
index 4ac1fbc9a54..d12504afa58 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-sync-transcript.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-sync-transcript.ts
@@ -7,14 +7,12 @@ import {
jsonSchemaToInputSchema,
} from 'twenty-sdk/logic-function';
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
import { TEAMS_SYNC_TRANSCRIPT_UNIVERSAL_IDENTIFIER } from 'src/features/transcripts/constants/universal-identifiers';
import { type CallRecordingSyncFields } from 'src/features/transcripts/logic-functions/types/call-recording-sync-fields.type';
import { getTeamsConnectionForRequestOrThrow } from 'src/features/transcripts/logic-functions/utils/get-teams-connection-for-request-or-throw';
import { syncTeamsTranscriptToCallRecordingOrThrow } from 'src/features/transcripts/logic-functions/utils/sync-teams-transcript-to-call-recording-or-throw';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
import { toErrorMessage } from 'src/utils/to-error-message';
+import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
const teamsSyncTranscriptInputSchema: InputJsonSchema = {
type: 'object',
@@ -52,12 +50,7 @@ export const teamsSyncTranscriptHandler = async (
},
context: Pick<LogicFunctionExecutionContext, 'userWorkspaceId'>,
): Promise<TeamsSyncTranscriptResult> => {
- if (
- !isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
- })
- ) {
+ if (!isTeamsTranscriptImportEnabled()) {
return { success: false, error: 'Teams transcripts are not enabled.' };
}
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-transcripts-webhook.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-transcripts-webhook.ts
index 01bbe092db1..25834500792 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-transcripts-webhook.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/teams-transcripts-webhook.ts
@@ -7,8 +7,6 @@ import {
} from 'twenty-sdk/logic-function';
import { isDefined } from 'twenty-sdk/utils';
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
import { TEAMS_TRANSCRIPTS_WEBHOOK_UNIVERSAL_IDENTIFIER } from 'src/features/transcripts/constants/universal-identifiers';
import { GRAPH_CREATED_CHANGE_TYPE } from 'src/features/transcripts/logic-functions/constants/graph-created-change-type';
import { GRAPH_REAUTHORIZATION_REQUIRED_LIFECYCLE_EVENT } from 'src/features/transcripts/logic-functions/constants/graph-reauthorization-required-lifecycle-event';
@@ -20,8 +18,8 @@ import { importTeamsTranscriptOrScheduleRetry } from 'src/features/transcripts/l
import { parseTeamsTranscriptResource } from 'src/features/transcripts/logic-functions/utils/parse-teams-transcript-resource';
import { parseTeamsTranscriptSubscriptionNotifications } from 'src/features/transcripts/logic-functions/utils/parse-teams-transcript-subscription-notifications';
import { renewTeamsTranscriptSubscription } from 'src/features/transcripts/logic-functions/utils/renew-teams-transcript-subscription';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
import { toErrorMessage } from 'src/utils/to-error-message';
+import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
type TeamsTranscriptsWebhookResult =
| {
@@ -110,12 +108,7 @@ export const teamsTranscriptsWebhookHandler = async (
return { success: false, error: 'Invalid Microsoft Graph notification' };
}
- if (
- !isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
- })
- ) {
+ if (!isTeamsTranscriptImportEnabled()) {
return {
success: true,
skipped: true,
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/__tests__/process-teams-transcript-history-page-or-throw.test.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/__tests__/process-teams-transcript-history-page-or-throw.test.ts
index bfa7bfdd351..20a779810be 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/__tests__/process-teams-transcript-history-page-or-throw.test.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/__tests__/process-teams-transcript-history-page-or-throw.test.ts
@@ -23,10 +23,6 @@ const {
listConnectionsMock: vi.fn(),
}));
-vi.mock('src/constants/release-flags', () => ({
- RELEASE_FLAGS: { IS_TRANSCRIPT_IMPORT_RELEASED: true },
-}));
-
vi.mock('twenty-sdk/logic-function', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
kv: {
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/__tests__/start-teams-transcript-history-initial-import-or-throw.test.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/__tests__/start-teams-transcript-history-initial-import-or-throw.test.ts
index a0a3486e506..1e1b0c34405 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/__tests__/start-teams-transcript-history-initial-import-or-throw.test.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/__tests__/start-teams-transcript-history-initial-import-or-throw.test.ts
@@ -9,10 +9,6 @@ const { kvStore, enqueueJobsMock, listConnectionsMock } = vi.hoisted(() => ({
listConnectionsMock: vi.fn(),
}));
-vi.mock('src/constants/release-flags', () => ({
- RELEASE_FLAGS: { IS_TRANSCRIPT_IMPORT_RELEASED: true },
-}));
-
vi.mock('twenty-sdk/logic-function', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
kv: {
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/handle-teams-transcript-history-route.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/handle-teams-transcript-history-route.ts
index d383e4de492..b438f326130 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/handle-teams-transcript-history-route.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/handle-teams-transcript-history-route.ts
@@ -1,12 +1,11 @@
import { type LogicFunctionExecutionContext } from 'twenty-sdk/logic-function';
import { RELEASE_FLAGS } from 'src/constants/release-flags';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
import { TeamsConnectionUnavailableError } from 'src/features/transcripts/logic-functions/types/teams-connection-unavailable-error';
import { type TeamsTranscriptHistoryRouteResult } from 'src/features/transcripts/logic-functions/types/teams-transcript-history-route-result.type';
import { getTeamsConnectionForRequestOrThrow } from 'src/features/transcripts/logic-functions/utils/get-teams-connection-for-request-or-throw';
import { toErrorMessage } from 'src/utils/to-error-message';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
+import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
export const handleTeamsTranscriptHistoryRoute = async ({
context,
@@ -21,10 +20,7 @@ export const handleTeamsTranscriptHistoryRoute = async ({
}): Promise<TeamsTranscriptHistoryRouteResult> => {
if (
!RELEASE_FLAGS.IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED ||
- !isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
- })
+ !isTeamsTranscriptImportEnabled()
) {
return { success: false, errorCode: 'transcripts-not-enabled' };
}
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled.ts
new file mode 100644
index 00000000000..481b6553306
--- /dev/null
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled.ts
@@ -0,0 +1,4 @@
+import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
+
+export const isTeamsTranscriptImportEnabled = (): boolean =>
+ process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY] === 'true';
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-summary-enabled.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-summary-enabled.ts
index ed69cbc93ce..fd8791af738 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-summary-enabled.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/is-teams-transcript-summary-enabled.ts
@@ -1,15 +1,6 @@
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
import { TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcript-summary-enabled-application-variable-key';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
+import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
export const isTeamsTranscriptSummaryEnabled = (): boolean =>
- isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
- }) &&
- isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue:
- process.env[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY],
- });
+ isTeamsTranscriptImportEnabled() &&
+ process.env[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY] === 'true';
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/process-teams-transcript-history-page-or-throw.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/process-teams-transcript-history-page-or-throw.ts
index c473b460736..1e7bdeac765 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/process-teams-transcript-history-page-or-throw.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/process-teams-transcript-history-page-or-throw.ts
@@ -8,9 +8,7 @@ import {
} from 'twenty-sdk/logic-function';
import { isDefined } from 'twenty-sdk/utils';
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
import { TEAMS_TRANSCRIPT_HISTORY_IMPORT_PAGE_DELAY_MILLISECONDS } from 'src/features/transcripts/constants/teams-transcript-history-import-page-delay-milliseconds';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
import { GRAPH_ACCESS_TO_TRANSCRIPTS_DISABLED_ERROR_CODE } from 'src/features/transcripts/logic-functions/constants/graph-access-to-transcripts-disabled-error-code';
import { TEAMS_TRANSCRIPT_HISTORY_RETRY_DELAYS_MILLISECONDS } from 'src/features/transcripts/logic-functions/constants/teams-transcript-history-retry-delays-milliseconds';
import { GraphRequestError } from 'src/features/transcripts/logic-functions/types/graph-request-error';
@@ -33,7 +31,7 @@ import { listTeamsCalendarPage } from 'src/features/transcripts/logic-functions/
import { listTeamsOccurrenceTranscripts } from 'src/features/transcripts/logic-functions/utils/list-teams-occurrence-transcripts';
import { resolveTeamsCalendarNextPageUrlOrThrow } from 'src/features/transcripts/logic-functions/utils/resolve-teams-calendar-next-page-url-or-throw';
import { toErrorMessage } from 'src/utils/to-error-message';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
+import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
type TeamsTranscriptHistoryPageJob = {
job: TeamsTranscriptHistoryJobPayload;
@@ -279,12 +277,7 @@ export const processTeamsTranscriptHistoryPageOrThrow = async ({
return { success: false, error: 'Invalid Teams transcript history job' };
}
- if (
- !isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
- })
- ) {
+ if (!isTeamsTranscriptImportEnabled()) {
return {
success: true,
skipped: true,
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/register-teams-transcript-subscription.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/register-teams-transcript-subscription.ts
index 2d7c7f7a1fc..e2a8ae16c81 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/register-teams-transcript-subscription.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/register-teams-transcript-subscription.ts
@@ -2,8 +2,6 @@ import { isNonEmptyString } from '@sniptt/guards';
import { getConnection, kv } from 'twenty-sdk/logic-function';
import { isDefined } from 'twenty-sdk/utils';
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
import { GraphRequestError } from 'src/features/transcripts/logic-functions/types/graph-request-error';
import { type TeamsTranscriptSubscription } from 'src/features/transcripts/logic-functions/types/teams-transcript-subscription.type';
import { buildTeamsTranscriptSubscriptionKvKey } from 'src/features/transcripts/logic-functions/utils/build-teams-transcript-subscription-kv-key';
@@ -14,7 +12,7 @@ import { deleteTeamsTranscriptSubscription } from 'src/features/transcripts/logi
import { isTeamsConnectionListed } from 'src/features/transcripts/logic-functions/utils/is-teams-connection-listed';
import { renewTeamsTranscriptSubscription } from 'src/features/transcripts/logic-functions/utils/renew-teams-transcript-subscription';
import { unregisterTeamsTranscriptSubscription } from 'src/features/transcripts/logic-functions/utils/unregister-teams-transcript-subscription';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
+import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
const renewStoredSubscriptionOrUndefined = async ({
accessToken,
@@ -49,10 +47,7 @@ export const registerTeamsTranscriptSubscription = async ({
}: {
connectedAccountId: string;
}): Promise<{ transcriptSubscriptionId: string | null }> => {
- const isTranscriptImportEnabled = isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
- });
+ const isTranscriptImportEnabled = isTeamsTranscriptImportEnabled();
if (!isTranscriptImportEnabled) {
await unregisterTeamsTranscriptSubscription({ connectedAccountId });
diff --git a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/start-teams-transcript-history-initial-import-or-throw.ts b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/start-teams-transcript-history-initial-import-or-throw.ts
index c1e59252027..7dfbb4b0ee4 100644
--- a/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/start-teams-transcript-history-initial-import-or-throw.ts
+++ b/packages/twenty-apps/public/teams/src/features/transcripts/logic-functions/utils/start-teams-transcript-history-initial-import-or-throw.ts
@@ -1,9 +1,7 @@
import { kv } from 'twenty-sdk/logic-function';
import { isDefined } from 'twenty-sdk/utils';
-import { RELEASE_FLAGS } from 'src/constants/release-flags';
import { TEAMS_TRANSCRIPT_HISTORY_INITIAL_IMPORT_DAYS } from 'src/features/transcripts/constants/teams-transcript-history-initial-import-days';
-import { TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY } from 'src/features/transcripts/constants/transcripts-enabled-application-variable-key';
import { type TeamsTranscriptHistoryState } from 'src/features/transcripts/logic-functions/types/teams-transcript-history-state.type';
import { buildTeamsTranscriptHistoryInitialImportKvKey } from 'src/features/transcripts/logic-functions/utils/build-teams-transcript-history-initial-import-kv-key';
import { buildTeamsTranscriptHistoryKvKey } from 'src/features/transcripts/logic-functions/utils/build-teams-transcript-history-kv-key';
@@ -11,19 +9,14 @@ import { deleteTeamsTranscriptHistoryKvKeys } from 'src/features/transcripts/log
import { isTeamsConnectionListed } from 'src/features/transcripts/logic-functions/utils/is-teams-connection-listed';
import { isTeamsTranscriptHistoryStalled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-history-stalled';
import { startTeamsTranscriptHistoryRunOrThrow } from 'src/features/transcripts/logic-functions/utils/start-teams-transcript-history-run-or-throw';
-import { isFeatureEnabled } from 'src/utils/is-feature-enabled';
+import { isTeamsTranscriptImportEnabled } from 'src/features/transcripts/logic-functions/utils/is-teams-transcript-import-enabled';
export const startTeamsTranscriptHistoryInitialImportOrThrow = async ({
connectedAccountId,
}: {
connectedAccountId: string;
}): Promise<void> => {
- if (
- !isFeatureEnabled({
- isAvailable: RELEASE_FLAGS.IS_TRANSCRIPT_IMPORT_RELEASED,
- settingValue: process.env[TRANSCRIPTS_ENABLED_APPLICATION_VARIABLE_KEY],
- })
- ) {
+ if (!isTeamsTranscriptImportEnabled()) {
return;
}
diff --git a/packages/twenty-apps/public/teams/src/front-components/components/__tests__/TeamsSettings.test.tsx b/packages/twenty-apps/public/teams/src/front-components/components/__tests__/TeamsSettings.test.tsx
index f1b57af8f92..53ae5abe4f5 100644
--- a/packages/twenty-apps/public/teams/src/front-components/components/__tests__/TeamsSettings.test.tsx
+++ b/packages/twenty-apps/public/teams/src/front-components/components/__tests__/TeamsSettings.test.tsx
@@ -16,7 +16,6 @@ const { releaseFlags, variables, queryMock, mutationMock, restGetMock } =
return {
releaseFlags: {
IS_CHAT_ASSISTANT_RELEASED: false,
- IS_TRANSCRIPT_IMPORT_RELEASED: false,
IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED: false,
},
variables,
@@ -69,7 +68,6 @@ describe('TeamsSettings', () => {
beforeEach(() => {
vi.resetAllMocks();
releaseFlags.IS_CHAT_ASSISTANT_RELEASED = false;
- releaseFlags.IS_TRANSCRIPT_IMPORT_RELEASED = false;
releaseFlags.IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED = false;
variables[CHAT_ENABLED_APPLICATION_VARIABLE_KEY] = 'false';
variables[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY] = 'false';
@@ -82,10 +80,9 @@ describe('TeamsSettings', () => {
afterEach(cleanup);
- it('hides chat and keeps transcript summaries inactive before their release', async () => {
+ it('hides chat before its release and keeps transcript summaries available', async () => {
variables[CHAT_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
variables[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
- const user = userEvent.setup();
render(<TeamsSettings />);
@@ -95,65 +92,23 @@ describe('TeamsSettings', () => {
name: 'Enable transcript summaries',
});
- expect(summaries.getAttribute('aria-checked')).toBe('false');
- expect(summaries.hasAttribute('disabled')).toBe(true);
- await user.click(summaries);
-
- expect(
- screen.getAllByText('Not available in this version yet.'),
- ).toHaveLength(1);
+ expect(summaries.getAttribute('aria-checked')).toBe('true');
+ expect(summaries.hasAttribute('disabled')).toBe(false);
+ expect(screen.queryByText('Not available in this version yet.')).toBeNull();
expect(queryMock).not.toHaveBeenCalled();
expect(mutationMock).not.toHaveBeenCalled();
});
- it.each([
- [false, false],
- [true, false],
- [false, true],
- [true, true],
- ])(
- 'supports independent chat (%s) and transcript (%s) releases',
- (isChatAvailable, isTranscriptsAvailable) => {
- releaseFlags.IS_CHAT_ASSISTANT_RELEASED = isChatAvailable;
- releaseFlags.IS_TRANSCRIPT_IMPORT_RELEASED = isTranscriptsAvailable;
- variables[CHAT_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
- variables[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY] = 'true';
-
- render(<TeamsSettings />);
-
- const chat = screen.queryByRole('switch', { name: 'Enable chat' });
- const summaries = screen.getByRole('switch', {
- name: 'Enable transcript summaries',
- });
-
- expect(chat?.getAttribute('aria-checked')).toBe(
- isChatAvailable ? 'true' : undefined,
- );
- expect(summaries.hasAttribute('disabled')).toBe(!isTranscriptsAvailable);
- expect(summaries.getAttribute('aria-checked')).toBe(
- String(isTranscriptsAvailable),
- );
- expect(queryMock).not.toHaveBeenCalled();
- expect(mutationMock).not.toHaveBeenCalled();
- },
- );
-
- it.each([
- [false, false],
- [true, false],
- [false, true],
- [true, true],
- ])(
- 'shows Import history only when transcripts (%s) and history import (%s) are released',
- (isTranscriptsAvailable, isHistoryImportAvailable) => {
- releaseFlags.IS_TRANSCRIPT_IMPORT_RELEASED = isTranscriptsAvailable;
+ it.each([false, true])(
+ 'shows Import history only when history import is released (%s)',
+ (isHistoryImportAvailable) => {
releaseFlags.IS_TRANSCRIPT_HISTORY_IMPORT_RELEASED =
isHistoryImportAvailable;
render(<TeamsSettings />);
expect(screen.queryByText('Import history') !== null).toBe(
- isTranscriptsAvailable && isHistoryImportAvailable,
+ isHistoryImportAvailable,
);
},
);
@@ -162,7 +117,6 @@ describe('TeamsSettings', () => {
'keeps available features off for workspace value %s',
(value) => {
releaseFlags.IS_CHAT_ASSISTANT_RELEASED = true;
- releaseFlags.IS_TRANSCRIPT_IMPORT_RELEASED = true;
variables[CHAT_ENABLED_APPLICATION_VARIABLE_KEY] = value;
variables[TRANSCRIPT_SUMMARY_ENABLED_APPLICATION_VARIABLE_KEY] = value;
@@ -195,7 +149,6 @@ describe('TeamsSettings', () => {
it('saves the selected feature without changing the other preference', async () => {
releaseFlags.IS_CHAT_ASSISTANT_RELEASED = true;
- releaseFlags.IS_TRANSCRIPT_IMPORT_RELEASED = true;
const user = userEvent.setup();
render(<TeamsSettings />);