Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.3 KB
Raw Blame
import { SYSTEM_PROPERTY_IDS } from '@property/constants';
import { defineQueryFilters } from '../next-soup/filters/filter-store';
import type { ViewTabConfig } from '../next-soup/sidebar/soup-filter-presets';
export const CRM_TAB_PRESETS: ViewTabConfig = {
  default: 'active',
  tabs: {
    active: () => ({
      filters: defineQueryFilters(
        { include: { crmCompanyHidden: false } },
        { skipTargets: ['ccf'] }
      ),
      clientFilters: { and: ['crm-company-active'] },
      groupBy: `property:${SYSTEM_PROPERTY_IDS.STAGE}`,
    }),
    // Admin/owner only — the BE rejects `hidden: true` requests from
    // non-admins with 403. Returning `undefined` hides the tab for
    // non-admins via the same pattern context-required views use.
    hidden: (ctx) => {
      if (!ctx.isTeamAdmin) return undefined;
      return {
        filters: defineQueryFilters(
          { include: { crmCompanyHidden: true } },
          { skipTargets: ['ccf'] }
        ),
        clientFilters: { and: ['crm-company-hidden'] },
        groupBy: `property:${SYSTEM_PROPERTY_IDS.STAGE}`,
      };
    },
    people: () => ({
      filters: defineQueryFilters(
        { include: { crmContactHidden: false } },
        { skipTargets: ['crmf'] }
      ),
      clientFilters: { and: ['crm-contact-active'] },
    }),
  },
};