Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat: signal noise split for inbox (#465)
Peter Chinmane345e173afee
diff --git a/js/app/packages/app/component/HelpDrawer.tsx b/js/app/packages/app/component/HelpDrawer.tsxindex 10f9ed9085..dff590c300 100644--- a/js/app/packages/app/component/HelpDrawer.tsx+++ b/js/app/packages/app/component/HelpDrawer.tsx@@ -21,7 +21,12 @@ export function HelpDrawer(props: { viewId?: ViewId }) {return (<Switch>- <Match when={props.viewId === 'emails' && !emailActive()}>+ <Match+ when={+ (props.viewId === 'noise' || props.viewId === 'signal') &&+ !emailActive()+ }+ ><HelpDrawerInnertitle={'Macro is better with email.'}subtitle={@@ -47,17 +52,13 @@ export function HelpDrawer(props: { viewId?: ViewId }) {}}/></Match>- <Match when={props.viewId === 'emails' && emailActive()}>+ <Match when={props.viewId === 'noise' && emailActive()}><HelpDrawerInner- title={'Email is better with Macro.'}+ title={'Filter out the noise.'}subtitle={<span>- Use{' '}- <span class="font-mono bg-edge/20 rounded-xs md-inline-code p-0.3">- @mentions- </span>{' '}- to give email recipients access to anything in Macro. Ask AI to- search your emails.+ This is where we gather everything we think you might not need to+ see.</span>}hotkeyExamples={[@@ -79,11 +80,11 @@ export function HelpDrawer(props: { viewId?: ViewId }) {]}/></Match>- <Match when={props.viewId === 'inbox'}>+ <Match when={props.viewId === 'signal'}><HelpDrawerInnertitle={'Your unified inbox.'}subtitle={- 'All your emails, messages, notifications, tasks in one place. Triage everything. No context switching.'+ 'All your important emails, messages, notifications, tasks in one place. Triage everything. No context switching.'}hotkeyExamples={[{diff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsxindex fbbf0cd59e..ff2358073d 100644--- a/js/app/packages/app/component/Soup.tsx+++ b/js/app/packages/app/component/Soup.tsx@@ -7,18 +7,14 @@ import { playSound } from '@app/util/sound';import { useIsAuthenticated } from '@core/auth';import { FileDropOverlay } from '@core/component/FileDropOverlay';import { Button } from '@core/component/FormControls/Button';-import { SegmentedControl } from '@core/component/FormControls/SegmentControls';import { ContextMenuContent, MenuItem } from '@core/component/Menu';import { fileTypeToBlockName } from '@core/constant/allBlocks';import { fileFolderDrop } from '@core/directive/fileFolderDrop';import { TOKENS } from '@core/hotkey/tokens';import type { BlockOrchestrator } from '@core/orchestrator';import {- CONDITIONAL_VIEWS,DEFAULT_VIEWS,type DefaultView,- VIEWS,- type View,type ViewId,type ViewLabel,} from '@core/types/view';@@ -55,7 +51,6 @@ import { EntityModal } from './EntityModal/EntityModal';import { HelpDrawer } from './HelpDrawer';import { SplitHeaderLeft } from './split-layout/components/SplitHeader';import { SplitTabs } from './split-layout/components/SplitTabs';-import { SplitToolbarRight } from './split-layout/components/SplitToolbar';import type { SplitPanelContextType } from './split-layout/context';import { SplitPanelContext } from './split-layout/context';import { useSplitPanelOrThrow } from './split-layout/layoutUtils';@@ -80,51 +75,31 @@ const ViewTab: ParentComponent<{);};-const DefaultViewTab: Component<{- viewId: ViewId;-}> = (props) => {- return (- <ViewTab viewId={props.viewId}>- <Suspense>- <UnifiedListView />- </Suspense>- </ViewTab>- );-};--const ConditionalViewTab: ParentComponent<{- view: Exclude<View, DefaultView>;-}> = (props) => {- return (- <Show when={VIEWS.includes(props.view)}>- <ViewTab viewId={props.view}>{props.children}</ViewTab>- </Show>- );-};-const ViewWithSearch: Component<{viewId: ViewId;}> = (props) => {return (- <Switch>- <Match when={props.viewId === 'emails'}>- <ConditionalViewTab view="emails">+ <ViewTab viewId={props.viewId}>+ <Switch>+ {/* <Match+ when={props.viewId === 'emails' && DEFAULT_VIEWS.includes('emails')}+ ><Suspense><EmailView /></Suspense>- </ConditionalViewTab>- </Match>- <Match when={props.viewId === 'all'}>- <ConditionalViewTab view="all">+ </Match> */}+ <Match when={props.viewId === 'all' && DEFAULT_VIEWS.includes('all')}><Suspense><AllView /></Suspense>- </ConditionalViewTab>- </Match>- <Match when={true}>- <DefaultViewTab viewId={props.viewId} />- </Match>- </Switch>+ </Match>+ <Match when={true}>+ <Suspense>+ <UnifiedListView />+ </Suspense>+ </Match>+ </Switch>+ </ViewTab>);};@@ -255,7 +230,7 @@ export function Soup() {if (showHelpDrawer().has(selectedView())) {setShowHelpDrawer(new Set<string>());} else {- setShowHelpDrawer(new Set([...DEFAULT_VIEWS, ...CONDITIONAL_VIEWS]));+ setShowHelpDrawer(new Set(DEFAULT_VIEWS));}return true;},@@ -324,7 +299,7 @@ export function Soup() {const TabContextMenu = (props: { value: ViewId; label: string }) => {const [isModalOpen, setIsModalOpen] = createSignal(false);const isDefaultView = () =>- VIEWCONFIG_DEFAULTS_IDS.includes(props.value as View);+ VIEWCONFIG_DEFAULTS_IDS.includes(props.value as DefaultView);return (<Show when={!isDefaultView()}><ContextMenu>@@ -461,32 +436,32 @@ function AllView() {return <UnifiedListView />;}-function EmailView() {- const {- emailViewSignal: [emailView, setEmailView],- viewsDataStore,- selectedView,- } = useSplitPanelOrThrow().unifiedListContext;- const viewData = createMemo(() => viewsDataStore[selectedView()]);-- return (- <>- <UnifiedListView />- <SplitToolbarRight>- <div class="flex flex-row items-center pr-2">- <SegmentedControl- disabled={!!viewData().searchText}- size="SM"- label="View"- list={['inbox', 'sent', 'drafts']}- value={emailView()}- onChange={setEmailView}- />- </div>- </SplitToolbarRight>- </>- );-}+// function EmailView() {+// const {+// emailViewSignal: [emailView, setEmailView],+// viewsDataStore,+// selectedView,+// } = useSplitPanelOrThrow().unifiedListContext;+// const viewData = createMemo(() => viewsDataStore[selectedView()]);++// return (+// <>+// <UnifiedListView />+// <SplitToolbarRight>+// <div class="flex flex-row items-center pr-2">+// <SegmentedControl+// disabled={!!viewData().searchText}+// size="SM"+// label="View"+// list={['inbox', 'sent', 'drafts']}+// value={emailView()}+// onChange={setEmailView}+// />+// </div>+// </SplitToolbarRight>+// </>+// );+// }export const useUpsertSavedViewMutation = () => {const queryClient = useQueryClient();@@ -503,7 +478,7 @@ export const useUpsertSavedViewMutation = () => {}) => {const isDefaultView = VIEWCONFIG_DEFAULTS_IDS.includes(- viewData.id as View+ viewData.id as DefaultView);if ('config' in viewData) {// if data id is in defaults, exclude default, set up args to create new viewdiff --git a/js/app/packages/app/component/SoupContext.tsx b/js/app/packages/app/component/SoupContext.tsxindex 1134e4fcd1..0a114a7604 100644--- a/js/app/packages/app/component/SoupContext.tsx+++ b/js/app/packages/app/component/SoupContext.tsx@@ -4,18 +4,14 @@ import { HotkeyTags } from '@core/hotkey/constants';import { activeScope, hotkeyScopeTree } from '@core/hotkey/state';import { TOKENS } from '@core/hotkey/tokens';import type { ValidHotkey } from '@core/hotkey/types';-import {- CONDITIONAL_VIEWS,- DEFAULT_VIEWS,- type View,- type ViewId,-} from '@core/types/view';+import { DEFAULT_VIEWS, type DefaultView, type ViewId } from '@core/types/view';import { filterMap } from '@core/util/list';import { isErr } from '@core/util/maybeResult';import { getScrollParent } from '@core/util/scrollParent';import { waitForFrames } from '@core/util/sleep';import type { EntityData } from '@macro-entity';import { entityHasUnreadNotifications } from '@notifications';+import type { PreviewViewStandardLabel } from '@service-email/generated/schemas';import { useTutorialCompleted } from '@service-gql/client';import { storageServiceClient } from '@service-storage/client';import { createLazyMemo } from '@solid-primitives/memo';@@ -83,13 +79,13 @@ export type UnifiedListContext = {virtualizerHandleSignal: Signal<VirtualizerHandle | undefined>;entityListRefSignal: Signal<HTMLDivElement | undefined>;entitiesSignal: Signal<EntityData[] | undefined>;- emailViewSignal: Signal<'inbox' | 'sent' | 'drafts' | 'all'>;+ emailViewSignal: Signal<PreviewViewStandardLabel>;showHelpDrawer: Accessor<Set<string>>;setShowHelpDrawer: Setter<Set<string>>;actionRegistry: EntityActionRegistry;};-const DEFAULT_VIEW_ID: View = 'inbox';+const DEFAULT_VIEW_ID: DefaultView = 'signal';const DEFAULT_VIEW_IDS_SET = new Set(VIEWCONFIG_DEFAULTS_IDS);@@ -101,14 +97,10 @@ export function createSoupContext(): UnifiedListContext {const virtualizerHandleSignal = createSignal<VirtualizerHandle>();const entityListRefSignal = createSignal<HTMLDivElement>();const entitiesSignal = createSignal<EntityData[]>();- const emailViewSignal = createSignal<'inbox' | 'sent' | 'drafts' | 'all'>(- 'inbox'- );+ const emailViewSignal = createSignal<PreviewViewStandardLabel>('inbox');const tutorialCompleted = useTutorialCompleted();const [showHelpDrawer, setShowHelpDrawer] = createSignal<Set<string>>(- !tutorialCompleted()- ? new Set([...DEFAULT_VIEWS, ...CONDITIONAL_VIEWS])- : new Set()+ !tutorialCompleted() ? new Set(DEFAULT_VIEWS) : new Set());const setViewDataStore: SetStoreFunction<ViewDataMap> = (...args: any[]) => {// need to create new reference, causes bug where first entity persits highlighting@@ -139,7 +131,7 @@ export function createSoupContext(): UnifiedListContext {}function createViewData(- view: View,+ view: DefaultView,viewProps?: Omit<ViewConfigEnhanced, 'id'> &Partial<Pick<ViewConfigEnhanced, 'id'>>): ViewData {@@ -301,7 +293,7 @@ export function createNavigationEntityListShortcut({'mark_as_done',async (entities) => {const handler =- VIEWCONFIG_DEFAULTS[selectedView() as View]?.hotkeyOptions?.e;+ VIEWCONFIG_DEFAULTS[selectedView() as DefaultView]?.hotkeyOptions?.e;if (handler) {if (isEntityLastItem()) {navigateThroughList({ axis: 'start', mode: 'step' });@@ -1280,7 +1272,7 @@ const useAllViews = ({const [selectedView, setSelectedView] = selectedViewSignal;const initialState: ViewDataMap = {};for (const [view, viewProps] of Object.entries(VIEWCONFIG_DEFAULTS)) {- initialState[view] = createViewData(view as View, viewProps);+ initialState[view] = createViewData(view as DefaultView, viewProps);}const [viewsData, setViewsData] = createStore(initialState);@@ -1308,9 +1300,9 @@ const useAllViews = ({const savedViewConfigs = data.views.map((view) => {const config = view.config as ViewConfigBase;- return createViewData(view.name as View, {+ return createViewData(view.name as DefaultView, {id: view.id,- view: view.name as View,+ view: view.name as DefaultView,display: { ...VIEWCONFIG_BASE.display, ...config.display },filters: { ...VIEWCONFIG_BASE.filters, ...config.filters },sort: {@@ -1329,7 +1321,7 @@ const useAllViews = ({Object.entries(viewsData).filter(([viewId, viewData]) =>savedViewIds.has(viewId) ||- DEFAULT_VIEW_IDS_SET.has(viewId as View) ||+ DEFAULT_VIEW_IDS_SET.has(viewId as DefaultView) ||viewData.viewType !== undefined));diff --git a/js/app/packages/app/component/UnifiedListEmptyState.tsx b/js/app/packages/app/component/UnifiedListEmptyState.tsxindex 6f8bec3d15..839a1f165b 100644--- a/js/app/packages/app/component/UnifiedListEmptyState.tsx+++ b/js/app/packages/app/component/UnifiedListEmptyState.tsx@@ -21,26 +21,26 @@ export function EmptyState(props: { viewId?: ViewId }) {} = splitPanelContext;return (<Switch>- <Match when={props.viewId === 'emails' && !emailActive()}>+ <Match when={props.viewId === 'noise' && !emailActive()}>{(_) => {onMount(() =>- setShowHelpDrawer((prev) => new Set([...prev, 'emails']))+ setShowHelpDrawer((prev) => new Set([...prev, 'noise'])));return <EmptyStateInner emptyMessage={'Email not connected.'} />;}}</Match><Matchwhen={- (props.viewId === 'emails' || props.viewId === 'inbox') &&+ (props.viewId === 'noise' || props.viewId === 'signal') &&emailActive()}><EmptyStateInner emptyMessage={'Inbox zero.'} /></Match>- <Match when={props.viewId === 'inbox' && !emailActive()}>+ <Match when={props.viewId === 'signal' && !emailActive()}>{(_) => {onMount(() =>- setShowHelpDrawer((prev) => new Set([...prev, 'inbox']))+ setShowHelpDrawer((prev) => new Set([...prev, 'signal'])));return (<EmptyStateInnerdiff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsxindex 8b3548660f..e72f7c52fa 100644--- a/js/app/packages/app/component/UnifiedListView.tsx+++ b/js/app/packages/app/component/UnifiedListView.tsx@@ -130,6 +130,7 @@ import { useSplitLayout } from './split-layout/layout';import { useSplitPanelOrThrow } from './split-layout/layoutUtils';import { EmptyState } from './UnifiedListEmptyState';import {+ applyClientFilters,type DisplayOptions,type DocumentTypeFilter,type FilterOptions,@@ -657,6 +658,14 @@ export function UnifiedListView(props: UnifiedListViewProps) {if (notificationFilter() === 'notDone') filterFns.push(notDoneFilterFn);+ const clientFilterFn = (entity: WithNotification<EntityData>) => {+ const filtered = applyClientFilters([entity], selectedView(), {+ soupContext: unifiedListContext,+ });+ return filtered.length > 0;+ };+ filterFns.push(clientFilterFn);+setRequiredFilters(filterFns);});@@ -827,11 +836,16 @@ export function UnifiedListView(props: UnifiedListViewProps) {);const emailQueryParams = createMemo((): FetchPaginatedEmailsParams => {const sort = sortType();+ const currentView = selectedView();+ const emailViewValue =+ currentView === 'noise' || currentView === 'signal'+ ? emailView()+ : 'inbox';return {limit: props.defaultDisplayOptions?.limit ?? 100,// email sort methods does not accept frecency yetsort_method: sort === 'frecency' ? 'viewed_updated' : sort,- view: selectedView() === 'emails' ? emailView() : 'inbox',+ view: emailViewValue,};});const searchUnifiedNameContentQueryParams = createMemo(diff --git a/js/app/packages/app/component/ViewConfig.tsx b/js/app/packages/app/component/ViewConfig.tsxindex bca710c6c4..1de891ce84 100644--- a/js/app/packages/app/component/ViewConfig.tsx+++ b/js/app/packages/app/component/ViewConfig.tsx@@ -1,6 +1,6 @@import {- VIEWS,- type View,+ DEFAULT_VIEWS,+ type DefaultView,type ViewId,type ViewLabel,} from '@core/types/view';@@ -20,6 +20,7 @@ import { emailClient } from '@service-email/client';import stringify from 'json-stable-stringify';import { queryClient } from '../../macro-entity/src/queries/client';import type { UnifiedListContext } from './SoupContext';+import { noiseFilter, signalFilter } from './soupFilters';// for custom views that extend the unified list viewexport type ViewType = 'project';@@ -62,7 +63,6 @@ export type FilterOptions = {typeFilter: EntityType[];documentTypeFilter: DocumentTypeFilter[];projectFilter?: string;- emailFilter?: 'inbox' | 'sent' | 'drafts' | 'all';fromFilter?: WithCustomUserInput<'user' | 'contact'>[];};@@ -113,6 +113,18 @@ export type ViewConfigEnhanced = {hotkeyOptions?: Partial<HotkeyOptions>;} & ViewConfigBase;+export type ClientFilterContext = {+ soupContext?: UnifiedListContext;+};++export type ClientFilter = {+ id: string;+ predicate: (+ entity: WithNotification<EntityData>,+ ctx?: ClientFilterContext+ ) => boolean;+};+export const VIEWCONFIG_BASE: ViewConfigBase = {sort: {type: 'systemSortOption',@@ -161,11 +173,10 @@ export const PROJECT_VIEWCONFIG_BASE: ViewConfigBase = {};const ALL_VIEWCONFIG_DEFAULTS = {- inbox: {- view: 'Inbox',+ signal: {+ view: 'Signal',filters: {notificationFilter: 'notDone',- emailFilter: 'sent',},sort: {sortBy: 'updated_at',@@ -188,43 +199,34 @@ const ALL_VIEWCONFIG_DEFAULTS = {},},},- emails: {- view: 'Emails',+ noise: {+ view: 'Noise',filters: {- typeFilter: ['email'],+ notificationFilter: 'notDone',},sort: {sortBy: 'updated_at',},display: {+ unrollNotifications: true,showUnreadIndicator: true,},hotkeyOptions: {e: (entity, extra) => {- if (extra?.soupContext) {- const {- emailViewSignal: [emailView],- } = extra.soupContext;- if (emailView() === 'inbox') {- if (entity.type === 'email') {- archiveEmail(entity.id, {- isDone: entity.done,- optimisticallyExclude: true,- });- }- return true;- }- }-if (entity.type === 'email') {- archiveEmail(entity.id, { isDone: entity.done });+ archiveEmail(entity.id, {+ isDone: entity.done,+ });+ }+ if (extra?.notificationSource) {+ markNotificationsForEntityAsDone(extra.notificationSource, entity);}return true;},},},- comms: {- view: 'Comms',+ people: {+ view: 'People',filters: {typeFilter: ['channel'],},@@ -232,18 +234,12 @@ const ALL_VIEWCONFIG_DEFAULTS = {showUnreadIndicator: true,},},- docs: {- view: 'Docs',+ files: {+ view: 'Files',filters: {typeFilter: ['document'],},},- ai: {- view: 'Ai',- filters: {- typeFilter: ['chat'],- },- },folders: {view: 'Folders',filters: {@@ -264,22 +260,22 @@ const ALL_VIEWCONFIG_DEFAULTS = {},},},-} satisfies Record<View, Omit<DeepPartial<ViewConfigEnhanced>, 'id'>>;+} satisfies Record<DefaultView, Omit<DeepPartial<ViewConfigEnhanced>, 'id'>>;export const VIEWCONFIG_DEFAULTS = Object.fromEntries(Object.entries(ALL_VIEWCONFIG_DEFAULTS).filter(([key]) =>- VIEWS.includes(key as View)+ DEFAULT_VIEWS.includes(key as DefaultView))-) as Record<View, Omit<ViewConfigEnhanced, 'id'>>;+) as Record<DefaultView, Omit<ViewConfigEnhanced, 'id'>>;export const VIEWCONFIG_DEFAULTS_IDS = Object.keys(VIEWCONFIG_DEFAULTS-) as View[];+) as DefaultView[];export const VIEWCONFIG_DEFAULTS_IDS_ENUM = Object.fromEntries(Object.entries(VIEWCONFIG_DEFAULTS).map(([key]) => {return [key, key];})-) as Record<View, string>;+) as Record<DefaultView, string>;export const VIEWCONFIG_FILTER_SHOW_OPTIONS: readonly FilterOptions['notificationFilter'][] =['all', 'unread', 'notDone'] as const;@@ -297,14 +293,33 @@ export const VIEWCONFIG_SORT_ORDER: readonly SortOptions['sortOrder'][] = ['ascending','descending',] as const;-export const VIEWCONFIG_FILTER_EMAIL_OPTIONS: readonly NonNullable<- FilterOptions['emailFilter']->[] = ['inbox', 'sent', 'drafts', 'all'] as const;export const VIEWCONFIG_FILTER_DOCUMENT_TYPE_FILTER: readonly FilterOptions['documentTypeFilter'][number][] =['md', 'code', 'image', 'canvas', 'pdf', 'unknown'] as const;export const VIEWCONFIG_FILTER_ENTITY_TYPE: readonly FilterOptions['typeFilter'][number][] =['channel', 'chat', 'document', 'email', 'project'] as const;+export const VIEW_CLIENT_FILTERS: Record<ViewId, ClientFilter[]> = {+ signal: [signalFilter],+ noise: [noiseFilter],+ people: [],+ files: [],+ folders: [],+ all: [],+};++export function applyClientFilters(+ entityList: WithNotification<EntityData>[],+ viewId: ViewId,+ ctx?: ClientFilterContext+): WithNotification<EntityData>[] {+ const filters = VIEW_CLIENT_FILTERS[viewId] ?? [];+ if (filters.length === 0) return entityList;++ return entityList.filter((entity) => {+ return filters.every((filter) => filter.predicate(entity, ctx));+ });+}+export async function archiveEmail(id: string,options: { isDone: boolean; optimisticallyExclude?: boolean }diff --git a/js/app/packages/app/component/settings/Inbox.tsx b/js/app/packages/app/component/settings/Inbox.tsxnew file mode 100644index 0000000000..d04ec79e30--- /dev/null+++ b/js/app/packages/app/component/settings/Inbox.tsx@@ -0,0 +1,57 @@+import { ToggleSwitch } from '@core/component/FormControls/ToggleSwitch';+import { TabContent } from '@core/component/TabContent';+import { For } from 'solid-js';+import {+ DEPRIORITY_LABEL_SIGNAL_TOGGLES,+ DEPRIORITY_METADATA_SIGNAL_TOGGLES,+ PRIORITY_LABEL_SIGNAL_TOGGLES,+ PRIORITY_METADATA_SIGNAL_TOGGLES,+} from '../soupFilters';++export function Inbox() {+ const prioritySignals = [+ ...PRIORITY_LABEL_SIGNAL_TOGGLES,+ ...PRIORITY_METADATA_SIGNAL_TOGGLES,+ ];+ const deprioritySignals = [+ ...DEPRIORITY_LABEL_SIGNAL_TOGGLES,+ ...DEPRIORITY_METADATA_SIGNAL_TOGGLES,+ ];++ return (+ <TabContent title="Inbox">+ <div class="font-mono flex flex-col gap-3 text-sm">+ <div class="border border-[var(--b4)] box-border px-5 py-3 flex flex-col gap-3">+ <div class="font-bold mb-1">Signal</div>+ <For each={prioritySignals}>+ {(signal) => (+ <div class="flex items-center justify-between">+ <span>{signal.label}</span>+ <ToggleSwitch+ checked={signal.enabled()}+ onChange={(enabled) => signal.setEnabled(enabled)}+ />+ </div>+ )}+ </For>+ </div>++ <div class="border border-[var(--b4)] box-border px-5 py-3 flex flex-col gap-3">+ <div class="font-bold mb-1">Noise</div>+ <For each={deprioritySignals}>+ {(signal) => (+ <div class="flex items-center justify-between">+ <span>{signal.label}</span>+ <ToggleSwitch+ checked={signal.enabled()}+ onChange={(enabled) => signal.setEnabled(enabled)}+ />+ </div>+ )}+ </For>+ </div>+ </div>+ </TabContent>+ );+}+diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsxindex ca812dfca9..ebfbacc670 100644--- a/js/app/packages/app/component/settings/Settings.tsx+++ b/js/app/packages/app/component/settings/Settings.tsx@@ -28,6 +28,7 @@ import { Appearance } from './Appearance';import { Notification } from './Notification';import Organization from './Organization/Organization';import { Subscription } from './Subscription';+import { Inbox } from './Inbox';export const [viewportOffset, setViewportOffset] = createSignal(0);@@ -121,8 +122,12 @@ export function Settings() {tabs.push({ value: 'Notification', label: 'Notification' });- if (isNativeMobilePlatform() && DEV_MODE_ENV) {- tabs.push({ value: 'Mobile', label: 'Mobile Dev Tools' });+ if (isNativeMobilePlatform() && DEV_MODE_ENV){+ tabs.push({ value: 'Mobile', label: 'Mobile Dev Tools' })+ }++ if (DEV_MODE_ENV){+ tabs.push({ value: 'Inbox', label: 'Inbox' })}return tabs;@@ -174,7 +179,7 @@ export function Settings() {value === 'Appearance' ||value === 'Notification' ||value === 'Mobile' ||- value === 'AI Memory')+ value === 'AI Memory' || value === 'Inbox')) {setActiveTabId(value as SettingsTab);track(TrackingEvents.SETTINGS.CHANGETAB, { tab: value });@@ -281,6 +286,11 @@ export function Settings() {<Tabs.Content value="Notification" class="h-full"><Notification /></Tabs.Content>+ <Show when={DEV_MODE_ENV}>+ <Tabs.Content value="Inbox" class="h-full">+ <Inbox />+ </Tabs.Content>+ </Show></div></Tabs></Dialog.Content>diff --git a/js/app/packages/app/component/soupFilters.ts b/js/app/packages/app/component/soupFilters.tsnew file mode 100644index 0000000000..f751d3e3f2--- /dev/null+++ b/js/app/packages/app/component/soupFilters.ts@@ -0,0 +1,241 @@+import type { EntityData } from '@macro-entity';+import type { APIEmailThreadPreviewMetadata } from '@service-email/generated/schemas';+import type { SoupEmailThreadPreviewMetadata } from '@service-storage/generated/schemas';+import { makePersisted } from '@solid-primitives/storage';+import { createMemo, createSignal } from 'solid-js';+import type { ClientFilter } from './ViewConfig';++type SignalConfig<T extends string> = {+ key: T;+ label: string;+ defaultValue: boolean;+};++type SignalToggle<T extends string> = SignalConfig<T> & {+ enabled: () => boolean;+ setEnabled: (value: boolean) => void;+};++const makeToggle = (storageKey: string, defaultValue: boolean) =>+ makePersisted(createSignal(defaultValue), { name: storageKey });++const toStorageKey = (scope: string, key: string) =>+ `signalFilter_${scope}_${key.toLowerCase().replace(/[^a-z0-9]+/g, '_')}`;++const createSignalToggles = <T extends string>(+ scope: string,+ configs: SignalConfig<T>[]+): SignalToggle<T>[] =>+ configs.map((config) => {+ const [enabled, setEnabled] = makeToggle(+ toStorageKey(scope, config.key),+ config.defaultValue+ );+ return { ...config, enabled, setEnabled };+ });++const PRIORITY_LABEL_SIGNAL_CONFIGS: SignalConfig<string>[] = [+ {+ key: 'CATEGORY_PERSONAL',+ label: 'Personal',+ defaultValue: true,+ },+ {+ key: 'SENT',+ label: 'Sent',+ defaultValue: true,+ },+ {+ key: 'IMPORTANT',+ label: 'Important',+ defaultValue: false,+ },+];++const PRIORITY_METADATA_SIGNAL_CONFIGS: SignalConfig<+ keyof SoupEmailThreadPreviewMetadata+>[] = [+ {+ key: 'knownSender',+ label: 'Known Sender',+ defaultValue: false,+ },+];++const DEPRIORITY_LABEL_SIGNAL_CONFIGS: SignalConfig<string>[] = [+ {+ key: 'CATEGORY_UPDATES',+ label: 'Updates',+ defaultValue: true,+ },+ {+ key: 'CATEGORY_PROMOTIONS',+ label: 'Promotions',+ defaultValue: true,+ },+ {+ key: 'CATEGORY_SOCIAL',+ label: 'Social',+ defaultValue: true,+ },+ {+ key: 'CATEGORY_FORUMS',+ label: 'Forums',+ defaultValue: true,+ },+];++const DEPRIORITY_METADATA_SIGNAL_CONFIGS: SignalConfig<+ keyof SoupEmailThreadPreviewMetadata+>[] = [+ {+ key: 'tabular',+ label: 'Tabular',+ defaultValue: false,+ },+ {+ key: 'genericSender',+ label: 'Generic Sender',+ defaultValue: false,+ },+];++export const PRIORITY_LABEL_SIGNAL_TOGGLES = createSignalToggles(+ 'priority_label',+ PRIORITY_LABEL_SIGNAL_CONFIGS+);+export const PRIORITY_METADATA_SIGNAL_TOGGLES = createSignalToggles(+ 'priority_metadata',+ PRIORITY_METADATA_SIGNAL_CONFIGS+);+export const DEPRIORITY_LABEL_SIGNAL_TOGGLES = createSignalToggles(+ 'depriority_label',+ DEPRIORITY_LABEL_SIGNAL_CONFIGS+);+export const DEPRIORITY_METADATA_SIGNAL_TOGGLES = createSignalToggles(+ 'depriority_metadata',+ DEPRIORITY_METADATA_SIGNAL_CONFIGS+);++// Computed Sets based on persisted settings+const SIGNAL_PRIORITY_LABELS = createMemo(+ () =>+ new Set(+ PRIORITY_LABEL_SIGNAL_TOGGLES.filter(({ enabled }) => enabled()).map(+ ({ key }) => key+ )+ )+);++const SIGNAL_DEPRIORITY_LABELS = createMemo(+ () =>+ new Set(+ DEPRIORITY_LABEL_SIGNAL_TOGGLES.filter(({ enabled }) => enabled()).map(+ ({ key }) => key+ )+ )+);++const SIGNAL_PRIORITY_METADATA = createMemo(+ () =>+ new Set<keyof SoupEmailThreadPreviewMetadata>(+ PRIORITY_METADATA_SIGNAL_TOGGLES.filter(({ enabled }) => enabled()).map(+ ({ key }) => key+ )+ )+);++const SIGNAL_DEPRIORITY_METADATA = createMemo(+ () =>+ new Set<keyof SoupEmailThreadPreviewMetadata>(+ DEPRIORITY_METADATA_SIGNAL_TOGGLES.filter(({ enabled }) => enabled()).map(+ ({ key }) => key+ )+ )+);++const getLabelTokens = (+ labels?: Array<{ id?: string; providerLabelId?: string; name?: string }>+): string[] => {+ if (!labels?.length) return [];++ const tokens: string[] = [];+ for (const label of labels) {+ if (label.id) tokens.push(label.id);+ if (label.providerLabelId) tokens.push(label.providerLabelId);+ if (label.name) tokens.push(label.name);+ }++ return tokens.map((token) => token.toUpperCase());+};++// Helper to safely check metadata properties that may use different naming conventions. We can removed this when we're no longer using Email query, and only Soup query.+const getMetadataValue = (+ metadata:+ | SoupEmailThreadPreviewMetadata+ | APIEmailThreadPreviewMetadata+ | undefined,+ key: keyof SoupEmailThreadPreviewMetadata+): boolean | undefined => {+ if (!metadata) return undefined;++ // Check SoupEmailThreadPreviewMetadata format (camelCase)+ if (key in metadata) {+ return (metadata as SoupEmailThreadPreviewMetadata)[key];+ }++ // Check APIEmailThreadPreviewMetadata format (snake_case)+ const snakeCaseKey = key+ .replace(/([A-Z])/g, '_$1')+ .toLowerCase() as keyof APIEmailThreadPreviewMetadata;+ if (snakeCaseKey in metadata) {+ return (metadata as APIEmailThreadPreviewMetadata)[snakeCaseKey];+ }++ return undefined;+};++const isSignalEmail = (entity: Extract<EntityData, { type: 'email' }>) => {+ const labelTokens = getLabelTokens(entity.labels);+ const priorityLabels = SIGNAL_PRIORITY_LABELS();+ const depriorityLabels = SIGNAL_DEPRIORITY_LABELS();+ const priorityMetadata = SIGNAL_PRIORITY_METADATA();+ const depriorityMetadata = SIGNAL_DEPRIORITY_METADATA();++ const hasPriorityLabel = labelTokens.some((label) =>+ priorityLabels.has(label)+ );+ const hasDeprioritizingLabel = labelTokens.some((label) =>+ depriorityLabels.has(label)+ );++ const hasPriorityMetadata = entity.metadata+ ? Array.from(priorityMetadata).some(+ (key) => getMetadataValue(entity.metadata, key) === true+ )+ : false;+ const hasDeprioritizingMetadata = entity.metadata+ ? Array.from(depriorityMetadata).some(+ (key) => getMetadataValue(entity.metadata, key) === true+ )+ : false;++ return (+ hasPriorityMetadata ||+ hasPriorityLabel ||+ (!hasDeprioritizingLabel && !hasDeprioritizingMetadata)+ );+};++export const signalFilter: ClientFilter = {+ id: 'signal',+ predicate: (entity, _ctx) => {+ if (entity.type !== 'email') return true;+ return isSignalEmail(entity);+ },+};++export const noiseFilter: ClientFilter = {+ id: 'noise',+ predicate: (entity, ctx) => !signalFilter.predicate(entity, ctx),+};diff --git a/js/app/packages/app/component/split-layout/componentRegistry.tsx b/js/app/packages/app/component/split-layout/componentRegistry.tsxindex 94c485824a..d512bdc58b 100644--- a/js/app/packages/app/component/split-layout/componentRegistry.tsx+++ b/js/app/packages/app/component/split-layout/componentRegistry.tsx@@ -52,7 +52,7 @@ export function resolveComponent(};}-registerComponent('unified-list', () => <Soup />, { viewId: 'inbox' });+registerComponent('unified-list', () => <Soup />, { viewId: 'signal' });registerComponent('loading', () => <LoadingBlock />);registerComponent('channel-compose', () => <ChannelCompose />);registerComponent('email-compose', () => <EmailCompose />);diff --git a/js/app/packages/app/component/split-layout/layoutUtils.ts b/js/app/packages/app/component/split-layout/layoutUtils.tsindex c857a23cc2..b56a3f7552 100644--- a/js/app/packages/app/component/split-layout/layoutUtils.ts+++ b/js/app/packages/app/component/split-layout/layoutUtils.ts@@ -1,3 +1,4 @@+import type { ViewId } from '@core/types/view';import { createCallback } from '@solid-primitives/rootless';import { useContext } from 'solid-js';import { SplitLayoutContext, SplitPanelContext } from './context';@@ -79,9 +80,9 @@ export function globalRemoveFromSplitHistory(}/**- * Check if there's a unified-list split with the inbox view active.+ * Check if there's a unified-list split with a particular view open.*/-export function isInboxOpen(manager: SplitManager): boolean {+export function isViewOpen(manager: SplitManager, viewId: ViewId): boolean {const split = manager.getSplitByContent('component', 'unified-list');- return split?.meta()?.viewId === 'inbox';+ return split?.meta()?.viewId === viewId;}diff --git a/js/app/packages/core/constant/SettingsState.tsx b/js/app/packages/core/constant/SettingsState.tsxindex 5fb0db7cc6..b91b4f4dd6 100644--- a/js/app/packages/core/constant/SettingsState.tsx+++ b/js/app/packages/core/constant/SettingsState.tsx@@ -7,7 +7,8 @@ export type SettingsTab =| 'Appearance'| 'Notification'| 'Mobile'- | 'AI Memory';+ | 'AI Memory'+ | 'Inbox';export const [settingsOpen, setSettingsOpen] = createSignal(false);export const [activeTabId, setActiveTabId] =diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.tsindex 626229cc99..678271e9de 100644--- a/js/app/packages/core/constant/featureFlags.ts+++ b/js/app/packages/core/constant/featureFlags.ts@@ -114,8 +114,6 @@ export const ENABLE_PROPERTIES_METADATA = DEV_MODE_ENV;export const ENABLE_PROPERTY_DISPLAY_CONTROL =ENABLE_PROPERTIES_METADATA && DEV_MODE_ENV;-export const ENABLE_EMAIL_VIEW = true;-// TODO: re-enable when supported in backendexport const ENABLE_SOUP_FROM_FILTER = false;diff --git a/js/app/packages/core/types/view.ts b/js/app/packages/core/types/view.tsindex aebe62c345..cc28b5cf22 100644--- a/js/app/packages/core/types/view.ts+++ b/js/app/packages/core/types/view.ts@@ -1,36 +1,16 @@-import { ENABLE_EMAIL_VIEW } from 'core/constant/featureFlags';-export const DEFAULT_VIEWS = [- 'inbox',- 'comms',- 'docs',- 'ai',+ 'signal',+ 'noise',+ 'people',+ 'files','folders',+ 'all',] as const;-export const CONDITIONAL_VIEWS = ['emails', 'all'] as const;-export type DefaultView = (typeof DEFAULT_VIEWS)[number];-export type ConditionalView = (typeof CONDITIONAL_VIEWS)[number];--export type View = DefaultView | ConditionalView;--const VIEW_DEFINITIONS: Array<{ key: View; disabled?: boolean }> = [- { key: 'inbox' },- { key: 'emails', disabled: !ENABLE_EMAIL_VIEW },- { key: 'comms' },- { key: 'docs' },- { key: 'ai' },- { key: 'folders' },- { key: 'all' },-];--export const VIEWS = VIEW_DEFINITIONS.filter((v) => !v.disabled).map(- (v) => v.key-);-/** equal to View type for default view, otherwise a uuid type */-export type ViewId = View | string;+/** equal to DefaultView type for default view, otherwise a uuid type */+export type ViewId = DefaultView | string;/** equal to upper case View type for default view, otherwise a custom string label */export type ViewLabel = string;diff --git a/js/app/packages/macro-entity/src/contexts/soup.ts b/js/app/packages/macro-entity/src/contexts/soup.tsindex 0beddbd9de..9366eab73c 100644--- a/js/app/packages/macro-entity/src/contexts/soup.ts+++ b/js/app/packages/macro-entity/src/contexts/soup.ts@@ -1,4 +1,4 @@-import type { View } from '@core/types/view';+import type { DefaultView } from '@core/types/view';import {type Accessor,createContext,@@ -8,7 +8,7 @@ import {export const SoupContext = createContext<{splitHotkeyScope: string;- setSelectedView: Setter<View>;+ setSelectedView: Setter<DefaultView>;tabButtonsRef: Accessor<HTMLDivElement | null>;}>();diff --git a/js/app/packages/macro-entity/src/types/entity.ts b/js/app/packages/macro-entity/src/types/entity.tsindex 92c9ed3f2a..c2040f7ade 100644--- a/js/app/packages/macro-entity/src/types/entity.ts+++ b/js/app/packages/macro-entity/src/types/entity.ts@@ -1,4 +1,12 @@import { isEntityType } from '@core/types/utils';+import type {+ APIEmailThreadPreviewMetadata,+ ApiLabel,+} from '@service-email/generated/schemas';+import type {+ SoupEmailThreadPreviewMetadata,+ SoupLabel,+} from '@service-storage/generated/schemas';import type { JSX } from 'solid-js';export type EntityBase = {@@ -41,6 +49,7 @@ export const getEntityProjectId = (e: EntityData): string | false => {return 'projectId' in e ? (e.projectId ?? false) : false;};+// We spread ApiThreadPreviewCursor into the email entity, should we explcitly include all those fields here, or only add them as needed?export type EmailEntity = EntityBase & {type: 'email';isRead: boolean;@@ -50,6 +59,8 @@ export type EmailEntity = EntityBase & {participants?: Array<{ email: string; name: string }>;senderEmail?: string;senderName?: string;+ labels?: SoupLabel[] | ApiLabel[];+ metadata?: SoupEmailThreadPreviewMetadata | APIEmailThreadPreviewMetadata;};export type ProjectEntity = EntityBase & {diff --git a/js/app/packages/service-email/generated/client.ts b/js/app/packages/service-email/generated/client.tsindex 2dc21f9fe7..485d44208d 100644--- a/js/app/packages/service-email/generated/client.ts+++ b/js/app/packages/service-email/generated/client.ts@@ -15,14 +15,19 @@ import type {EmptyResponse,ErrorResponse,GetActiveBackfillJobResponse,+ GetAttachmentDocumentIDResponse,GetAttachmentResponse,GetBackfillJobResponse,GetThreadMessagesHandlerParams,GetThreadParams,GetThreadResponse,+ InitResponse,ListContactsResponse,ListLabelsResponse,+ ListLinksResponse,ParsedMessage,+ PatchSettingsRequest,+ PatchSettingsResponse,PreviewsInboxCursorParams,SendMessageRequest,SendMessageResponse,@@ -34,7 +39,7 @@ import type {* @summary Get an attachment by ID.*/export type getAttachmentResponse200 = {- data: GetAttachmentResponse[]+ data: GetAttachmentResponsestatus: 200}@@ -94,6 +99,70 @@ export const getAttachment = async (id: string, options?: RequestInit): Promise<+/**+ * @summary Get the Macro document id for an email attachment, uploading it if it doesn't already exist.+ */+export type getAttachmentDocumentIdResponse200 = {+ data: GetAttachmentDocumentIDResponse+ status: 200+}++export type getAttachmentDocumentIdResponse400 = {+ data: ErrorResponse+ status: 400+}++export type getAttachmentDocumentIdResponse401 = {+ data: ErrorResponse+ status: 401+}++export type getAttachmentDocumentIdResponse404 = {+ data: ErrorResponse+ status: 404+}++export type getAttachmentDocumentIdResponse500 = {+ data: ErrorResponse+ status: 500+}++export type getAttachmentDocumentIdResponseSuccess = (getAttachmentDocumentIdResponse200) & {+ headers: Headers;+};+export type getAttachmentDocumentIdResponseError = (getAttachmentDocumentIdResponse400 | getAttachmentDocumentIdResponse401 | getAttachmentDocumentIdResponse404 | getAttachmentDocumentIdResponse500) & {+ headers: Headers;+};++export type getAttachmentDocumentIdResponse = (getAttachmentDocumentIdResponseSuccess | getAttachmentDocumentIdResponseError)++export const getGetAttachmentDocumentIdUrl = (id: string,) => {+++++ return `/email/attachments/${id}/document_id`+}++export const getAttachmentDocumentId = async (id: string, options?: RequestInit): Promise<getAttachmentDocumentIdResponse> => {++ const res = await fetch(getGetAttachmentDocumentIdUrl(id),+ {+ ...options,+ method: 'GET'+++ }+)++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: getAttachmentDocumentIdResponse['data'] = body ? JSON.parse(body) : {}+ return { data, status: res.status, headers: res.headers } as getAttachmentDocumentIdResponse+}+++/*** @summary Cancel a backfill job.*/@@ -459,7 +528,7 @@ export const deleteDraft = async (id: string, options?: RequestInit): Promise<de* @summary Initialize email functionality for the user. Populates initial threads and enables inbox syncing.*/export type initUserResponse200 = {- data: EmptyResponse+ data: InitResponsestatus: 200}@@ -706,7 +775,7 @@ export const deleteLabel = async (id: string, options?: RequestInit): Promise<de* @summary List all links belonging to the user.*/export type listLinksResponse200 = {- data: EmptyResponse+ data: ListLinksResponsestatus: 200}@@ -1009,6 +1078,66 @@ export const getMessage = async (id: string, options?: RequestInit): Promise<get+/**+ * @summary Patch user settings.+ */+export type patchSettingsResponse200 = {+ data: PatchSettingsResponse+ status: 200+}++export type patchSettingsResponse400 = {+ data: ErrorResponse+ status: 400+}++export type patchSettingsResponse401 = {+ data: ErrorResponse+ status: 401+}++export type patchSettingsResponse500 = {+ data: ErrorResponse+ status: 500+}++export type patchSettingsResponseSuccess = (patchSettingsResponse200) & {+ headers: Headers;+};+export type patchSettingsResponseError = (patchSettingsResponse400 | patchSettingsResponse401 | patchSettingsResponse500) & {+ headers: Headers;+};++export type patchSettingsResponse = (patchSettingsResponseSuccess | patchSettingsResponseError)++export const getPatchSettingsUrl = () => {+++++ return `/email/settings`+}++export const patchSettings = async (patchSettingsRequest: PatchSettingsRequest, options?: RequestInit): Promise<patchSettingsResponse> => {++ const res = await fetch(getPatchSettingsUrl(),+ {+ ...options,+ method: 'PATCH',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(+ patchSettingsRequest,)+ }+)++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: patchSettingsResponse['data'] = body ? JSON.parse(body) : {}+ return { data, status: res.status, headers: res.headers } as patchSettingsResponse+}+++/*** @summary Enables inbox syncing for user.*/@@ -1199,7 +1328,7 @@ export const previewsInboxCursor = async (view: string,* @summary Get a thread with a paginated number of messages.*/export type getThreadResponse200 = {- data: GetThreadResponse[]+ data: GetThreadResponsestatus: 200}diff --git a/js/app/packages/service-email/generated/schemas/aPIEmailThreadPreviewMetadata.ts b/js/app/packages/service-email/generated/schemas/aPIEmailThreadPreviewMetadata.tsnew file mode 100644index 0000000000..95e8095c47--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/aPIEmailThreadPreviewMetadata.ts@@ -0,0 +1,17 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export interface APIEmailThreadPreviewMetadata {+ /** if any email contains a calendar invite */+ calendar_invite: boolean;+ /** if any sender in the thread is a generic email */+ generic_sender: boolean;+ /** if user has previously emailed any sender in the thread */+ known_sender: boolean;+ /** if any email contains a <table> html tag */+ tabular: boolean;+}diff --git a/js/app/packages/service-email/generated/schemas/accessLevel.ts b/js/app/packages/service-email/generated/schemas/accessLevel.tsnew file mode 100644index 0000000000..0e2d3acbed--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/accessLevel.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Ordered from least to most access top -> bottom+ */+export type AccessLevel = typeof AccessLevel[keyof typeof AccessLevel];+++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const AccessLevel = {+ view: 'view',+ comment: 'comment',+ edit: 'edit',+ owner: 'owner',+} as const;diff --git a/js/app/packages/service-email/generated/schemas/apiLabel.ts b/js/app/packages/service-email/generated/schemas/apiLabel.tsnew file mode 100644index 0000000000..e73ce7ebb7--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/apiLabel.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */+import type { ApiLabelListVisibility } from './apiLabelListVisibility';+import type { ApiMessageListVisibility } from './apiMessageListVisibility';+import type { ApiLabelType } from './apiLabelType';++export interface ApiLabel {+ createdAt: string;+ id: string;+ labelListVisibility: ApiLabelListVisibility;+ linkId: string;+ messageListVisibility: ApiMessageListVisibility;+ name: string;+ providerLabelId: string;+ type: ApiLabelType;+}diff --git a/js/app/packages/service-email/generated/schemas/apiLabelListVisibility.ts b/js/app/packages/service-email/generated/schemas/apiLabelListVisibility.tsnew file mode 100644index 0000000000..95dc6154b4--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/apiLabelListVisibility.ts@@ -0,0 +1,16 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type ApiLabelListVisibility = typeof ApiLabelListVisibility[keyof typeof ApiLabelListVisibility];+++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const ApiLabelListVisibility = {+ LabelShow: 'LabelShow',+ LabelShowIfUnread: 'LabelShowIfUnread',+ LabelHide: 'LabelHide',+} as const;diff --git a/js/app/packages/service-email/generated/schemas/apiLabelType.ts b/js/app/packages/service-email/generated/schemas/apiLabelType.tsnew file mode 100644index 0000000000..8acbda0494--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/apiLabelType.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type ApiLabelType = typeof ApiLabelType[keyof typeof ApiLabelType];+++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const ApiLabelType = {+ System: 'System',+ User: 'User',+} as const;diff --git a/js/app/packages/service-email/generated/schemas/apiMessageListVisibility.ts b/js/app/packages/service-email/generated/schemas/apiMessageListVisibility.tsnew file mode 100644index 0000000000..3c29259781--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/apiMessageListVisibility.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type ApiMessageListVisibility = typeof ApiMessageListVisibility[keyof typeof ApiMessageListVisibility];+++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const ApiMessageListVisibility = {+ Show: 'Show',+ Hide: 'Hide',+} as const;diff --git a/js/app/packages/service-email/generated/schemas/apiThreadPreviewCursorAllOf.ts b/js/app/packages/service-email/generated/schemas/apiThreadPreviewCursorAllOf.tsindex 923f016f08..e9c64271b4 100644--- a/js/app/packages/service-email/generated/schemas/apiThreadPreviewCursorAllOf.ts+++ b/js/app/packages/service-email/generated/schemas/apiThreadPreviewCursorAllOf.ts@@ -7,11 +7,15 @@import type { ApiAttachment } from './apiAttachment';import type { ApiContact } from './apiContact';import type { ApiThreadPreviewCursorAllOfFrecencyScore } from './apiThreadPreviewCursorAllOfFrecencyScore';+import type { ApiLabel } from './apiLabel';import type { ApiAttachmentMacro } from './apiAttachmentMacro';+import type { APIEmailThreadPreviewMetadata } from './aPIEmailThreadPreviewMetadata';export type ApiThreadPreviewCursorAllOf = {attachments: ApiAttachment[];contacts: ApiContact[];frecencyScore?: ApiThreadPreviewCursorAllOfFrecencyScore;+ labels: ApiLabel[];macroAttachments: ApiAttachmentMacro[];+ metadata: APIEmailThreadPreviewMetadata;};diff --git a/js/app/packages/service-email/generated/schemas/getAttachmentDocumentIDResponse.ts b/js/app/packages/service-email/generated/schemas/getAttachmentDocumentIDResponse.tsnew file mode 100644index 0000000000..6bc3c09092--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/getAttachmentDocumentIDResponse.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The response returned from the get attachment endpoint+ */+export interface GetAttachmentDocumentIDResponse {+ attachment_id: string;+ document_id: string;+}diff --git a/js/app/packages/service-email/generated/schemas/getThreadResponse.ts b/js/app/packages/service-email/generated/schemas/getThreadResponse.tsindex 41ddad1e28..416efc2556 100644--- a/js/app/packages/service-email/generated/schemas/getThreadResponse.ts+++ b/js/app/packages/service-email/generated/schemas/getThreadResponse.ts@@ -4,12 +4,14 @@* email_service* OpenAPI spec version: 0.1.0*/+import type { AccessLevel } from './accessLevel';import type { APIThread } from './aPIThread';/*** The response returned from the get thread endpoint*/export interface GetThreadResponse {+ access_level: AccessLevel;/** the thread, with messages inside */thread: APIThread;}diff --git a/js/app/packages/service-email/generated/schemas/index.ts b/js/app/packages/service-email/generated/schemas/index.tsindex 30d163497e..8ec6fc6fd1 100644--- a/js/app/packages/service-email/generated/schemas/index.ts+++ b/js/app/packages/service-email/generated/schemas/index.ts@@ -5,12 +5,14 @@* OpenAPI spec version: 0.1.0*/+export * from './aPIEmailThreadPreviewMetadata';export * from './aPIThread';export * from './aPIThreadDbId';export * from './aPIThreadLatestInboundMessageTs';export * from './aPIThreadLatestNonSpamMessageTs';export * from './aPIThreadLatestOutboundMessageTs';export * from './aPIThreadProviderId';+export * from './accessLevel';export * from './apiAttachment';export * from './apiAttachmentContentId';export * from './apiAttachmentFilename';@@ -22,6 +24,10 @@ export * from './apiContact';export * from './apiContactEmailAddress';export * from './apiContactName';export * from './apiContactSfsPhotoUrl';+export * from './apiLabel';+export * from './apiLabelListVisibility';+export * from './apiLabelType';+export * from './apiMessageListVisibility';export * from './apiPaginatedThreadCursor';export * from './apiPaginatedThreadCursorNextCursor';export * from './apiSortMethod';@@ -74,6 +80,7 @@ export * from './createLabelResponse';export * from './emptyResponse';export * from './errorResponse';export * from './getActiveBackfillJobResponse';+export * from './getAttachmentDocumentIDResponse';export * from './getAttachmentResponse';export * from './getBackfillJobResponse';export * from './getPreviewsCursorParams';@@ -93,6 +100,7 @@ export * from './labelName';export * from './labelType';export * from './labelTypeProperty';export * from './link';+export * from './linkSignature';export * from './listContactsResponse';export * from './listContactsResponseContacts';export * from './listLabelsResponse';@@ -141,11 +149,15 @@ export * from './parsedMessageBodyParsed';export * from './parsedMessageFrom';export * from './parsedMessageInternalDateTs';export * from './parsedMessageSubject';+export * from './patchSettingsRequest';+export * from './patchSettingsResponse';export * from './previewView';export * from './previewViewStandardLabel';export * from './previewsInboxCursorParams';export * from './sendMessageRequest';export * from './sendMessageResponse';+export * from './settings';+export * from './settingsSignatureOnRepliesForwards';export * from './thread';export * from './threadDbId';export * from './threadLatestInboundMessageTs';diff --git a/js/app/packages/service-email/generated/schemas/link.ts b/js/app/packages/service-email/generated/schemas/link.tsindex ac9cc636bf..0fbfdd4784 100644--- a/js/app/packages/service-email/generated/schemas/link.ts+++ b/js/app/packages/service-email/generated/schemas/link.ts@@ -5,6 +5,8 @@* OpenAPI spec version: 0.1.0*/import type { UserProvider } from './userProvider';+import type { Settings } from './settings';+import type { LinkSignature } from './linkSignature';export interface Link {created_at: string;@@ -14,5 +16,7 @@ export interface Link {is_sync_active: boolean;macro_id: string;provider: UserProvider;+ settings: Settings;+ signature?: LinkSignature;updated_at: string;}diff --git a/js/app/packages/service-email/generated/schemas/linkSignature.ts b/js/app/packages/service-email/generated/schemas/linkSignature.tsnew file mode 100644index 0000000000..48054bac33--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/linkSignature.ts@@ -0,0 +1,8 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type LinkSignature = string | null;diff --git a/js/app/packages/service-email/generated/schemas/message.ts b/js/app/packages/service-email/generated/schemas/message.tsindex 4d667a5f55..7fb95e1c76 100644--- a/js/app/packages/service-email/generated/schemas/message.ts+++ b/js/app/packages/service-email/generated/schemas/message.ts@@ -4,28 +4,28 @@* email_service* OpenAPI spec version: 0.1.0*/-import type { Label } from './label';-import type { MessageThreadDbId } from './messageThreadDbId';-import type { MessageSubject } from './messageSubject';-import type { MessageSnippet } from './messageSnippet';-import type { MessageSizeEstimate } from './messageSizeEstimate';-import type { MessageSentAt } from './messageSentAt';-import type { MessageScheduledSendTime } from './messageScheduledSendTime';-import type { MessageReplyingToId } from './messageReplyingToId';-import type { MessageProviderThreadId } from './messageProviderThreadId';-import type { MessageProviderId } from './messageProviderId';-import type { MessageProviderHistoryId } from './messageProviderHistoryId';import type { Attachment } from './attachment';-import type { MessageInternalDateTs } from './messageInternalDateTs';-import type { MessageHeadersJson } from './messageHeadersJson';-import type { MessageGlobalId } from './messageGlobalId';-import type { MessageFrom } from './messageFrom';-import type { MessageDbId } from './messageDbId';-import type { MessageBodyText } from './messageBodyText';-import type { MessageBodyMacro } from './messageBodyMacro';-import type { MessageBodyHtmlSanitized } from './messageBodyHtmlSanitized';-import type { ContactInfo } from './contactInfo';import type { AttachmentMacro } from './attachmentMacro';+import type { ContactInfo } from './contactInfo';+import type { MessageBodyHtmlSanitized } from './messageBodyHtmlSanitized';+import type { MessageBodyMacro } from './messageBodyMacro';+import type { MessageBodyText } from './messageBodyText';+import type { MessageDbId } from './messageDbId';+import type { MessageFrom } from './messageFrom';+import type { MessageGlobalId } from './messageGlobalId';+import type { MessageHeadersJson } from './messageHeadersJson';+import type { MessageInternalDateTs } from './messageInternalDateTs';+import type { Label } from './label';+import type { MessageProviderHistoryId } from './messageProviderHistoryId';+import type { MessageProviderId } from './messageProviderId';+import type { MessageProviderThreadId } from './messageProviderThreadId';+import type { MessageReplyingToId } from './messageReplyingToId';+import type { MessageScheduledSendTime } from './messageScheduledSendTime';+import type { MessageSentAt } from './messageSentAt';+import type { MessageSizeEstimate } from './messageSizeEstimate';+import type { MessageSnippet } from './messageSnippet';+import type { MessageSubject } from './messageSubject';+import type { MessageThreadDbId } from './messageThreadDbId';export interface Message {attachments: Attachment[];diff --git a/js/app/packages/service-email/generated/schemas/patchSettingsRequest.ts b/js/app/packages/service-email/generated/schemas/patchSettingsRequest.tsnew file mode 100644index 0000000000..5207d5d399--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/patchSettingsRequest.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */+import type { Settings } from './settings';++export interface PatchSettingsRequest {+ settings: Settings;+}diff --git a/js/app/packages/service-email/generated/schemas/patchSettingsResponse.ts b/js/app/packages/service-email/generated/schemas/patchSettingsResponse.tsnew file mode 100644index 0000000000..2216cc2306--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/patchSettingsResponse.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */+import type { Settings } from './settings';++export interface PatchSettingsResponse {+ settings: Settings;+}diff --git a/js/app/packages/service-email/generated/schemas/settings.ts b/js/app/packages/service-email/generated/schemas/settings.tsnew file mode 100644index 0000000000..2e31cc9694--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/settings.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */+import type { SettingsSignatureOnRepliesForwards } from './settingsSignatureOnRepliesForwards';++export interface Settings {+ signature_on_replies_forwards?: SettingsSignatureOnRepliesForwards;+}diff --git a/js/app/packages/service-email/generated/schemas/settingsSignatureOnRepliesForwards.ts b/js/app/packages/service-email/generated/schemas/settingsSignatureOnRepliesForwards.tsnew file mode 100644index 0000000000..0fc051e2fb--- /dev/null+++ b/js/app/packages/service-email/generated/schemas/settingsSignatureOnRepliesForwards.ts@@ -0,0 +1,8 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type SettingsSignatureOnRepliesForwards = boolean | null;diff --git a/js/app/packages/service-email/generated/schemas/userProvider.ts b/js/app/packages/service-email/generated/schemas/userProvider.tsindex 72b56c7805..949d16ba29 100644--- a/js/app/packages/service-email/generated/schemas/userProvider.ts+++ b/js/app/packages/service-email/generated/schemas/userProvider.ts@@ -10,5 +10,5 @@ export type UserProvider = typeof UserProvider[keyof typeof UserProvider];// eslint-disable-next-line @typescript-eslint/no-redeclareexport const UserProvider = {- Gmail: 'Gmail',+ GMAIL: 'GMAIL',} as const;diff --git a/js/app/packages/service-email/openapi.json b/js/app/packages/service-email/openapi.jsonindex c5b364571e..37da1ce0c8 100644--- a/js/app/packages/service-email/openapi.json+++ b/js/app/packages/service-email/openapi.json@@ -28,10 +28,67 @@"content": {"application/json": {"schema": {- "type": "array",- "items": {- "$ref": "#/components/schemas/GetAttachmentResponse"- }+ "$ref": "#/components/schemas/GetAttachmentResponse"+ }+ }+ }+ },+ "400": {+ "description": "",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }+ }+ }+ },+ "404": {+ "description": "",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }+ }+ }+ }+ }+ }+ },+ "/email/attachments/{id}/document_id": {+ "get": {+ "tags": ["Attachments"],+ "summary": "Get the Macro document id for an email attachment, uploading it if it doesn't already exist.",+ "operationId": "get_attachment_document_id",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "Attachment ID.",+ "required": true,+ "schema": { "type": "string", "format": "uuid" }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GetAttachmentDocumentIDResponse"}}}@@ -375,7 +432,7 @@"description": "","content": {"application/json": {- "schema": { "$ref": "#/components/schemas/EmptyResponse" }+ "schema": { "$ref": "#/components/schemas/InitResponse" }}}},@@ -570,7 +627,7 @@"description": "","content": {"application/json": {- "schema": { "$ref": "#/components/schemas/EmptyResponse" }+ "schema": { "$ref": "#/components/schemas/ListLinksResponse" }}}},@@ -830,6 +887,57 @@}}},+ "/email/settings": {+ "patch": {+ "tags": ["Settings"],+ "summary": "Patch user settings.",+ "operationId": "patch_settings",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/PatchSettingsRequest" }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/PatchSettingsResponse"+ }+ }+ }+ },+ "400": {+ "description": "",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }+ }+ }+ }+ }+ }+ },"/email/sync": {"post": {"tags": ["Sync"],@@ -1016,10 +1124,7 @@"description": "","content": {"application/json": {- "schema": {- "type": "array",- "items": { "$ref": "#/components/schemas/GetThreadResponse" }- }+ "schema": { "$ref": "#/components/schemas/GetThreadResponse" }}}},@@ -1117,7 +1222,7 @@},"/email/threads/{id}/messages": {"get": {- "tags": ["email::threads::get"],+ "tags": ["Threads"],"operationId": "get_thread_messages_handler","parameters": [{@@ -1259,6 +1364,33 @@},"components": {"schemas": {+ "APIEmailThreadPreviewMetadata": {+ "type": "object",+ "required": [+ "known_sender",+ "tabular",+ "calendar_invite",+ "generic_sender"+ ],+ "properties": {+ "calendar_invite": {+ "type": "boolean",+ "description": "if any email contains a calendar invite"+ },+ "generic_sender": {+ "type": "boolean",+ "description": "if any sender in the thread is a generic email"+ },+ "known_sender": {+ "type": "boolean",+ "description": "if user has previously emailed any sender in the thread"+ },+ "tabular": {+ "type": "boolean",+ "description": "if any email contains a <table> html tag"+ }+ }+ },"APIThread": {"type": "object","description": "Thread object exposed to the FE in Get Threads Call",@@ -1296,6 +1428,11 @@"updated_at": { "type": "string", "format": "date-time" }}},+ "AccessLevel": {+ "type": "string",+ "description": "Ordered from least to most access top -> bottom",+ "enum": ["view", "comment", "edit", "owner"]+ },"ApiAttachment": {"type": "object","required": ["id", "messageId", "createdAt"],@@ -1331,6 +1468,42 @@"sfsPhotoUrl": { "type": ["string", "null"] }}},+ "ApiLabel": {+ "type": "object",+ "required": [+ "id",+ "linkId",+ "providerLabelId",+ "name",+ "createdAt",+ "messageListVisibility",+ "labelListVisibility",+ "type"+ ],+ "properties": {+ "createdAt": { "type": "string", "format": "date-time" },+ "id": { "type": "string", "format": "uuid" },+ "labelListVisibility": {+ "$ref": "#/components/schemas/ApiLabelListVisibility"+ },+ "linkId": { "type": "string", "format": "uuid" },+ "messageListVisibility": {+ "$ref": "#/components/schemas/ApiMessageListVisibility"+ },+ "name": { "type": "string" },+ "providerLabelId": { "type": "string" },+ "type": { "$ref": "#/components/schemas/ApiLabelType" }+ }+ },+ "ApiLabelListVisibility": {+ "type": "string",+ "enum": ["LabelShow", "LabelShowIfUnread", "LabelHide"]+ },+ "ApiLabelType": { "type": "string", "enum": ["System", "User"] },+ "ApiMessageListVisibility": {+ "type": "string",+ "enum": ["Show", "Hide"]+ },"ApiPaginatedThreadCursor": {"type": "object","required": ["items"],@@ -1352,7 +1525,13 @@{ "$ref": "#/components/schemas/ApiThreadPreviewCursorInner" },{"type": "object",- "required": ["attachments", "macroAttachments", "contacts"],+ "required": [+ "attachments",+ "macroAttachments",+ "contacts",+ "labels",+ "metadata"+ ],"properties": {"attachments": {"type": "array",@@ -1366,9 +1545,16 @@"type": ["number", "null"],"format": "double"},+ "labels": {+ "type": "array",+ "items": { "$ref": "#/components/schemas/ApiLabel" }+ },"macroAttachments": {"type": "array","items": { "$ref": "#/components/schemas/ApiAttachmentMacro" }+ },+ "metadata": {+ "$ref": "#/components/schemas/APIEmailThreadPreviewMetadata"}}}@@ -1566,6 +1752,15 @@"required": ["job"],"properties": { "job": { "$ref": "#/components/schemas/BackfillJob" } }},+ "GetAttachmentDocumentIDResponse": {+ "type": "object",+ "description": "The response returned from the get attachment endpoint",+ "required": ["attachment_id", "document_id"],+ "properties": {+ "attachment_id": { "type": "string", "format": "uuid" },+ "document_id": { "type": "string" }+ }+ },"GetAttachmentResponse": {"type": "object","description": "The response returned from the get attachment endpoint",@@ -1604,8 +1799,9 @@"GetThreadResponse": {"type": "object","description": "The response returned from the get thread endpoint",- "required": ["thread"],+ "required": ["thread", "access_level"],"properties": {+ "access_level": { "$ref": "#/components/schemas/AccessLevel" },"thread": {"$ref": "#/components/schemas/APIThread","description": "the thread, with messages inside"@@ -1671,6 +1867,7 @@"email_address","provider","is_sync_active",+ "settings","created_at","updated_at"],@@ -1682,6 +1879,8 @@"is_sync_active": { "type": "boolean" },"macro_id": { "type": "string" },"provider": { "$ref": "#/components/schemas/UserProvider" },+ "settings": { "$ref": "#/components/schemas/Settings" },+ "signature": { "type": ["string", "null"] },"updated_at": { "type": "string", "format": "date-time" }}},@@ -1912,6 +2111,20 @@}}},+ "PatchSettingsRequest": {+ "type": "object",+ "required": ["settings"],+ "properties": {+ "settings": { "$ref": "#/components/schemas/Settings" }+ }+ },+ "PatchSettingsResponse": {+ "type": "object",+ "required": ["settings"],+ "properties": {+ "settings": { "$ref": "#/components/schemas/Settings" }+ }+ },"PreviewView": {"oneOf": [{@@ -1957,6 +2170,12 @@"message": { "$ref": "#/components/schemas/MessageToSend" }}},+ "Settings": {+ "type": "object",+ "properties": {+ "signature_on_replies_forwards": { "type": ["boolean", "null"] }+ }+ },"Thread": {"type": "object","required": [@@ -2088,7 +2307,7 @@}}},- "UserProvider": { "type": "string", "enum": ["Gmail"] },+ "UserProvider": { "type": "string", "enum": ["GMAIL"] },"Value": {}}},