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.

feat(crm): Customers view with default properties, filtering, and kanban (#4561)

Jacob Beckermane1f1cd4ac4c3
diff --git a/docs/concepts/properties.mdx b/docs/concepts/properties.mdx
index b9a566c8f0..7aa17f0d3d 100644
--- a/docs/concepts/properties.mdx
+++ b/docs/concepts/properties.mdx
@@ -49,6 +49,7 @@ Some blocks ship with their own system properties:
- **Tasks**: Status, Priority, Assignees, Due Date, Parent Task / Subtasks, Depends On, Effort, Story Points, and Relevant Documents. See [Tasks](/product/tasks).
- **Documents**: Owner, Folder, Created and Updated timestamps, plus assignable fields like a linked Task and urgency. See [Documents](/product/docs).
+- **CRM companies (Customers)**: Stage (Lead, Qualified, Demo, Trial, Negotiation, Customer, Churned), Owner (a person on your team), and Revenue, plus a Last Interaction timestamp that updates automatically from synced workspace emails.
- **CRM contacts & companies**: Email, Name, Company, interaction timestamps, Domains, Email Sync, and more.
## Agent access
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index c02133622b..f2c641f12b 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -187,7 +187,7 @@ const SIDEBAR_LINKS = [
? ([
{
id: 'companies',
- label: 'Companies',
+ label: 'Customers',
href: LIST_VIEW_PATHS.companies,
icon: AnimatedCompanyIcon,
hotkey: 'o',
diff --git a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts b/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
index 8e014e3586..164362165d 100644
--- a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
+++ b/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
@@ -429,6 +429,7 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
{ 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
@@ -441,6 +442,7 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
{ skipTargets: ['ccf'] }
),
clientFilters: { and: ['crm-company-hidden'] },
+ groupBy: `property:${SYSTEM_PROPERTY_IDS.STAGE}`,
};
},
},
diff --git a/js/app/packages/app/component/next-soup/filters/configs/base.ts b/js/app/packages/app/component/next-soup/filters/configs/base.ts
index 7203cabea1..1e5a24d187 100644
--- a/js/app/packages/app/component/next-soup/filters/configs/base.ts
+++ b/js/app/packages/app/component/next-soup/filters/configs/base.ts
@@ -44,6 +44,8 @@ export type FilterContext = {
userId?: string;
notificationSource?: NotificationSource;
assignees?: string[];
+ /** Selected company Owner ids for the Customers view's owner filter. */
+ owners?: string[];
};
export type Predicate = (entity: EntityData, ctx: FilterContext) => boolean;
diff --git a/js/app/packages/app/component/next-soup/filters/configs/company.ts b/js/app/packages/app/component/next-soup/filters/configs/company.ts
new file mode 100644
index 0000000000..da87f077ba
--- /dev/null
+++ b/js/app/packages/app/component/next-soup/filters/configs/company.ts
@@ -0,0 +1,45 @@
+import { PROPERTY_OPTION_IDS } from '@property/constants';
+import {
+ companyOwnedByUsersFilter,
+ hasCompanyStage,
+ hasNoCompanyStage,
+} from '../predicates';
+import { config, type Predicate } from './base';
+
+// Companies are fetched via the dedicated CRM soup request (capped at 500
+// per team) rather than the dynamic filter AST, which has no property
+// support for the `ccf` target — so stage/owner filters are client-side
+// predicates with a no-op server query.
+const stageFilter = <TId extends string>(id: TId, predicate: Predicate) =>
+ config({ id, predicate, query: {} });
+
+export const COMPANY_STAGE_FILTERS = [
+ stageFilter('company-stage-lead', (e) =>
+ hasCompanyStage(e, PROPERTY_OPTION_IDS.STAGE.LEAD)
+ ),
+ stageFilter('company-stage-qualified', (e) =>
+ hasCompanyStage(e, PROPERTY_OPTION_IDS.STAGE.QUALIFIED)
+ ),
+ stageFilter('company-stage-demo', (e) =>
+ hasCompanyStage(e, PROPERTY_OPTION_IDS.STAGE.DEMO)
+ ),
+ stageFilter('company-stage-trial', (e) =>
+ hasCompanyStage(e, PROPERTY_OPTION_IDS.STAGE.TRIAL)
+ ),
+ stageFilter('company-stage-negotiation', (e) =>
+ hasCompanyStage(e, PROPERTY_OPTION_IDS.STAGE.NEGOTIATION)
+ ),
+ stageFilter('company-stage-customer', (e) =>
+ hasCompanyStage(e, PROPERTY_OPTION_IDS.STAGE.CUSTOMER)
+ ),
+ stageFilter('company-stage-churned', (e) =>
+ hasCompanyStage(e, PROPERTY_OPTION_IDS.STAGE.CHURNED)
+ ),
+ stageFilter('company-no-stage', hasNoCompanyStage),
+] as const;
+
+export const companyOwnerFilter = config({
+ id: 'company-owner',
+ predicate: (e, ctx) => companyOwnedByUsersFilter(() => ctx.owners)(e),
+ query: {},
+});
diff --git a/js/app/packages/app/component/next-soup/filters/configs/index.ts b/js/app/packages/app/component/next-soup/filters/configs/index.ts
index 2145d47819..39de8fa7e2 100644
--- a/js/app/packages/app/component/next-soup/filters/configs/index.ts
+++ b/js/app/packages/app/component/next-soup/filters/configs/index.ts
@@ -1,5 +1,6 @@
export type { FilterContext } from './base';
export * from './base';
+export * from './company';
export * from './document';
export * from './email';
export * from './entity';
@@ -9,6 +10,7 @@ export * from './general';
export * from './task';
import type { FilterGroupConfig } from './base';
+import { COMPANY_STAGE_FILTERS, companyOwnerFilter } from './company';
import {
DOCUMENT_CONTEXTUAL_FILTERS,
emailAttachmentsFilter,
@@ -87,10 +89,12 @@ export const SOUP_FILTERS = [
crmCompanyFilter,
crmCompanyActiveFilter,
crmCompanyHiddenFilter,
+ companyOwnerFilter,
emailAttachmentsFilter,
inFolderFilter,
searchSupportedFilter,
...ENTITY_TYPE_FILTERS,
+ ...COMPANY_STAGE_FILTERS,
...TASK_STATUS_FILTERS,
...TASK_PRIORITY_FILTERS,
...DOCUMENT_CONTEXTUAL_FILTERS,
diff --git a/js/app/packages/app/component/next-soup/filters/predicates.ts b/js/app/packages/app/component/next-soup/filters/predicates.ts
index 7d35b02056..14e5c6a7c3 100644
--- a/js/app/packages/app/component/next-soup/filters/predicates.ts
+++ b/js/app/packages/app/component/next-soup/filters/predicates.ts
@@ -1,5 +1,7 @@
import {
type EntityData,
+ getCompanyOwnerId,
+ getCompanyStageOptionId,
getTaskAssigneeIds,
getTaskStatusOptionId,
isGithubPrEntity,
@@ -11,6 +13,7 @@ import {
import { getTaskPriorityOptionId } from '@entity/utils/task-properties';
import { compositeEntity, type NotificationSource } from '@notifications';
import { PROPERTY_OPTION_IDS } from '@property/constants';
+import { NO_ASSIGNEE } from './configs/base';
/**
* Unread filter - entity has unread content.
@@ -148,6 +151,39 @@ export function crmCompanyHiddenFilter(entity: EntityData): boolean {
return entity.type === 'crm_company' && entity.hidden;
}
+/** True when the company's Stage property matches the given option id. */
+export function hasCompanyStage(
+ entity: EntityData,
+ stageOptionId: string
+): boolean {
+ if (entity.type !== 'crm_company') return false;
+ return getCompanyStageOptionId(entity) === stageOptionId;
+}
+
+/** True when the company has no Stage set. */
+export function hasNoCompanyStage(entity: EntityData): boolean {
+ if (entity.type !== 'crm_company') return false;
+ return getCompanyStageOptionId(entity) === undefined;
+}
+
+/**
+ * Owner filter for companies, driven by the view's owner selection
+ * (`ctx.owners`). `NO_OWNER` matches companies without an Owner set.
+ */
+export function companyOwnedByUsersFilter(
+ ownerIds: () => string[] | undefined
+) {
+ return (entity: EntityData): boolean => {
+ const owners = ownerIds();
+ if (!owners?.length) return true;
+ if (entity.type !== 'crm_company') return false;
+ const ownerId = getCompanyOwnerId(entity);
+ return owners.some((id) =>
+ id === NO_ASSIGNEE ? ownerId === undefined : ownerId === id
+ );
+ };
+}
+
export function filesAndFolderFilter(entity: EntityData): boolean {
if (entity.type !== 'project' && entity.type !== 'document') return false;
diff --git a/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx b/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx
index af8da34808..e7425c02eb 100644
--- a/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx
@@ -223,8 +223,8 @@ export function EmptyState(props: {
<Match when={props.listView === 'companies'}>
<EmptyStatePanel
graphic={EmptyStateCompaniesGraphic}
- title="No companies"
- description="Companies you add or sync into your CRM will appear here."
+ title="No customers"
+ description="Customers you add or sync into your CRM will appear here."
/>
</Match>
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-group.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-group.tsx
index c98e1a2772..71d406c148 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-group.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-group.tsx
@@ -1,5 +1,6 @@
import { GroupDropdown } from '@app/component/next-soup/soup-view/filters-bar/group-dropdown';
import {
+ COMPANY_GROUP_OPTIONS,
type GroupOptionId,
TASK_GROUP_OPTIONS,
} from '@app/component/next-soup/soup-view/group-options';
@@ -54,6 +55,15 @@ export const SoupViewContextGroup = () => {
onOpenChange={setGroupOpen}
/>
</Show>
+ <Show when={isComponentListView('companies')}>
+ <GroupDropdown
+ value={value}
+ onChange={onChange}
+ options={COMPANY_GROUP_OPTIONS}
+ open={groupOpen()}
+ onOpenChange={setGroupOpen}
+ />
+ </Show>
</Show>
);
};
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
index b494e3574f..dac8226d18 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
@@ -299,6 +299,49 @@ const TASKS_FILTER_CATEGORIES: FilterCategory[] = [
},
];
+const COMPANIES_FILTER_CATEGORIES: FilterCategory[] = [
+ {
+ id: 'stage',
+ label: 'Stage',
+ labelPlural: 'Stages',
+ options: [
+ ...(
+ [
+ ['company-stage-lead', 'Lead', PROPERTY_OPTION_IDS.STAGE.LEAD],
+ [
+ 'company-stage-qualified',
+ 'Qualified',
+ PROPERTY_OPTION_IDS.STAGE.QUALIFIED,
+ ],
+ ['company-stage-demo', 'Demo', PROPERTY_OPTION_IDS.STAGE.DEMO],
+ ['company-stage-trial', 'Trial', PROPERTY_OPTION_IDS.STAGE.TRIAL],
+ [
+ 'company-stage-negotiation',
+ 'Negotiation',
+ PROPERTY_OPTION_IDS.STAGE.NEGOTIATION,
+ ],
+ [
+ 'company-stage-customer',
+ 'Customer',
+ PROPERTY_OPTION_IDS.STAGE.CUSTOMER,
+ ],
+ [
+ 'company-stage-churned',
+ 'Churned',
+ PROPERTY_OPTION_IDS.STAGE.CHURNED,
+ ],
+ ] as const
+ ).map(([id, label, optionId]) => ({
+ id,
+ label,
+ icon: () => <PropertyValueIcon optionId={optionId} class="size-3.5" />,
+ })),
+ { id: 'company-no-stage', label: 'No Stage' },
+ ],
+ multiple: true,
+ },
+];
+
const DOCUMENTS_FILTER_CATEGORIES: FilterCategory[] = [
{
id: 'type',
@@ -371,7 +414,7 @@ export const VIEW_FILTER_CATEGORIES: Record<ListView, FilterCategory[]> = {
mail: MAIL_FILTER_CATEGORIES,
documents: DOCUMENTS_FILTER_CATEGORIES,
tasks: TASKS_FILTER_CATEGORIES,
- companies: [],
+ companies: COMPANIES_FILTER_CATEGORIES,
channels: [],
calls: [],
folders: [],
@@ -537,6 +580,8 @@ export const UnifiedFilterDropdown = (
queryFilters,
assigneeFilter,
setAssigneeFilter,
+ ownerFilter,
+ setOwnerFilter,
activeTab,
readFilter,
setReadFilter,
@@ -702,7 +747,56 @@ export const UnifiedFilterDropdown = (
});
};
+ // Owner options for the Customers view (contacts, plus a "No owner" row).
+ const ownerOptions = createMemo((): SearchableOption[] => {
+ const currentUserId = userId();
+ const noOwnerOption: SearchableOption = {
+ id: NO_ASSIGNEE,
+ label: 'No owner',
+ icon: () => <CircleDashedIcon class="size-3.5 text-ink-muted" />,
+ };
+ let meOption: SearchableOption | undefined;
+ const otherContactOptions: SearchableOption[] = [];
+ for (const contact of contacts()) {
+ const opt: SearchableOption = {
+ id: contact.id,
+ label: buildContactLabel(contact, currentUserId),
+ icon: () => (
+ <UserIcon
+ id={contact.id}
+ size="sm"
+ suppressClick
+ showTooltip={false}
+ />
+ ),
+ };
+ if (contact.id === currentUserId) {
+ meOption = opt;
+ } else {
+ otherContactOptions.push(opt);
+ }
+ }
+ return [
+ ...(meOption ? [meOption] : []),
+ noOwnerOption,
+ ...otherContactOptions,
+ ];
+ });
+
+ // Owner filtering is a client-side predicate (companies come back from a
+ // dedicated capped CRM request), so no query filters to maintain here.
+ const handleOwnerChange = (ids: string[]) => {
+ batch(() => {
+ setOwnerFilter(ids);
+ const shouldBeActive = ids.length > 0;
+ if (shouldBeActive !== soup.predicates.isActive('company-owner')) {
+ soup.predicates.toggle({ and: ['company-owner'] });
+ }
+ });
+ };
+
const isTasksView = () => currentView() === 'tasks';
+ const isCompaniesView = () => currentView() === 'companies';
const isDocumentsView = () => currentView() === 'documents';
const tagFilter = useTagFilter();
@@ -785,7 +879,10 @@ export const UnifiedFilterDropdown = (
</Show>
<Show
when={
- categories().length === 1 && !isTasksView() && !isNewInbox()
+ categories().length === 1 &&
+ !isTasksView() &&
+ !isCompaniesView() &&
+ !isNewInbox()
}
fallback={
<>
@@ -845,6 +942,17 @@ export const UnifiedFilterDropdown = (
placeholder="Search assignees..."
/>
</Show>
+
+ {/* Owner filter for the Customers view */}
+ <Show when={isCompaniesView()}>
+ <SearchableFilterSubmenu
+ label="Owner"
+ options={ownerOptions}
+ activeIds={ownerFilter}
+ onChange={handleOwnerChange}
+ placeholder="Search owners..."
+ />
+ </Show>
</>
}
>
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.tsx
index b05a0b71ee..d1de7a12cb 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.tsx
@@ -70,6 +70,8 @@ export function useFilterRefinements() {
queryFilters,
assigneeFilter,
setAssigneeFilter,
+ ownerFilter,
+ setOwnerFilter,
activeTab,
} = useSoupView();
const filterData = () => queryFilters.state;
@@ -131,7 +133,8 @@ export function useFilterRefinements() {
) ||
currentFilterData.emailView !== presetFilters.emailView;
- const hasSubFilters = assigneeFilter().length > 0;
+ const hasSubFilters =
+ assigneeFilter().length > 0 || ownerFilter().length > 0;
return hasClientFilterDiff || hasQueryFilterDiff || hasSubFilters;
});
@@ -206,6 +209,87 @@ export function useFilterRefinements() {
];
});
+ /**
+ * Owner options for the Customers view's owner sub-filter, keyed by id.
+ */
+ const ownerOptionsMap = createMemo(
+ (): Map<string, { label: string; icon?: () => JSX.Element }> => {
+ const uid = currentUserId();
+ const map = new Map<
+ string,
+ { label: string; icon?: () => JSX.Element }
+ >();
+ map.set(NO_ASSIGNEE, {
+ label: 'No owner',
+ icon: () => <CircleDashedIcon class="size-3 text-ink-muted" />,
+ });
+ for (const contact of contacts()) {
+ map.set(contact.id, {
+ label: buildContactLabel(contact, uid),
+ icon: () => (
+ <UserIcon
+ id={contact.id}
+ size="sm"
+ suppressClick
+ showTooltip={false}
+ />
+ ),
+ });
+ }
+ return map;
+ }
+ );
+
+ const ownerSearchableOptions = createMemo((): SearchableOption[] => {
+ const uid = currentUserId();
+ const noOwnerOption: SearchableOption = {
+ id: NO_ASSIGNEE,
+ label: 'No owner',
+ icon: () => <CircleDashedIcon class="size-3.5 text-ink-muted" />,
+ };
+ let meOption: SearchableOption | undefined;
+ const otherContactOptions: SearchableOption[] = [];
+ for (const contact of contacts()) {
+ const opt: SearchableOption = {
+ id: contact.id,
+ label: buildContactLabel(contact, uid),
+ icon: () => (
+ <UserIcon
+ id={contact.id}
+ size="sm"
+ suppressClick
+ showTooltip={false}
+ />
+ ),
+ };
+ if (contact.id === uid) {
+ meOption = opt;
+ } else {
+ otherContactOptions.push(opt);
+ }
+ }
+ return [
+ ...(meOption ? [meOption] : []),
+ noOwnerOption,
+ ...otherContactOptions,
+ ];
+ });
+
+ /**
+ * Handler for owner filter changes (Customers view). Client-side
+ * predicate only — companies come back from a dedicated capped CRM
+ * request with no property filter support.
+ */
+ const handleOwnerChange = (ids: string[]) => {
+ batch(() => {
+ setOwnerFilter(ids);
+ const shouldBeActive = ids.length > 0;
+ if (shouldBeActive !== soup.predicates.isActive('company-owner')) {
+ soup.predicates.toggle({ and: ['company-owner'] });
+ }
+ });
+ };
+
/**
* Handler for assignee filter changes.
*/
@@ -589,8 +673,57 @@ export function useFilterRefinements() {
);
};
+ // Owner filter (consolidated) for the Customers view.
+ const pushOwnerConsolidatedChip = () => {
+ if (view !== 'companies') return;
+ const key = 'owner';
+ const popupOpen =
+ consolidatedChipCache.get(key)?.isPopupOpen?.() ?? false;
+ const ids = ownerFilter();
+ if (ids.length === 0 && !popupOpen) return;
+
+ seenKeys.add(key);
+
+ const getValues = (): FilterValue[] =>
+ ownerFilter().map((id) => {
+ const opt = ownerOptionsMap().get(id);
+ return {
+ id,
+ label: opt?.label ?? id,
+ icon: opt?.icon,
+ };
+ });
+
+ filters.push(
+ getOrCreateConsolidatedChip(key, () => {
+ const [isPopupOpen, _setPopupOpen] = createSignal(false);
+ const setPopupOpen = (v: boolean) => {
+ if (!v) {
+ queueMicrotask(() =>
+ panel.panelRef()?.focus({ preventScroll: true })
+ );
+ }
+ _setPopupOpen(v);
+ };
+ return {
+ key,
+ categoryLabel: 'Owner',
+ values: getValues,
+ searchableOptions: ownerSearchableOptions,
+ activeSearchableIds: ownerFilter,
+ onSearchableChange: handleOwnerChange,
+ searchPlaceholder: 'Search owners...',
+ isPopupOpen,
+ setPopupOpen,
+ onRemoveAll: () => handleOwnerChange([]),
+ };
+ })
+ );
+ };
+
pushTaskStatusChip();
pushAssigneeConsolidatedChip();
+ pushOwnerConsolidatedChip();
pushTagsConsolidatedChip();
// Evict stale chips
@@ -711,6 +844,7 @@ export function useFilterRefinements() {
soup.predicates.set(preset.clientFilters);
queryFilters.replace(preset.filters ?? null);
setAssigneeFilter([]);
+ setOwnerFilter([]);
if (presetSeedsStatusSubset) taskStatus.clear();
});
};
diff --git a/js/app/packages/app/component/next-soup/soup-view/group-options.ts b/js/app/packages/app/component/next-soup/soup-view/group-options.ts
index ed1a1bcd6d..32f1a5de5b 100644
--- a/js/app/packages/app/component/next-soup/soup-view/group-options.ts
+++ b/js/app/packages/app/component/next-soup/soup-view/group-options.ts
@@ -55,6 +55,12 @@ export const TASK_GROUP_OPTIONS: GroupOption[] = [
{ value: 'date', label: 'Date' },
];
+export const COMPANY_GROUP_OPTIONS: GroupOption[] = [
+ { value: 'none', label: 'None' },
+ { value: `property:${SYSTEM_PROPERTY_IDS.STAGE}`, label: 'Stage' },
+ { value: `property:${SYSTEM_PROPERTY_IDS.COMPANY_OWNER}`, label: 'Owner' },
+];
+
const _EMAIL_GROUP_OPTIONS: GroupOption[] = [
{ value: 'none', label: 'None' },
{ value: 'date', label: 'Date' },
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
index 1d2fd71542..e61b5ef359 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
@@ -47,6 +47,7 @@ import {
} from '@core/constant/featureFlags';
import { useUserId } from '@core/context/user';
import {
+ COMPANY_STAGE_OPTIONS,
type EntityData,
getPropertyOptionLabel,
isWithNotification,
@@ -121,6 +122,8 @@ interface SoupViewContextValues {
queryFilters: QueryStore;
assigneeFilter: Accessor<string[]>;
setAssigneeFilter: Setter<string[]>;
+ ownerFilter: Accessor<string[]>;
+ setOwnerFilter: Setter<string[]>;
inboxFilter: Accessor<string[] | undefined>;
setInboxFilter: Setter<string[] | undefined>;
activeTab: Accessor<string | undefined>;
@@ -224,7 +227,7 @@ export const SoupViewContextProvider: FlowComponent<
onCleanup(predicatesCaptorTeardown);
const invalidateCache = () => {
- const groupBy = groupByField();
+ const groupBy = serverGroupByField();
queryClient.setQueryData(
soupKeys.astItems({
@@ -270,6 +273,10 @@ export const SoupViewContextProvider: FlowComponent<
'soup.assigneeFilter',
{ default: [] }
);
+ const [ownerFilter, setOwnerFilter] = useEntryState<string[]>(
+ 'soup.ownerFilter',
+ { default: [] }
+ );
const [inboxFilter, setInboxFilter] = useEntryState<string[] | undefined>(
INBOX_FILTER_ENTRY_KEY,
{ default: undefined }
@@ -329,6 +336,16 @@ export const SoupViewContextProvider: FlowComponent<
}
});
+ // Clear the owner sub-filter when leaving the CRM company presets
+ createEffect(() => {
+ if (
+ !soup.predicates.isActive('crm-company-active') &&
+ !soup.predicates.isActive('crm-company-hidden')
+ ) {
+ setOwnerFilter([]);
+ }
+ });
+
const notificationSource = useGlobalNotificationSource();
const userId = useUserId();
@@ -338,6 +355,21 @@ export const SoupViewContextProvider: FlowComponent<
return isListViewID(content.id) ? content.id : undefined;
});
+ // CRM companies come back from a dedicated soup request (not the dynamic
+ // query the server-side grouped path is built on), so property grouping on
+ // the Customers view buckets client-side over the flat list — same approach
+ // as date grouping. `groupByField` stays populated so group headers can
+ // resolve icons/labels for the grouping property.
+ const isClientPropertyGroup = createMemo(
+ () =>
+ activeListView() === 'companies' && groupByField()?.type === 'property'
+ );
+
+ // The group-by actually sent to the backend (drives the grouped queries).
+ const serverGroupByField = createMemo(() =>
+ isClientPropertyGroup() ? undefined : groupByField()
+ );
+
// The new inbox surfaces channel threads the current user participates in —
// the root sender, anyone who replied, or anyone @-mentioned — via the
// `channelThreadParticipantId` filter, since soup otherwise only surfaces
@@ -455,6 +487,7 @@ export const SoupViewContextProvider: FlowComponent<
userId: userId(),
notificationSource,
assignees: assigneeFilter(),
+ owners: ownerFilter(),
});
const attachNotifications = (entity: EntityData) => {
@@ -475,7 +508,7 @@ export const SoupViewContextProvider: FlowComponent<
const itemsQuery = useSoupAstItemsQuery(
() => {
- const groupBy = groupByField();
+ const groupBy = serverGroupByField();
return {
params: soupParams(),
body: soupBody(),
@@ -610,7 +643,7 @@ export const SoupViewContextProvider: FlowComponent<
if (!groups || !items) return;
return { groups, items };
}),
- groupByField,
+ groupByField: serverGroupByField,
soupParams,
soupBody,
queryOptions: () => {
@@ -650,10 +683,104 @@ export const SoupViewContextProvider: FlowComponent<
};
};
+ // Group key an entity falls under for a property grouping: the first
+ // select-option id / entity-reference id, or '' for "Not set".
+ const clientPropertyGroupKey = (
+ entity: SoupEntity,
+ propertyDefinitionId: string
+ ): string => {
+ const properties = 'properties' in entity ? (entity.properties ?? []) : [];
+ const property = properties.find(
+ (p) => p.definition.id === propertyDefinitionId
+ );
+ const value = property?.value;
+ if (!value) return '';
+ if (value.type === 'SelectOption' || value.type === 'Link') {
+ const first = value.value[0];
+ return typeof first === 'string' ? first : '';
+ }
+ if (value.type === 'EntityReference') {
+ const first = value.value[0];
+ return first && typeof first === 'object' && 'entity_id' in first
+ ? String(first.entity_id)
+ : '';
+ }
+ return '';
+ };
+
const rows = createMemo((): SoupRow[] => {
const field = groupByField();
const groups = itemsQuery.data?.groups;
+ // Client-side property grouping (Customers view): bucket the flat
+ // (paginated) list by property value; option order comes from the
+ // statically-known stage options, then label, with "Not set" last.
+ if (enabled() && isClientPropertyGroup() && !search.isSearching()) {
+ const definitionId =
+ field?.type === 'property' ? field.propertyDefinitionId : '';
+ const buckets = new Map<string, SoupEntity[]>();
+ for (const entity of entities()) {
+ const key = clientPropertyGroupKey(entity, definitionId);
+ const bucket = buckets.get(key);
+ if (bucket) {
+ bucket.push(entity);
+ } else {
+ buckets.set(key, [entity]);
+ }
+ }
+
+ const stageOrder = COMPANY_STAGE_OPTIONS.map((o) => o.value as string);
+ const order = [...buckets.keys()].sort((a, b) => {
+ if (a === '') return 1;
+ if (b === '') return -1;
+ const aStage = stageOrder.indexOf(a);
+ const bStage = stageOrder.indexOf(b);
+ if (aStage !== -1 || bStage !== -1) {
+ return (
+ (aStage === -1 ? stageOrder.length : aStage) -
+ (bStage === -1 ? stageOrder.length : bStage)
+ );
+ }
+ const aLabel = getPropertyOptionLabel(a) ?? a;
+ const bLabel = getPropertyOptionLabel(b) ?? b;
+ return aLabel.localeCompare(bLabel);
+ });
+
+ const groupedRows: SoupRow[] = [];
+ let index = 0;
+ for (const key of order) {
+ const groupEntities = buckets.get(key)!;
+ const groupMeta: GroupMeta = {
+ key,
+ value: key,
+ label: key === '' ? 'Not set' : (getPropertyOptionLabel(key) ?? key),
+ count: groupEntities.length,
+ isExpanded: () => soup.grouping.isExpanded(key),
+ toggle: () => soup.grouping.toggle(key),
+ };
+ groupedRows.push(
+ soup.buildRow({
+ id: `header:${key}`,
+ index: index++,
+ original: groupEntities[0],
+ group: groupMeta,
+ isGrouped: true,
+ })
+ );
+ for (const entity of groupEntities) {
+ groupedRows.push(
+ soup.buildRow({
+ id: entity.id,
+ index: index++,
+ original: entity,
+ group: groupMeta,
+ })
+ );
+ }
+ }
+ return groupedRows;
+ }
+
// Client-side date grouping: reuse the single flat (paginated) list and
// regenerate date buckets from whatever's loaded — no per-group fetching.
if (enabled() && isClientDateGroup() && !search.isSearching()) {
@@ -819,6 +946,8 @@ export const SoupViewContextProvider: FlowComponent<
queryFilters,
assigneeFilter,
setAssigneeFilter,
+ ownerFilter,
+ setOwnerFilter,
inboxFilter,
setInboxFilter,
activeTab,
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
index 49bff74c75..1d41caa84d 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
@@ -45,6 +45,9 @@ import {
callsLayoutMode,
getCallsGalleryColumns,
} from '@app/component/next-soup/soup-view/views/calls/CallsGallery';
+import { CompanyKanban } from '@app/component/next-soup/soup-view/views/companies/CompanyKanban';
+import { CompanyListEntity } from '@app/component/next-soup/soup-view/views/companies/CompanyListEntity';
+import { ResponsiveCompanyListHeader } from '@app/component/next-soup/soup-view/views/companies/CompanyListHeader';
import { InboxListEntity } from '@app/component/next-soup/soup-view/views/inbox/InboxListEntity';
import { TaskListEntity } from '@app/component/next-soup/soup-view/views/tasks/TaskListEntity';
import { ResponsiveTaskListHeader } from '@app/component/next-soup/soup-view/views/tasks/TaskListHeader';
@@ -63,6 +66,7 @@ import {
SplitHeaderRight,
} from '@app/component/split-layout/components/SplitHeader';
import { SplitPanelContext } from '@app/component/split-layout/context';
+import { useEntryState } from '@app/component/split-layout/entry-state';
import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';
import { LIST_VIEW_DOCS_URL } from '@app/constants/docs-links';
import { isListViewID, type ListView } from '@app/constants/list-views';
@@ -106,6 +110,8 @@ import ChevronRightIcon from '@phosphor/caret-right.svg';
import CheckIcon from '@phosphor/check.svg';
import CircleDashed from '@phosphor/circle-dashed.svg';
import InfoIcon from '@phosphor/info.svg';
+import KanbanIcon from '@phosphor/kanban.svg';
+import ListIcon from '@phosphor/list.svg';
import Spinner from '@phosphor/spinner.svg';
import { PropertyValueIcon } from '@property/component/propertyValue/PropertyValueIcon';
import { PROPERTY_OPTION_IDS, SYSTEM_PROPERTY_IDS } from '@property/constants';
@@ -214,7 +220,8 @@ const DefaultGroupHeader = (
const field = groupByField();
if (
field?.type !== 'property' ||
- field.propertyDefinitionId !== SYSTEM_PROPERTY_IDS.ASSIGNEES ||
+ (field.propertyDefinitionId !== SYSTEM_PROPERTY_IDS.ASSIGNEES &&
+ field.propertyDefinitionId !== SYSTEM_PROPERTY_IDS.COMPANY_OWNER) ||
props.group.key === ''
) {
return;
@@ -400,6 +407,47 @@ interface SoupViewProps {
additionalEntities?: Accessor<EntityData[]>;
}
+type SoupViewMode = 'list' | 'board';
+
+/** Segmented list/board toggle shown in the topbar of the Customers view. */
+const SoupViewModeToggle = (props: {
+ mode: SoupViewMode;
+ onChange: (mode: SoupViewMode) => void;
+}) => {
+ return (
+ <div class="flex items-center gap-0.5 rounded-lg border border-edge-muted bg-surface p-0.5">
+ <Tooltip label="List">
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ label="List view"
+ class={cn(
+ 'size-6 rounded-md p-1',
+ props.mode === 'list' && 'bg-active text-ink'
+ )}
+ onClick={() => props.onChange('list')}
+ >
+ <ListIcon class="size-3.5" />
+ </Button>
+ </Tooltip>
+ <Tooltip label="Board">
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ label="Board view"
+ class={cn(
+ 'size-6 rounded-md p-1',
+ props.mode === 'board' && 'bg-active text-ink'
+ )}
+ onClick={() => props.onChange('board')}
+ >
+ <KanbanIcon class="size-3.5" />
+ </Button>
+ </Tooltip>
+ </div>
+ );
+};
+
export const SoupView = (props: SoupViewProps) => {
const soup = useSoup();
const panel = useSplitPanelOrThrow();
@@ -544,6 +592,16 @@ export const SoupView = (props: SoupViewProps) => {
return view ? LIST_VIEW_DOCS_URL[view] : undefined;
});
+ // List/board display mode — currently only the Customers view offers a
+ // board (kanban grouped by Stage). Per-entry state so back/forward
+ // restores the mode the user left each entry with.
+ const [viewMode, setViewMode] = useEntryState<SoupViewMode>('soup.viewMode', {
+ default: 'list',
+ });
+ const isBoardMode = createMemo(
+ () => activeListView() === 'companies' && viewMode() === 'board'
+ );
+
const [narrowSearchExpanded, setNarrowSearchExpanded] = createSignal(false);
const [mobileSearchOpen, setMobileSearchOpen] = createSignal(false);
const [searchIsCollapsed, setSearchIsCollapsed] = createSignal(false);
@@ -638,6 +696,13 @@ export const SoupView = (props: SoupViewProps) => {
</SplitHeaderLeft>
<Show when={!isMobile()}>
<SplitHeaderRight>
+ <Show
+ when={
+ !narrowSearchExpanded() && isComponentListView('companies')
+ }
+ >
+ <SoupViewModeToggle mode={viewMode()} onChange={setViewMode} />
+ </Show>
<Show
when={!narrowSearchExpanded() && !isComponentListView('search')}
>
@@ -708,9 +773,11 @@ export const SoupView = (props: SoupViewProps) => {
<SoupFiltersBar />
<div class="relative grow min-h-1 flex max-sm:flex-col flex-row size-full">
<Suspense>
- <SoupViewFileDropzone>
- <SoupViewList />
- </SoupViewFileDropzone>
+ <Show when={!isBoardMode()} fallback={<CompanyKanban />}>
+ <SoupViewFileDropzone>
+ <SoupViewList />
+ </SoupViewFileDropzone>
+ </Show>
</Suspense>
<Show when={isMobile()}>
<FloatRegion region="accessory">
@@ -997,6 +1064,7 @@ export const SoupViewList = (props: SoupViewListProps) => {
// The per-row component depends on the active view (and the inbox flag).
const listEntityComponent = () => {
if (currentView() === 'tasks') return TaskListEntity;
+ if (currentView() === 'companies') return CompanyListEntity;
if (isNewInboxEnabled()) return InboxListEntity;
return ListEntity;
};
@@ -1376,6 +1444,9 @@ export const SoupViewList = (props: SoupViewListProps) => {
<Show when={currentView() === 'tasks' && !isMobile()}>
<ResponsiveTaskListHeader class="shrink-0" />
</Show>
+ <Show when={currentView() === 'companies' && !isMobile()}>
+ <ResponsiveCompanyListHeader class="shrink-0" />
+ </Show>
<EntityRowProvider
container={localEntityListRef}
canSwipeLeft={(entityId) => {
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/companies/CompanyKanban.tsx b/js/app/packages/app/component/next-soup/soup-view/views/companies/CompanyKanban.tsx
new file mode 100644
index 0000000000..11552817b5
--- /dev/null
+++ b/js/app/packages/app/component/next-soup/soup-view/views/companies/CompanyKanban.tsx
@@ -0,0 +1,248 @@
+import { useSoupView } from '@app/component/next-soup/soup-view/soup-view-context';
+import { openEntityInSplitFromUnifiedList } from '@app/component/next-soup/utils';
+import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';
+import { UserIcon } from '@core/component/UserIcon';
+import {
+ COMPANY_STAGE_OPTIONS,
+ Entity,
+ type EntityData,
+ formatTimestamp,
+ getCompanyOwnerId,
+ getCompanyStageOptionId,
+ isCrmCompanyEntity,
+} from '@entity';
+import { buildCompanyDefaultProperties } from '@entity/extractors-property';
+import CircleDashed from '@phosphor/circle-dashed.svg';
+import { PropertyValueIcon } from '@property/component/propertyValue/PropertyValueIcon';
+import { SYSTEM_PROPERTY_IDS } from '@property/constants';
+import type { Property } from '@property/types';
+import { useBulkSaveEntityPropertiesMutation } from '@queries/properties/entity';
+import { useIsTeamAdmin } from '@queries/team/teams';
+import { EntityType } from '@service-properties/generated/schemas/entityType';
+import { cn, Layer } from '@ui';
+import { createMemo, createSignal, For, Show } from 'solid-js';
+
+/** Column key for companies without a Stage value. */
+const NO_STAGE_KEY = '';
+
+type StageColumn = {
+ key: string;
+ label: string;
+};
+
+const STAGE_COLUMNS: StageColumn[] = [
+ ...COMPANY_STAGE_OPTIONS.map((option) => ({
+ key: option.value as string,
+ label: option.label,
+ })),
+ { key: NO_STAGE_KEY, label: 'No stage' },
+];
+
+/**
+ * Kanban board for the Customers view: one column per Stage option (plus
+ * "No stage"), fed by the same filtered soup entities as the list. Cards
+ * drag between columns to update the company's Stage property (team
+ * admins/owners only, matching CRM edit access).
+ */
+export function CompanyKanban() {
+ const { source, soup } = useSoupView();
+ const panel = useSplitPanelOrThrow();
+ const isTeamAdmin = useIsTeamAdmin();
+ const saveMutation = useBulkSaveEntityPropertiesMutation();
+
+ const stageProperty = createMemo(
+ (): Property =>
+ buildCompanyDefaultProperties().find(
+ (property) =>
+ property.propertyDefinitionId === SYSTEM_PROPERTY_IDS.STAGE
+ )!
+ );
+
+ const companies = createMemo(() => source.data().filter(isCrmCompanyEntity));
+
+ const columns = createMemo(() => {
+ const buckets = new Map<string, EntityData[]>(
+ STAGE_COLUMNS.map((column) => [column.key, []])
+ );
+ for (const company of companies()) {
+ const key = getCompanyStageOptionId(company) ?? NO_STAGE_KEY;
+ (buckets.get(buckets.has(key) ? key : NO_STAGE_KEY) ?? []).push(company);
+ }
+ return STAGE_COLUMNS.map((column) => ({
+ ...column,
+ entities: buckets.get(column.key) ?? [],
+ }));
+ });
+
+ const [draggedId, setDraggedId] = createSignal<string>();
+ const [dropTarget, setDropTarget] = createSignal<string>();
+
+ const moveToStage = (entityId: string, stageKey: string) => {
+ const entity = companies().find((company) => company.id === entityId);
+ if (!entity) return;
+ const currentStage = getCompanyStageOptionId(entity) ?? NO_STAGE_KEY;
+ if (currentStage === stageKey) return;
+
+ saveMutation.mutate({
+ properties: [
+ {
+ entityId,
+ entityType: EntityType.COMPANY,
+ property: stageProperty(),
+ apiValues: {
+ valueType: 'SELECT_STRING',
+ values: stageKey === NO_STAGE_KEY ? null : [stageKey],
+ },
+ },
+ ],
+ });
+ };
+
+ const openCompany = (entity: EntityData, event: MouseEvent) => {
+ soup.focus.set(entity.id);
+ void openEntityInSplitFromUnifiedList(entity, {
+ openInNewSplit: event.shiftKey,
+ splitHandle: panel.handle,
+ referredFrom: 'companies',
+ });
+ };
+
+ return (
+ <div class="size-full min-w-0 overflow-x-auto overflow-y-hidden">
+ <div class="flex h-full gap-3 p-3">
+ <For each={columns()}>
+ {(column) => (
+ <div
+ class={cn(
+ 'flex h-full w-64 shrink-0 flex-col rounded-lg border border-edge-muted bg-surface',
+ dropTarget() === column.key &&
+ draggedId() &&
+ 'border-accent/50 bg-accent/5'
+ )}
+ onDragOver={(e) => {
+ if (!draggedId()) return;
+ e.preventDefault();
+ setDropTarget(column.key);
+ }}
+ onDragLeave={(e) => {
+ if (
+ e.relatedTarget instanceof Node &&
+ e.currentTarget.contains(e.relatedTarget)
+ ) {
+ return;
+ }
+ if (dropTarget() === column.key) setDropTarget(undefined);
+ }}
+ onDrop={(e) => {
+ e.preventDefault();
+ const id = draggedId() ?? e.dataTransfer?.getData('text/plain');
+ setDropTarget(undefined);
+ setDraggedId(undefined);
+ if (id) moveToStage(id, column.key);
+ }}
+ >
+ <div class="flex items-center gap-2 px-3 py-2.5 text-xs font-semibold text-ink-muted">
+ <Show
+ when={column.key !== NO_STAGE_KEY}
+ fallback={
+ <CircleDashed class="size-3.5 text-ink-extra-muted" />
+ }
+ >
+ <PropertyValueIcon optionId={column.key} class="size-3.5" />
+ </Show>
+ <span class="truncate">{column.label}</span>
+ <span class="ml-auto shrink-0 tabular-nums px-1.5 py-px rounded-full bg-ink/10 text-ink-extra-muted font-medium">
+ {column.entities.length}
+ </span>
+ </div>
+ <div class="min-h-0 flex-1 overflow-y-auto scrollbar-hidden flex flex-col gap-2 px-2 pb-2">
+ <For each={column.entities}>
+ {(entity) => (
+ <CompanyKanbanCard
+ entity={entity}
+ draggable={isTeamAdmin()}
+ dragging={draggedId() === entity.id}
+ onDragStart={(e) => {
+ e.dataTransfer?.setData('text/plain', entity.id);
+ if (e.dataTransfer) {
+ e.dataTransfer.effectAllowed = 'move';
+ }
+ setDraggedId(entity.id);
+ }}
+ onDragEnd={() => {
+ setDraggedId(undefined);
+ setDropTarget(undefined);
+ }}
+ onClick={(e) => openCompany(entity, e)}
+ />
+ )}
+ </For>
+ </div>
+ </div>
+ )}
+ </For>
+ </div>
+ </div>
+ );
+}
+
+function CompanyKanbanCard(props: {
+ entity: EntityData;
+ draggable: boolean;
+ dragging: boolean;
+ onDragStart: (e: DragEvent) => void;
+ onDragEnd: () => void;
+ onClick: (e: MouseEvent) => void;
+}) {
+ const ownerId = () =>
+ isCrmCompanyEntity(props.entity)
+ ? getCompanyOwnerId(props.entity)
+ : undefined;
+ const primaryDomain = () =>
+ isCrmCompanyEntity(props.entity)
+ ? props.entity.domains[0]?.domain
+ : undefined;
+
+ return (
+ <Layer depth={2}>
+ <div
+ draggable={props.draggable}
+ onDragStart={props.onDragStart}
+ onDragEnd={props.onDragEnd}
+ onClick={props.onClick}
+ class={cn(
+ 'flex flex-col gap-1.5 rounded-lg border border-edge-muted bg-panel p-2.5 text-sm',
+ 'hover:border-edge transition-colors',
+ props.dragging && 'opacity-40'
+ )}
+ >
+ <div class="flex items-center gap-2 min-w-0">
+ <div class="size-4 shrink-0">
+ <Entity.Icon entity={props.entity} />
+ </div>
+ <span class="ph-no-capture truncate font-semibold min-w-0">
+ <Entity.Title entity={props.entity} />
+ </span>
+ <Show when={ownerId()}>
+ {(id) => (
+ <span class="ml-auto shrink-0">
+ <UserIcon id={id()} size="sm" suppressClick />
+ </span>
+ )}
+ </Show>
+ </div>
+ <div class="flex items-center gap-2 min-w-0 text-xs text-ink-extra-muted">
+ <Show when={primaryDomain()}>
+ {(domain) => <span class="truncate min-w-0">{domain()}</span>}
+ </Show>
+ {/* Last interaction — updatedAt carries crm_companies.last_interaction. */}
+ <Show when={props.entity.updatedAt}>
+ {(ts) => (
+ <span class="ml-auto shrink-0">{formatTimestamp(ts())}</span>
+ )}
+ </Show>
+ </div>
+ </div>
+ </Layer>
+ );
+}
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/companies/CompanyListEntity.tsx b/js/app/packages/app/component/next-soup/soup-view/views/companies/CompanyListEntity.tsx
new file mode 100644
index 0000000000..edac328d92
--- /dev/null
+++ b/js/app/packages/app/component/next-soup/soup-view/views/companies/CompanyListEntity.tsx
@@ -0,0 +1,116 @@
+import '@entity/composed/ListEntity.css';
+import { EntityRow, EntityRowContext } from '@app/component/mobile/EntityRow';
+import { useSplitPanel } from '@app/component/split-layout/layoutUtils';
+import { isMobile } from '@core/mobile/isMobile';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { createEntityDraggable, Entity, unreadFilterFn } from '@entity';
+import { NarrowLayout } from '@entity/composed/list-entity/narrow-layout';
+import {
+ type BaseListEntityProps,
+ type LayoutProps,
+ useListLayout,
+} from '@entity/composed/list-entity/shared';
+import type { EntityRowConfig } from '@entity/extractors-notification';
+import { mergeRefs } from '@solid-primitives/refs';
+import { cn } from '@ui/utils/classname';
+import { type JSX, Match, Show, Switch, useContext } from 'solid-js';
+import { CompanyGridLayout } from './company-grid-layout';
+
+function MaybeEntityRow(props: {
+ entityId: string;
+ children: JSX.Element;
+ config?: EntityRowConfig;
+}) {
+ const ctx = useContext(EntityRowContext);
+ return (
+ <Show when={isMobile() && ctx} fallback={props.children}>
+ <EntityRow
+ entityId={props.entityId}
+ swipeLeftColor={props.config?.swipeLeftColor}
+ swipeLeftRevealedComponent={props.config?.swipeLeftRevealedComponent}
+ swipeRightColor={props.config?.swipeRightColor}
+ swipeRightRevealedComponent={props.config?.swipeRightRevealedComponent}
+ >
+ {props.children}
+ </EntityRow>
+ </Show>
+ );
+}
+
+/**
+ * Customers-list row that renders CRM properties (Stage, Owner, Revenue)
+ * in fixed-width grid columns so they line up vertically across rows,
+ * mirroring `TaskListEntity`.
+ */
+export function CompanyListEntity(props: BaseListEntityProps) {
+ const unread = () => unreadFilterFn(props.entity);
+
+ const layoutProps = (): LayoutProps => ({
+ entity: props.entity,
+ checked: props.checked,
+ hideCheckbox: props.hideCheckbox,
+ onChecked: props.onChecked,
+ unread: unread(),
+ isShared: false,
+ hasNotifications: false,
+ showHitSnippet: false,
+ streamState: undefined,
+ setSnippetContainerRef: () => {},
+ chars: 0,
+ onProjectClick: props.onProjectClick,
+ });
+
+ const draggable = createEntityDraggable({
+ entity: props.entity,
+ splitId: useSplitPanel()?.handle?.id,
+ });
+
+ const isWide = useListLayout()?.isWide ?? (() => true);
+
+ return (
+ <Entity.Root
+ entity={props.entity}
+ onClick={(e) => {
+ if (e.metaKey && props.onChecked) {
+ props.onChecked(!props.checked, e.shiftKey);
+ return;
+ }
+ props.onClick?.(e);
+ }}
+ ref={mergeRefs(props.ref, draggable)}
+ class={cn(
+ 'soup-list-entity @container/entity w-[calc(100%-0.5rem)] mr-1 relative group/narrow flex flex-col py-0.5 rounded-lg',
+ {
+ 'min-h-10 mx-1': !isMobile(),
+ 'bg-accent/8': props.checked,
+ 'bg-accent/16':
+ props.checked && props.highlighted && !isTouchDevice(),
+ 'bg-active/60':
+ props.highlighted && !props.checked && !isTouchDevice(),
+ 'hover:bg-active/30':
+ !props.highlighted && !props.checked && !isTouchDevice(),
+ }
+ )}
+ onMouseMove={props.onMouseMove}
+ >
+ <Switch>
+ <Match when={isWide()}>
+ <MaybeEntityRow
+ entityId={props.entity.id}
+ config={props.entityRowConfig}
+ >
+ <CompanyGridLayout {...layoutProps()} />
+ </MaybeEntityRow>
+ </Match>
+ <Match when={true}>
+ <MaybeEntityRow
+ entityId={props.entity.id}
+ config={props.entityRowConfig}
+ >
+ <NarrowLayout {...layoutProps()} />
+ </MaybeEntityRow>
+ </Match>
+ </Switch>
+ </Entity.Root>
+ );
+}
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/companies/CompanyListHeader.tsx b/js/app/packages/app/component/next-soup/soup-view/views/companies/CompanyListHeader.tsx
new file mode 100644
index 0000000000..9dbadd0d8d
--- /dev/null
+++ b/js/app/packages/app/component/next-soup/soup-view/views/companies/CompanyListHeader.tsx
@@ -0,0 +1,105 @@
+import type { SystemSortOption } from '@app/component/next-soup/soup-view/sort-options';
+import { useSoupView } from '@app/component/next-soup/soup-view/soup-view-context';
+import { useListLayout } from '@entity/composed/list-entity/shared';
+import ArrowDownIcon from '@phosphor/arrow-down.svg';
+import { cn } from '@ui/utils/classname';
+import { createMemo, For, Show } from 'solid-js';
+import '../tasks/list-property-value.css';
+import {
+ COMPANY_GRID_COLUMNS,
+ COMPANY_GRID_TEMPLATE_AREAS,
+ COMPANY_GRID_TEMPLATE_COLUMNS,
+} from './company-grid-template';
+
+/**
+ * Responsive wrapper that only shows the header when layout is wide.
+ * Must be used inside a ListLayoutProvider.
+ */
+export function ResponsiveCompanyListHeader(props: { class?: string }) {
+ const layout = useListLayout();
+ const isWide = () => layout?.isWide() ?? true;
+
+ return (
+ <Show when={isWide()}>
+ <CompanyListHeader class={props.class} />
+ </Show>
+ );
+}
+
+/**
+ * Sticky table header mirroring the column template of CompanyGridLayout
+ * so the column labels line up with the property values in each row.
+ * The trailing Last Interaction column is clickable to sort (backed by
+ * `updated_at`, which carries `crm_companies.last_interaction`).
+ */
+function CompanyListHeader(props: { class?: string }) {
+ const { soup } = useSoupView();
+ const activeSort = createMemo(() => soup.sort.active()[0]);
+ const setSort = (id: SystemSortOption) => {
+ if (activeSort()?.id === id) {
+ soup.sort.flip(id);
+ } else {
+ soup.sort.setAll([id]);
+ }
+ };
+
+ return (
+ <div
+ // px-3 (12px) matches each row's total horizontal inset — the row's
+ // Entity.Root `mx-1` (4px) plus Entity.Layout `px-2` (8px) — so the
+ // header grid tracks line up exactly with the row grid tracks.
+ class={cn(
+ 'company-grid-row w-full grid items-center gap-2 px-3 h-10',
+ 'text-xs font-medium text-ink-extra-muted',
+ 'bg-surface',
+ props.class
+ )}
+ style={{
+ 'grid-template-columns': COMPANY_GRID_TEMPLATE_COLUMNS,
+ 'grid-template-areas': COMPANY_GRID_TEMPLATE_AREAS,
+ }}
+ >
+ <div style={{ 'grid-area': 'indicator' }} />
+ <div style={{ 'grid-area': 'content' }} class="truncate">
+ Customer
+ </div>
+ <For each={COMPANY_GRID_COLUMNS}>
+ {(col) => (
+ <div
+ style={{ 'grid-area': col.id }}
+ class="flex items-center min-w-0 @min-[841px]/u-list:pl-2"
+ >
+ <span class="truncate @max-[840px]/u-list:hidden">{col.label}</span>
+ </div>
+ )}
+ </For>
+ <div
+ style={{ 'grid-area': 'timestamp' }}
+ class="flex items-center min-w-0"
+ >
+ <button
+ type="button"
+ onClick={() => setSort('updated_at')}
+ class={cn(
+ 'flex items-center gap-1 min-w-0 w-full h-full justify-end',
+ 'hover:text-ink transition-colors',
+ activeSort()?.id === 'updated_at' && 'text-ink'
+ )}
+ >
+ <span class="truncate">Last Interaction</span>
+ <ArrowDownIcon
+ class={cn(
+ 'size-3 shrink-0 transition-transform',
+ activeSort()?.id === 'updated_at'
+ ? 'text-ink'
+ : 'text-ink-extra-muted',
+ activeSort()?.id === 'updated_at' &&
+ activeSort()?.reversed &&
+ 'rotate-180'
+ )}
+ />
+ </button>
+ </div>
+ </div>
+ );
+}
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/companies/company-grid-layout.tsx b/js/app/packages/app/component/next-soup/soup-view/views/companies/company-grid-layout.tsx
new file mode 100644
index 0000000000..d8c1df9273
--- /dev/null
+++ b/js/app/packages/app/component/next-soup/soup-view/views/companies/company-grid-layout.tsx
@@ -0,0 +1,185 @@
+import {
+ Entity,
+ type EntityData,
+ isCrmCompanyEntity,
+ MultiSelectCheckbox,
+ UnreadIndicator,
+} from '@entity';
+import type { LayoutProps } from '@entity/composed/list-entity/shared';
+import {
+ buildCompanyDefaultProperties,
+ soupPropertyToProperty,
+} from '@entity/extractors-property';
+import { Modals } from '@property/component/modal';
+import {
+ PropertiesProvider,
+ type PropertySaveHandler,
+} from '@property/context/PropertiesContext';
+import type { Property, PropertyApiValues } from '@property/types';
+import { useBulkSaveEntityPropertiesMutation } from '@queries/properties/entity';
+import { useIsTeamAdmin } from '@queries/team/teams';
+import { EntityType } from '@service-properties/generated/schemas/entityType';
+import { cn } from '@ui/utils/classname';
+import { createMemo, For, Show, Suspense } from 'solid-js';
+import { ListPropertyValue } from '../tasks/list-property-value';
+import {
+ COMPANY_GRID_COLUMNS,
+ COMPANY_GRID_TEMPLATE_AREAS,
+ COMPANY_GRID_TEMPLATE_AREAS_NO_INDICATOR,
+ COMPANY_GRID_TEMPLATE_COLUMNS,
+ COMPANY_GRID_TEMPLATE_COLUMNS_NO_INDICATOR,
+} from './company-grid-template';
+
+/**
+ * Grid row layout for the Customers list: company name + editable CRM
+ * property columns (Stage, Owner, Revenue) and a trailing Last
+ * Interaction timestamp, mirroring `TaskGridLayout`.
+ */
+export function CompanyGridLayout(props: LayoutProps) {
+ const isTeamAdmin = useIsTeamAdmin();
+
+ const primaryDomain = () => {
+ const entity = props.entity as EntityData;
+ return isCrmCompanyEntity(entity) ? entity.domains[0]?.domain : undefined;
+ };
+
+ // Fetched properties by definition id, with builtin stubs filling the
+ // gaps so every column renders (and can open its editor) even before a
+ // value is saved.
+ const propertyMap = createMemo(() => {
+ const map = new Map<string, Property>();
+ const entity = props.entity as EntityData;
+ if (!isCrmCompanyEntity(entity)) return map;
+ for (const soupProperty of entity.properties ?? []) {
+ try {
+ const property = soupPropertyToProperty(soupProperty);
+ map.set(property.propertyDefinitionId, property);
+ } catch (error) {
+ console.warn('Skipping property with unsupported type', error);
+ }
+ }
+ for (const stub of buildCompanyDefaultProperties()) {
+ if (!map.has(stub.propertyDefinitionId)) {
+ map.set(stub.propertyDefinitionId, stub);
+ }
+ }
+ return map;
+ });
+
+ const properties = createMemo(() => Array.from(propertyMap().values()));
+
+ const saveMutation = useBulkSaveEntityPropertiesMutation();
+
+ const saveOne = (property: Property, apiValues: PropertyApiValues) =>
+ saveMutation.mutateAsync({
+ properties: [
+ {
+ entityId: props.entity.id,
+ entityType: EntityType.COMPANY,
+ property,
+ apiValues,
+ },
+ ],
+ });
+
+ const saveHandler: PropertySaveHandler = {
+ saveProperty: (property, value) => saveOne(property, value),
+ saveDate: (property, date) =>
+ saveOne(property, { valueType: 'DATE', value: date }),
+ };
+
+ return (
+ <PropertiesProvider
+ entityType={EntityType.COMPANY}
+ canEdit={isTeamAdmin()}
+ properties={properties}
+ onRefresh={() => {}}
+ onPropertyAdded={() => {}}
+ onPropertyDeleted={() => {}}
+ saveHandler={saveHandler}
+ >
+ <Entity.Layout
+ class={cn(
+ 'company-grid-row w-full min-h-[inherit] items-center text-sm px-2',
+ 'gap-2 grid grid-rows-[1fr]'
+ )}
+ style={{
+ 'grid-template-columns': props.hideCheckbox
+ ? COMPANY_GRID_TEMPLATE_COLUMNS_NO_INDICATOR
+ : COMPANY_GRID_TEMPLATE_COLUMNS,
+ 'grid-template-areas': props.hideCheckbox
+ ? COMPANY_GRID_TEMPLATE_AREAS_NO_INDICATOR
+ : COMPANY_GRID_TEMPLATE_AREAS,
+ }}
+ >
+ <Show when={!props.hideCheckbox}>
+ <Entity.Slot placement="indicator" class="relative size-full group">
+ <div class="absolute inset-0 grid place-items-center group-hover:opacity-0">
+ <UnreadIndicator active={props.unread} />
+ </div>
+ <div
+ class={cn(
+ 'absolute inset-0 grid place-items-center opacity-0 group-hover:opacity-100',
+ {
+ 'opacity-100': props.checked,
+ }
+ )}
+ >
+ <MultiSelectCheckbox
+ checked={props.checked}
+ onChecked={props.onChecked}
+ />
+ </div>
+ </Entity.Slot>
+ </Show>
+
+ <Entity.Slot
+ placement="content"
+ class="ph-no-capture font-semibold truncate items-center gap-2 flex min-w-0"
+ >
+ <div class="size-4 shrink-0">
+ <Entity.Icon
+ entity={props.entity}
+ streamState={props.streamState}
+ />
+ </div>
+ <span class="truncate min-w-0">
+ <Entity.Title entity={props.entity} />
+ </span>
+ <Show when={primaryDomain()}>
+ {(domain) => (
+ <span class="truncate shrink-[2] min-w-0 text-xs font-normal text-ink-extra-muted">
+ {domain()}
+ </span>
+ )}
+ </Show>
+ </Entity.Slot>
+
+ <For each={COMPANY_GRID_COLUMNS}>
+ {(col) => (
+ <Entity.Slot
+ placement={col.id}
+ class="flex items-center min-w-0 text-xs ph-no-capture @container/slot @max-[840px]/u-list:justify-center"
+ >
+ <Show when={propertyMap().get(col.defId)}>
+ {(property) => <ListPropertyValue property={property()} />}
+ </Show>
+ </Entity.Slot>
+ )}
+ </For>
+
+ {/* Last interaction — `updatedAt` carries crm_companies.last_interaction,
+ kept fresh from synced workspace emails. */}
+ <Entity.Slot
+ placement="timestamp"
+ class="text-xs text-right text-ink-extra-muted font-light"
+ >
+ <Entity.Timestamp entity={props.entity} />
+ </Entity.Slot>
+ </Entity.Layout>
+ <Suspense>
+ <Modals />
+ </Suspense>
+ </PropertiesProvider>
+ );
+}
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/companies/company-grid-template.ts b/js/app/packages/app/component/next-soup/soup-view/views/companies/company-grid-template.ts
new file mode 100644
index 0000000000..c81af15778
--- /dev/null
+++ b/js/app/packages/app/component/next-soup/soup-view/views/companies/company-grid-template.ts
@@ -0,0 +1,61 @@
+import { SYSTEM_PROPERTY_IDS } from '@property/constants';
+import { DataType } from '@service-storage/generated/schemas/dataType';
+import { EntityType } from '@service-storage/generated/schemas/entityType';
+
+/**
+ * Property columns for the Customers (CRM companies) list, mirroring
+ * `task-grid-template.ts`. Each column maps to a builtin CRM system
+ * property and is editable inline from the list.
+ */
+export const COMPANY_GRID_COLUMNS = [
+ {
+ id: 'stage',
+ label: 'Stage',
+ defId: SYSTEM_PROPERTY_IDS.STAGE,
+ dataType: DataType.SELECT_STRING,
+ isMultiSelect: false,
+ specificEntityType: null,
+ width: 'var(--company-col-stage, 8rem)',
+ },
+ {
+ id: 'owner',
+ label: 'Owner',
+ defId: SYSTEM_PROPERTY_IDS.COMPANY_OWNER,
+ dataType: DataType.ENTITY,
+ isMultiSelect: false,
+ specificEntityType: EntityType.USER,
+ width: 'var(--company-col-owner, 8rem)',
+ },
+ {
+ id: 'revenue',
+ label: 'Revenue',
+ defId: SYSTEM_PROPERTY_IDS.REVENUE,
+ dataType: DataType.NUMBER,
+ isMultiSelect: false,
+ specificEntityType: null,
+ width: 'var(--company-col-revenue, 7rem)',
+ },
+] as const;
+
+export type CompanyGridColumn = (typeof COMPANY_GRID_COLUMNS)[number];
+
+/** Width for the trailing Last Interaction timestamp column. */
+const LAST_INTERACTION_COLUMN_WIDTH = 'var(--company-col-timestamp, 7rem)';
+
+export const COMPANY_GRID_TEMPLATE_COLUMNS = `1rem minmax(0, 100%) ${COMPANY_GRID_COLUMNS.map(
+ (c) => c.width
+).join(' ')} ${LAST_INTERACTION_COLUMN_WIDTH}`;
+
+/** Template without the leading indicator (checkbox) column. */
+export const COMPANY_GRID_TEMPLATE_COLUMNS_NO_INDICATOR = `minmax(0, 100%) ${COMPANY_GRID_COLUMNS.map(
+ (c) => c.width
+).join(' ')} ${LAST_INTERACTION_COLUMN_WIDTH}`;
+
+export const COMPANY_GRID_TEMPLATE_AREAS = `"indicator content ${COMPANY_GRID_COLUMNS.map(
+ (c) => c.id
+).join(' ')} timestamp"`;
+
+/** Template areas without the leading indicator (checkbox) column. */
+export const COMPANY_GRID_TEMPLATE_AREAS_NO_INDICATOR = `"content ${COMPANY_GRID_COLUMNS.map(
+ (c) => c.id
+).join(' ')} timestamp"`;
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx b/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx
index 5ebc20d918..8539d7c830 100644
--- a/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx
@@ -30,6 +30,38 @@ export const ListPropertyValue: Component<ListPropertyValueProps> = (props) => {
const isEmpty = () => !hasValue(props.property);
+ // STRING / NUMBER / BOOLEAN / LINK edit in place rather than via the
+ // EditTrigger + popover pair.
+ const isInlineType = () =>
+ props.property.valueType === 'STRING' ||
+ props.property.valueType === 'NUMBER' ||
+ props.property.valueType === 'BOOLEAN' ||
+ props.property.valueType === 'LINK';
+
+ if (isInlineType()) {
+ return (
+ <Property.Root
+ property={props.property}
+ canEdit={ctx.canEdit}
+ onSave={ctx.saveHandler.saveProperty}
+ onRefresh={ctx.onRefresh}
+ >
+ <Property.Tooltip property={props.property}>
+ <Layer depth={2}>
+ {/* Stop clicks from bubbling to the row (which opens the entity). */}
+ <div
+ class="list-property-cell w-full max-w-full min-w-0 overflow-hidden rounded-full hover:bg-surface/50 text-left @max-[840px]/u-list:hidden"
+ onClick={(e) => e.stopPropagation()}
+ role="presentation"
+ >
+ <Property.InlineEditor />
+ </div>
+ </Layer>
+ </Property.Tooltip>
+ </Property.Root>
+ );
+ }
+
return (
<Property.Root
property={props.property}
diff --git a/js/app/packages/app/component/side-panel/properties/EntityPropertiesSection.tsx b/js/app/packages/app/component/side-panel/properties/EntityPropertiesSection.tsx
index a0b248dc65..7de34f73e6 100644
--- a/js/app/packages/app/component/side-panel/properties/EntityPropertiesSection.tsx
+++ b/js/app/packages/app/component/side-panel/properties/EntityPropertiesSection.tsx
@@ -56,6 +56,12 @@ export interface EntityPropertiesSectionProps {
pinnedPropertyDefinitionOrder?: readonly string[];
onPropertyPinned?: (propertyId: string) => void;
onPropertyUnpinned?: (propertyId: string) => void;
+ /**
+ * Placeholder properties shown (and editable) even when the entity has no
+ * value row for them yet — e.g. builtin CRM company defaults. Fetched
+ * properties with the same definition id take precedence.
+ */
+ defaultProperties?: () => Property[];
}
const TAGGABLE_ENTITY_TYPES: ReadonlySet<EntityType> = new Set<EntityType>([
@@ -85,13 +91,30 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
)
);
+ // Fetched properties merged with any default placeholders whose
+ // definition the entity doesn't carry yet.
+ const mergedProperties = createMemo(() => {
+ const fetched = properties();
+ const defaults = props.defaultProperties?.() ?? [];
+ if (defaults.length === 0) return fetched;
+ const fetchedDefinitionIds = new Set(
+ fetched.map((property) => property.propertyDefinitionId)
+ );
+ return [
+ ...fetched,
+ ...defaults.filter(
+ (property) => !fetchedDefinitionIds.has(property.propertyDefinitionId)
+ ),
+ ];
+ });
+
const filteredPinnedProperties = createMemo(() => {
const defaultPinnedIds = props.defaultPinnedPropertyIds?.() ?? [];
const pinnedIds = props.pinnedPropertyIds?.() ?? [];
const usesPinnedFilter =
props.defaultPinnedPropertyIds !== undefined ||
props.pinnedPropertyIds !== undefined;
- const pinned = properties().filter((property) => {
+ const pinned = mergedProperties().filter((property) => {
if (tagDefinitionIds().has(property.propertyDefinitionId)) {
return false;
}
diff --git a/js/app/packages/app/component/split-layout/componentRegistry.tsx b/js/app/packages/app/component/split-layout/componentRegistry.tsx
index 4b61066d7d..8833b365aa 100644
--- a/js/app/packages/app/component/split-layout/componentRegistry.tsx
+++ b/js/app/packages/app/component/split-layout/componentRegistry.tsx
@@ -282,7 +282,7 @@ registerComponent(
const preset = getViewPreset('companies');
return (
<SoupView
- viewName="Companies"
+ viewName="Customers"
initialFilters={preset?.filters}
initialClientFilters={preset?.clientFilters}
initialGroupBy={preset?.groupBy}
diff --git a/js/app/packages/companies/Company/Company.tsx b/js/app/packages/companies/Company/Company.tsx
index 82dd8325e0..9e5bd3e730 100644
--- a/js/app/packages/companies/Company/Company.tsx
+++ b/js/app/packages/companies/Company/Company.tsx
@@ -5,6 +5,7 @@ import { CompanyDiscussionSection } from './CompanyDiscussionSection';
import { CompanyEmailsSection } from './CompanyEmailsSection';
import { CompanyHeader } from './CompanyHeader';
import { CompanyMetadataSection } from './CompanyMetadataSection';
+import { CompanyPropertiesSection } from './CompanyPropertiesSection';
import { CompanySharingSection } from './CompanySharingSection';
/**
@@ -34,6 +35,14 @@ export function Company(props: { companyId: string }) {
>
<CompanyMetadataSection company={company()} />
</SidePanel.Section>
+ <SidePanel.Section
+ id="company-properties"
+ title="Properties"
+ order={15}
+ defaultOpen
+ >
+ <CompanyPropertiesSection companyId={props.companyId} />
+ </SidePanel.Section>
<SidePanel.Section
id="company-contacts"
title="Contacts"
diff --git a/js/app/packages/companies/Company/CompanyMetadataSection.tsx b/js/app/packages/companies/Company/CompanyMetadataSection.tsx
index b8502a2306..d045bc55d7 100644
--- a/js/app/packages/companies/Company/CompanyMetadataSection.tsx
+++ b/js/app/packages/companies/Company/CompanyMetadataSection.tsx
@@ -1,4 +1,4 @@
-import type { CrmCompanyEntity } from '@entity';
+import { type CrmCompanyEntity, formatDateAndTime } from '@entity';
import { For, type JSX, Show } from 'solid-js';
function Field(props: { label: string; children: JSX.Element }) {
@@ -26,6 +26,16 @@ export function CompanyMetadataSection(props: { company?: CrmCompanyEntity }) {
{(domain) => <div class="truncate">{domain.domain}</div>}
</For>
</Field>
+ {/* `updatedAt` carries `crm_companies.last_interaction`, which the
+ backend keeps fresh from synced workspace emails. */}
+ <Field label="Last interaction">
+ <Show
+ when={company().updatedAt}
+ fallback={<span class="text-ink-muted">None</span>}
+ >
+ {(ts) => <span>{formatDateAndTime(ts())}</span>}
+ </Show>
+ </Field>
</div>
)}
</Show>
diff --git a/js/app/packages/companies/Company/CompanyPropertiesSection.tsx b/js/app/packages/companies/Company/CompanyPropertiesSection.tsx
new file mode 100644
index 0000000000..8fed093b42
--- /dev/null
+++ b/js/app/packages/companies/Company/CompanyPropertiesSection.tsx
@@ -0,0 +1,32 @@
+import { EntityPropertiesSection } from '@app/component/side-panel/properties/EntityPropertiesSection';
+import { buildCompanyDefaultProperties } from '@entity/extractors-property';
+import { SYSTEM_PROPERTY_IDS } from '@property/constants';
+import { useIsTeamAdmin } from '@queries/team/teams';
+
+/** Fixed display order: builtin CRM defaults first, custom ones after. */
+const COMPANY_PINNED_ORDER = [
+ SYSTEM_PROPERTY_IDS.STAGE,
+ SYSTEM_PROPERTY_IDS.COMPANY_OWNER,
+ SYSTEM_PROPERTY_IDS.REVENUE,
+] as const;
+
+/**
+ * CRM properties for a company (Stage / Owner / Revenue + custom),
+ * mirroring the task side panel's properties section. The builtin
+ * defaults render as editable placeholders even before the company has
+ * any values saved. Editing follows CRM access: team admins/owners can
+ * edit, members see read-only values.
+ */
+export function CompanyPropertiesSection(props: { companyId: string }) {
+ const isTeamAdmin = useIsTeamAdmin();
+
+ return (
+ <EntityPropertiesSection
+ entityId={props.companyId}
+ entityType="COMPANY"
+ canEdit={isTeamAdmin()}
+ defaultProperties={buildCompanyDefaultProperties}
+ pinnedPropertyDefinitionOrder={COMPANY_PINNED_ORDER}
+ />
+ );
+}
diff --git a/js/app/packages/entity/src/extractors-property/index.ts b/js/app/packages/entity/src/extractors-property/index.ts
index 7d62784d63..2e143e46e5 100644
--- a/js/app/packages/entity/src/extractors-property/index.ts
+++ b/js/app/packages/entity/src/extractors-property/index.ts
@@ -1,3 +1,6 @@
export { EntityKeyProperties } from './entity-key-properties';
-export { soupPropertyToProperty } from './property-helpers';
+export {
+ buildCompanyDefaultProperties,
+ soupPropertyToProperty,
+} from './property-helpers';
diff --git a/js/app/packages/entity/src/extractors-property/property-helpers.ts b/js/app/packages/entity/src/extractors-property/property-helpers.ts
index 0cc4cf41e4..406710a8f6 100644
--- a/js/app/packages/entity/src/extractors-property/property-helpers.ts
+++ b/js/app/packages/entity/src/extractors-property/property-helpers.ts
@@ -6,7 +6,10 @@ import {
import type { Property, PropertyOption, ValueType } from '@property/types';
import type { SoupProperty } from '@service-storage/generated/schemas/soupProperty';
import { nanoid } from 'nanoid';
-import { TASK_STATUS_OPTIONS } from '../utils/task-properties';
+import {
+ COMPANY_STAGE_OPTIONS,
+ TASK_STATUS_OPTIONS,
+} from '../utils/task-properties';
const EPOCH_ZERO = new Date(0);
@@ -70,6 +73,16 @@ const SYSTEM_PROPERTY_OPTIONS: Record<string, PropertyOption[]> = {
updated_at: EPOCH_ZERO.toISOString(),
},
],
+ [SYSTEM_PROPERTY_IDS.STAGE]: COMPANY_STAGE_OPTIONS.map(
+ ({ value, label }, displayOrder) => ({
+ id: value,
+ property_definition_id: SYSTEM_PROPERTY_IDS.STAGE,
+ value: { type: 'string', value: label },
+ display_order: displayOrder,
+ created_at: EPOCH_ZERO.toISOString(),
+ updated_at: EPOCH_ZERO.toISOString(),
+ })
+ ),
};
/**
@@ -269,6 +282,54 @@ function _soupPropertiesToProperties(
return soupProperties.map(soupPropertyToProperty);
}
+/** Definition stubs for the builtin CRM company properties. */
+const COMPANY_DEFAULT_PROPERTY_DEFS = [
+ {
+ id: SYSTEM_PROPERTY_IDS.STAGE,
+ displayName: 'Stage',
+ dataType: 'SELECT_STRING',
+ specificEntityType: undefined,
+ },
+ {
+ id: SYSTEM_PROPERTY_IDS.COMPANY_OWNER,
+ displayName: 'Owner',
+ dataType: 'ENTITY',
+ specificEntityType: 'USER',
+ },
+ {
+ id: SYSTEM_PROPERTY_IDS.REVENUE,
+ displayName: 'Revenue',
+ dataType: 'NUMBER',
+ specificEntityType: undefined,
+ },
+] as const;
+
+/**
+ * Build placeholder `Property` values for the builtin CRM company
+ * properties (Stage / Owner / Revenue). Companies are auto-created from
+ * synced email, so most have no `entity_properties` rows yet — these
+ * stubs let the panel and list render (and edit) the defaults before a
+ * value ever gets saved. Setting a value upserts the real row.
+ */
+export function buildCompanyDefaultProperties(): Property[] {
+ return COMPANY_DEFAULT_PROPERTY_DEFS.map((def) =>
+ soupPropertyToProperty({
+ definition: {
+ id: def.id,
+ display_name: def.displayName,
+ data_type: def.dataType,
+ is_metadata: false,
+ is_multi_select: false,
+ is_system: true,
+ owner: { scope: 'system' },
+ specific_entity_type: def.specificEntityType,
+ created_at: EPOCH_ZERO.toISOString(),
+ updated_at: EPOCH_ZERO.toISOString(),
+ },
+ })
+ );
+}
+
/**
* Sort properties by the defined sort order (status, priority, assignees first)
*/
diff --git a/js/app/packages/entity/src/index.ts b/js/app/packages/entity/src/index.ts
index 47652547cc..0624a8e362 100644
--- a/js/app/packages/entity/src/index.ts
+++ b/js/app/packages/entity/src/index.ts
@@ -30,8 +30,12 @@ export {
type BuildEntityDataArgs,
buildEntityData,
} from './utils/buildEntityData';
+export {
+ type CrmCompanyEntityWithProperties,
+ getCompanyOwnerId,
+ getCompanyStageOptionId,
+} from './utils/company-properties';
export { createEntityDraggable } from './utils/draggable';
-
export { unreadFilterFn } from './utils/filter';
export {
filterNotDoneNotifications,
@@ -40,6 +44,7 @@ export {
} from './utils/notification';
export { useIsShared } from './utils/shared';
export {
+ COMPANY_STAGE_OPTIONS,
getPropertyOptionLabel,
getTaskAssigneeIds,
getTaskStatusOptionId,
diff --git a/js/app/packages/entity/src/types/entity.ts b/js/app/packages/entity/src/types/entity.ts
index 93883064b9..c564b09b5c 100644
--- a/js/app/packages/entity/src/types/entity.ts
+++ b/js/app/packages/entity/src/types/entity.ts
@@ -245,6 +245,10 @@ export type CrmCompanyEntity = EntityBase & {
* endpoint. */
hidden: boolean;
domains: CrmCompanyDomain[];
+ /** CRM properties (Stage / Owner / Revenue + custom) attached to the
+ * company. Populated by the soup queries; search results don't carry
+ * them. */
+ properties?: SoupProperty[];
};
export type CrmContactEntity = EntityBase & {
diff --git a/js/app/packages/entity/src/utils/company-properties.ts b/js/app/packages/entity/src/utils/company-properties.ts
new file mode 100644
index 0000000000..46ab1e2dd0
--- /dev/null
+++ b/js/app/packages/entity/src/utils/company-properties.ts
@@ -0,0 +1,63 @@
+import { SYSTEM_PROPERTY_IDS } from '@property/constants';
+import type { CrmCompanyEntity, EntityWithProperties } from '../types/entity';
+
+export type CrmCompanyEntityWithProperties =
+ EntityWithProperties<CrmCompanyEntity>;
+
+const getCompanyPropertyByDefinitionId = (
+ entity: CrmCompanyEntityWithProperties,
+ definitionId: string
+) => {
+ return entity.properties?.find(
+ (property) => property.definition.id === definitionId
+ );
+};
+
+/**
+ * Gets the stage option id from company properties.
+ */
+export const getCompanyStageOptionId = (
+ entity: CrmCompanyEntityWithProperties
+): string | undefined => {
+ const stageProperty = getCompanyPropertyByDefinitionId(
+ entity,
+ SYSTEM_PROPERTY_IDS.STAGE
+ );
+
+ const value = stageProperty?.value;
+ if (value?.type !== 'SelectOption' || !Array.isArray(value.value)) {
+ return undefined;
+ }
+
+ const optionId = value.value[0];
+ return typeof optionId === 'string' ? optionId : undefined;
+};
+
+/**
+ * Gets the owner user id from company properties.
+ */
+export const getCompanyOwnerId = (
+ entity: CrmCompanyEntityWithProperties
+): string | undefined => {
+ const ownerProperty = getCompanyPropertyByDefinitionId(
+ entity,
+ SYSTEM_PROPERTY_IDS.COMPANY_OWNER
+ );
+
+ const value = ownerProperty?.value;
+ if (value?.type !== 'EntityReference' || !Array.isArray(value.value)) {
+ return undefined;
+ }
+
+ const reference = value.value[0];
+ if (
+ typeof reference !== 'object' ||
+ reference === null ||
+ !('entity_id' in reference) ||
+ typeof reference.entity_id !== 'string'
+ ) {
+ return undefined;
+ }
+
+ return reference.entity_id;
+};
diff --git a/js/app/packages/entity/src/utils/task-properties.ts b/js/app/packages/entity/src/utils/task-properties.ts
index 2cf2657a00..5da4aedde3 100644
--- a/js/app/packages/entity/src/utils/task-properties.ts
+++ b/js/app/packages/entity/src/utils/task-properties.ts
@@ -16,9 +16,20 @@ const TASK_PRIORITY_OPTIONS = [
{ value: PROPERTY_OPTION_IDS.PRIORITY.LOW, label: 'Low' },
] as const;
+export const COMPANY_STAGE_OPTIONS = [
+ { value: PROPERTY_OPTION_IDS.STAGE.LEAD, label: 'Lead' },
+ { value: PROPERTY_OPTION_IDS.STAGE.QUALIFIED, label: 'Qualified' },
+ { value: PROPERTY_OPTION_IDS.STAGE.DEMO, label: 'Demo' },
+ { value: PROPERTY_OPTION_IDS.STAGE.TRIAL, label: 'Trial' },
+ { value: PROPERTY_OPTION_IDS.STAGE.NEGOTIATION, label: 'Negotiation' },
+ { value: PROPERTY_OPTION_IDS.STAGE.CUSTOMER, label: 'Customer' },
+ { value: PROPERTY_OPTION_IDS.STAGE.CHURNED, label: 'Churned' },
+] as const;
+
const PROPERTY_OPTION_LABELS: Record<string, string> = {
...Object.fromEntries(TASK_STATUS_OPTIONS.map((o) => [o.value, o.label])),
...Object.fromEntries(TASK_PRIORITY_OPTIONS.map((o) => [o.value, o.label])),
+ ...Object.fromEntries(COMPANY_STAGE_OPTIONS.map((o) => [o.value, o.label])),
};
export const getPropertyOptionLabel = (
diff --git a/js/app/packages/property/src/component/propertyValue/PropertyValueIcon.tsx b/js/app/packages/property/src/component/propertyValue/PropertyValueIcon.tsx
index a9e5aa3dcb..4cbfda9402 100644
--- a/js/app/packages/property/src/component/propertyValue/PropertyValueIcon.tsx
+++ b/js/app/packages/property/src/component/propertyValue/PropertyValueIcon.tsx
@@ -16,6 +16,23 @@ type PropertyValueIconProps = {
class?: string;
};
+/** Filled dot used for CRM stage options — colored via `currentColor`. */
+const StageDot: Component<{ class?: string }> = (props) => (
+ <svg viewBox="0 0 12 12" class={props.class} aria-hidden="true">
+ <circle cx="6" cy="6" r="4" fill="currentColor" />
+ </svg>
+);
+
+const STAGE_DOT_TINTS: Record<string, string> = {
+ [PROPERTY_OPTION_IDS.STAGE.LEAD]: 'text-ink-muted',
+ [PROPERTY_OPTION_IDS.STAGE.QUALIFIED]: 'text-task',
+ [PROPERTY_OPTION_IDS.STAGE.DEMO]: 'text-note',
+ [PROPERTY_OPTION_IDS.STAGE.TRIAL]: 'text-alert-ink',
+ [PROPERTY_OPTION_IDS.STAGE.NEGOTIATION]: 'text-accent',
+ [PROPERTY_OPTION_IDS.STAGE.CUSTOMER]: 'text-success',
+ [PROPERTY_OPTION_IDS.STAGE.CHURNED]: 'text-failure-ink',
+};
+
const knownPropertyIds = new Set<string>(
Object.values(PROPERTY_OPTION_IDS).flatMap((group) => Object.values(group))
);
@@ -77,6 +94,11 @@ export const PropertyValueIcon: Component<PropertyValueIconProps> = (props) => {
class={twMerge('size-3', props.class, 'text-ink-muted')}
/>
</Match>
+
+ {/* CRM stage */}
+ <Match when={STAGE_DOT_TINTS[props.optionId]}>
+ {(tint) => <StageDot class={twMerge('size-3', props.class, tint())} />}
+ </Match>
</Switch>
);
};
diff --git a/js/app/packages/property/src/constants.ts b/js/app/packages/property/src/constants.ts
index ebb33ca866..93ec05fcbe 100644
--- a/js/app/packages/property/src/constants.ts
+++ b/js/app/packages/property/src/constants.ts
@@ -29,6 +29,10 @@ export const SYSTEM_PROPERTY_IDS = {
SENDER: '00000001-0000-0000-0000-00000000000d',
RECIPIENTS: '00000001-0000-0000-0000-00000000000e',
SUBJECT: '00000001-0000-0000-0000-00000000000f',
+ // CRM company properties
+ STAGE: '00000001-0000-0000-0000-000000000010',
+ COMPANY_OWNER: '00000001-0000-0000-0000-000000000011',
+ REVENUE: '00000001-0000-0000-0000-000000000012',
} as const;
/**
@@ -51,6 +55,11 @@ const BUILTIN_PROPERTIES_BY_BLOCK: Partial<
SYSTEM_PROPERTY_IDS.STORY_POINTS,
SYSTEM_PROPERTY_IDS.RELEVANT_DOCUMENTS,
],
+ company: [
+ SYSTEM_PROPERTY_IDS.STAGE,
+ SYSTEM_PROPERTY_IDS.COMPANY_OWNER,
+ SYSTEM_PROPERTY_IDS.REVENUE,
+ ],
} as const;
/**
@@ -65,6 +74,11 @@ const DEFAULT_PINNED_PROPERTIES_BY_BLOCK: Partial<
SYSTEM_PROPERTY_IDS.PRIORITY,
SYSTEM_PROPERTY_IDS.ASSIGNEES,
],
+ company: [
+ SYSTEM_PROPERTY_IDS.STAGE,
+ SYSTEM_PROPERTY_IDS.COMPANY_OWNER,
+ SYSTEM_PROPERTY_IDS.REVENUE,
+ ],
} as const;
/**
@@ -106,4 +120,13 @@ export const PROPERTY_OPTION_IDS = {
COMPLETED: '00000001-0000-0000-0002-000000000004',
CANCELED: '00000001-0000-0000-0002-000000000005',
},
+ STAGE: {
+ LEAD: '00000001-0000-0000-0010-000000000001',
+ QUALIFIED: '00000001-0000-0000-0010-000000000002',
+ DEMO: '00000001-0000-0000-0010-000000000003',
+ TRIAL: '00000001-0000-0000-0010-000000000004',
+ NEGOTIATION: '00000001-0000-0000-0010-000000000005',
+ CUSTOMER: '00000001-0000-0000-0010-000000000006',
+ CHURNED: '00000001-0000-0000-0010-000000000007',
+ },
} as const;
diff --git a/js/app/packages/queries/properties/entity.ts b/js/app/packages/queries/properties/entity.ts
index 2f0d637ba5..5bc4d64dbc 100644
--- a/js/app/packages/queries/properties/entity.ts
+++ b/js/app/packages/queries/properties/entity.ts
@@ -91,12 +91,11 @@ function optimisticUpdateSoupEntityProperty(
value: SoupPropertyValue
): SoupTransaction | undefined {
const current = getSoupEntityById(entityId);
- // crmCompany has no properties; channel / call are also property-less.
+ // channel / call / foreign entities are property-less.
if (
!current ||
current.tag === 'channel' ||
current.tag === 'call' ||
- current.tag === 'crmCompany' ||
current.tag === 'foreignEntity' ||
current.tag === 'channelThread' ||
!current.data.properties
diff --git a/js/app/packages/queries/soup/transform-utils.ts b/js/app/packages/queries/soup/transform-utils.ts
index 2fca7c4cf2..86eec73006 100644
--- a/js/app/packages/queries/soup/transform-utils.ts
+++ b/js/app/packages/queries/soup/transform-utils.ts
@@ -773,6 +773,7 @@ export const mapApiSoupItemToEntity = (item: DisplayableSoupItem): SoupEntity =>
domain: d.domain,
createdAt: d.createdAt,
})),
+ properties: item.data.properties,
} satisfies CrmCompanyEntity;
})
.exhaustive();
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupCrmCompany.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupCrmCompany.ts
index efc1324ff5..1c1cc18d3f 100644
--- a/js/app/packages/service-clients/service-storage/generated/schemas/soupCrmCompany.ts
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupCrmCompany.ts
@@ -8,6 +8,7 @@ import type { SoupCrmCompanyDescription } from './soupCrmCompanyDescription';
import type { SoupCrmCompanyName } from './soupCrmCompanyName';
import type { SoupCrmCompanyViewedAt } from './soupCrmCompanyViewedAt';
import type { SoupCrmDomain } from './soupCrmDomain';
+import type { SoupProperty } from './soupProperty';
/**
* A CRM company as displayed in Soup. Carries the core company
@@ -32,6 +33,9 @@ these out by default. */
/** Display name from the primary domain's directory entry, or
`None` when unresolved. */
name?: SoupCrmCompanyName;
+ /** Properties attached to this company (system CRM properties like
+Stage / Owner / Revenue plus any custom ones). */
+ properties?: SoupProperty[];
/** The id of the team that owns this company record. */
teamId: string;
/** When the company was last updated. */
diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.ts
index dd37cfc194..a90a84e3d3 100644
--- a/js/app/packages/service-clients/service-storage/generated/zod.ts
+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts
@@ -8363,6 +8363,222 @@ export const getItemsSoupResponse = zod
.describe(
"Display name from the primary domain's directory entry, or\n`None` when unresolved."
),
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe('User-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe('Team-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['SelectOption']),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['EntityReference']),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
+ )
+ .optional()
+ .describe(
+ 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
+ ),
teamId: zod
.uuid()
.describe(
@@ -10709,48 +10925,264 @@ export const postItemsSoupResponse = zod
.describe(
"Display name from the primary domain's directory entry, or\n`None` when unresolved."
),
- teamId: zod
- .uuid()
- .describe(
- 'The id of the team that owns this company record.'
- ),
- updatedAt: zod.iso
- .datetime({})
- .describe('When the company was last updated.'),
- viewedAt: zod.iso
- .datetime({})
- .nullish()
- .describe(
- 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
- ),
- })
- .describe(
- 'A CRM company as displayed in Soup. Carries the core company\nfields plus display metadata resolved from `crm_domain_directory`\nagainst the primary (earliest-created) domain.'
- ),
- tag: zod.enum(['crmCompany']),
- })
- .describe('CRM company item.'),
- zod
- .object({
- data: zod
- .object({
- createdAt: zod.iso
- .datetime({})
- .describe('Timestamp when the record was created.'),
- foreignEntityId: zod
- .string()
- .describe('Identifier assigned by the external system.'),
- foreignEntitySource: zod
- .string()
- .describe(
- 'Source system that owns the external identifier.'
- ),
- id: zod
- .uuid()
- .describe(
- 'Internal primary key for this foreign entity record.'
- ),
- metadata: zod
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe('User-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe('Team-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['SelectOption']),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['EntityReference']),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
+ )
+ .optional()
+ .describe(
+ 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
+ ),
+ teamId: zod
+ .uuid()
+ .describe(
+ 'The id of the team that owns this company record.'
+ ),
+ updatedAt: zod.iso
+ .datetime({})
+ .describe('When the company was last updated.'),
+ viewedAt: zod.iso
+ .datetime({})
+ .nullish()
+ .describe(
+ 'When the requesting user last viewed this company, or `None` if\nnever viewed. Mirrors the `viewed_at` other soup entities carry.'
+ ),
+ })
+ .describe(
+ 'A CRM company as displayed in Soup. Carries the core company\nfields plus display metadata resolved from `crm_domain_directory`\nagainst the primary (earliest-created) domain.'
+ ),
+ tag: zod.enum(['crmCompany']),
+ })
+ .describe('CRM company item.'),
+ zod
+ .object({
+ data: zod
+ .object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('Timestamp when the record was created.'),
+ foreignEntityId: zod
+ .string()
+ .describe('Identifier assigned by the external system.'),
+ foreignEntitySource: zod
+ .string()
+ .describe(
+ 'Source system that owns the external identifier.'
+ ),
+ id: zod
+ .uuid()
+ .describe(
+ 'Internal primary key for this foreign entity record.'
+ ),
+ metadata: zod
.object({})
.describe('Arbitrary metadata stored with the mapping.'),
storedForAuthEntity: zod
@@ -12564,28 +12996,244 @@ export const postItemsSoupAstResponse = zod
.describe('The id of the domain record.'),
})
.describe(
- "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
+ "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
+ )
+ )
+ .describe(
+ 'Domains associated with this company, ordered by creation time\nascending (primary first).'
+ ),
+ emailSync: zod
+ .boolean()
+ .describe(
+ 'Whether email sync is enabled for this company.'
+ ),
+ hidden: zod
+ .boolean()
+ .describe(
+ 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
+ ),
+ id: zod.uuid().describe('The id of the company.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ ),
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe('User-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe('Team-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['SelectOption']),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['EntityReference']),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
+ .optional()
.describe(
- 'Domains associated with this company, ordered by creation time\nascending (primary first).'
- ),
- emailSync: zod
- .boolean()
- .describe(
- 'Whether email sync is enabled for this company.'
- ),
- hidden: zod
- .boolean()
- .describe(
- 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
- ),
- id: zod.uuid().describe('The id of the company.'),
- name: zod
- .string()
- .nullish()
- .describe(
- "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
),
teamId: zod
.uuid()
@@ -14764,28 +15412,244 @@ export const postItemsSoupAstGroupedResponse = zod
.describe('The id of the domain record.'),
})
.describe(
- "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
+ "A CRM domain as displayed in Soup. Mirrors the crm crate's\n[`CrmDomain`] with a stable wire shape that the FE can rely on."
+ )
+ )
+ .describe(
+ 'Domains associated with this company, ordered by creation time\nascending (primary first).'
+ ),
+ emailSync: zod
+ .boolean()
+ .describe(
+ 'Whether email sync is enabled for this company.'
+ ),
+ hidden: zod
+ .boolean()
+ .describe(
+ 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
+ ),
+ id: zod.uuid().describe('The id of the company.'),
+ name: zod
+ .string()
+ .nullish()
+ .describe(
+ "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ ),
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe('User-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe('Team-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['SelectOption']),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['EntityReference']),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
)
)
+ .optional()
.describe(
- 'Domains associated with this company, ordered by creation time\nascending (primary first).'
- ),
- emailSync: zod
- .boolean()
- .describe(
- 'Whether email sync is enabled for this company.'
- ),
- hidden: zod
- .boolean()
- .describe(
- 'Whether the company is hidden from CRM listings. Soup filters\nthese out by default.'
- ),
- id: zod.uuid().describe('The id of the company.'),
- name: zod
- .string()
- .nullish()
- .describe(
- "Display name from the primary domain's directory entry, or\n`None` when unresolved."
+ 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
),
teamId: zod
.uuid()
@@ -16667,6 +17531,222 @@ export const postItemsSoupAstGroupedResponse = zod
.describe(
"Display name from the primary domain's directory entry, or\n`None` when unresolved."
),
+ properties: zod
+ .array(
+ zod
+ .object({
+ definition: zod
+ .object({
+ created_at: zod.iso.datetime({}),
+ data_type: zod
+ .enum([
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'STRING',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'TAG',
+ 'ENTITY',
+ 'LINK',
+ ])
+ .describe(
+ 'Data type for property values, determining storage and validation.'
+ ),
+ display_name: zod.string(),
+ id: zod.uuid(),
+ is_metadata: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system-generated metadata property.\nNot stored in database - computed at service layer.'
+ ),
+ is_multi_select: zod.boolean(),
+ is_system: zod
+ .boolean()
+ .describe(
+ 'Flag to indicate if this is a system property (stored in DB).'
+ ),
+ owner: zod
+ .union([
+ zod
+ .object({
+ scope: zod.enum(['user']),
+ user_id: zod.string(),
+ })
+ .describe('User-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['team']),
+ team_id: zod.uuid(),
+ })
+ .describe('Team-scoped property.'),
+ zod
+ .object({
+ scope: zod.enum(['system']),
+ })
+ .describe(
+ 'System-owned property (no user or team owner).'
+ ),
+ ])
+ .describe(
+ 'Defines who owns a property - user-scoped, team-scoped, or system.'
+ ),
+ specific_entity_type: zod
+ .union([
+ zod.null(),
+ zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ ])
+ .optional(),
+ updated_at: zod.iso.datetime({}),
+ })
+ .describe(
+ 'Property definition model (service representation).'
+ ),
+ value: zod
+ .union([
+ zod.null(),
+ zod
+ .union([
+ zod
+ .object({
+ type: zod.enum(['Boolean']),
+ value: zod
+ .boolean()
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ })
+ .describe(
+ 'Boolean value\nSerializes as: {\"type\": \"Boolean\", \"value\": true}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Number']),
+ value: zod
+ .number()
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ })
+ .describe(
+ 'Numeric value\nSerializes as: {\"type\": \"Number\", \"value\": 42.5}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['String']),
+ value: zod
+ .string()
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ })
+ .describe(
+ 'String value\nSerializes as: {\"type\": \"String\", \"value\": \"text\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Date']),
+ value: zod.iso
+ .datetime({})
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ })
+ .describe(
+ 'Date\/timestamp value\nSerializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"}'
+ ),
+ zod
+ .object({
+ type: zod.enum(['SelectOption']),
+ value: zod
+ .array(zod.uuid())
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Select option(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1)\nMulti-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['EntityReference']),
+ value: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string(),
+ entity_type: zod
+ .enum([
+ 'CHANNEL',
+ 'CHAT',
+ 'COMPANY',
+ 'DOCUMENT',
+ 'PROJECT',
+ 'TASK',
+ 'THREAD',
+ 'USER',
+ ])
+ .describe(
+ 'Type of entity that can be referenced by entity properties.'
+ ),
+ specific_message_id: zod
+ .uuid()
+ .nullish()
+ .describe(
+ 'For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread\/channel\/chat.'
+ ),
+ })
+ .describe(
+ 'Entity reference for entity-type property values.'
+ )
+ )
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Entity reference(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1)\nMulti-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+)'
+ ),
+ zod
+ .object({
+ type: zod.enum(['Link']),
+ value: zod
+ .array(zod.string())
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ })
+ .describe(
+ 'Link value(s) - always an array (check is_multi_select to determine if single or multi)\nSingle-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\"]} (length 0 or 1)\nMulti-select: {\"type\": \"Link\", \"value\": [\"https:\/\/example.com\", \"https:\/\/other.com\"]} (length 0+)'
+ ),
+ ])
+ .describe(
+ 'Property value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to\/from JSONB in the database.'
+ ),
+ ])
+ .optional(),
+ })
+ .describe(
+ 'A property attached to a Soup item.\n\nThis is a simplified representation that includes only the definition and value,\nomitting the entity property assignment metadata and options.'
+ )
+ )
+ .optional()
+ .describe(
+ 'Properties attached to this company (system CRM properties like\nStage \/ Owner \/ Revenue plus any custom ones).'
+ ),
teamId: zod
.uuid()
.describe(
diff --git a/js/app/packages/service-clients/service-storage/graphql-soup.ts b/js/app/packages/service-clients/service-storage/graphql-soup.ts
index f6c5c7bf76..0bc31c18ab 100644
--- a/js/app/packages/service-clients/service-storage/graphql-soup.ts
+++ b/js/app/packages/service-clients/service-storage/graphql-soup.ts
@@ -480,6 +480,7 @@ function mapGraphqlSoupItem(item: GraphqlSoupItem): SoupApiItem {
domain,
createdAt: entity.createdAt,
})),
+ properties: mapGraphqlProperties(entity.properties),
},
}) as SoupApiItem
)
diff --git a/js/app/packages/service-clients/service-storage/graphql/generated/graphql.ts b/js/app/packages/service-clients/service-storage/graphql/generated/graphql.ts
index 882c7cf614..9c7e1bf0e3 100644
--- a/js/app/packages/service-clients/service-storage/graphql/generated/graphql.ts
+++ b/js/app/packages/service-clients/service-storage/graphql/generated/graphql.ts
@@ -355,7 +355,7 @@ export type SoupQuery = { user: { id: string, soup: { nextCursor: string | null,
| { __typename: 'GraphqlSoupChannel', id: string, channelType: string, ownerId: string, organizationId: string | null, createdAt: string, updatedAt: string, viewedAt: string | null, interactedAt: string | null, channelName: string | null, channelTeamId: string | null, participants: Array<{ channelId: string, userId: string, role: string, joinedAt: string, leftAt: string | null }>, latestMessage: { id: string, threadId: string | null, senderId: string, content: string, createdAt: string, updatedAt: string, deletedAt: string | null, mentions: Array<string> } | null, latestNonThreadMessage: { id: string, threadId: string | null, senderId: string, content: string, createdAt: string, updatedAt: string, deletedAt: string | null, mentions: Array<string> } | null }
| { __typename: 'GraphqlSoupChannelThread', id: string, channelId: string, senderId: string, content: string, createdAt: string, updatedAt: string, effectiveUpdatedAt: string, replyCount: number }
| { __typename: 'GraphqlSoupChat', id: string, ownerId: string, projectId: string | null, isPersistent: boolean, createdAt: string, updatedAt: string, viewedAt: string | null, deletedAt: string | null, chatName: string, properties: Array<{ propertyDefinitionId: string, displayName: string, dataType: string, isMultiSelect: boolean, specificEntityType: string | null, isSystem: boolean, isMetadata: boolean, value: { kind: string, boolValue: boolean | null, numberValue: number | null, stringValue: string | null, dateValue: string | null, selectOptionIds: Array<string>, links: Array<string>, entityReferences: Array<{ entityId: string, entityType: string, specificMessageId: string | null }> } | null }> }
- | { __typename: 'GraphqlSoupCrmCompany', id: string, description: string | null, emailSync: boolean, hidden: boolean, createdAt: string, updatedAt: string, viewedAt: string | null, domains: Array<string>, crmTeamId: string, crmCompanyName: string | null }
+ | { __typename: 'GraphqlSoupCrmCompany', id: string, description: string | null, emailSync: boolean, hidden: boolean, createdAt: string, updatedAt: string, viewedAt: string | null, domains: Array<string>, crmTeamId: string, crmCompanyName: string | null, properties: Array<{ propertyDefinitionId: string, displayName: string, dataType: string, isMultiSelect: boolean, specificEntityType: string | null, isSystem: boolean, isMetadata: boolean, value: { kind: string, boolValue: boolean | null, numberValue: number | null, stringValue: string | null, dateValue: string | null, selectOptionIds: Array<string>, links: Array<string>, entityReferences: Array<{ entityId: string, entityType: string, specificMessageId: string | null }> } | null }> }
| { __typename: 'GraphqlSoupDocument', id: string, ownerId: string, fileType: string | null, projectId: string | null, createdAt: string, updatedAt: string, viewedAt: string | null, deletedAt: string | null, documentName: string, subType: { kind: string, isCompleted: boolean | null } | null, properties: Array<{ propertyDefinitionId: string, displayName: string, dataType: string, isMultiSelect: boolean, specificEntityType: string | null, isSystem: boolean, isMetadata: boolean, value: { kind: string, boolValue: boolean | null, numberValue: number | null, stringValue: string | null, dateValue: string | null, selectOptionIds: Array<string>, links: Array<string>, entityReferences: Array<{ entityId: string, entityType: string, specificMessageId: string | null }> } | null }> }
| { __typename: 'GraphqlSoupEmailThread', id: string, providerId: string | null, ownerId: string, inboxVisible: boolean, linkId: string | null, snippet: string | null, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null, isRead: boolean, isDraft: boolean, isImportant: boolean, projectId: string | null, sortTs: string, createdAt: string, updatedAt: string, viewedAt: string | null, emailName: string | null, participants: Array<{ id: string, linkId: string, name: string | null, email: string | null, sfsPhotoUrl: string | null }>, attachments: Array<{ id: string, messageId: string, providerAttachmentId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, contentId: string | null, createdAt: string }>, labels: Array<{ id: string, linkId: string, providerLabelId: string, name: string, createdAt: string, messageListVisibility: string, labelListVisibility: string, type: string }>, properties: Array<{ propertyDefinitionId: string, displayName: string, dataType: string, isMultiSelect: boolean, specificEntityType: string | null, isSystem: boolean, isMetadata: boolean, value: { kind: string, boolValue: boolean | null, numberValue: number | null, stringValue: string | null, dateValue: string | null, selectOptionIds: Array<string>, links: Array<string>, entityReferences: Array<{ entityId: string, entityType: string, specificMessageId: string | null }> } | null }> }
| { __typename: 'GraphqlSoupForeignEntity', id: string, foreignEntityId: string, foreignEntitySource: string, storedForId: string, storedForAuthEntity: string, metadata: unknown, createdAt: string, updatedAt: string }
@@ -368,4 +368,4 @@ export type SoupChannelMessageFieldsFragment = { id: string, threadId: string |
export const SoupPropertyFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"boolValue"}},{"kind":"Field","name":{"kind":"Name","value":"numberValue"}},{"kind":"Field","name":{"kind":"Name","value":"stringValue"}},{"kind":"Field","name":{"kind":"Name","value":"dateValue"}},{"kind":"Field","name":{"kind":"Name","value":"selectOptionIds"}},{"kind":"Field","name":{"kind":"Name","value":"entityReferences"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}},{"kind":"Field","name":{"kind":"Name","value":"links"}}]}}]}}]} as unknown as DocumentNode<SoupPropertyFieldsFragment, unknown>;
export const SoupChannelMessageFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}}]} as unknown as DocumentNode<SoupChannelMessageFieldsFragment, unknown>;
-export const SoupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Soup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"Field","name":{"kind":"Name","value":"entity"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"sortTs"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}},{"kind":"Field","name":{"kind":"Name","value":"hasMore"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"boolValue"}},{"kind":"Field","name":{"kind":"Name","value":"numberValue"}},{"kind":"Field","name":{"kind":"Name","value":"stringValue"}},{"kind":"Field","name":{"kind":"Name","value":"dateValue"}},{"kind":"Field","name":{"kind":"Name","value":"selectOptionIds"}},{"kind":"Field","name":{"kind":"Name","value":"entityReferences"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}},{"kind":"Field","name":{"kind":"Name","value":"links"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}}]} as unknown as DocumentNode<SoupQuery, SoupQueryVariables>;
\ No newline at end of file
+export const SoupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Soup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"Field","name":{"kind":"Name","value":"entity"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"sortTs"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}},{"kind":"Field","name":{"kind":"Name","value":"hasMore"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"boolValue"}},{"kind":"Field","name":{"kind":"Name","value":"numberValue"}},{"kind":"Field","name":{"kind":"Name","value":"stringValue"}},{"kind":"Field","name":{"kind":"Name","value":"dateValue"}},{"kind":"Field","name":{"kind":"Name","value":"selectOptionIds"}},{"kind":"Field","name":{"kind":"Name","value":"entityReferences"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}},{"kind":"Field","name":{"kind":"Name","value":"links"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}}]} as unknown as DocumentNode<SoupQuery, SoupQueryVariables>;
\ No newline at end of file
diff --git a/js/app/packages/service-clients/service-storage/graphql/soup.graphql b/js/app/packages/service-clients/service-storage/graphql/soup.graphql
index 2ade16671a..6a125a47d8 100644
--- a/js/app/packages/service-clients/service-storage/graphql/soup.graphql
+++ b/js/app/packages/service-clients/service-storage/graphql/soup.graphql
@@ -168,6 +168,9 @@ query Soup($input: SoupInput!) {
updatedAt
viewedAt
domains
+ properties {
+ ...SoupPropertyFields
+ }
}
... on GraphqlSoupForeignEntity {
id
diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.json
index 5515bb95ba..1d168b4ef3 100644
--- a/js/app/packages/service-clients/service-storage/openapi.json
+++ b/js/app/packages/service-clients/service-storage/openapi.json
@@ -18445,6 +18445,13 @@
"type": ["string", "null"],
"description": "Display name from the primary domain's directory entry, or\n`None` when unresolved."
},
+ "properties": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SoupProperty"
+ },
+ "description": "Properties attached to this company (system CRM properties like\nStage / Owner / Revenue plus any custom ones)."
+ },
"teamId": {
"type": "string",
"format": "uuid",
diff --git a/rust/cloud-storage/graphql_soup/src/objects.rs b/rust/cloud-storage/graphql_soup/src/objects.rs
index 22781bc35a..4d1455767a 100644
--- a/rust/cloud-storage/graphql_soup/src/objects.rs
+++ b/rust/cloud-storage/graphql_soup/src/objects.rs
@@ -1365,6 +1365,15 @@ impl GraphqlSoupCrmCompany {
.collect()
}
+ async fn properties(&self) -> Vec<GraphqlSoupProperty> {
+ self.0
+ .properties
+ .iter()
+ .cloned()
+ .map(GraphqlSoupProperty)
+ .collect()
+ }
+
async fn notifications(&self) -> Vec<GraphqlSoupNotification> {
Vec::new()
}
diff --git a/rust/cloud-storage/macro_db_client/migrations/20260707183206_seed_crm_company_system_properties.sql b/rust/cloud-storage/macro_db_client/migrations/20260707183206_seed_crm_company_system_properties.sql
new file mode 100644
index 0000000000..334b6a0e02
--- /dev/null
+++ b/rust/cloud-storage/macro_db_client/migrations/20260707183206_seed_crm_company_system_properties.sql
@@ -0,0 +1,119 @@
+-- Seed system property definitions for CRM companies.
+-- UUIDs mirror system_properties::SystemPropertyKey (Stage 0x10, Owner 0x11,
+-- Revenue 0x12) and StageOption (options group 0010).
+
+-- Stage (single-select string)
+INSERT INTO property_definitions (
+ id,
+ team_id,
+ user_id,
+ display_name,
+ data_type,
+ is_multi_select,
+ specific_entity_type,
+ is_system
+ )
+VALUES (
+ '00000001-0000-0000-0000-000000000010',
+ NULL,
+ NULL,
+ 'Stage',
+ 'SELECT_STRING',
+ false,
+ NULL,
+ true
+ );
+
+-- Owner (single entity reference to a user on the team)
+INSERT INTO property_definitions (
+ id,
+ team_id,
+ user_id,
+ display_name,
+ data_type,
+ is_multi_select,
+ specific_entity_type,
+ is_system
+ )
+VALUES (
+ '00000001-0000-0000-0000-000000000011',
+ NULL,
+ NULL,
+ 'Owner',
+ 'ENTITY',
+ false,
+ 'USER',
+ true
+ );
+
+-- Revenue (number, dollar value)
+INSERT INTO property_definitions (
+ id,
+ team_id,
+ user_id,
+ display_name,
+ data_type,
+ is_multi_select,
+ specific_entity_type,
+ is_system
+ )
+VALUES (
+ '00000001-0000-0000-0000-000000000012',
+ NULL,
+ NULL,
+ 'Revenue',
+ 'NUMBER',
+ false,
+ NULL,
+ true
+ );
+
+-- Stage options
+INSERT INTO property_options (
+ id,
+ property_definition_id,
+ display_order,
+ string_value
+ )
+VALUES (
+ '00000001-0000-0000-0010-000000000001',
+ '00000001-0000-0000-0000-000000000010',
+ 0,
+ 'Lead'
+ ),
+ (
+ '00000001-0000-0000-0010-000000000002',
+ '00000001-0000-0000-0000-000000000010',
+ 1,
+ 'Qualified'
+ ),
+ (
+ '00000001-0000-0000-0010-000000000003',
+ '00000001-0000-0000-0000-000000000010',
+ 2,
+ 'Demo'
+ ),
+ (
+ '00000001-0000-0000-0010-000000000004',
+ '00000001-0000-0000-0000-000000000010',
+ 3,
+ 'Trial'
+ ),
+ (
+ '00000001-0000-0000-0010-000000000005',
+ '00000001-0000-0000-0000-000000000010',
+ 4,
+ 'Negotiation'
+ ),
+ (
+ '00000001-0000-0000-0010-000000000006',
+ '00000001-0000-0000-0000-000000000010',
+ 5,
+ 'Customer'
+ ),
+ (
+ '00000001-0000-0000-0010-000000000007',
+ '00000001-0000-0000-0000-000000000010',
+ 6,
+ 'Churned'
+ );
diff --git a/rust/cloud-storage/models_soup/src/crm_company.rs b/rust/cloud-storage/models_soup/src/crm_company.rs
index 2078dcef5f..5883122cfe 100644
--- a/rust/cloud-storage/models_soup/src/crm_company.rs
+++ b/rust/cloud-storage/models_soup/src/crm_company.rs
@@ -1,3 +1,4 @@
+use crate::SoupProperty;
use chrono::{DateTime, Utc};
use crm::domain::model::{CrmCompanyForSoup, CrmDomain};
use serde::{Deserialize, Serialize};
@@ -61,6 +62,10 @@ pub struct SoupCrmCompany {
/// Domains associated with this company, ordered by creation time
/// ascending (primary first).
pub domains: Vec<SoupCrmDomain>,
+ /// Properties attached to this company (system CRM properties like
+ /// Stage / Owner / Revenue plus any custom ones).
+ #[serde(default)]
+ pub properties: Vec<SoupProperty>,
}
impl From<CrmCompanyForSoup> for SoupCrmCompany {
@@ -86,6 +91,7 @@ impl From<CrmCompanyForSoup> for SoupCrmCompany {
.into_iter()
.map(SoupCrmDomain::from)
.collect(),
+ properties: Vec::new(),
}
}
}
diff --git a/rust/cloud-storage/models_soup/src/item.rs b/rust/cloud-storage/models_soup/src/item.rs
index 57de2f1088..e2c324ed52 100644
--- a/rust/cloud-storage/models_soup/src/item.rs
+++ b/rust/cloud-storage/models_soup/src/item.rs
@@ -220,8 +220,10 @@ impl SoupItem {
SoupItem::Channel(_) => None,
SoupItem::ChannelThread(_) => None,
SoupItem::Call(_) => None,
- // CRM companies are not in entity_properties.
- SoupItem::CrmCompany(_) => None,
+ SoupItem::CrmCompany(c) => Some(EntityReference::new(
+ c.id.to_string(),
+ PropertiesEntityType::Company,
+ )),
SoupItem::ForeignEntity(_) => None,
}
}
diff --git a/rust/cloud-storage/properties/src/domain/service_impl/helpers.rs b/rust/cloud-storage/properties/src/domain/service_impl/helpers.rs
index 6f2dab0798..0cfb15368e 100644
--- a/rust/cloud-storage/properties/src/domain/service_impl/helpers.rs
+++ b/rust/cloud-storage/properties/src/domain/service_impl/helpers.rs
@@ -22,5 +22,13 @@ pub fn is_property_applicable_to(property_id: Uuid, entity_type: EntityType) ->
return entity_type == EntityType::Task;
}
+ // CRM-company-only properties: Stage, Owner, Revenue
+ if property_id == SystemPropertyKey::STAGE_UUID
+ || property_id == SystemPropertyKey::COMPANY_OWNER_UUID
+ || property_id == SystemPropertyKey::REVENUE_UUID
+ {
+ return entity_type == EntityType::Company;
+ }
+
true
}
diff --git a/rust/cloud-storage/properties/src/outbound/permission_service.rs b/rust/cloud-storage/properties/src/outbound/permission_service.rs
index 551f80b051..9350aa099d 100644
--- a/rust/cloud-storage/properties/src/outbound/permission_service.rs
+++ b/rust/cloud-storage/properties/src/outbound/permission_service.rs
@@ -38,7 +38,10 @@ fn map_entity_type(entity_type: EntityType) -> Option<ModelEntityType> {
EntityType::Thread => Some(ModelEntityType::EmailThread),
EntityType::Channel => Some(ModelEntityType::Channel),
EntityType::Task => Some(ModelEntityType::Document), // tasks use document permissions
- EntityType::Company | EntityType::User => None,
+ // CRM company access is resolved from the owning team's membership
+ // (member → View, admin → Edit, owner → Owner).
+ EntityType::Company => Some(ModelEntityType::CrmCompany),
+ EntityType::User => None,
}
}
diff --git a/rust/cloud-storage/properties_service/src/api/permissions.rs b/rust/cloud-storage/properties_service/src/api/permissions.rs
index b84dae9e3e..33322be6dc 100644
--- a/rust/cloud-storage/properties_service/src/api/permissions.rs
+++ b/rust/cloud-storage/properties_service/src/api/permissions.rs
@@ -96,7 +96,10 @@ fn map_entity_type(entity_type: EntityType) -> Option<ModelEntityType> {
EntityType::Thread => Some(ModelEntityType::EmailThread),
EntityType::Channel => Some(ModelEntityType::Channel),
EntityType::Task => Some(ModelEntityType::Document), // tasks use document permissions
- EntityType::Company | EntityType::User => None,
+ // CRM company access is resolved from the owning team's membership
+ // (member → View, admin → Edit, owner → Owner).
+ EntityType::Company => Some(ModelEntityType::CrmCompany),
+ EntityType::User => None,
}
}
diff --git a/rust/cloud-storage/schema.graphql b/rust/cloud-storage/schema.graphql
index 2c9a321adb..e3dd5ecd2b 100644
--- a/rust/cloud-storage/schema.graphql
+++ b/rust/cloud-storage/schema.graphql
@@ -442,6 +442,7 @@ type GraphqlSoupCrmCompany {
updatedAt: String!
viewedAt: String
domains: [String!]!
+ properties: [GraphqlSoupProperty!]!
notifications: [GraphqlSoupNotification!]!
}
diff --git a/rust/cloud-storage/soup/src/domain/service.rs b/rust/cloud-storage/soup/src/domain/service.rs
index 998902f260..2eb260fa06 100644
--- a/rust/cloud-storage/soup/src/domain/service.rs
+++ b/rust/cloud-storage/soup/src/domain/service.rs
@@ -447,25 +447,38 @@ where
limit,
} = req;
- Ok(Either::Right(
- self.crm_service
- .list_companies_for_soup(
- &access,
- user_id.as_ref(),
- &company_ids,
- hidden,
- sort,
- cursor,
- limit,
- )
+ let mut items: Vec<SoupItem> = self
+ .crm_service
+ .list_companies_for_soup(
+ &access,
+ user_id.as_ref(),
+ &company_ids,
+ hidden,
+ sort,
+ cursor,
+ limit,
+ )
+ .await
+ .map_err(|_| SoupErr::CrmErr)?
+ .into_iter()
+ .map(|company| SoupItem::CrmCompany(SoupCrmCompany::from(company)))
+ .collect();
+
+ // Companies are fetched outside the main soup queries (which hydrate
+ // their own items), so attach entity properties here.
+ if !items.is_empty() {
+ self.soup_storage
+ .populate_properties(user_id, &mut items)
.await
- .map_err(|_| SoupErr::CrmErr)?
- .into_iter()
- .map(|company| FrecencySoupItem {
- item: SoupItem::CrmCompany(SoupCrmCompany::from(company)),
- frecency_score: None,
- }),
- ))
+ .map_err(anyhow::Error::from)?;
+ }
+
+ Ok(Either::Right(items.into_iter().map(|item| {
+ FrecencySoupItem {
+ item,
+ frecency_score: None,
+ }
+ })))
}
#[tracing::instrument(err, skip(self, req))]
diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs
index b6ec3ef439..000d73cc00 100644
--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs
+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs
@@ -205,11 +205,11 @@ pub(crate) async fn populate_properties(
SoupItem::Project(x) => properties_map.get(&x.id.to_string()),
SoupItem::EmailThread(x) => properties_map.get(&x.thread.id.to_string()),
SoupItem::Chat(x) => properties_map.get(&x.id.to_string()),
- // Channels, calls, CRM companies, and foreign entities are not in entity_properties.
+ SoupItem::CrmCompany(x) => properties_map.get(&x.id.to_string()),
+ // Channels, calls, and foreign entities are not in entity_properties.
SoupItem::Channel(_)
| SoupItem::ChannelThread(_)
| SoupItem::Call(_)
- | SoupItem::CrmCompany(_)
| SoupItem::ForeignEntity(_) => None,
};
if let Some(props) = props {
@@ -220,10 +220,10 @@ pub(crate) async fn populate_properties(
SoupItem::Project(x) => x.properties = soup_props,
SoupItem::EmailThread(x) => x.properties = soup_props,
SoupItem::Chat(x) => x.properties = soup_props,
+ SoupItem::CrmCompany(x) => x.properties = soup_props,
SoupItem::Channel(_)
| SoupItem::ChannelThread(_)
| SoupItem::Call(_)
- | SoupItem::CrmCompany(_)
| SoupItem::ForeignEntity(_) => {}
}
}
diff --git a/rust/cloud-storage/system_properties/src/domain/model/constants/mod.rs b/rust/cloud-storage/system_properties/src/domain/model/constants/mod.rs
index e110c7955d..94c0ee0cc9 100644
--- a/rust/cloud-storage/system_properties/src/domain/model/constants/mod.rs
+++ b/rust/cloud-storage/system_properties/src/domain/model/constants/mod.rs
@@ -3,5 +3,5 @@
mod options;
mod system_property_key;
-pub use options::{EffortOption, PriorityOption, StatusOption};
+pub use options::{EffortOption, PriorityOption, StageOption, StatusOption};
pub use system_property_key::SystemPropertyKey;
diff --git a/rust/cloud-storage/system_properties/src/domain/model/constants/options/mod.rs b/rust/cloud-storage/system_properties/src/domain/model/constants/options/mod.rs
index 55dab23cd4..5c5a836925 100644
--- a/rust/cloud-storage/system_properties/src/domain/model/constants/options/mod.rs
+++ b/rust/cloud-storage/system_properties/src/domain/model/constants/options/mod.rs
@@ -2,8 +2,10 @@
mod effort;
mod priority;
+mod stage;
mod status;
pub use effort::EffortOption;
pub use priority::PriorityOption;
+pub use stage::StageOption;
pub use status::StatusOption;
diff --git a/rust/cloud-storage/system_properties/src/domain/model/constants/options/stage.rs b/rust/cloud-storage/system_properties/src/domain/model/constants/options/stage.rs
new file mode 100644
index 0000000000..9ada87a7ae
--- /dev/null
+++ b/rust/cloud-storage/system_properties/src/domain/model/constants/options/stage.rs
@@ -0,0 +1,84 @@
+//! CRM stage option enum.
+
+use serde::{Deserialize, Serialize};
+use uuid::Uuid;
+
+/// Type-safe enum for the CRM Stage property options.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum StageOption {
+ Lead,
+ Qualified,
+ Demo,
+ Trial,
+ Negotiation,
+ Customer,
+ Churned,
+}
+
+impl TryFrom<&str> for StageOption {
+ type Error = String;
+
+ fn try_from(s: &str) -> Result<Self, Self::Error> {
+ match s {
+ "Lead" | "lead" => Ok(Self::Lead),
+ "Qualified" | "qualified" => Ok(Self::Qualified),
+ "Demo" | "demo" => Ok(Self::Demo),
+ "Trial" | "trial" => Ok(Self::Trial),
+ "Negotiation" | "negotiation" => Ok(Self::Negotiation),
+ "Customer" | "customer" => Ok(Self::Customer),
+ "Churned" | "churned" => Ok(Self::Churned),
+ _ => Err(format!("unknown stage option: {s}")),
+ }
+ }
+}
+
+impl StageOption {
+ pub const LEAD_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0010_000000000001);
+ pub const QUALIFIED_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0010_000000000002);
+ pub const DEMO_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0010_000000000003);
+ pub const TRIAL_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0010_000000000004);
+ pub const NEGOTIATION_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0010_000000000005);
+ pub const CUSTOMER_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0010_000000000006);
+ pub const CHURNED_UUID: Uuid = Uuid::from_u128(0x00000001_0000_0000_0010_000000000007);
+
+ /// Get the UUID for this option.
+ pub const fn uuid(&self) -> Uuid {
+ match self {
+ Self::Lead => Self::LEAD_UUID,
+ Self::Qualified => Self::QUALIFIED_UUID,
+ Self::Demo => Self::DEMO_UUID,
+ Self::Trial => Self::TRIAL_UUID,
+ Self::Negotiation => Self::NEGOTIATION_UUID,
+ Self::Customer => Self::CUSTOMER_UUID,
+ Self::Churned => Self::CHURNED_UUID,
+ }
+ }
+
+ /// Get the display value for this option.
+ pub const fn display_value(&self) -> &'static str {
+ match self {
+ Self::Lead => "Lead",
+ Self::Qualified => "Qualified",
+ Self::Demo => "Demo",
+ Self::Trial => "Trial",
+ Self::Negotiation => "Negotiation",
+ Self::Customer => "Customer",
+ Self::Churned => "Churned",
+ }
+ }
+
+ /// Try to get a StageOption from an option UUID.
+ pub fn from_uuid(uuid: Uuid) -> Option<Self> {
+ match uuid {
+ u if u == Self::LEAD_UUID => Some(Self::Lead),
+ u if u == Self::QUALIFIED_UUID => Some(Self::Qualified),
+ u if u == Self::DEMO_UUID => Some(Self::Demo),
+ u if u == Self::TRIAL_UUID => Some(Self::Trial),
+ u if u == Self::NEGOTIATION_UUID => Some(Self::Negotiation),
+ u if u == Self::CUSTOMER_UUID => Some(Self::Customer),
+ u if u == Self::CHURNED_UUID => Some(Self::Churned),
+ _ => None,
+ }
+ }
+}
diff --git a/rust/cloud-storage/system_properties/src/domain/model/constants/system_property_key.rs b/rust/cloud-storage/system_properties/src/domain/model/constants/system_property_key.rs
index 90820a3ee7..228d12b9bc 100644
--- a/rust/cloud-storage/system_properties/src/domain/model/constants/system_property_key.rs
+++ b/rust/cloud-storage/system_properties/src/domain/model/constants/system_property_key.rs
@@ -95,6 +95,11 @@ define_system_properties! {
Sender, SENDER_UUID, 0x0d, "Sender";
Recipients, RECIPIENTS_UUID, 0x0e, "Recipients";
Subject, SUBJECT_UUID, 0x0f, "Subject";
+
+ // CRM companies
+ Stage, STAGE_UUID, 0x10, "Stage";
+ CompanyOwner, COMPANY_OWNER_UUID, 0x11, "Owner";
+ Revenue, REVENUE_UUID, 0x12, "Revenue";
}
impl SystemPropertyKey {
@@ -116,6 +121,11 @@ impl SystemPropertyKey {
Self::STORY_POINTS_UUID,
Self::RELEVANT_DOCUMENTS_UUID,
],
+ EntityType::Company => &[
+ Self::STAGE_UUID,
+ Self::COMPANY_OWNER_UUID,
+ Self::REVENUE_UUID,
+ ],
// Other entity types don't have required properties yet
// Add new cases here as needed:
// EntityType::Email => &[...],
@@ -161,7 +171,7 @@ mod tests {
#[test]
fn test_all_system_property_keys_returns_all_uuids() {
let all_keys = SystemPropertyKey::all_system_property_keys();
- assert_eq!(all_keys.len(), 15);
+ assert_eq!(all_keys.len(), 18);
assert!(all_keys.contains(&SystemPropertyKey::ASSIGNEES_UUID));
assert!(all_keys.contains(&SystemPropertyKey::STATUS_UUID));
assert!(all_keys.contains(&SystemPropertyKey::PRIORITY_UUID));
@@ -177,6 +187,18 @@ mod tests {
assert!(all_keys.contains(&SystemPropertyKey::SENDER_UUID));
assert!(all_keys.contains(&SystemPropertyKey::RECIPIENTS_UUID));
assert!(all_keys.contains(&SystemPropertyKey::SUBJECT_UUID));
+ assert!(all_keys.contains(&SystemPropertyKey::STAGE_UUID));
+ assert!(all_keys.contains(&SystemPropertyKey::COMPANY_OWNER_UUID));
+ assert!(all_keys.contains(&SystemPropertyKey::REVENUE_UUID));
+ }
+
+ #[test]
+ fn test_required_property_ids_for_company() {
+ let required = SystemPropertyKey::required_property_ids_for_entity(EntityType::Company);
+ assert_eq!(required.len(), 3);
+ assert!(required.contains(&SystemPropertyKey::STAGE_UUID));
+ assert!(required.contains(&SystemPropertyKey::COMPANY_OWNER_UUID));
+ assert!(required.contains(&SystemPropertyKey::REVENUE_UUID));
}
#[test]
@@ -261,6 +283,9 @@ mod tests {
SystemPropertyKey::Sender,
SystemPropertyKey::Recipients,
SystemPropertyKey::Subject,
+ SystemPropertyKey::Stage,
+ SystemPropertyKey::CompanyOwner,
+ SystemPropertyKey::Revenue,
];
for variant in variants {
diff --git a/rust/cloud-storage/system_properties/src/domain/model/mod.rs b/rust/cloud-storage/system_properties/src/domain/model/mod.rs
index 1c6f3a9791..fb131b35ca 100644
--- a/rust/cloud-storage/system_properties/src/domain/model/mod.rs
+++ b/rust/cloud-storage/system_properties/src/domain/model/mod.rs
@@ -5,7 +5,7 @@ mod error;
mod inbound;
mod repository;
-pub use constants::{EffortOption, PriorityOption, StatusOption, SystemPropertyKey};
+pub use constants::{EffortOption, PriorityOption, StageOption, StatusOption, SystemPropertyKey};
pub use error::SystemPropertyError;
pub use inbound::{EmailAttachmentInput, EmailAttachmentProperty, SourceEntity};
pub use repository::PropertyRow;
diff --git a/rust/cloud-storage/system_properties/src/lib.rs b/rust/cloud-storage/system_properties/src/lib.rs
index c8fd77b539..7084af525b 100644
--- a/rust/cloud-storage/system_properties/src/lib.rs
+++ b/rust/cloud-storage/system_properties/src/lib.rs
@@ -48,7 +48,7 @@ pub mod outbound;
pub use domain::model::PropertyRow;
pub use domain::model::{
EffortOption, EmailAttachmentInput, EmailAttachmentProperty, PriorityOption, SourceEntity,
- StatusOption, SystemPropertyError, SystemPropertyKey,
+ StageOption, StatusOption, SystemPropertyError, SystemPropertyKey,
};
pub use domain::port::SystemPropertiesRepository;
pub use domain::service::{SystemPropertiesService, SystemPropertiesServiceImpl};