@trii/types 2.10.803 → 2.10.804
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/Sales/Runtime.d.ts +10 -0
- package/dist/Sales/Runtime.js +2 -0
- package/dist/Sales/Settings.d.ts +78 -0
- package/dist/Sales/Settings.js +2 -0
- package/dist/Sales/Workspace.d.ts +163 -0
- package/dist/Sales/Workspace.js +2 -0
- package/dist/Sales/index.d.ts +3 -0
- package/dist/Sales/index.js +3 -0
- package/dist/Search.d.ts +42 -0
- package/dist/Search.js +17 -0
- package/dist/Users/UserProfile.d.ts +12 -8
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Health contract shared by the Sales API, processor and microfrontend. */
|
|
2
|
+
export interface ISalesServiceHealth {
|
|
3
|
+
service: 'sales-api' | 'sales-processor';
|
|
4
|
+
status: 'ok' | 'unavailable';
|
|
5
|
+
mode: 'scaffold' | 'development';
|
|
6
|
+
database?: 'ok' | 'unavailable';
|
|
7
|
+
version: string;
|
|
8
|
+
startedAt: string;
|
|
9
|
+
lastTickAt?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export interface ISalesPreferences {
|
|
2
|
+
defaultCurrency: string;
|
|
3
|
+
timeZone: string;
|
|
4
|
+
defaultPipelineId: string | null;
|
|
5
|
+
lossReasonMode: 'TEXT' | 'CATALOG';
|
|
6
|
+
board: {
|
|
7
|
+
showNumber: boolean;
|
|
8
|
+
showContact: boolean;
|
|
9
|
+
showAmount: boolean;
|
|
10
|
+
showClosedStages: boolean;
|
|
11
|
+
pageSize: 25 | 50 | 100;
|
|
12
|
+
density: 'COMFORTABLE' | 'COMPACT';
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface ISalesCatalogItem {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
color: string;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
detailRequired: boolean;
|
|
21
|
+
version: number;
|
|
22
|
+
}
|
|
23
|
+
export type SalesCatalogKind = 'tags' | 'loss-reasons';
|
|
24
|
+
export interface ISalesCatalogInput {
|
|
25
|
+
name: string;
|
|
26
|
+
color: string;
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
detailRequired?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type SalesFieldType = 'TEXT' | 'TEXTAREA' | 'NUMBER' | 'DATE' | 'SELECT' | 'BOOLEAN';
|
|
31
|
+
export type SalesFieldValue = string | number | boolean | null;
|
|
32
|
+
export interface ISalesFieldInput {
|
|
33
|
+
name: string;
|
|
34
|
+
type: SalesFieldType;
|
|
35
|
+
options: string[];
|
|
36
|
+
requiredStageIds: string[];
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface ISalesFieldDefinition extends ISalesFieldInput {
|
|
40
|
+
id: string;
|
|
41
|
+
version: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ISalesSettingsSnapshot {
|
|
44
|
+
version: number;
|
|
45
|
+
preferences: ISalesPreferences;
|
|
46
|
+
fields: ISalesFieldDefinition[];
|
|
47
|
+
tags: ISalesCatalogItem[];
|
|
48
|
+
lossReasons: ISalesCatalogItem[];
|
|
49
|
+
}
|
|
50
|
+
export interface ISalesSettingsAudit {
|
|
51
|
+
id: string;
|
|
52
|
+
resource: string;
|
|
53
|
+
resourceId: string;
|
|
54
|
+
actorId: string;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
changes: {
|
|
57
|
+
before: unknown;
|
|
58
|
+
after: unknown;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface ISalesGeneralSettings {
|
|
62
|
+
version: number;
|
|
63
|
+
preferences: Omit<ISalesPreferences, 'board'>;
|
|
64
|
+
}
|
|
65
|
+
export interface ISalesBoardSettings {
|
|
66
|
+
version: number;
|
|
67
|
+
board: ISalesPreferences['board'];
|
|
68
|
+
}
|
|
69
|
+
export interface ISalesBoardOptions {
|
|
70
|
+
preferences: Pick<ISalesPreferences, 'board' | 'defaultPipelineId'>;
|
|
71
|
+
tags: ISalesCatalogItem[];
|
|
72
|
+
}
|
|
73
|
+
export interface ISalesLeadFormOptions {
|
|
74
|
+
preferences: Pick<ISalesPreferences, 'defaultCurrency' | 'timeZone' | 'lossReasonMode'>;
|
|
75
|
+
fields: ISalesFieldDefinition[];
|
|
76
|
+
tags: ISalesCatalogItem[];
|
|
77
|
+
lossReasons: ISalesCatalogItem[];
|
|
78
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { IContact, IBusiness } from '../Contacts/contacts';
|
|
2
|
+
import type { SalesFieldValue } from './Settings';
|
|
3
|
+
/** Sales v1 HTTP contracts. Dates are ISO strings; money is a decimal string. */
|
|
4
|
+
export type SalesStageKind = 'OPEN' | 'WON' | 'LOST';
|
|
5
|
+
export interface ISalesPipelineStage {
|
|
6
|
+
id: string;
|
|
7
|
+
pipelineId: string;
|
|
8
|
+
name: string;
|
|
9
|
+
position: number;
|
|
10
|
+
kind: SalesStageKind;
|
|
11
|
+
color: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ISalesPipeline {
|
|
14
|
+
id: string;
|
|
15
|
+
spaceId: string;
|
|
16
|
+
name: string;
|
|
17
|
+
version: number;
|
|
18
|
+
stages: ISalesPipelineStage[];
|
|
19
|
+
createdAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ISalesCreatePipeline {
|
|
23
|
+
name: string;
|
|
24
|
+
stages: {
|
|
25
|
+
name: string;
|
|
26
|
+
kind: SalesStageKind;
|
|
27
|
+
color?: string;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
export interface ISalesUpdatePipeline {
|
|
31
|
+
expectedVersion: number;
|
|
32
|
+
name: string;
|
|
33
|
+
stages: {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
color: string;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
/** References to the shared Contacts module; names are snapshots, not a second directory. */
|
|
40
|
+
export type ISalesContactReference = Pick<IContact, 'id' | 'name'>;
|
|
41
|
+
export type ISalesCompanyReference = Pick<IBusiness, 'id' | 'name'>;
|
|
42
|
+
export interface ISalesLeadLinks {
|
|
43
|
+
contactIds: string[];
|
|
44
|
+
mainContactId: string | null;
|
|
45
|
+
companyId: string | null;
|
|
46
|
+
}
|
|
47
|
+
export interface ISalesLeadAssociations {
|
|
48
|
+
contacts: ISalesContactReference[];
|
|
49
|
+
mainContactId: string | null;
|
|
50
|
+
company: ISalesCompanyReference | null;
|
|
51
|
+
}
|
|
52
|
+
export interface ISalesLeadRecord {
|
|
53
|
+
id: string;
|
|
54
|
+
spaceId: string;
|
|
55
|
+
number: number;
|
|
56
|
+
pipelineId: string;
|
|
57
|
+
stageId: string;
|
|
58
|
+
title: string;
|
|
59
|
+
description: string;
|
|
60
|
+
contactName: string | null;
|
|
61
|
+
associations: ISalesLeadAssociations;
|
|
62
|
+
contactId: string | null;
|
|
63
|
+
assigneeId: string | null;
|
|
64
|
+
amount: string;
|
|
65
|
+
currency: string;
|
|
66
|
+
origin: 'MANUAL' | 'API';
|
|
67
|
+
customFields: Record<string, SalesFieldValue>;
|
|
68
|
+
tagIds: string[];
|
|
69
|
+
lossReasonId: string | null;
|
|
70
|
+
lossReason: string | null;
|
|
71
|
+
acceptanceEvidence: string | null;
|
|
72
|
+
closedAt: string | null;
|
|
73
|
+
version: number;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
updatedAt: string;
|
|
76
|
+
}
|
|
77
|
+
export interface ISalesCreateLead {
|
|
78
|
+
pipelineId: string;
|
|
79
|
+
stageId?: string;
|
|
80
|
+
title: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
links?: ISalesLeadLinks;
|
|
83
|
+
contactName?: string;
|
|
84
|
+
amount?: string;
|
|
85
|
+
currency?: string;
|
|
86
|
+
customFields?: Record<string, SalesFieldValue>;
|
|
87
|
+
tagIds?: string[];
|
|
88
|
+
}
|
|
89
|
+
export interface ISalesUpdateLead {
|
|
90
|
+
expectedVersion: number;
|
|
91
|
+
title: string;
|
|
92
|
+
description: string;
|
|
93
|
+
contactName: string;
|
|
94
|
+
links?: ISalesLeadLinks;
|
|
95
|
+
amount: string;
|
|
96
|
+
currency: string;
|
|
97
|
+
customFields?: Record<string, SalesFieldValue>;
|
|
98
|
+
tagIds?: string[];
|
|
99
|
+
}
|
|
100
|
+
export interface ISalesMoveLead {
|
|
101
|
+
/** Validated and saved atomically with the stage transition. */
|
|
102
|
+
customFields?: Record<string, SalesFieldValue>;
|
|
103
|
+
expectedVersion: number;
|
|
104
|
+
toStageId: string;
|
|
105
|
+
lossReason?: string;
|
|
106
|
+
lossReasonId?: string;
|
|
107
|
+
acceptanceEvidence?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface ISalesLeadActivity {
|
|
110
|
+
id: string;
|
|
111
|
+
type: 'CREATED' | 'UPDATED' | 'STAGE_CHANGED';
|
|
112
|
+
actorId: string;
|
|
113
|
+
createdAt: string;
|
|
114
|
+
fromStageId: string | null;
|
|
115
|
+
toStageId: string | null;
|
|
116
|
+
data: Record<string, unknown>;
|
|
117
|
+
}
|
|
118
|
+
export interface ISalesStageTotal {
|
|
119
|
+
stageId: string;
|
|
120
|
+
count: number;
|
|
121
|
+
amounts: {
|
|
122
|
+
currency: string;
|
|
123
|
+
amount: string;
|
|
124
|
+
}[];
|
|
125
|
+
}
|
|
126
|
+
export interface ISalesLeadList {
|
|
127
|
+
stageTotals: ISalesStageTotal[];
|
|
128
|
+
items: ISalesLeadRecord[];
|
|
129
|
+
total: number;
|
|
130
|
+
page: number;
|
|
131
|
+
pageSize: number;
|
|
132
|
+
}
|
|
133
|
+
export type SalesPermission = 'sales.read' | 'sales.leads.write' | 'sales.pipelines.manage' | 'sales.settings.manage';
|
|
134
|
+
export interface ISalesSession {
|
|
135
|
+
mode: 'authenticated';
|
|
136
|
+
spaceId: string;
|
|
137
|
+
actorId: string;
|
|
138
|
+
space: {
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
};
|
|
142
|
+
user: {
|
|
143
|
+
uid: string;
|
|
144
|
+
displayName: string;
|
|
145
|
+
userType: number;
|
|
146
|
+
};
|
|
147
|
+
permissions: SalesPermission[];
|
|
148
|
+
}
|
|
149
|
+
export interface ISalesApiError {
|
|
150
|
+
code: string;
|
|
151
|
+
message: string;
|
|
152
|
+
correlationId: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ISalesLeadFilters {
|
|
155
|
+
stageId?: string;
|
|
156
|
+
kind?: SalesStageKind;
|
|
157
|
+
tagId?: string;
|
|
158
|
+
currency?: string;
|
|
159
|
+
minAmount?: string;
|
|
160
|
+
maxAmount?: string;
|
|
161
|
+
createdFrom?: string;
|
|
162
|
+
createdTo?: string;
|
|
163
|
+
}
|
package/dist/Sales/index.d.ts
CHANGED
package/dist/Sales/index.js
CHANGED
|
@@ -18,3 +18,6 @@ __exportStar(require("./Common"), exports);
|
|
|
18
18
|
__exportStar(require("./Lead"), exports);
|
|
19
19
|
__exportStar(require("./Api"), exports);
|
|
20
20
|
__exportStar(require("./Dashboard"), exports);
|
|
21
|
+
__exportStar(require("./Runtime"), exports);
|
|
22
|
+
__exportStar(require("./Workspace"), exports);
|
|
23
|
+
__exportStar(require("./Settings"), exports);
|
package/dist/Search.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Shared contextual search contract; providers keep their own authentication and domain validation. */
|
|
2
|
+
export interface IContextualSearchState {
|
|
3
|
+
text: string;
|
|
4
|
+
filters: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
export interface IContextualSearchField {
|
|
7
|
+
key: string;
|
|
8
|
+
label: string;
|
|
9
|
+
type: 'select' | 'text' | 'number' | 'date';
|
|
10
|
+
options?: {
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}[];
|
|
14
|
+
uppercase?: boolean;
|
|
15
|
+
maxLength?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface IContextualSearchItem {
|
|
18
|
+
id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
subtitle?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface IContextualSearchProvider {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
contextLabel: string;
|
|
26
|
+
pathPrefix: string;
|
|
27
|
+
spaceId: string;
|
|
28
|
+
userId: string;
|
|
29
|
+
state: IContextualSearchState;
|
|
30
|
+
fields: IContextualSearchField[];
|
|
31
|
+
search(state: IContextualSearchState, signal: AbortSignal): Promise<IContextualSearchItem[]>;
|
|
32
|
+
validate?(state: IContextualSearchState): string | null;
|
|
33
|
+
apply(state: IContextualSearchState): void;
|
|
34
|
+
open(item: IContextualSearchItem): void;
|
|
35
|
+
}
|
|
36
|
+
export interface IContextualSearchRegistry {
|
|
37
|
+
get(): IContextualSearchProvider | null;
|
|
38
|
+
subscribe(listener: () => void): () => void;
|
|
39
|
+
register(provider: IContextualSearchProvider): () => void;
|
|
40
|
+
}
|
|
41
|
+
/** A versioned host singleton, shared even when each microfrontend bundles its own package copy. */
|
|
42
|
+
export declare function getContextualSearchRegistry(): IContextualSearchRegistry;
|
package/dist/Search.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContextualSearchRegistry = getContextualSearchRegistry;
|
|
4
|
+
/** A versioned host singleton, shared even when each microfrontend bundles its own package copy. */
|
|
5
|
+
function getContextualSearchRegistry() {
|
|
6
|
+
const host = globalThis;
|
|
7
|
+
if (!host.__triiContextualSearchV1) {
|
|
8
|
+
let current = null;
|
|
9
|
+
const listeners = new Set();
|
|
10
|
+
const notify = () => listeners.forEach(listener => listener());
|
|
11
|
+
host.__triiContextualSearchV1 = { get: () => current, subscribe: listener => { listeners.add(listener); return () => { listeners.delete(listener); }; }, register: provider => { current = provider; notify(); return () => { if (current === provider) {
|
|
12
|
+
current = null;
|
|
13
|
+
notify();
|
|
14
|
+
} }; } };
|
|
15
|
+
}
|
|
16
|
+
return host.__triiContextualSearchV1;
|
|
17
|
+
}
|
|
@@ -11,10 +11,16 @@ export interface UserProfile_Calendar {
|
|
|
11
11
|
enabled: boolean;
|
|
12
12
|
editConfig: boolean;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface UserProfile_Sales {
|
|
15
15
|
enabled: boolean;
|
|
16
16
|
editConfig: boolean;
|
|
17
17
|
}
|
|
18
|
+
export interface UserProfile_Automations {
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface UserProfile_HelpCenter {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
}
|
|
18
24
|
export interface UserProfile_Datasync {
|
|
19
25
|
enabled: boolean;
|
|
20
26
|
editConfig: boolean;
|
|
@@ -72,9 +78,6 @@ export interface UserProfile_Marketing {
|
|
|
72
78
|
editConfig: boolean;
|
|
73
79
|
enabled: boolean;
|
|
74
80
|
}
|
|
75
|
-
export interface UserProfile_Docs {
|
|
76
|
-
enabled: boolean;
|
|
77
|
-
}
|
|
78
81
|
export interface UserProfile_Service {
|
|
79
82
|
dashboard: boolean;
|
|
80
83
|
editConfig: boolean;
|
|
@@ -103,13 +106,14 @@ export interface UserProfile {
|
|
|
103
106
|
contacts: UserProfile_Contacts;
|
|
104
107
|
calendar: UserProfile_Calendar;
|
|
105
108
|
signature: UserProfile_Signature;
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
tickets: UserProfile_Tickets;
|
|
110
|
+
sales: UserProfile_Sales;
|
|
111
|
+
helpCenter: UserProfile_HelpCenter;
|
|
112
|
+
automations: UserProfile_Automations;
|
|
108
113
|
debtCollection: UserProfile_DebtCollection;
|
|
109
|
-
crm: UserProfile_Crm;
|
|
110
114
|
datasync: UserProfile_Datasync;
|
|
111
115
|
service: UserProfile_Service;
|
|
112
|
-
|
|
116
|
+
agent: UserProfile_Agent;
|
|
113
117
|
}
|
|
114
118
|
export interface UserRole {
|
|
115
119
|
id: string;
|