@fleox-agent-crm/agentcrm 0.0.0-stage → 0.3.1
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/LICENSE +143 -0
- package/README.md +223 -2
- package/changelog.json +76 -0
- package/dist/admin/admin-files.json +26 -0
- package/dist/admin/assets/chartsImpl-B45AAqnr.js +91 -0
- package/dist/admin/assets/firebase-C1x_l9P9.js +2 -0
- package/dist/admin/assets/gitJson-CAUSxl8d.js +3 -0
- package/dist/admin/assets/index-ChFauO8y.js +1181 -0
- package/dist/admin/assets/index-TcjySLVg.css +1 -0
- package/dist/admin/assets/index.esm-BFc7vwnl.js +400 -0
- package/dist/admin/assets/index.esm-CtEQZRb1.js +1651 -0
- package/dist/admin/assets/index.esm-Dum0J07z.js +16 -0
- package/dist/admin/assets/index.esm2017-EOzKbpUS.js +390 -0
- package/dist/admin/assets/lucide-react.min--rznIkmQ.js +6 -0
- package/dist/admin/assets/sdk-DgzLACmL.js +1717 -0
- package/dist/admin/config.js +3 -0
- package/dist/admin/favicon.svg +1 -0
- package/dist/admin/index.html +139 -0
- package/dist/admin/runtime/agentcrm-runtime.js +104 -0
- package/dist/admin/runtime/lucide-react.js +791 -0
- package/dist/admin/runtime/react-dom-client.js +17 -0
- package/dist/admin/runtime/react-dom.js +20 -0
- package/dist/admin/runtime/react-i18next.js +19 -0
- package/dist/admin/runtime/react-jsx-runtime.js +17 -0
- package/dist/admin/runtime/react.js +22 -0
- package/dist/agent/agentcrm.mjs +4057 -0
- package/dist/agent/chunks/_commonjsHelpers-ClciMIcB.mjs +14 -0
- package/dist/agent/chunks/activities-Cj_SIOay.mjs +227 -0
- package/dist/agent/chunks/api-Cz0Ubj-B.mjs +98 -0
- package/dist/agent/chunks/appearance-BloHbiLA.mjs +174 -0
- package/dist/agent/chunks/automations-DwWruxmu.mjs +698 -0
- package/dist/agent/chunks/backup-W3CjgkAJ.mjs +116 -0
- package/dist/agent/chunks/batch-CVETiJj5.mjs +142 -0
- package/dist/agent/chunks/compact-BGHI92tm.mjs +69 -0
- package/dist/agent/chunks/context-CxFfqS4D.mjs +65 -0
- package/dist/agent/chunks/core-Dy7vY9H6.mjs +255 -0
- package/dist/agent/chunks/dedupe-BepmsaHv.mjs +123 -0
- package/dist/agent/chunks/encoding-C9MzdP95.mjs +36 -0
- package/dist/agent/chunks/exportCsv-C6e6XEmB.mjs +130 -0
- package/dist/agent/chunks/extCheck-GgHG1dYB.mjs +200 -0
- package/dist/agent/chunks/extPackage-DuZ6GZhp.mjs +115 -0
- package/dist/agent/chunks/extScaffold-Aqyjf1nr.mjs +320 -0
- package/dist/agent/chunks/extensionActions-D2HtpQz4.mjs +48 -0
- package/dist/agent/chunks/extensions-Bp72uZ9a.mjs +164 -0
- package/dist/agent/chunks/featureRegistry-DSsZbhrh.mjs +149 -0
- package/dist/agent/chunks/fields-B0bitgmr.mjs +476 -0
- package/dist/agent/chunks/files-CjsPJSR6.mjs +158 -0
- package/dist/agent/chunks/files-D1daDgY0.mjs +367 -0
- package/dist/agent/chunks/firebase-DxGVQV9E.mjs +454 -0
- package/dist/agent/chunks/firebaseRules-iori-s7U.mjs +221 -0
- package/dist/agent/chunks/forms-BfuWaQjA.mjs +847 -0
- package/dist/agent/chunks/gitJson-fjr8mcHe.mjs +528 -0
- package/dist/agent/chunks/hosting-Bme7LxPc.mjs +144 -0
- package/dist/agent/chunks/http-Bk9ICb7I.mjs +127 -0
- package/dist/agent/chunks/ids-CvnmrMJX.mjs +59 -0
- package/dist/agent/chunks/ids-u-noYcy5.mjs +14 -0
- package/dist/agent/chunks/importCsv-LVmMTaWU.mjs +334 -0
- package/dist/agent/chunks/index-B-4W0-P4.mjs +535 -0
- package/dist/agent/chunks/index-BM8qeGOb.mjs +2489 -0
- package/dist/agent/chunks/index-Bnmav-Oh.mjs +311 -0
- package/dist/agent/chunks/index-CRkw3_iF.mjs +147 -0
- package/dist/agent/chunks/index-CWrrF1wl.mjs +111 -0
- package/dist/agent/chunks/index-DUSdTBkz.mjs +2988 -0
- package/dist/agent/chunks/index-RCmo-uld.mjs +26 -0
- package/dist/agent/chunks/index-w03ReRs4.mjs +9780 -0
- package/dist/agent/chunks/install-CbpD_7gd.mjs +188 -0
- package/dist/agent/chunks/jsx-runtime-Ca2uwGDr.mjs +76 -0
- package/dist/agent/chunks/loader-MPD9iAvh.mjs +184 -0
- package/dist/agent/chunks/lucide-react.min-Bt3gtepY.mjs +64 -0
- package/dist/agent/chunks/memory-WNR3VHUJ.mjs +56 -0
- package/dist/agent/chunks/migrate-CsClnnN8.mjs +182 -0
- package/dist/agent/chunks/modules-clWdE-K2.mjs +202 -0
- package/dist/agent/chunks/nodeImport-ylfRDvqt.mjs +38 -0
- package/dist/agent/chunks/package-B7mI6HGi.mjs +194 -0
- package/dist/agent/chunks/papaparse-Df7i1dHr.mjs +1309 -0
- package/dist/agent/chunks/pipelines-BAKpPk1w.mjs +234 -0
- package/dist/agent/chunks/plan-BmTat6-T.mjs +254 -0
- package/dist/agent/chunks/pluginRegistry-DyHtlkcr.mjs +83 -0
- package/dist/agent/chunks/query-C5nJB_3C.mjs +192 -0
- package/dist/agent/chunks/records-DcHFelq5.mjs +2195 -0
- package/dist/agent/chunks/registry-COfJrSmg.mjs +182 -0
- package/dist/agent/chunks/registry-DijAKZ24.mjs +431 -0
- package/dist/agent/chunks/relations-B9TynBmA.mjs +191 -0
- package/dist/agent/chunks/reports-BACHGccj.mjs +189 -0
- package/dist/agent/chunks/runtime-C0Xf0Axi.mjs +14873 -0
- package/dist/agent/chunks/runtimeConfig-CCOFg1RM.mjs +250 -0
- package/dist/agent/chunks/s3-Dz50-NuA.mjs +903 -0
- package/dist/agent/chunks/schema-C4lSslXv.mjs +373 -0
- package/dist/agent/chunks/schema-DnLj8dUO.mjs +213 -0
- package/dist/agent/chunks/sdk-whvfg786.mjs +43644 -0
- package/dist/agent/chunks/seed-6MRmQQBR.mjs +541 -0
- package/dist/agent/chunks/server-DC3t8r30.mjs +242 -0
- package/dist/agent/chunks/settings-Di8nzNEL.mjs +111 -0
- package/dist/agent/chunks/standardObjects-CheqfDqa.mjs +243 -0
- package/dist/agent/chunks/stats-BfuLWhVV.mjs +51 -0
- package/dist/agent/chunks/store-5gqRSKXg.mjs +122 -0
- package/dist/agent/chunks/themes-DPZFv3yc.mjs +43 -0
- package/dist/agent/chunks/tools-iSH-yMpl.mjs +884 -0
- package/dist/agent/chunks/types-BOy9PUl7.mjs +44 -0
- package/dist/agent/chunks/users-DI1BvS0f.mjs +107 -0
- package/dist/agent/chunks/utils-DmI8FtXP.mjs +83 -0
- package/dist/agent/chunks/views-DH1n9Lrt.mjs +109 -0
- package/dist/version.json +7 -0
- package/package.json +97 -4
- package/plugin/.claude-plugin/plugin.json +17 -0
- package/plugin/skills/agentcrm-admin/SKILL.md +191 -0
- package/plugin/skills/agentcrm-admin/references/appearance.md +26 -0
- package/plugin/skills/agentcrm-admin/references/import.md +16 -0
- package/plugin/skills/agentcrm-admin/references/records.md +30 -0
- package/plugin/skills/agentcrm-admin/references/schema.md +59 -0
- package/plugin/skills/agentcrm-extensions/SKILL.md +93 -0
- package/plugin/skills/agentcrm-extensions/references/module-recipes.md +213 -0
- package/plugin/skills/agentcrm-extensions/references/runtime-api.md +41 -0
- package/plugin/skills/agentcrm-extensions/references/testing.md +78 -0
- package/plugin/skills/agentcrm-extensions/references/theme-recipes.md +65 -0
- package/plugin/skills/agentcrm-install/SKILL.md +116 -0
- package/plugin/skills/agentcrm-install/references/firebase.md +18 -0
- package/plugin/skills/agentcrm-install/references/github.md +20 -0
- package/plugin/skills/agentcrm-install/references/mcp.md +17 -0
- package/plugin/skills/agentcrm-install/references/plans.md +45 -0
- package/plugin/skills/agentcrm-install/references/s3.md +24 -0
- package/plugin/skills/agentcrm-manage/SKILL.md +108 -0
- package/plugin/skills/agentcrm-manage/references/cron.md +11 -0
- package/plugin/skills/agentcrm-manage/references/doctor.md +18 -0
- package/plugin/skills/agentcrm-sales/SKILL.md +92 -0
- package/plugin/skills/agentcrm-sales/references/enrichment.md +13 -0
- package/plugin/skills/agentcrm-sales/references/playbooks.md +29 -0
- package/plugin/skills/agentcrm-sales/references/weekly-report.md +27 -0
- package/types/agentcrm-runtime.d.ts +894 -0
|
@@ -0,0 +1,894 @@
|
|
|
1
|
+
// Public typings of `@agent-crm/runtime` — the API AgentCRM extensions
|
|
2
|
+
// (external modules & themes) import. Self-contained: only depends on
|
|
3
|
+
// `react` and `lucide-react` types. Map the specifier to this file in your
|
|
4
|
+
// tsconfig (`"paths": { "@agent-crm/runtime": ["…/agentcrm-runtime.d.ts"] }`)
|
|
5
|
+
// and externalise it (plus react, react/jsx-runtime, react-dom,
|
|
6
|
+
// react-dom/client, react-i18next, lucide-react) in your bundler.
|
|
7
|
+
//
|
|
8
|
+
// Kept identical to the runtime object by src/extensions/runtime.test.ts
|
|
9
|
+
// (value exports) and its compile-time checks (signatures).
|
|
10
|
+
// API version: see `apiVersion` (src/extensions/api.ts).
|
|
11
|
+
|
|
12
|
+
import type { ComponentType, ForwardRefExoticComponent, ReactNode, RefAttributes, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, HTMLAttributes, ThHTMLAttributes, TdHTMLAttributes, AnchorHTMLAttributes } from "react";
|
|
13
|
+
import type { LucideIcon } from "lucide-react";
|
|
14
|
+
|
|
15
|
+
// ─── Domain ──────────────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
export type FieldType =
|
|
18
|
+
| "text"
|
|
19
|
+
| "longText"
|
|
20
|
+
| "number"
|
|
21
|
+
| "currency"
|
|
22
|
+
| "percent"
|
|
23
|
+
| "date"
|
|
24
|
+
| "datetime"
|
|
25
|
+
| "boolean"
|
|
26
|
+
| "select"
|
|
27
|
+
| "multiSelect"
|
|
28
|
+
| "email"
|
|
29
|
+
| "phone"
|
|
30
|
+
| "url"
|
|
31
|
+
| "relation"
|
|
32
|
+
| "user"
|
|
33
|
+
| "rating"
|
|
34
|
+
| "address"
|
|
35
|
+
| "tags"
|
|
36
|
+
| "image"
|
|
37
|
+
| "files";
|
|
38
|
+
|
|
39
|
+
export interface SelectOption {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
color: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface RelationDef {
|
|
46
|
+
object: string;
|
|
47
|
+
cardinality: "one" | "many";
|
|
48
|
+
inverseField?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface FieldDef {
|
|
52
|
+
id: string;
|
|
53
|
+
label: string;
|
|
54
|
+
type: FieldType;
|
|
55
|
+
description?: string;
|
|
56
|
+
required?: boolean;
|
|
57
|
+
unique?: boolean;
|
|
58
|
+
standard?: boolean;
|
|
59
|
+
system?: boolean;
|
|
60
|
+
hidden?: boolean;
|
|
61
|
+
options?: SelectOption[];
|
|
62
|
+
currency?: string;
|
|
63
|
+
relation?: RelationDef;
|
|
64
|
+
defaultValue?: unknown;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ObjectDef {
|
|
68
|
+
id: string;
|
|
69
|
+
labelSingular: string;
|
|
70
|
+
labelPlural: string;
|
|
71
|
+
icon: string;
|
|
72
|
+
color: string;
|
|
73
|
+
standard: boolean;
|
|
74
|
+
labelField: string;
|
|
75
|
+
fields: FieldDef[];
|
|
76
|
+
hidden?: boolean;
|
|
77
|
+
imageField?: string;
|
|
78
|
+
createdAt: number;
|
|
79
|
+
updatedAt: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface CrmRecord {
|
|
83
|
+
id: string;
|
|
84
|
+
object: string;
|
|
85
|
+
fields: Record<string, unknown>;
|
|
86
|
+
ownerId?: string;
|
|
87
|
+
createdAt: number;
|
|
88
|
+
updatedAt: number;
|
|
89
|
+
createdBy?: string;
|
|
90
|
+
updatedBy?: string;
|
|
91
|
+
deletedAt?: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type ActivityType = "note" | "task" | "call" | "email" | "meeting";
|
|
95
|
+
|
|
96
|
+
export interface ActivityTarget {
|
|
97
|
+
object: string;
|
|
98
|
+
id: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface Activity {
|
|
102
|
+
id: string;
|
|
103
|
+
type: ActivityType;
|
|
104
|
+
title: string;
|
|
105
|
+
body?: string;
|
|
106
|
+
targets: ActivityTarget[];
|
|
107
|
+
dueAt?: number;
|
|
108
|
+
doneAt?: number;
|
|
109
|
+
assigneeId?: string;
|
|
110
|
+
meta?: Record<string, unknown>;
|
|
111
|
+
attachments?: string[];
|
|
112
|
+
createdAt: number;
|
|
113
|
+
updatedAt: number;
|
|
114
|
+
createdBy?: string;
|
|
115
|
+
deletedAt?: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type StageKind = "open" | "won" | "lost";
|
|
119
|
+
|
|
120
|
+
export interface PipelineStage {
|
|
121
|
+
id: string;
|
|
122
|
+
label: string;
|
|
123
|
+
color: string;
|
|
124
|
+
probability: number;
|
|
125
|
+
kind: StageKind;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface Pipeline {
|
|
129
|
+
id: string;
|
|
130
|
+
object: string;
|
|
131
|
+
name: string;
|
|
132
|
+
stageField: string;
|
|
133
|
+
stages: PipelineStage[];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type FilterOp = "eq" | "neq" | "contains" | "notContains" | "empty" | "notEmpty" | "gt" | "gte" | "lt" | "lte" | "in" | "notIn" | "before" | "after" | "withinDays";
|
|
137
|
+
|
|
138
|
+
export interface Filter {
|
|
139
|
+
field: string;
|
|
140
|
+
op: FilterOp;
|
|
141
|
+
value?: unknown;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface Sort {
|
|
145
|
+
field: string;
|
|
146
|
+
dir: "asc" | "desc";
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ViewDef {
|
|
150
|
+
id: string;
|
|
151
|
+
object: string;
|
|
152
|
+
name: string;
|
|
153
|
+
type: "table" | "kanban";
|
|
154
|
+
columns: string[];
|
|
155
|
+
filters: Filter[];
|
|
156
|
+
sorts: Sort[];
|
|
157
|
+
groupBy?: string;
|
|
158
|
+
pipelineId?: string;
|
|
159
|
+
shared: boolean;
|
|
160
|
+
ownerId?: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export type UserRole = "admin" | "member" | "viewer";
|
|
164
|
+
|
|
165
|
+
export interface CrmUser {
|
|
166
|
+
id: string;
|
|
167
|
+
email: string;
|
|
168
|
+
name: string;
|
|
169
|
+
role: UserRole;
|
|
170
|
+
avatarUrl?: string;
|
|
171
|
+
disabled?: boolean;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface CrmSettings {
|
|
175
|
+
id: "general";
|
|
176
|
+
name: string;
|
|
177
|
+
defaultCurrency: string;
|
|
178
|
+
locale: string;
|
|
179
|
+
timezone?: string;
|
|
180
|
+
weekStartsOn?: 0 | 1;
|
|
181
|
+
staleDealDays: number;
|
|
182
|
+
ownerUserId?: string;
|
|
183
|
+
maxUploadMb?: number;
|
|
184
|
+
createdAt?: number;
|
|
185
|
+
updatedAt?: number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface Page<T> {
|
|
189
|
+
items: T[];
|
|
190
|
+
total: number;
|
|
191
|
+
offset: number;
|
|
192
|
+
limit: number;
|
|
193
|
+
hasMore: boolean;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ─── Data store & ops context ────────────────────────────────────────────
|
|
197
|
+
|
|
198
|
+
export type CollectionName = "objects" | "records" | "activities" | "pipelines" | "views" | "automations" | "forms" | "users" | "settings" | "config" | "automationRuns" | "extensions" | "files";
|
|
199
|
+
|
|
200
|
+
export interface StoredDoc {
|
|
201
|
+
id: string;
|
|
202
|
+
[key: string]: unknown;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export type DocMutation =
|
|
206
|
+
| { op: "set"; collection: CollectionName; doc: StoredDoc }
|
|
207
|
+
| { op: "patch"; collection: CollectionName; id: string; fields: Record<string, unknown> }
|
|
208
|
+
| { op: "delete"; collection: CollectionName; id: string };
|
|
209
|
+
|
|
210
|
+
// The parts of the DataStore extensions may use (reads; write through ops).
|
|
211
|
+
export interface DataStore {
|
|
212
|
+
readonly kind: "local" | "journal" | "git-json" | "firebase" | "memory";
|
|
213
|
+
list(collection: CollectionName): StoredDoc[];
|
|
214
|
+
get(collection: CollectionName, id: string): StoredDoc | undefined;
|
|
215
|
+
write(mutations: DocMutation[], opts?: { message?: string }): Promise<void>;
|
|
216
|
+
subscribe(listener: (changed: Set<CollectionName>) => void): () => void;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Passed first to every op (useOps() in components, `ctx` in AI tool and
|
|
220
|
+
// automation action handlers). `user: null` = system context.
|
|
221
|
+
export interface OpsContext {
|
|
222
|
+
store: DataStore;
|
|
223
|
+
user: CrmUser | null;
|
|
224
|
+
now(): number;
|
|
225
|
+
log?: (msg: string) => void;
|
|
226
|
+
depth?: number;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface ListRecordsOptions {
|
|
230
|
+
filters?: Filter[];
|
|
231
|
+
sorts?: Sort[];
|
|
232
|
+
search?: string;
|
|
233
|
+
viewId?: string;
|
|
234
|
+
ownerId?: string;
|
|
235
|
+
offset?: number;
|
|
236
|
+
limit?: number;
|
|
237
|
+
includeDeleted?: boolean;
|
|
238
|
+
onlyDeleted?: boolean;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface WriteRecordOptions {
|
|
242
|
+
unknownFields?: "error" | "drop";
|
|
243
|
+
dayFirst?: boolean;
|
|
244
|
+
silent?: boolean;
|
|
245
|
+
message?: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface ListActivitiesOptions {
|
|
249
|
+
target?: ActivityTarget | string;
|
|
250
|
+
includeRelated?: boolean;
|
|
251
|
+
type?: ActivityType;
|
|
252
|
+
types?: ActivityType[];
|
|
253
|
+
assigneeId?: string;
|
|
254
|
+
status?: "open" | "done" | "all";
|
|
255
|
+
dueBefore?: number;
|
|
256
|
+
dueAfter?: number;
|
|
257
|
+
since?: number;
|
|
258
|
+
offset?: number;
|
|
259
|
+
limit?: number;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface TaskInput {
|
|
263
|
+
title: string;
|
|
264
|
+
body?: string;
|
|
265
|
+
dueAt?: number | string | null;
|
|
266
|
+
assigneeId?: string | null;
|
|
267
|
+
targets?: ActivityTarget[];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface ForecastStage {
|
|
271
|
+
stageId: string;
|
|
272
|
+
label: string;
|
|
273
|
+
kind: StageKind;
|
|
274
|
+
probability: number;
|
|
275
|
+
count: number;
|
|
276
|
+
amount: number;
|
|
277
|
+
weighted: number;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface Forecast {
|
|
281
|
+
pipelineId: string;
|
|
282
|
+
currency?: string;
|
|
283
|
+
openCount: number;
|
|
284
|
+
openAmount: number;
|
|
285
|
+
weightedAmount: number;
|
|
286
|
+
wonAmount: number;
|
|
287
|
+
lostAmount: number;
|
|
288
|
+
byStage: ForecastStage[];
|
|
289
|
+
byMonth: { month: string; count: number; amount: number; weighted: number }[];
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface ModuleInfo {
|
|
293
|
+
id: string;
|
|
294
|
+
source: "builtin" | "extension";
|
|
295
|
+
name: string;
|
|
296
|
+
description: string;
|
|
297
|
+
nameKey?: string;
|
|
298
|
+
descriptionKey?: string;
|
|
299
|
+
icon: string;
|
|
300
|
+
category: ModuleCategory;
|
|
301
|
+
required: boolean;
|
|
302
|
+
enabled: boolean;
|
|
303
|
+
dependsOn: string[];
|
|
304
|
+
dependents: string[];
|
|
305
|
+
missingDependencies: string[];
|
|
306
|
+
objects: string[];
|
|
307
|
+
settingsSection?: string;
|
|
308
|
+
version?: string;
|
|
309
|
+
incompatible?: boolean;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// The business engine (src/ops/). The most used ops are typed below; the
|
|
313
|
+
// object holds every op of the admin (see docs / src/ops/index.ts).
|
|
314
|
+
export interface RuntimeOps {
|
|
315
|
+
listRecords(ctx: OpsContext, objectId: string, opts?: ListRecordsOptions): Page<CrmRecord>;
|
|
316
|
+
getRecord(ctx: OpsContext, id: string, opts?: { includeDeleted?: boolean }): CrmRecord;
|
|
317
|
+
createRecord(ctx: OpsContext, objectId: string, input: Record<string, unknown>, opts?: WriteRecordOptions & { id?: string; ownerId?: string | null }): Promise<CrmRecord>;
|
|
318
|
+
updateRecord(ctx: OpsContext, id: string, input: Record<string, unknown>, opts?: WriteRecordOptions & { ownerId?: string | null }): Promise<CrmRecord>;
|
|
319
|
+
deleteRecord(ctx: OpsContext, id: string, opts?: { hard?: boolean; silent?: boolean }): Promise<{ id: string; hard: boolean }>;
|
|
320
|
+
listActivities(ctx: OpsContext, opts?: ListActivitiesOptions): Page<Activity>;
|
|
321
|
+
addNote(ctx: OpsContext, target: ActivityTarget | string, body: string, title?: string): Promise<Activity>;
|
|
322
|
+
createTask(ctx: OpsContext, input: TaskInput): Promise<Activity>;
|
|
323
|
+
completeTask(ctx: OpsContext, id: string, done?: boolean): Promise<Activity>;
|
|
324
|
+
listPipelines(ctx: OpsContext, object?: string): Pipeline[];
|
|
325
|
+
pipelineOfRecord(ctx: OpsContext, record: CrmRecord): Pipeline | undefined;
|
|
326
|
+
moveStage(ctx: OpsContext, recordId: string, stage: string, opts?: { lostReason?: string }): Promise<CrmRecord>;
|
|
327
|
+
forecast(ctx: OpsContext, opts?: { pipelineId?: string; from?: number | string; to?: number | string; ownerId?: string }): Forecast;
|
|
328
|
+
listObjects(ctx: OpsContext): ObjectDef[];
|
|
329
|
+
getSettings(ctx: OpsContext): CrmSettings;
|
|
330
|
+
listUsers(ctx: OpsContext, opts?: { includeDisabled?: boolean }): CrmUser[];
|
|
331
|
+
listModules(ctx: OpsContext): ModuleInfo[];
|
|
332
|
+
getModuleConfig<T = unknown>(ctx: OpsContext, id: string): T | undefined;
|
|
333
|
+
setModuleConfig<T = unknown>(ctx: OpsContext, id: string, value: T | null): Promise<T | undefined>;
|
|
334
|
+
getAppearance(ctx: OpsContext): Appearance;
|
|
335
|
+
[op: string]: unknown;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// ─── Customisation ───────────────────────────────────────────────────────
|
|
339
|
+
|
|
340
|
+
export type ModuleCategory = "core" | "sales" | "productivity" | "automation" | "integrations" | "ai" | "customisation";
|
|
341
|
+
|
|
342
|
+
export interface Appearance {
|
|
343
|
+
preset: string;
|
|
344
|
+
accent: string;
|
|
345
|
+
neutral: "zinc" | "slate" | "stone" | "gray" | "neutral";
|
|
346
|
+
radius: "none" | "sm" | "md" | "lg" | "xl";
|
|
347
|
+
density: "compact" | "comfortable";
|
|
348
|
+
font: string;
|
|
349
|
+
sidebar: "default" | "dark" | "accent";
|
|
350
|
+
defaultMode: "system" | "light" | "dark";
|
|
351
|
+
contrast: "normal" | "high";
|
|
352
|
+
buttons: "neutral" | "accent";
|
|
353
|
+
logo?: string;
|
|
354
|
+
favicon?: string;
|
|
355
|
+
customCss?: string;
|
|
356
|
+
themeId?: string;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export interface ThemeDefinition {
|
|
360
|
+
id: string;
|
|
361
|
+
apiVersion: string;
|
|
362
|
+
name: string;
|
|
363
|
+
description?: string;
|
|
364
|
+
appearance: Partial<Appearance>;
|
|
365
|
+
css?: string;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export type JsonSchema = {
|
|
369
|
+
type?: string | string[];
|
|
370
|
+
description?: string;
|
|
371
|
+
properties?: Record<string, JsonSchema>;
|
|
372
|
+
required?: string[];
|
|
373
|
+
items?: JsonSchema;
|
|
374
|
+
enum?: readonly unknown[];
|
|
375
|
+
additionalProperties?: boolean | JsonSchema;
|
|
376
|
+
default?: unknown;
|
|
377
|
+
minimum?: number;
|
|
378
|
+
maximum?: number;
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// An AI tool (MCP, in-admin assistant, `agentcrm tools`). Name: snake_case,
|
|
382
|
+
// unique — prefix it with your module.
|
|
383
|
+
export interface AiTool<I = Record<string, unknown>> {
|
|
384
|
+
name: string;
|
|
385
|
+
description: string;
|
|
386
|
+
inputSchema: JsonSchema & { type: "object" };
|
|
387
|
+
mutating: boolean;
|
|
388
|
+
handler(ctx: OpsContext, input: I): Promise<unknown> | unknown;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export interface AutomationActionParam {
|
|
392
|
+
id: string;
|
|
393
|
+
label: string;
|
|
394
|
+
type: "text" | "longText" | "number" | "boolean" | "select";
|
|
395
|
+
required?: boolean;
|
|
396
|
+
options?: { value: string; label: string }[];
|
|
397
|
+
placeholder?: string;
|
|
398
|
+
template?: boolean;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export type AutomationTriggerType = "record.created" | "record.updated" | "field.changed" | "stage.changed" | "schedule" | "inactivity";
|
|
402
|
+
|
|
403
|
+
export interface Automation {
|
|
404
|
+
id: string;
|
|
405
|
+
name: string;
|
|
406
|
+
enabled: boolean;
|
|
407
|
+
object: string;
|
|
408
|
+
trigger: { type: AutomationTriggerType; field?: string; to?: unknown; days?: number; everyHours?: number };
|
|
409
|
+
conditions: Filter[];
|
|
410
|
+
actions: ({ type: string } & Record<string, unknown>)[];
|
|
411
|
+
lastRunAt?: number;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export interface AutomationActionRunInput {
|
|
415
|
+
params: Record<string, unknown>;
|
|
416
|
+
record: CrmRecord;
|
|
417
|
+
object: ObjectDef;
|
|
418
|
+
automation: Automation;
|
|
419
|
+
trigger: string;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// An automation action ("<moduleId>.<action>") shown in the automation
|
|
423
|
+
// editor next to the built-in ones.
|
|
424
|
+
export interface AutomationActionDef {
|
|
425
|
+
id: string;
|
|
426
|
+
label: string;
|
|
427
|
+
description?: string;
|
|
428
|
+
params?: AutomationActionParam[];
|
|
429
|
+
objects?: string[];
|
|
430
|
+
describe?(input: Pick<AutomationActionRunInput, "params" | "record" | "object">): string;
|
|
431
|
+
validate?(params: Record<string, unknown>, object: ObjectDef): string[];
|
|
432
|
+
run(ctx: OpsContext, input: AutomationActionRunInput): Promise<string | void> | string | void;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// CRM actions emitted by the engine (addAction / ModuleApi.addAction).
|
|
436
|
+
export interface CrmActionPayloads {
|
|
437
|
+
"record.created": { record: CrmRecord };
|
|
438
|
+
"record.updated": { record: CrmRecord; before: CrmRecord; changed: string[] };
|
|
439
|
+
"record.deleted": { record: CrmRecord; hard: boolean };
|
|
440
|
+
"record.restored": { record: CrmRecord };
|
|
441
|
+
"stage.changed": { record: CrmRecord; pipelineId: string; from: string | null; to: string };
|
|
442
|
+
"activity.created": { activity: Activity };
|
|
443
|
+
"activity.updated": { activity: Activity; before: Activity };
|
|
444
|
+
"activity.completed": { activity: Activity };
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export type CrmActionName = keyof CrmActionPayloads;
|
|
448
|
+
|
|
449
|
+
export interface OpsContextLike {
|
|
450
|
+
user: { id: string; role: string } | null;
|
|
451
|
+
now(): number;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export type CrmActionHandler<K extends CrmActionName> = (ctx: OpsContextLike, payload: CrmActionPayloads[K]) => void | Promise<void>;
|
|
455
|
+
|
|
456
|
+
// ─── Feature (routes, nav, slots) ────────────────────────────────────────
|
|
457
|
+
|
|
458
|
+
export type NamespaceBundles = { en: Record<string, unknown>; fr?: Record<string, unknown> };
|
|
459
|
+
|
|
460
|
+
export interface FeatureRoute {
|
|
461
|
+
path: string;
|
|
462
|
+
element: ReactNode;
|
|
463
|
+
roles?: UserRole[];
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export type NavSection = "main" | "workspace" | "bottom";
|
|
467
|
+
|
|
468
|
+
export interface NavItem {
|
|
469
|
+
id: string;
|
|
470
|
+
label: string;
|
|
471
|
+
icon: LucideIcon;
|
|
472
|
+
to: string;
|
|
473
|
+
section?: NavSection;
|
|
474
|
+
order?: number;
|
|
475
|
+
roles?: UserRole[];
|
|
476
|
+
useBadge?: () => number | null;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export interface RecordSlotProps {
|
|
480
|
+
record: CrmRecord;
|
|
481
|
+
object: ObjectDef;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export interface RecordDetailTab {
|
|
485
|
+
id: string;
|
|
486
|
+
label: string;
|
|
487
|
+
icon?: LucideIcon;
|
|
488
|
+
order?: number;
|
|
489
|
+
component: ComponentType<RecordSlotProps>;
|
|
490
|
+
when?: (object: ObjectDef) => boolean;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export interface RecordDetailPanel {
|
|
494
|
+
id: string;
|
|
495
|
+
order?: number;
|
|
496
|
+
component: ComponentType<RecordSlotProps>;
|
|
497
|
+
when?: (object: ObjectDef) => boolean;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export interface RecordAction {
|
|
501
|
+
id: string;
|
|
502
|
+
label: string;
|
|
503
|
+
icon?: LucideIcon;
|
|
504
|
+
order?: number;
|
|
505
|
+
component?: ComponentType<RecordSlotProps>;
|
|
506
|
+
onSelect?: (props: RecordSlotProps) => void;
|
|
507
|
+
when?: (object: ObjectDef) => boolean;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export interface SettingsSection {
|
|
511
|
+
id: string;
|
|
512
|
+
label: string;
|
|
513
|
+
icon?: LucideIcon;
|
|
514
|
+
order?: number;
|
|
515
|
+
roles?: UserRole[];
|
|
516
|
+
component: ComponentType;
|
|
517
|
+
group?: "workspace" | "data" | "extra";
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export interface DashboardWidget {
|
|
521
|
+
id: string;
|
|
522
|
+
order?: number;
|
|
523
|
+
span?: 4 | 6 | 8 | 12;
|
|
524
|
+
component: ComponentType;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export interface FeatureSlots {
|
|
528
|
+
topBar?: ComponentType[];
|
|
529
|
+
recordDetailTabs?: RecordDetailTab[];
|
|
530
|
+
recordDetailPanels?: RecordDetailPanel[];
|
|
531
|
+
recordActions?: RecordAction[];
|
|
532
|
+
globalOverlays?: ComponentType[];
|
|
533
|
+
settingsSections?: SettingsSection[];
|
|
534
|
+
dashboardWidgets?: DashboardWidget[];
|
|
535
|
+
loginScreen?: ComponentType<{ onSignedIn(): void }>;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export interface FeatureEnv {
|
|
539
|
+
user: CrmUser;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// What a module contributes (i18n namespace = the module id → t("<id>:key")).
|
|
543
|
+
export interface ModuleFeature {
|
|
544
|
+
routes?: FeatureRoute[];
|
|
545
|
+
unconfiguredRoutes?: FeatureRoute[];
|
|
546
|
+
navItems?: NavItem[];
|
|
547
|
+
i18n?: NamespaceBundles;
|
|
548
|
+
slots?: FeatureSlots;
|
|
549
|
+
onStart?: (env: FeatureEnv) => void | (() => void);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export interface ModuleApi {
|
|
553
|
+
readonly moduleId: string;
|
|
554
|
+
addAction<K extends CrmActionName>(hook: K, fn: CrmActionHandler<K>, priority?: number): () => void;
|
|
555
|
+
addAction(hook: string, fn: (...args: never[]) => void | Promise<void>, priority?: number): () => void;
|
|
556
|
+
addFilter<T = unknown>(hook: string, fn: (value: T, ...args: unknown[]) => T | Promise<T>, priority?: number): () => void;
|
|
557
|
+
registerAiTool(tool: AiTool): () => void;
|
|
558
|
+
registerAutomationAction(def: AutomationActionDef): () => void;
|
|
559
|
+
onDispose(fn: () => void): void;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// Default export of a module bundle.
|
|
563
|
+
export interface ModuleDefinition {
|
|
564
|
+
id: string;
|
|
565
|
+
apiVersion: string;
|
|
566
|
+
feature?: ModuleFeature;
|
|
567
|
+
register?(api: ModuleApi): void | (() => void);
|
|
568
|
+
aiTools?: AiTool[];
|
|
569
|
+
automationActions?: AutomationActionDef[];
|
|
570
|
+
settingsPage?: ComponentType;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
export type ExtensionKind = "module" | "theme";
|
|
574
|
+
|
|
575
|
+
// manifest.json of an extension ZIP.
|
|
576
|
+
export interface ExtensionManifest {
|
|
577
|
+
id: string;
|
|
578
|
+
kind: ExtensionKind;
|
|
579
|
+
name: string;
|
|
580
|
+
version: string;
|
|
581
|
+
apiVersion: string;
|
|
582
|
+
description: string;
|
|
583
|
+
author?: string;
|
|
584
|
+
homepage?: string;
|
|
585
|
+
entry: "bundle.js";
|
|
586
|
+
style?: "style.css";
|
|
587
|
+
icon?: string;
|
|
588
|
+
category?: ModuleCategory;
|
|
589
|
+
dependsOn?: string[];
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// ─── UI kit props ────────────────────────────────────────────────────────
|
|
593
|
+
|
|
594
|
+
export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger" | "outline";
|
|
595
|
+
export type ButtonSize = "xs" | "sm" | "md";
|
|
596
|
+
|
|
597
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
598
|
+
variant?: ButtonVariant;
|
|
599
|
+
size?: ButtonSize;
|
|
600
|
+
icon?: ReactNode;
|
|
601
|
+
loading?: boolean;
|
|
602
|
+
trailing?: ReactNode;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
export interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
606
|
+
label: string;
|
|
607
|
+
icon: ReactNode;
|
|
608
|
+
size?: ButtonSize;
|
|
609
|
+
variant?: ButtonVariant;
|
|
610
|
+
active?: boolean;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
614
|
+
icon?: ReactNode;
|
|
615
|
+
invalid?: boolean;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export interface SelectOptionItem {
|
|
619
|
+
value: string;
|
|
620
|
+
label: string;
|
|
621
|
+
disabled?: boolean;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "children"> {
|
|
625
|
+
options: SelectOptionItem[];
|
|
626
|
+
placeholder?: string;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
630
|
+
label?: ReactNode;
|
|
631
|
+
indeterminate?: boolean;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export interface SwitchProps {
|
|
635
|
+
checked: boolean;
|
|
636
|
+
onChange(checked: boolean): void;
|
|
637
|
+
label?: ReactNode;
|
|
638
|
+
disabled?: boolean;
|
|
639
|
+
size?: "sm" | "md";
|
|
640
|
+
className?: string;
|
|
641
|
+
id?: string;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export interface ModalProps {
|
|
645
|
+
open: boolean;
|
|
646
|
+
onClose(): void;
|
|
647
|
+
title?: ReactNode;
|
|
648
|
+
description?: ReactNode;
|
|
649
|
+
children?: ReactNode;
|
|
650
|
+
footer?: ReactNode;
|
|
651
|
+
size?: "sm" | "md" | "lg" | "xl";
|
|
652
|
+
dismissible?: boolean;
|
|
653
|
+
className?: string;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export interface DrawerProps {
|
|
657
|
+
open: boolean;
|
|
658
|
+
onClose(): void;
|
|
659
|
+
title?: ReactNode;
|
|
660
|
+
children?: ReactNode;
|
|
661
|
+
footer?: ReactNode;
|
|
662
|
+
width?: "sm" | "md" | "lg";
|
|
663
|
+
side?: "right" | "left";
|
|
664
|
+
actions?: ReactNode;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
export interface TabItem {
|
|
668
|
+
id: string;
|
|
669
|
+
label: ReactNode;
|
|
670
|
+
icon?: ReactNode;
|
|
671
|
+
count?: number;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
export interface MenuItem {
|
|
675
|
+
id: string;
|
|
676
|
+
label: ReactNode;
|
|
677
|
+
icon?: ReactNode;
|
|
678
|
+
onSelect?(): void;
|
|
679
|
+
danger?: boolean;
|
|
680
|
+
disabled?: boolean;
|
|
681
|
+
shortcut?: string;
|
|
682
|
+
separator?: boolean;
|
|
683
|
+
checked?: boolean;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
export interface FieldValueProps {
|
|
687
|
+
field: FieldDef;
|
|
688
|
+
value: unknown;
|
|
689
|
+
compact?: boolean;
|
|
690
|
+
className?: string;
|
|
691
|
+
emptyText?: string;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
export interface FieldInputProps {
|
|
695
|
+
field: FieldDef;
|
|
696
|
+
value: unknown;
|
|
697
|
+
onChange(value: unknown): void;
|
|
698
|
+
onCommit?(value: unknown): void;
|
|
699
|
+
onCancel?(): void;
|
|
700
|
+
autoFocus?: boolean;
|
|
701
|
+
disabled?: boolean;
|
|
702
|
+
invalid?: boolean;
|
|
703
|
+
placeholder?: string;
|
|
704
|
+
className?: string;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
export interface ConfirmOptions {
|
|
708
|
+
title: ReactNode;
|
|
709
|
+
description?: ReactNode;
|
|
710
|
+
confirmLabel?: ReactNode;
|
|
711
|
+
cancelLabel?: ReactNode;
|
|
712
|
+
danger?: boolean;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
export interface FormatContext {
|
|
716
|
+
locale?: string;
|
|
717
|
+
currency?: string;
|
|
718
|
+
recordLabel?: (object: string, id: string) => string | undefined;
|
|
719
|
+
userName?: (id: string) => string | undefined;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
export type CoerceResult = { ok: true; value: unknown } | { ok: false; code: string; message: string };
|
|
723
|
+
|
|
724
|
+
export interface ToastApi {
|
|
725
|
+
info(message: string, durationMs?: number): unknown;
|
|
726
|
+
success(message: string, durationMs?: number): unknown;
|
|
727
|
+
warn(message: string, durationMs?: number): unknown;
|
|
728
|
+
error(message: string, durationMs?: number): unknown;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export type OpsAction =
|
|
732
|
+
| "records.read"
|
|
733
|
+
| "records.write"
|
|
734
|
+
| "records.delete"
|
|
735
|
+
| "activities.read"
|
|
736
|
+
| "activities.write"
|
|
737
|
+
| "views.read"
|
|
738
|
+
| "views.writeOwn"
|
|
739
|
+
| "views.writeShared"
|
|
740
|
+
| "schema.write"
|
|
741
|
+
| "pipelines.write"
|
|
742
|
+
| "settings.read"
|
|
743
|
+
| "settings.write"
|
|
744
|
+
| "users.read"
|
|
745
|
+
| "users.write"
|
|
746
|
+
| "automations.write"
|
|
747
|
+
| "automations.run"
|
|
748
|
+
| "forms.write"
|
|
749
|
+
| "import"
|
|
750
|
+
| "export"
|
|
751
|
+
| "reports.read"
|
|
752
|
+
| "compact"
|
|
753
|
+
| "modules.write"
|
|
754
|
+
| "appearance.write"
|
|
755
|
+
| "extensions.write";
|
|
756
|
+
|
|
757
|
+
export interface CrmContextValue {
|
|
758
|
+
store: DataStore;
|
|
759
|
+
user: CrmUser;
|
|
760
|
+
ops: OpsContext;
|
|
761
|
+
can(action: OpsAction): boolean;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
export type DateLike = Date | string | number | null | undefined;
|
|
765
|
+
|
|
766
|
+
export interface I18nInstance {
|
|
767
|
+
readonly language: string;
|
|
768
|
+
t: (...args: any[]) => any;
|
|
769
|
+
changeLanguage: (...args: any[]) => any;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
export interface AppPaths {
|
|
773
|
+
dashboard(): string;
|
|
774
|
+
objectList(objectId: string, viewId?: string): string;
|
|
775
|
+
record(objectId: string, recordId: string): string;
|
|
776
|
+
tasks(): string;
|
|
777
|
+
automations(): string;
|
|
778
|
+
forms(): string;
|
|
779
|
+
reports(): string;
|
|
780
|
+
settings(section?: string): string;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
export interface NavigateFunction {
|
|
784
|
+
(to: string | { pathname?: string; search?: string; hash?: string }, opts?: { replace?: boolean; state?: unknown }): void;
|
|
785
|
+
(delta: number): void;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
export interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
|
|
789
|
+
to: string | { pathname?: string; search?: string; hash?: string };
|
|
790
|
+
replace?: boolean;
|
|
791
|
+
state?: unknown;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
type FC<P> = (props: P) => ReactNode;
|
|
795
|
+
|
|
796
|
+
export type ClassDictionary = Record<string, any>;
|
|
797
|
+
export type ClassArray = ClassValue[];
|
|
798
|
+
export type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined;
|
|
799
|
+
|
|
800
|
+
// ─── Values ──────────────────────────────────────────────────────────────
|
|
801
|
+
|
|
802
|
+
export declare const apiVersion: string;
|
|
803
|
+
export declare const minApiVersion: string;
|
|
804
|
+
export declare function defineModule(def: ModuleDefinition): ModuleDefinition;
|
|
805
|
+
export declare function defineTheme(def: ThemeDefinition): ThemeDefinition;
|
|
806
|
+
export declare const ops: RuntimeOps;
|
|
807
|
+
|
|
808
|
+
export declare function useCrm(): CrmContextValue;
|
|
809
|
+
export declare function useOps(): OpsContext;
|
|
810
|
+
export declare function useCan(action: OpsAction): boolean;
|
|
811
|
+
export declare function useCurrentUser(): CrmUser;
|
|
812
|
+
export declare function useCollection<T = StoredDoc>(c: CollectionName): T[];
|
|
813
|
+
export declare function useObjects(opts?: { includeHidden?: boolean }): ObjectDef[];
|
|
814
|
+
export declare function useObject(id: string | undefined): ObjectDef | undefined;
|
|
815
|
+
export declare function useRecords(objectId: string | undefined, opts?: { includeDeleted?: boolean }): CrmRecord[];
|
|
816
|
+
export declare function useRecord(id: string | undefined): CrmRecord | undefined;
|
|
817
|
+
export declare function useActivities(target?: string | { id: string } | null, opts?: { includeDeleted?: boolean }): Activity[];
|
|
818
|
+
export declare function usePipelines(objectId?: string): Pipeline[];
|
|
819
|
+
export declare function useViews(objectId: string | undefined): ViewDef[];
|
|
820
|
+
export declare function useUsers(opts?: { includeDisabled?: boolean }): CrmUser[];
|
|
821
|
+
export declare function useSettings(): CrmSettings;
|
|
822
|
+
export declare function useModuleConfig<T = unknown>(id: string): T | undefined;
|
|
823
|
+
export declare function useModuleEnabled(id: string): boolean;
|
|
824
|
+
export declare function useAppearance(): Appearance;
|
|
825
|
+
|
|
826
|
+
export declare function useNavigate(): NavigateFunction;
|
|
827
|
+
export declare function useParams(): Readonly<Record<string, string | undefined>>;
|
|
828
|
+
export declare function useSearchParams(): [URLSearchParams, (next: URLSearchParams | Record<string, string>, opts?: { replace?: boolean }) => void];
|
|
829
|
+
export declare function useLocation(): { pathname: string; search: string; hash: string; state: unknown; key: string };
|
|
830
|
+
export declare const Link: FC<LinkProps>;
|
|
831
|
+
export declare const NavLink: FC<Omit<LinkProps, "className"> & { end?: boolean; className?: string | ((s: { isActive: boolean; isPending: boolean }) => string | undefined) }>;
|
|
832
|
+
export declare const paths: AppPaths;
|
|
833
|
+
export declare function recordHref(objectId: string, recordId: string): string;
|
|
834
|
+
|
|
835
|
+
export declare function addAction<K extends CrmActionName>(hook: K, fn: CrmActionHandler<K>, priority?: number): () => void;
|
|
836
|
+
export declare function addAction(hook: string, fn: (...args: never[]) => void | Promise<void>, priority?: number): () => void;
|
|
837
|
+
export declare function removeAction(hook: string, fn: (...args: never[]) => void | Promise<void>): void;
|
|
838
|
+
export declare function addFilter<T = unknown>(hook: string, fn: (value: T, ...args: unknown[]) => T | Promise<T>, priority?: number): () => void;
|
|
839
|
+
export declare function removeFilter<T = unknown>(hook: string, fn: (value: T, ...args: unknown[]) => T | Promise<T>): void;
|
|
840
|
+
export declare function doAction(hook: string, ...args: unknown[]): Promise<void>;
|
|
841
|
+
export declare function applyFilters<T>(hook: string, value: T, ...args: unknown[]): Promise<T>;
|
|
842
|
+
export declare function registerAiTool(tool: AiTool): () => void;
|
|
843
|
+
export declare function registerAutomationAction(def: AutomationActionDef): () => void;
|
|
844
|
+
|
|
845
|
+
export declare const Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
846
|
+
export declare const IconButton: ForwardRefExoticComponent<IconButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
847
|
+
export declare const Input: ForwardRefExoticComponent<InputProps & RefAttributes<HTMLInputElement>>;
|
|
848
|
+
export declare const Textarea: ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & { invalid?: boolean } & RefAttributes<HTMLTextAreaElement>>;
|
|
849
|
+
export declare const Select: ForwardRefExoticComponent<SelectProps & RefAttributes<HTMLSelectElement>>;
|
|
850
|
+
export declare const Label: FC<{ children: ReactNode; htmlFor?: string; className?: string; hint?: ReactNode }>;
|
|
851
|
+
export declare const FormField: FC<{ label?: ReactNode; htmlFor?: string; error?: ReactNode; help?: ReactNode; children: ReactNode; className?: string }>;
|
|
852
|
+
export declare const Checkbox: ForwardRefExoticComponent<CheckboxProps & RefAttributes<HTMLInputElement>>;
|
|
853
|
+
export declare const Switch: FC<SwitchProps>;
|
|
854
|
+
export declare const Modal: FC<ModalProps>;
|
|
855
|
+
export declare const Drawer: FC<DrawerProps>;
|
|
856
|
+
export declare const Card: FC<{ title?: ReactNode; actions?: ReactNode; children?: ReactNode; className?: string; padded?: boolean } & Omit<HTMLAttributes<HTMLDivElement>, "title">>;
|
|
857
|
+
export declare const Badge: FC<{ children: ReactNode; color?: string; className?: string; dot?: boolean }>;
|
|
858
|
+
export declare const Avatar: FC<{ name: string; src?: string; size?: "xs" | "sm" | "md" | "lg"; square?: boolean; className?: string }>;
|
|
859
|
+
export declare const Tabs: FC<{ tabs: TabItem[]; value: string; onChange(id: string): void; className?: string }>;
|
|
860
|
+
export declare const Tooltip: FC<{ content: ReactNode; children: ReactNode; side?: "top" | "bottom" }>;
|
|
861
|
+
export declare const Spinner: FC<{ className?: string; size?: "sm" | "md" | "lg" }>;
|
|
862
|
+
export declare const EmptyState: FC<{ icon?: ReactNode; title: ReactNode; description?: ReactNode; action?: ReactNode; className?: string }>;
|
|
863
|
+
export declare const PageHeader: FC<{ title: ReactNode; icon?: ReactNode; description?: ReactNode; actions?: ReactNode; children?: ReactNode }>;
|
|
864
|
+
export declare const Kbd: FC<{ children: ReactNode }>;
|
|
865
|
+
export declare const Dropdown: FC<{ trigger: (props: { ref: (el: HTMLElement | null) => void; onClick(): void; open: boolean }) => ReactNode; items: MenuItem[]; align?: "start" | "end"; header?: ReactNode }>;
|
|
866
|
+
export declare const Table: ForwardRefExoticComponent<HTMLAttributes<HTMLTableElement> & RefAttributes<HTMLTableElement>>;
|
|
867
|
+
export declare const THead: FC<HTMLAttributes<HTMLTableSectionElement>>;
|
|
868
|
+
export declare const TBody: FC<HTMLAttributes<HTMLTableSectionElement>>;
|
|
869
|
+
export declare const Tr: FC<HTMLAttributes<HTMLTableRowElement> & { selected?: boolean }>;
|
|
870
|
+
export declare const Th: FC<ThHTMLAttributes<HTMLTableCellElement>>;
|
|
871
|
+
export declare const Td: FC<TdHTMLAttributes<HTMLTableCellElement>>;
|
|
872
|
+
export declare const FieldValue: FC<FieldValueProps>;
|
|
873
|
+
export declare const FieldInput: FC<FieldInputProps>;
|
|
874
|
+
export declare const ObjectIcon: FC<{ name?: string; color?: string; className?: string; tile?: boolean }>;
|
|
875
|
+
export declare const Markdown: FC<{ source: string; className?: string }>;
|
|
876
|
+
export declare function confirmDialog(opts: ConfirmOptions): Promise<boolean>;
|
|
877
|
+
export declare const toast: ToastApi;
|
|
878
|
+
export declare function cn(...args: ClassValue[]): string;
|
|
879
|
+
export declare function newId(now?: number): string;
|
|
880
|
+
|
|
881
|
+
export declare const i18n: I18nInstance;
|
|
882
|
+
export declare function addBundles(namespace: string, bundles: NamespaceBundles): void;
|
|
883
|
+
export declare function activeLocale(): "en" | "fr";
|
|
884
|
+
export declare function intlLocale(): string;
|
|
885
|
+
|
|
886
|
+
export declare function formatFieldValue(field: FieldDef, value: unknown, ctx?: FormatContext): string;
|
|
887
|
+
export declare function formatCurrency(n: number, currency?: string, locale?: string, compact?: boolean): string;
|
|
888
|
+
export declare function formatNumber(n: number, locale?: string, opts?: Intl.NumberFormatOptions): string;
|
|
889
|
+
export declare function formatDate(value: DateLike, locale?: string): string;
|
|
890
|
+
export declare function formatDateTime(value: DateLike, locale?: string): string;
|
|
891
|
+
export declare function formatRelative(value: DateLike, locale?: string, now?: number): string;
|
|
892
|
+
export declare function recordLabel(object: ObjectDef | undefined, record: Pick<CrmRecord, "id" | "fields">): string;
|
|
893
|
+
export declare function coerceFieldValue(field: FieldDef, raw: unknown, opts?: { dayFirst?: boolean; unknownOptions?: "fail" | "keep" }): CoerceResult;
|
|
894
|
+
export declare function isEmptyFieldValue(field: FieldDef, value: unknown): boolean;
|