@opencxh/domain 1.277.0 → 1.278.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities/company/types.d.ts +5 -0
- package/dist/entities/contact/index.d.ts +3 -0
- package/dist/entities/contact/lifecycle.d.ts +9 -0
- package/dist/entities/contact/name.d.ts +3 -0
- package/dist/entities/contact/segment.d.ts +32 -0
- package/dist/entities/contact/types.d.ts +6 -0
- package/dist/index.cjs +16 -16
- package/dist/index.js +1269 -1242
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PostalAddress } from '../organization/types';
|
|
2
2
|
import { OwnerScope } from '../scope/types';
|
|
3
|
+
/** Same meaning as {@link ContactOrigin}: `shadow` is a lazily cached hit, a landed row is `own`. */
|
|
4
|
+
export type CompanyOrigin = "own" | "shadow";
|
|
3
5
|
/** Where a company row came from. `local` is a row somebody created by hand. */
|
|
4
6
|
export interface CompanySource {
|
|
5
7
|
providerId: string;
|
|
@@ -40,6 +42,9 @@ export interface Company {
|
|
|
40
42
|
externalIds: string[];
|
|
41
43
|
ownerScope: OwnerScope;
|
|
42
44
|
source: CompanySource;
|
|
45
|
+
origin?: CompanyOrigin;
|
|
46
|
+
/** The group this company belongs to. One level up per row; a cycle is refused on write. */
|
|
47
|
+
parentCompanyId?: string;
|
|
43
48
|
/**
|
|
44
49
|
* Where the company sits. Needed by anything that puts this company on paper — a quote's
|
|
45
50
|
* recipient block is the first, and the issue gate refuses a document with a hole in it.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a person stands with us. `lead` has not been qualified yet; qualifying (a deal is made)
|
|
3
|
+
* moves it to `opportunity`. `customer` and `former` are set by hand or by a rule.
|
|
4
|
+
*/
|
|
5
|
+
export declare const LIFECYCLE_STAGES: readonly ["lead", "opportunity", "customer", "former"];
|
|
6
|
+
export type LifecycleStage = (typeof LIFECYCLE_STAGES)[number];
|
|
7
|
+
/** How far a lead is worked; only meaningful while the stage is `lead`. */
|
|
8
|
+
export declare const LEAD_STATUSES: readonly ["new", "working", "unqualified"];
|
|
9
|
+
export type LeadStatus = (typeof LEAD_STATUSES)[number];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SavedView, SavedViewSort } from '../saved-view/types';
|
|
2
|
+
/**
|
|
3
|
+
* A crm segment: a {@link SavedView} over contacts or companies. It stores the question, never
|
|
4
|
+
* the rows — whoever matches later is in it. One filter shape for both lists; `SEGMENT_FILTER_KEYS`
|
|
5
|
+
* says which keys a kind reads, and the server drops the rest.
|
|
6
|
+
*/
|
|
7
|
+
export type SegmentKind = "contact" | "company";
|
|
8
|
+
/** Multi-value filters: empty or absent = no filter on that axis. */
|
|
9
|
+
export declare const SEGMENT_LIST_FILTERS: readonly ["stages", "leadStatuses", "sources", "scopes", "cities", "parentCompanyIds"];
|
|
10
|
+
export type SegmentListFilter = (typeof SEGMENT_LIST_FILTERS)[number];
|
|
11
|
+
/** Yes/no filters that need another store to answer: open deals in work, people at a company. */
|
|
12
|
+
export declare const SEGMENT_PRESENCE_FILTERS: readonly ["openDeal", "hasContacts"];
|
|
13
|
+
export type SegmentPresenceFilter = (typeof SEGMENT_PRESENCE_FILTERS)[number];
|
|
14
|
+
export type SegmentFilters = {
|
|
15
|
+
search?: string;
|
|
16
|
+
/** Created in the last N days; relative, so a saved segment stays current. */
|
|
17
|
+
createdWithinDays?: number;
|
|
18
|
+
/** Select custom fields: field key → accepted values. */
|
|
19
|
+
fields?: Record<string, string[]>;
|
|
20
|
+
} & Partial<Record<SegmentListFilter, string[]>> & Partial<Record<SegmentPresenceFilter, "yes" | "no">>;
|
|
21
|
+
/** Which filters each list offers. `sources` holds provider ids (`local`, `hubspot`). */
|
|
22
|
+
export declare const SEGMENT_FILTER_KEYS: Record<SegmentKind, readonly string[]>;
|
|
23
|
+
export declare const SEGMENT_SORT_FIELDS: readonly ["updatedAt", "createdAt", "name"];
|
|
24
|
+
export type SegmentSortField = (typeof SEGMENT_SORT_FIELDS)[number];
|
|
25
|
+
export type SegmentSort = SavedViewSort<SegmentSortField>;
|
|
26
|
+
export declare const SEGMENT_LAYOUTS: readonly ["list"];
|
|
27
|
+
export type SegmentLayout = (typeof SEGMENT_LAYOUTS)[number];
|
|
28
|
+
export type CrmSegment = SavedView<SegmentFilters, SegmentLayout, SegmentSortField> & {
|
|
29
|
+
kind: SegmentKind;
|
|
30
|
+
};
|
|
31
|
+
/** True when a filter narrows anything; an empty segment is the plain list. */
|
|
32
|
+
export declare function segmentIsEmpty(filters: SegmentFilters): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommunicationScheme } from '../../platform/communication';
|
|
2
2
|
import { OwnerScope } from '../scope/types';
|
|
3
|
+
import { LeadStatus, LifecycleStage } from './lifecycle';
|
|
3
4
|
export interface ContactEndpoint {
|
|
4
5
|
scheme: CommunicationScheme;
|
|
5
6
|
resource: string;
|
|
@@ -69,6 +70,11 @@ export interface Contact {
|
|
|
69
70
|
*/
|
|
70
71
|
locale?: string;
|
|
71
72
|
origin?: ContactOrigin;
|
|
73
|
+
jobTitle?: string;
|
|
74
|
+
lifecycleStage?: LifecycleStage;
|
|
75
|
+
leadStatus?: LeadStatus;
|
|
76
|
+
/** When a deal was first made for this person (`POST /contact/:id/qualify`). */
|
|
77
|
+
qualifiedAt?: number;
|
|
72
78
|
/** When a shadow row last saw its source. There is no refresh job; touching refreshes. */
|
|
73
79
|
syncedAt?: number;
|
|
74
80
|
}
|