Skip to content

The open alternative to Salesforce, designed for AI.

Fireflies app settings tab with API-key-gated call history backfill (#24152)

nitin86776646e08d
diff --git a/packages/twenty-apps/public/fireflies/css.d.ts b/packages/twenty-apps/public/fireflies/css.d.ts
new file mode 100644
index 00000000000..35306c6fc9a
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/css.d.ts
@@ -0,0 +1 @@
+declare module '*.css';
diff --git a/packages/twenty-apps/public/fireflies/package.json b/packages/twenty-apps/public/fireflies/package.json
index d664262ef46..f0a9cc99bbc 100644
--- a/packages/twenty-apps/public/fireflies/package.json
+++ b/packages/twenty-apps/public/fireflies/package.json
@@ -35,10 +35,11 @@
"oxlint": "^0.16.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
- "twenty-client-sdk": "2.31.0-alpha.1",
- "twenty-sdk": "2.31.0-alpha.1",
+ "twenty-client-sdk": "2.31.0",
+ "twenty-sdk": "2.31.0",
"twenty-ui": "^1.0.0-alpha.1",
"typescript": "^5.9.3",
+ "use-debounce": "^10.0.0",
"vite-tsconfig-paths": "^4.2.1",
"vitest": "^4.0.0"
}
diff --git a/packages/twenty-apps/public/fireflies/src/application.config.ts b/packages/twenty-apps/public/fireflies/src/application.config.ts
index 1c62e32a6c1..e00ef9369e8 100644
--- a/packages/twenty-apps/public/fireflies/src/application.config.ts
+++ b/packages/twenty-apps/public/fireflies/src/application.config.ts
@@ -26,14 +26,13 @@ export default defineApplication({
FIREFLIES_API_KEY: {
universalIdentifier: FIREFLIES_API_KEY_VARIABLE_UNIVERSAL_IDENTIFIER,
description:
- 'API key from Fireflies (Integrations → Fireflies API → Generate). Used as a Bearer token against https://api.fireflies.ai/graphql to fetch full transcript content after a webhook fires.',
+ 'Your Fireflies API key (Fireflies → Integrations → Fireflies API).',
isSecret: true,
},
FIREFLIES_WEBHOOK_SECRET: {
universalIdentifier:
FIREFLIES_WEBHOOK_SECRET_VARIABLE_UNIVERSAL_IDENTIFIER,
- description:
- 'Signing secret for verifying Fireflies Webhooks V2 payloads (sent in the X-Hub-Signature header as sha256=<hex-hmac-sha256-of-body>). Configure the same value on the Fireflies V2 webhook setup page.',
+ description: 'Signing secret from the Fireflies Webhooks V2 setup page.',
isSecret: true,
},
},
diff --git a/packages/twenty-apps/public/fireflies/src/constants/fireflies-api-key-variable-key.constant.ts b/packages/twenty-apps/public/fireflies/src/constants/fireflies-api-key-variable-key.constant.ts
new file mode 100644
index 00000000000..25d34c8d083
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/constants/fireflies-api-key-variable-key.constant.ts
@@ -0,0 +1 @@
+export const FIREFLIES_API_KEY_VARIABLE_KEY = 'FIREFLIES_API_KEY';
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/constants/fireflies-backfill-max-window-days.constant.ts b/packages/twenty-apps/public/fireflies/src/constants/fireflies-backfill-max-window-days.constant.ts
similarity index 100%
rename from packages/twenty-apps/public/fireflies/src/logic-functions/constants/fireflies-backfill-max-window-days.constant.ts
rename to packages/twenty-apps/public/fireflies/src/constants/fireflies-backfill-max-window-days.constant.ts
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/constants/fireflies-backfill-outcome.constant.ts b/packages/twenty-apps/public/fireflies/src/constants/fireflies-backfill-outcome.constant.ts
similarity index 100%
rename from packages/twenty-apps/public/fireflies/src/logic-functions/constants/fireflies-backfill-outcome.constant.ts
rename to packages/twenty-apps/public/fireflies/src/constants/fireflies-backfill-outcome.constant.ts
diff --git a/packages/twenty-apps/public/fireflies/src/constants/universal-identifiers.ts b/packages/twenty-apps/public/fireflies/src/constants/universal-identifiers.ts
index 39481eb2b55..34d09fc83b7 100644
--- a/packages/twenty-apps/public/fireflies/src/constants/universal-identifiers.ts
+++ b/packages/twenty-apps/public/fireflies/src/constants/universal-identifiers.ts
@@ -59,3 +59,6 @@ export const CALENDAR_EVENT_TRANSCRIPT_PAGE_LAYOUT_WIDGET_UNIVERSAL_IDENTIFIER =
export const CALENDAR_EVENT_TRANSCRIPT_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER =
'364642a6-addb-4df1-8c57-25228b826259';
+
+export const SETTINGS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER =
+ '0a78863d-069e-4333-97a3-58b11e9c603d';
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/components/ApplicationVariableLabelRow.tsx b/packages/twenty-apps/public/fireflies/src/front-components/components/ApplicationVariableLabelRow.tsx
new file mode 100644
index 00000000000..49b084941d9
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/components/ApplicationVariableLabelRow.tsx
@@ -0,0 +1,34 @@
+import styled from '@emotion/styled';
+import { Pill } from 'twenty-ui/data-display';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+const StyledLabelRow = styled.div`
+ align-items: center;
+ display: flex;
+ gap: ${() => themeCssVariables.spacing[1]};
+ margin-bottom: ${() => themeCssVariables.spacing[1]};
+`;
+
+const StyledLabel = styled.label`
+ color: ${() => themeCssVariables.font.color.light};
+ font-family: ${() => themeCssVariables.font.family};
+ font-size: 11px;
+ font-weight: ${() => themeCssVariables.font.weight.semiBold};
+`;
+
+type ApplicationVariableLabelRowProps = {
+ variableKey: string;
+ isDeprecated: boolean;
+ inputId: string;
+};
+
+export const ApplicationVariableLabelRow = ({
+ variableKey,
+ isDeprecated,
+ inputId,
+}: ApplicationVariableLabelRowProps) => (
+ <StyledLabelRow>
+ <StyledLabel htmlFor={inputId}>{variableKey}</StyledLabel>
+ {isDeprecated && <Pill label="Deprecated" />}
+ </StyledLabelRow>
+);
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/components/ApplicationVariableRow.tsx b/packages/twenty-apps/public/fireflies/src/front-components/components/ApplicationVariableRow.tsx
new file mode 100644
index 00000000000..ffe6132e4b2
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/components/ApplicationVariableRow.tsx
@@ -0,0 +1,89 @@
+import styled from '@emotion/styled';
+import { isNonEmptyString } from '@sniptt/guards';
+import { useId } from 'react';
+import { enqueueSnackbar } from 'twenty-sdk/front-component';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useDebouncedCallback } from 'use-debounce';
+
+import { ApplicationVariableLabelRow } from 'src/front-components/components/ApplicationVariableLabelRow';
+import { StyledSettingsTextInput } from 'src/front-components/components/StyledSettingsTextInput';
+import { useUpdateApplicationVariable } from 'src/front-components/hooks/use-update-application-variable';
+import { type FirefliesApplicationVariable } from 'src/front-components/types/fireflies-application-variable.type';
+
+const APPLICATION_VARIABLE_SAVE_DEBOUNCE_MILLISECONDS = 250;
+
+const StyledRow = styled.div`
+ display: flex;
+ flex-direction: column;
+`;
+
+const StyledDescription = styled.span`
+ color: ${() => themeCssVariables.font.color.tertiary};
+ font-family: ${() => themeCssVariables.font.family};
+ font-size: ${() => themeCssVariables.font.size.xs};
+ margin-bottom: ${() => themeCssVariables.spacing[1]};
+`;
+
+type ApplicationVariableRowProps = {
+ variable: FirefliesApplicationVariable;
+ applicationId: string;
+ value: string | undefined;
+ onValueChange: (params: { variableKey: string; value: string }) => void;
+};
+
+export const ApplicationVariableRow = ({
+ variable,
+ applicationId,
+ value,
+ onValueChange,
+}: ApplicationVariableRowProps) => {
+ const inputId = useId();
+
+ const { updateApplicationVariable } =
+ useUpdateApplicationVariable(applicationId);
+
+ const isSecretStored = variable.isSecret && isNonEmptyString(variable.value);
+ const draftValue = value ?? (isSecretStored ? '' : variable.value);
+
+ const saveDebounced = useDebouncedCallback(async (newValue: string) => {
+ const isUpdated = await updateApplicationVariable({
+ variableKey: variable.key,
+ value: newValue,
+ });
+
+ if (!isUpdated) {
+ enqueueSnackbar({
+ message: `Could not save ${variable.key}.`,
+ variant: 'error',
+ });
+ }
+ }, APPLICATION_VARIABLE_SAVE_DEBOUNCE_MILLISECONDS);
+
+ return (
+ <StyledRow>
+ <ApplicationVariableLabelRow
+ variableKey={variable.key}
+ isDeprecated={variable.isDeprecated}
+ inputId={inputId}
+ />
+ {isNonEmptyString(variable.description) && (
+ <StyledDescription>{variable.description}</StyledDescription>
+ )}
+ <StyledSettingsTextInput
+ id={inputId}
+ type={variable.isSecret ? 'password' : 'text'}
+ autoComplete="off"
+ placeholder={isSecretStored ? variable.value : 'Value'}
+ value={draftValue}
+ onChange={(event) => {
+ onValueChange({
+ variableKey: variable.key,
+ value: event.target.value,
+ });
+ saveDebounced(event.target.value);
+ }}
+ onBlur={() => saveDebounced.flush()}
+ />
+ </StyledRow>
+ );
+};
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/components/FirefliesBackfillSection.tsx b/packages/twenty-apps/public/fireflies/src/front-components/components/FirefliesBackfillSection.tsx
new file mode 100644
index 00000000000..71a3c612e55
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/components/FirefliesBackfillSection.tsx
@@ -0,0 +1,107 @@
+import styled from '@emotion/styled';
+import { isUndefined } from '@sniptt/guards';
+import { useState } from 'react';
+import { enqueueSnackbar } from 'twenty-sdk/front-component';
+import { Button } from 'twenty-ui/input';
+import { Section } from 'twenty-ui/layout';
+import { H2Title } from 'twenty-ui/typography';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+import { FIREFLIES_BACKFILL_MAX_WINDOW_DAYS } from 'src/constants/fireflies-backfill-max-window-days.constant';
+import { StyledSettingsTextInput } from 'src/front-components/components/StyledSettingsTextInput';
+import { DEFAULT_FIREFLIES_BACKFILL_DAYS } from 'src/front-components/constants/default-fireflies-backfill-days.constant';
+import { useRequestFirefliesBackfill } from 'src/front-components/hooks/use-request-fireflies-backfill';
+import { getFirefliesBackfillFeedback } from 'src/front-components/utils/get-fireflies-backfill-feedback.util';
+import { parseBackfillDays } from 'src/front-components/utils/parse-backfill-days.util';
+
+const StyledRow = styled.div`
+ align-items: center;
+ display: flex;
+ gap: ${() => themeCssVariables.spacing[2]};
+`;
+
+const StyledDaysInputContainer = styled.div`
+ display: flex;
+ width: ${() => themeCssVariables.spacing[20]};
+`;
+
+const StyledDaysUnit = styled.span`
+ color: ${() => themeCssVariables.font.color.secondary};
+ font-family: ${() => themeCssVariables.font.family};
+ font-size: ${() => themeCssVariables.font.size.sm};
+`;
+
+const StyledHint = styled.div`
+ color: ${() => themeCssVariables.font.color.tertiary};
+ font-family: ${() => themeCssVariables.font.family};
+ font-size: ${() => themeCssVariables.font.size.xs};
+ margin-top: ${() => themeCssVariables.spacing[2]};
+`;
+
+type FirefliesBackfillSectionProps = {
+ isApiKeyConfigured: boolean;
+};
+
+export const FirefliesBackfillSection = ({
+ isApiKeyConfigured,
+}: FirefliesBackfillSectionProps) => {
+ const [daysDraftValue, setDaysDraftValue] = useState(
+ String(DEFAULT_FIREFLIES_BACKFILL_DAYS),
+ );
+ const { requestFirefliesBackfill, isRequestingFirefliesBackfill } =
+ useRequestFirefliesBackfill();
+
+ const parsedDays = parseBackfillDays(daysDraftValue);
+ const isStartDisabled =
+ !isApiKeyConfigured ||
+ isUndefined(parsedDays) ||
+ isRequestingFirefliesBackfill;
+
+ const handleStartClick = async () => {
+ if (isUndefined(parsedDays)) {
+ return;
+ }
+
+ const outcome = await requestFirefliesBackfill(parsedDays);
+ const feedback = getFirefliesBackfillFeedback(outcome);
+
+ enqueueSnackbar({ message: feedback.message, variant: feedback.variant });
+ };
+
+ return (
+ <Section>
+ <H2Title
+ title="Import call history"
+ description="Imports past Fireflies calls as call recordings. Already-imported calls are skipped."
+ />
+ <StyledRow>
+ <StyledDaysInputContainer>
+ <StyledSettingsTextInput
+ aria-label="Days of call history to import"
+ type="number"
+ min={1}
+ max={FIREFLIES_BACKFILL_MAX_WINDOW_DAYS}
+ step={1}
+ value={daysDraftValue}
+ onChange={(event) => setDaysDraftValue(event.target.value)}
+ />
+ </StyledDaysInputContainer>
+ <StyledDaysUnit>days</StyledDaysUnit>
+ <Button
+ title={isRequestingFirefliesBackfill ? 'Starting…' : 'Start backfill'}
+ disabled={isStartDisabled}
+ onClick={handleStartClick}
+ />
+ </StyledRow>
+ {!isApiKeyConfigured && (
+ <StyledHint>Set the Fireflies API key first.</StyledHint>
+ )}
+ {isApiKeyConfigured && isUndefined(parsedDays) && (
+ <StyledHint>
+ Enter a whole number of days between 1 and{' '}
+ {FIREFLIES_BACKFILL_MAX_WINDOW_DAYS}.
+ </StyledHint>
+ )}
+ </Section>
+ );
+};
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/components/FirefliesSettings.tsx b/packages/twenty-apps/public/fireflies/src/front-components/components/FirefliesSettings.tsx
new file mode 100644
index 00000000000..77d9add92e0
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/components/FirefliesSettings.tsx
@@ -0,0 +1,101 @@
+import 'twenty-ui/style.css';
+
+import styled from '@emotion/styled';
+import { isUndefined } from '@sniptt/guards';
+import { useState } from 'react';
+import { Section } from 'twenty-ui/layout';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { H2Title } from 'twenty-ui/typography';
+
+import { FIREFLIES_API_KEY_VARIABLE_KEY } from 'src/constants/fireflies-api-key-variable-key.constant';
+import { ApplicationVariableRow } from 'src/front-components/components/ApplicationVariableRow';
+import { FirefliesBackfillSection } from 'src/front-components/components/FirefliesBackfillSection';
+import { useFirefliesApplicationVariables } from 'src/front-components/hooks/use-fireflies-application-variables';
+import { getIsApplicationVariableConfigured } from 'src/front-components/utils/get-is-application-variable-configured.util';
+
+const StyledContainer = styled.div`
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+ gap: ${() => themeCssVariables.spacing[8]};
+ width: 100%;
+`;
+
+const StyledVariablesList = styled.div`
+ display: flex;
+ flex-direction: column;
+ gap: ${() => themeCssVariables.spacing[4]};
+`;
+
+const StyledCenteredState = styled.div`
+ align-items: center;
+ box-sizing: border-box;
+ color: ${() => themeCssVariables.font.color.tertiary};
+ display: flex;
+ font-family: ${() => themeCssVariables.font.family};
+ font-size: ${() => themeCssVariables.font.size.sm};
+ height: 100%;
+ justify-content: center;
+ padding: ${() => themeCssVariables.spacing[4]};
+ width: 100%;
+`;
+
+export const FirefliesSettings = () => {
+ const {
+ applicationId,
+ applicationVariables,
+ isApplicationVariablesQueryLoading,
+ errorMessage,
+ } = useFirefliesApplicationVariables();
+
+ const [draftValueByVariableKey, setDraftValueByVariableKey] = useState<
+ Record<string, string>
+ >({});
+
+ const isApiKeyConfigured = getIsApplicationVariableConfigured({
+ draftValue: draftValueByVariableKey[FIREFLIES_API_KEY_VARIABLE_KEY],
+ storedValue: applicationVariables.find(
+ (variable) => variable.key === FIREFLIES_API_KEY_VARIABLE_KEY,
+ )?.value,
+ });
+
+ if (isApplicationVariablesQueryLoading) {
+ return <StyledCenteredState>Loading settings…</StyledCenteredState>;
+ }
+
+ if (isUndefined(applicationId)) {
+ return <StyledCenteredState>{errorMessage}</StyledCenteredState>;
+ }
+
+ return (
+ <StyledContainer>
+ <Section>
+ <H2Title
+ title="Configuration"
+ description={
+ applicationVariables.length > 0
+ ? 'Set your application configuration variables'
+ : 'No variables to set for this application'
+ }
+ />
+ <StyledVariablesList>
+ {applicationVariables.map((variable) => (
+ <ApplicationVariableRow
+ key={variable.key}
+ variable={variable}
+ applicationId={applicationId}
+ value={draftValueByVariableKey[variable.key]}
+ onValueChange={({ variableKey, value }) =>
+ setDraftValueByVariableKey((previousDraftValues) => ({
+ ...previousDraftValues,
+ [variableKey]: value,
+ }))
+ }
+ />
+ ))}
+ </StyledVariablesList>
+ </Section>
+ <FirefliesBackfillSection isApiKeyConfigured={isApiKeyConfigured} />
+ </StyledContainer>
+ );
+};
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/components/StyledSettingsTextInput.tsx b/packages/twenty-apps/public/fireflies/src/front-components/components/StyledSettingsTextInput.tsx
new file mode 100644
index 00000000000..982395dd5cd
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/components/StyledSettingsTextInput.tsx
@@ -0,0 +1,39 @@
+import styled from '@emotion/styled';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+export const StyledSettingsTextInput = styled.input`
+ background-color: ${() => themeCssVariables.background.transparent.lighter};
+ border: 1px solid ${() => themeCssVariables.border.color.medium};
+ border-radius: ${() => themeCssVariables.border.radius.md};
+ box-sizing: border-box;
+ color: ${() => themeCssVariables.font.color.primary};
+ display: flex;
+ flex-grow: 1;
+ font-family: ${() => themeCssVariables.font.family};
+ font-size: ${() => themeCssVariables.font.size.md};
+ font-weight: ${() => themeCssVariables.font.weight.regular};
+ height: 32px;
+ outline: none;
+ padding: ${() => themeCssVariables.spacing[2]};
+ text-overflow: ellipsis;
+ width: 100%;
+
+ &::placeholder,
+ &::-webkit-input-placeholder {
+ color: ${() => themeCssVariables.font.color.light};
+ font-family: ${() => themeCssVariables.font.family};
+ font-weight: ${() => themeCssVariables.font.weight.medium};
+ }
+
+ &:disabled {
+ color: ${() => themeCssVariables.font.color.tertiary};
+ }
+
+ &[readonly] {
+ pointer-events: none;
+ }
+
+ &:focus {
+ border-color: ${() => themeCssVariables.color.blue};
+ }
+`;
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/constants/default-fireflies-backfill-days.constant.ts b/packages/twenty-apps/public/fireflies/src/front-components/constants/default-fireflies-backfill-days.constant.ts
new file mode 100644
index 00000000000..dc4194b5408
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/constants/default-fireflies-backfill-days.constant.ts
@@ -0,0 +1 @@
+export const DEFAULT_FIREFLIES_BACKFILL_DAYS = 90;
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/hooks/use-fireflies-application-variables.ts b/packages/twenty-apps/public/fireflies/src/front-components/hooks/use-fireflies-application-variables.ts
new file mode 100644
index 00000000000..a5645cb9700
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/hooks/use-fireflies-application-variables.ts
@@ -0,0 +1,115 @@
+import { isNonEmptyString } from '@sniptt/guards';
+import { useEffect, useState } from 'react';
+import { MetadataApiClient } from 'twenty-client-sdk/metadata';
+import { useFrontComponentId } from 'twenty-sdk/front-component';
+
+import { type FirefliesApplicationVariable } from 'src/front-components/types/fireflies-application-variable.type';
+import { shouldDisplayApplicationVariable } from 'src/front-components/utils/should-display-application-variable.util';
+
+type FirefliesApplicationVariablesState = {
+ applicationId: string | undefined;
+ applicationVariables: FirefliesApplicationVariable[];
+ isApplicationVariablesQueryLoading: boolean;
+ errorMessage: string | undefined;
+};
+
+const APPLICATION_VARIABLES_ERROR_MESSAGE = 'Please try again later.';
+
+const APPLICATION_VARIABLES_LOADING_STATE: FirefliesApplicationVariablesState =
+ {
+ applicationId: undefined,
+ applicationVariables: [],
+ isApplicationVariablesQueryLoading: true,
+ errorMessage: undefined,
+ };
+
+export const useFirefliesApplicationVariables =
+ (): FirefliesApplicationVariablesState => {
+ const frontComponentId = useFrontComponentId();
+ const [state, setState] = useState<FirefliesApplicationVariablesState>(
+ APPLICATION_VARIABLES_LOADING_STATE,
+ );
+
+ useEffect(() => {
+ let cancelled = false;
+
+ setState(APPLICATION_VARIABLES_LOADING_STATE);
+
+ const fetchApplicationVariables = async () => {
+ try {
+ const client = new MetadataApiClient();
+ const frontComponentResult = await client.query({
+ frontComponent: {
+ __args: { id: frontComponentId },
+ applicationId: true,
+ },
+ });
+
+ const applicationId =
+ frontComponentResult.frontComponent?.applicationId;
+
+ if (!isNonEmptyString(applicationId)) {
+ if (!cancelled) {
+ setState({
+ applicationId: undefined,
+ applicationVariables: [],
+ isApplicationVariablesQueryLoading: false,
+ errorMessage: APPLICATION_VARIABLES_ERROR_MESSAGE,
+ });
+ }
+ return;
+ }
+
+ const applicationResult = await client.query({
+ findOneApplication: {
+ __args: { id: applicationId },
+ applicationVariables: {
+ key: true,
+ value: true,
+ description: true,
+ isSecret: true,
+ isDeprecated: true,
+ },
+ },
+ });
+
+ if (cancelled) {
+ return;
+ }
+
+ const applicationVariables = [
+ ...(applicationResult.findOneApplication?.applicationVariables ??
+ []),
+ ]
+ .filter(shouldDisplayApplicationVariable)
+ .sort((left, right) => left.key.localeCompare(right.key));
+
+ setState({
+ applicationId,
+ applicationVariables,
+ isApplicationVariablesQueryLoading: false,
+ errorMessage: undefined,
+ });
+ } catch {
+ if (cancelled) {
+ return;
+ }
+
+ setState({
+ applicationId: undefined,
+ applicationVariables: [],
+ isApplicationVariablesQueryLoading: false,
+ errorMessage: APPLICATION_VARIABLES_ERROR_MESSAGE,
+ });
+ }
+ };
+
+ fetchApplicationVariables();
+
+ return () => {
+ cancelled = true;
+ };
+ }, [frontComponentId]);
+
+ return state;
+ };
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/hooks/use-request-fireflies-backfill.ts b/packages/twenty-apps/public/fireflies/src/front-components/hooks/use-request-fireflies-backfill.ts
new file mode 100644
index 00000000000..af06ace743d
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/hooks/use-request-fireflies-backfill.ts
@@ -0,0 +1,41 @@
+import { isString } from '@sniptt/guards';
+import { useState } from 'react';
+import { RestApiClient } from 'twenty-client-sdk/rest';
+
+import { FIREFLIES_BACKFILL_ROUTE_PATH } from 'src/constants/fireflies-backfill-route-path.constant';
+import { asRecord } from 'src/front-components/utils/as-record.util';
+
+type RequestFirefliesBackfillState = {
+ requestFirefliesBackfill: (days: number) => Promise<string | undefined>;
+ isRequestingFirefliesBackfill: boolean;
+};
+
+export const useRequestFirefliesBackfill =
+ (): RequestFirefliesBackfillState => {
+ const [isRequestingFirefliesBackfill, setIsRequestingFirefliesBackfill] =
+ useState(false);
+
+ const requestFirefliesBackfill = async (
+ days: number,
+ ): Promise<string | undefined> => {
+ setIsRequestingFirefliesBackfill(true);
+
+ try {
+ const client = new RestApiClient();
+ const backfillResult = await client.post(
+ `/s${FIREFLIES_BACKFILL_ROUTE_PATH}`,
+ { days },
+ );
+
+ const outcome = asRecord(backfillResult)?.outcome;
+
+ return isString(outcome) ? outcome : undefined;
+ } catch {
+ return undefined;
+ } finally {
+ setIsRequestingFirefliesBackfill(false);
+ }
+ };
+
+ return { requestFirefliesBackfill, isRequestingFirefliesBackfill };
+ };
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/hooks/use-update-application-variable.ts b/packages/twenty-apps/public/fireflies/src/front-components/hooks/use-update-application-variable.ts
new file mode 100644
index 00000000000..f808373b8dc
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/hooks/use-update-application-variable.ts
@@ -0,0 +1,37 @@
+import { MetadataApiClient } from 'twenty-client-sdk/metadata';
+
+type UpdateApplicationVariableParams = {
+ variableKey: string;
+ value: string;
+};
+
+type UpdateApplicationVariableState = {
+ updateApplicationVariable: (
+ params: UpdateApplicationVariableParams,
+ ) => Promise<boolean>;
+};
+
+export const useUpdateApplicationVariable = (
+ applicationId: string,
+): UpdateApplicationVariableState => {
+ const updateApplicationVariable = async ({
+ variableKey,
+ value,
+ }: UpdateApplicationVariableParams): Promise<boolean> => {
+ try {
+ const client = new MetadataApiClient();
+
+ await client.mutation({
+ updateOneApplicationVariable: {
+ __args: { key: variableKey, value, applicationId },
+ },
+ });
+
+ return true;
+ } catch {
+ return false;
+ }
+ };
+
+ return { updateApplicationVariable };
+};
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/settings.front-component.tsx b/packages/twenty-apps/public/fireflies/src/front-components/settings.front-component.tsx
new file mode 100644
index 00000000000..6c215246d2c
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/settings.front-component.tsx
@@ -0,0 +1,12 @@
+import { defineSettingsFrontComponent } from 'twenty-sdk/define';
+
+import { SETTINGS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { FirefliesSettings } from 'src/front-components/components/FirefliesSettings';
+
+export default defineSettingsFrontComponent({
+ universalIdentifier: SETTINGS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
+ name: 'fireflies-settings',
+ description:
+ 'Admin settings panel: Fireflies credentials and call-history backfill.',
+ component: FirefliesSettings,
+});
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/types/fireflies-application-variable.type.ts b/packages/twenty-apps/public/fireflies/src/front-components/types/fireflies-application-variable.type.ts
new file mode 100644
index 00000000000..94c818f6458
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/types/fireflies-application-variable.type.ts
@@ -0,0 +1,7 @@
+export type FirefliesApplicationVariable = {
+ key: string;
+ value: string;
+ description: string;
+ isSecret: boolean;
+ isDeprecated: boolean;
+};
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/types/fireflies-backfill-feedback.type.ts b/packages/twenty-apps/public/fireflies/src/front-components/types/fireflies-backfill-feedback.type.ts
new file mode 100644
index 00000000000..29e2e9c2eea
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/types/fireflies-backfill-feedback.type.ts
@@ -0,0 +1,4 @@
+export type FirefliesBackfillFeedback = {
+ variant: 'success' | 'error';
+ message: string;
+};
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/get-fireflies-backfill-feedback.test.ts b/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/get-fireflies-backfill-feedback.test.ts
new file mode 100644
index 00000000000..73ab4b062a1
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/get-fireflies-backfill-feedback.test.ts
@@ -0,0 +1,24 @@
+import { describe, expect, it } from 'vitest';
+
+import { getFirefliesBackfillFeedback } from 'src/front-components/utils/get-fireflies-backfill-feedback.util';
+
+describe('getFirefliesBackfillFeedback', () => {
+ it.each([
+ ['started', 'success'],
+ ['invalid-request', 'error'],
+ ['not-configured', 'error'],
+ ])('maps the %s outcome to a %s feedback', (outcome, variant) => {
+ expect(getFirefliesBackfillFeedback(outcome).variant).toBe(variant);
+ });
+
+ it('maps an unknown outcome to an error feedback', () => {
+ expect(getFirefliesBackfillFeedback('unexpected')).toEqual({
+ variant: 'error',
+ message: 'Could not start the backfill. Try again later.',
+ });
+ });
+
+ it('maps a missing outcome to an error feedback', () => {
+ expect(getFirefliesBackfillFeedback(undefined).variant).toBe('error');
+ });
+});
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/get-is-application-variable-configured.test.ts b/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/get-is-application-variable-configured.test.ts
new file mode 100644
index 00000000000..d4d5d59ac86
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/get-is-application-variable-configured.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, it } from 'vitest';
+
+import { getIsApplicationVariableConfigured } from 'src/front-components/utils/get-is-application-variable-configured.util';
+
+describe('getIsApplicationVariableConfigured', () => {
+ it('is configured when untouched and a value is stored', () => {
+ expect(
+ getIsApplicationVariableConfigured({
+ draftValue: undefined,
+ storedValue: 'dem********',
+ }),
+ ).toBe(true);
+ });
+
+ it('is not configured when untouched and nothing is stored', () => {
+ expect(
+ getIsApplicationVariableConfigured({
+ draftValue: undefined,
+ storedValue: '',
+ }),
+ ).toBe(false);
+ });
+
+ it('is configured as soon as a value is typed', () => {
+ expect(
+ getIsApplicationVariableConfigured({
+ draftValue: 'new-key',
+ storedValue: '',
+ }),
+ ).toBe(true);
+ });
+
+ it('is not configured once a stored value is cleared, even while the stored value is still present', () => {
+ expect(
+ getIsApplicationVariableConfigured({
+ draftValue: '',
+ storedValue: 'dem********',
+ }),
+ ).toBe(false);
+ });
+});
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/parse-backfill-days.test.ts b/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/parse-backfill-days.test.ts
new file mode 100644
index 00000000000..e702ed556d5
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/parse-backfill-days.test.ts
@@ -0,0 +1,24 @@
+import { describe, expect, it } from 'vitest';
+
+import { parseBackfillDays } from 'src/front-components/utils/parse-backfill-days.util';
+
+describe('parseBackfillDays', () => {
+ it('parses a positive integer', () => {
+ expect(parseBackfillDays('90')).toBe(90);
+ });
+
+ it('parses a padded value', () => {
+ expect(parseBackfillDays(' 30 ')).toBe(30);
+ });
+
+ it('accepts the maximum window', () => {
+ expect(parseBackfillDays('3650')).toBe(3650);
+ });
+
+ it.each([['0'], ['-5'], ['1.5'], ['abc'], [''], ['3651']])(
+ 'rejects %s',
+ (rawValue) => {
+ expect(parseBackfillDays(rawValue)).toBeUndefined();
+ },
+ );
+});
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/should-display-application-variable.test.ts b/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/should-display-application-variable.test.ts
new file mode 100644
index 00000000000..6abb0142c8d
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/utils/__tests__/should-display-application-variable.test.ts
@@ -0,0 +1,35 @@
+import { describe, expect, it } from 'vitest';
+
+import { type FirefliesApplicationVariable } from 'src/front-components/types/fireflies-application-variable.type';
+import { shouldDisplayApplicationVariable } from 'src/front-components/utils/should-display-application-variable.util';
+
+const buildVariable = (
+ overrides: Partial<FirefliesApplicationVariable>,
+): FirefliesApplicationVariable => ({
+ key: 'FIREFLIES_API_KEY',
+ value: '',
+ description: '',
+ isSecret: true,
+ isDeprecated: false,
+ ...overrides,
+});
+
+describe('shouldDisplayApplicationVariable', () => {
+ it('displays a supported variable without a value', () => {
+ expect(shouldDisplayApplicationVariable(buildVariable({}))).toBe(true);
+ });
+
+ it('hides a deprecated variable without a value', () => {
+ expect(
+ shouldDisplayApplicationVariable(buildVariable({ isDeprecated: true })),
+ ).toBe(false);
+ });
+
+ it('displays a deprecated variable that still holds a value', () => {
+ expect(
+ shouldDisplayApplicationVariable(
+ buildVariable({ isDeprecated: true, value: 'dem********' }),
+ ),
+ ).toBe(true);
+ });
+});
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/utils/get-fireflies-backfill-feedback.util.ts b/packages/twenty-apps/public/fireflies/src/front-components/utils/get-fireflies-backfill-feedback.util.ts
new file mode 100644
index 00000000000..406b0e87616
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/utils/get-fireflies-backfill-feedback.util.ts
@@ -0,0 +1,35 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { FIREFLIES_BACKFILL_OUTCOME } from 'src/constants/fireflies-backfill-outcome.constant';
+import { type FirefliesBackfillFeedback } from 'src/front-components/types/fireflies-backfill-feedback.type';
+
+const BACKFILL_FEEDBACK_BY_OUTCOME: Record<string, FirefliesBackfillFeedback> =
+ {
+ [FIREFLIES_BACKFILL_OUTCOME.STARTED]: {
+ variant: 'success',
+ message: 'Backfill started. Calls will appear as they are imported.',
+ },
+ [FIREFLIES_BACKFILL_OUTCOME.INVALID_REQUEST]: {
+ variant: 'error',
+ message: 'Enter a valid number of days.',
+ },
+ [FIREFLIES_BACKFILL_OUTCOME.NOT_CONFIGURED]: {
+ variant: 'error',
+ message: 'Set the Fireflies API key first.',
+ },
+ };
+
+const UNKNOWN_OUTCOME_FEEDBACK: FirefliesBackfillFeedback = {
+ variant: 'error',
+ message: 'Could not start the backfill. Try again later.',
+};
+
+export const getFirefliesBackfillFeedback = (
+ outcome: string | undefined,
+): FirefliesBackfillFeedback => {
+ if (isUndefined(outcome)) {
+ return UNKNOWN_OUTCOME_FEEDBACK;
+ }
+
+ return BACKFILL_FEEDBACK_BY_OUTCOME[outcome] ?? UNKNOWN_OUTCOME_FEEDBACK;
+};
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/utils/get-is-application-variable-configured.util.ts b/packages/twenty-apps/public/fireflies/src/front-components/utils/get-is-application-variable-configured.util.ts
new file mode 100644
index 00000000000..022df970ebb
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/utils/get-is-application-variable-configured.util.ts
@@ -0,0 +1,12 @@
+import { isNonEmptyString, isUndefined } from '@sniptt/guards';
+
+export const getIsApplicationVariableConfigured = ({
+ draftValue,
+ storedValue,
+}: {
+ draftValue: string | undefined;
+ storedValue: string | undefined;
+}): boolean =>
+ isUndefined(draftValue)
+ ? isNonEmptyString(storedValue)
+ : isNonEmptyString(draftValue);
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/utils/parse-backfill-days.util.ts b/packages/twenty-apps/public/fireflies/src/front-components/utils/parse-backfill-days.util.ts
new file mode 100644
index 00000000000..60eaca94a6a
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/utils/parse-backfill-days.util.ts
@@ -0,0 +1,15 @@
+import { FIREFLIES_BACKFILL_MAX_WINDOW_DAYS } from 'src/constants/fireflies-backfill-max-window-days.constant';
+
+export const parseBackfillDays = (rawValue: string): number | undefined => {
+ const parsedValue = Number(rawValue);
+
+ if (
+ !Number.isInteger(parsedValue) ||
+ parsedValue <= 0 ||
+ parsedValue > FIREFLIES_BACKFILL_MAX_WINDOW_DAYS
+ ) {
+ return undefined;
+ }
+
+ return parsedValue;
+};
diff --git a/packages/twenty-apps/public/fireflies/src/front-components/utils/should-display-application-variable.util.ts b/packages/twenty-apps/public/fireflies/src/front-components/utils/should-display-application-variable.util.ts
new file mode 100644
index 00000000000..6386fd882f1
--- /dev/null
+++ b/packages/twenty-apps/public/fireflies/src/front-components/utils/should-display-application-variable.util.ts
@@ -0,0 +1,7 @@
+import { isNonEmptyString } from '@sniptt/guards';
+
+import { type FirefliesApplicationVariable } from 'src/front-components/types/fireflies-application-variable.type';
+
+export const shouldDisplayApplicationVariable = (
+ variable: FirefliesApplicationVariable,
+): boolean => !variable.isDeprecated || isNonEmptyString(variable.value);
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/__tests__/fireflies-backfill.test.ts b/packages/twenty-apps/public/fireflies/src/logic-functions/__tests__/fireflies-backfill.test.ts
index 02f9061c855..b5e730c5914 100644
--- a/packages/twenty-apps/public/fireflies/src/logic-functions/__tests__/fireflies-backfill.test.ts
+++ b/packages/twenty-apps/public/fireflies/src/logic-functions/__tests__/fireflies-backfill.test.ts
@@ -1,4 +1,4 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { type RoutePayload } from 'twenty-sdk/define';
import { FIREFLIES_BACKFILL_WORKER_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
@@ -24,9 +24,14 @@ const buildRoutePayload = (body: object | null): RoutePayload<unknown> => ({
describe('firefliesBackfillLogicFunction', () => {
beforeEach(() => {
vi.clearAllMocks();
+ vi.stubEnv('FIREFLIES_API_KEY', 'fireflies-api-key');
enqueueJobMock.mockResolvedValue({ enqueued: true });
});
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ });
+
it('is configured as an authenticated backfill route', () => {
expect(firefliesBackfillLogicFunction.config).toEqual(
expect.objectContaining({
@@ -53,6 +58,20 @@ describe('firefliesBackfillLogicFunction', () => {
expect(enqueueJobMock).not.toHaveBeenCalled();
});
+ it('returns not-configured without enqueueing when the API key is missing', async () => {
+ vi.stubEnv('FIREFLIES_API_KEY', '');
+
+ const result = await firefliesBackfillLogicFunction.config.handler(
+ buildRoutePayload({ days: 30 }),
+ );
+
+ expect(result).toEqual({
+ outcome: 'not-configured',
+ error: expect.stringContaining('Fireflies is not configured'),
+ });
+ expect(enqueueJobMock).not.toHaveBeenCalled();
+ });
+
it('enqueues discovery instead of listing transcripts in the route', async () => {
const result = await firefliesBackfillLogicFunction.config.handler(
buildRoutePayload({ days: 30 }),
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/fireflies-backfill.ts b/packages/twenty-apps/public/fireflies/src/logic-functions/fireflies-backfill.ts
index 0df28f35679..17b71cc56ed 100644
--- a/packages/twenty-apps/public/fireflies/src/logic-functions/fireflies-backfill.ts
+++ b/packages/twenty-apps/public/fireflies/src/logic-functions/fireflies-backfill.ts
@@ -6,10 +6,11 @@ import {
FIREFLIES_BACKFILL_WORKER_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
} from 'src/constants/universal-identifiers';
import { FIREFLIES_BACKFILL_ROUTE_PATH } from 'src/constants/fireflies-backfill-route-path.constant';
-import { FIREFLIES_BACKFILL_MAX_WINDOW_DAYS } from 'src/logic-functions/constants/fireflies-backfill-max-window-days.constant';
-import { FIREFLIES_BACKFILL_OUTCOME } from 'src/logic-functions/constants/fireflies-backfill-outcome.constant';
+import { FIREFLIES_BACKFILL_MAX_WINDOW_DAYS } from 'src/constants/fireflies-backfill-max-window-days.constant';
+import { FIREFLIES_BACKFILL_OUTCOME } from 'src/constants/fireflies-backfill-outcome.constant';
import { FIREFLIES_BACKFILL_TIMEOUT_SECONDS } from 'src/logic-functions/constants/fireflies-backfill-timeout-seconds.constant';
import { firefliesBackfillRequestBodySchema } from 'src/logic-functions/schemas/fireflies-backfill-request-body.schema';
+import { getFirefliesApiKey } from 'src/logic-functions/utils/get-fireflies-api-key';
const firefliesBackfillRequestHandler = async (
payload: RoutePayload<unknown>,
@@ -25,6 +26,15 @@ const firefliesBackfillRequestHandler = async (
};
}
+ const apiKeyResult = getFirefliesApiKey();
+
+ if (!apiKeyResult.success) {
+ return {
+ outcome: FIREFLIES_BACKFILL_OUTCOME.NOT_CONFIGURED,
+ error: apiKeyResult.error,
+ };
+ }
+
await enqueueJob({
logicFunctionUniversalIdentifier:
FIREFLIES_BACKFILL_WORKER_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/handlers/fireflies-backfill-handler.ts b/packages/twenty-apps/public/fireflies/src/logic-functions/handlers/fireflies-backfill-handler.ts
index 74bbbad3fa3..03f1659bb64 100644
--- a/packages/twenty-apps/public/fireflies/src/logic-functions/handlers/fireflies-backfill-handler.ts
+++ b/packages/twenty-apps/public/fireflies/src/logic-functions/handlers/fireflies-backfill-handler.ts
@@ -1,5 +1,5 @@
+import { FIREFLIES_BACKFILL_OUTCOME } from 'src/constants/fireflies-backfill-outcome.constant';
import { FIREFLIES_BACKFILL_BATCH_SIZE } from 'src/logic-functions/constants/fireflies-backfill-batch-size.constant';
-import { FIREFLIES_BACKFILL_OUTCOME } from 'src/logic-functions/constants/fireflies-backfill-outcome.constant';
import { enqueueFirefliesBackfillBatches } from 'src/logic-functions/data/enqueue-fireflies-backfill-batches.util';
import { type FirefliesBackfillResult } from 'src/logic-functions/types/fireflies-backfill-result.type';
import { buildFirefliesBackfillWindow } from 'src/logic-functions/utils/build-fireflies-backfill-window.util';
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/schemas/__tests__/fireflies-backfill-request-body.schema.test.ts b/packages/twenty-apps/public/fireflies/src/logic-functions/schemas/__tests__/fireflies-backfill-request-body.schema.test.ts
index 7b27297e273..950071a6b6f 100644
--- a/packages/twenty-apps/public/fireflies/src/logic-functions/schemas/__tests__/fireflies-backfill-request-body.schema.test.ts
+++ b/packages/twenty-apps/public/fireflies/src/logic-functions/schemas/__tests__/fireflies-backfill-request-body.schema.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { FIREFLIES_BACKFILL_MAX_WINDOW_DAYS } from 'src/logic-functions/constants/fireflies-backfill-max-window-days.constant';
+import { FIREFLIES_BACKFILL_MAX_WINDOW_DAYS } from 'src/constants/fireflies-backfill-max-window-days.constant';
import { firefliesBackfillRequestBodySchema } from 'src/logic-functions/schemas/fireflies-backfill-request-body.schema';
describe('firefliesBackfillRequestBodySchema', () => {
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/schemas/fireflies-backfill-request-body.schema.ts b/packages/twenty-apps/public/fireflies/src/logic-functions/schemas/fireflies-backfill-request-body.schema.ts
index a3f61f1e7f7..2f32a3bfefe 100644
--- a/packages/twenty-apps/public/fireflies/src/logic-functions/schemas/fireflies-backfill-request-body.schema.ts
+++ b/packages/twenty-apps/public/fireflies/src/logic-functions/schemas/fireflies-backfill-request-body.schema.ts
@@ -1,6 +1,6 @@
import { z } from 'zod';
-import { FIREFLIES_BACKFILL_MAX_WINDOW_DAYS } from 'src/logic-functions/constants/fireflies-backfill-max-window-days.constant';
+import { FIREFLIES_BACKFILL_MAX_WINDOW_DAYS } from 'src/constants/fireflies-backfill-max-window-days.constant';
export const firefliesBackfillRequestBodySchema = z.object({
days: z.number().int().positive().max(FIREFLIES_BACKFILL_MAX_WINDOW_DAYS),
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/types/fireflies-backfill-result.type.ts b/packages/twenty-apps/public/fireflies/src/logic-functions/types/fireflies-backfill-result.type.ts
index ca28379f18f..d186ebfab36 100644
--- a/packages/twenty-apps/public/fireflies/src/logic-functions/types/fireflies-backfill-result.type.ts
+++ b/packages/twenty-apps/public/fireflies/src/logic-functions/types/fireflies-backfill-result.type.ts
@@ -1,4 +1,4 @@
-import type { FIREFLIES_BACKFILL_OUTCOME } from 'src/logic-functions/constants/fireflies-backfill-outcome.constant';
+import type { FIREFLIES_BACKFILL_OUTCOME } from 'src/constants/fireflies-backfill-outcome.constant';
export type FirefliesBackfillResult =
| {
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/utils/get-fireflies-api-key.ts b/packages/twenty-apps/public/fireflies/src/logic-functions/utils/get-fireflies-api-key.ts
index 1ab2b741558..74b7c5770fc 100644
--- a/packages/twenty-apps/public/fireflies/src/logic-functions/utils/get-fireflies-api-key.ts
+++ b/packages/twenty-apps/public/fireflies/src/logic-functions/utils/get-fireflies-api-key.ts
@@ -1,11 +1,11 @@
import { isNonEmptyString } from '@sniptt/guards';
-export const FIREFLIES_API_KEY_ENV_VAR = 'FIREFLIES_API_KEY';
+import { FIREFLIES_API_KEY_VARIABLE_KEY } from 'src/constants/fireflies-api-key-variable-key.constant';
export const getFirefliesApiKey = ():
| { success: true; apiKey: string }
| { success: false; error: string } => {
- const apiKey = process.env[FIREFLIES_API_KEY_ENV_VAR];
+ const apiKey = process.env[FIREFLIES_API_KEY_VARIABLE_KEY];
if (!isNonEmptyString(apiKey)) {
return {
diff --git a/packages/twenty-apps/public/fireflies/src/logic-functions/utils/upsert-call-recording-or-throw.util.ts b/packages/twenty-apps/public/fireflies/src/logic-functions/utils/upsert-call-recording-or-throw.util.ts
index f7bc884dce2..8ce1244a45a 100644
--- a/packages/twenty-apps/public/fireflies/src/logic-functions/utils/upsert-call-recording-or-throw.util.ts
+++ b/packages/twenty-apps/public/fireflies/src/logic-functions/utils/upsert-call-recording-or-throw.util.ts
@@ -8,6 +8,18 @@ type UpsertCallRecordingOrThrowResult = {
created: boolean;
};
+// twenty-client-sdk 2.31 mistypes the JSON scalar as an object, rejecting the
+// transcript array. Drop this cast once the app is on a fixed SDK.
+const toCallRecordingInputFields = ({
+ transcript,
+ ...scalarFields
+}: CallRecordingSyncFields) => ({
+ ...scalarFields,
+ ...(isDefined(transcript)
+ ? { transcript: transcript as unknown as Record<string, unknown> }
+ : {}),
+});
+
const doesCallRecordingExist = async ({
coreApiClient,
callRecordingId,
@@ -45,7 +57,7 @@ const updateCallRecordingOrThrow = async ({
}): Promise<void> => {
await coreApiClient.mutation({
updateCallRecording: {
- __args: { id: callRecordingId, data: fields },
+ __args: { id: callRecordingId, data: toCallRecordingInputFields(fields) },
id: true,
},
});
@@ -80,7 +92,12 @@ export const upsertCallRecordingOrThrow = async ({
try {
await coreApiClient.mutation({
createCallRecording: {
- __args: { data: { id: callRecordingId, ...createFields } },
+ __args: {
+ data: {
+ id: callRecordingId,
+ ...toCallRecordingInputFields(createFields),
+ },
+ },
id: true,
},
});
diff --git a/packages/twenty-apps/public/fireflies/src/roles/default-function.role.ts b/packages/twenty-apps/public/fireflies/src/roles/default-function.role.ts
index 05654509734..bd05f6fa06b 100644
--- a/packages/twenty-apps/public/fireflies/src/roles/default-function.role.ts
+++ b/packages/twenty-apps/public/fireflies/src/roles/default-function.role.ts
@@ -1,6 +1,7 @@
import {
defineApplicationRole,
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ SystemPermissionFlag,
} from 'twenty-sdk/define';
import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
@@ -46,5 +47,5 @@ export default defineApplicationRole({
},
],
fieldPermissions: [],
- permissionFlagUniversalIdentifiers: [],
+ permissionFlagUniversalIdentifiers: [SystemPermissionFlag.APPLICATIONS],
});
diff --git a/packages/twenty-apps/public/fireflies/tsconfig.spec.json b/packages/twenty-apps/public/fireflies/tsconfig.spec.json
index ea69a6c0105..b780a60a65e 100644
--- a/packages/twenty-apps/public/fireflies/tsconfig.spec.json
+++ b/packages/twenty-apps/public/fireflies/tsconfig.spec.json
@@ -4,6 +4,6 @@
"composite": true,
"types": ["vitest/globals", "node"]
},
- "include": ["src/**/*.ts", "src/**/*.tsx"],
+ "include": ["css.d.ts", "src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules", "dist"]
}
diff --git a/packages/twenty-apps/public/fireflies/yarn.lock b/packages/twenty-apps/public/fireflies/yarn.lock
index 4987af219c3..e27966ee9b9 100644
--- a/packages/twenty-apps/public/fireflies/yarn.lock
+++ b/packages/twenty-apps/public/fireflies/yarn.lock
@@ -1393,10 +1393,11 @@ __metadata:
oxlint: "npm:^0.16.0"
react: "npm:^18.2.0"
react-dom: "npm:^18.2.0"
- twenty-client-sdk: "npm:2.31.0-alpha.1"
- twenty-sdk: "npm:2.31.0-alpha.1"
+ twenty-client-sdk: "npm:2.31.0"
+ twenty-sdk: "npm:2.31.0"
twenty-ui: "npm:^1.0.0-alpha.1"
typescript: "npm:^5.9.3"
+ use-debounce: "npm:^10.0.0"
vite-tsconfig-paths: "npm:^4.2.1"
vitest: "npm:^4.0.0"
zod: "npm:^4.1.11"
@@ -3667,22 +3668,22 @@ __metadata:
languageName: node
linkType: hard
-"twenty-client-sdk@npm:2.31.0-alpha.1":
- version: 2.31.0-alpha.1
- resolution: "twenty-client-sdk@npm:2.31.0-alpha.1"
+"twenty-client-sdk@npm:2.31.0":
+ version: 2.31.0
+ resolution: "twenty-client-sdk@npm:2.31.0"
dependencies:
"@genql/runtime": "npm:^2.10.0"
esbuild: "npm:^0.28.1"
graphql: "npm:^16.8.1"
lodash: "npm:^4.17.21"
prettier: "npm:^3.8.3"
- checksum: 10c0/f396b04dc99eb7e224de2a6295a326fdf274a17a49db5398ee74026d9ead0202e02090cd81e95e5e3c8987268beee9de273d68fc194e5c046d6274f7ddb16c4d
+ checksum: 10c0/03a476db2dd6092875d6929a7f96a72d79c17d95fd9e42963ba2530b3f5ceec3760a96946ec032144976c75004ee2bbbb5791bb2583dd69f7f91c6ac20cd0337
languageName: node
linkType: hard
-"twenty-sdk@npm:2.31.0-alpha.1":
- version: 2.31.0-alpha.1
- resolution: "twenty-sdk@npm:2.31.0-alpha.1"
+"twenty-sdk@npm:2.31.0":
+ version: 2.31.0
+ resolution: "twenty-sdk@npm:2.31.0"
dependencies:
"@sniptt/guards": "npm:^0.2.0"
axios: "npm:^1.16.0"
@@ -3701,12 +3702,12 @@ __metadata:
semver: "npm:7.6.3"
sharp: "npm:^0.35.3"
tinyglobby: "npm:^0.2.15"
- twenty-client-sdk: "npm:2.31.0-alpha.1"
+ twenty-client-sdk: "npm:2.31.0"
typescript: "npm:^5.9.3"
uuid: "npm:^13.0.2"
bin:
twenty: dist/cli.cjs
- checksum: 10c0/a66ad73824532886b2cca1afe096698b226201d92bcb20eacdfb2f739d34e0a13d45fe75f5272e0dec309c2b6bbe06ee1eaa0196cd2126af19d0a44e50e821a2
+ checksum: 10c0/ceb42a2abb29b43243c1db41b8de6ef5a5c3140cafc1cd663026d034b9aa010aa140f656af742d5804b89ace2be9e7eea63b3c4279959aad86253f59c1b95da0
languageName: node
linkType: hard
@@ -3796,6 +3797,15 @@ __metadata:
languageName: node
linkType: hard
+"use-debounce@npm:^10.0.0":
+ version: 10.1.1
+ resolution: "use-debounce@npm:10.1.1"
+ peerDependencies:
+ react: "*"
+ checksum: 10c0/0d1b2ff16447651c92ef444be3b7e29608e229c169a90e7cbd1ef13775475734b0910eaf01f2f64dc9f2b1d5dd8cf03042c5a09e230c9bb2ee148a18b5bba074
+ languageName: node
+ linkType: hard
+
"use-sync-external-store@npm:^1.6.0":
version: 1.6.0
resolution: "use-sync-external-store@npm:1.6.0"