@clianta/sdk 1.1.1 → 1.3.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/CHANGELOG.md +69 -0
- package/README.md +71 -1
- package/dist/clianta.cjs.js +1393 -225
- package/dist/clianta.cjs.js.map +1 -1
- package/dist/clianta.esm.js +1393 -226
- package/dist/clianta.esm.js.map +1 -1
- package/dist/clianta.umd.js +1393 -225
- package/dist/clianta.umd.js.map +1 -1
- package/dist/clianta.umd.min.js +2 -2
- package/dist/clianta.umd.min.js.map +1 -1
- package/dist/index.d.ts +596 -6
- package/dist/react.cjs.js +1393 -226
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.esm.js +1393 -226
- package/dist/react.esm.js.map +1 -1
- package/dist/vue.cjs.js +3900 -0
- package/dist/vue.cjs.js.map +1 -0
- package/dist/vue.d.ts +201 -0
- package/dist/vue.esm.js +3893 -0
- package/dist/vue.esm.js.map +1 -0
- package/package.json +16 -3
package/dist/index.d.ts
CHANGED
|
@@ -100,8 +100,8 @@ interface UserTraits {
|
|
|
100
100
|
interface Plugin {
|
|
101
101
|
/** Unique plugin name */
|
|
102
102
|
name: PluginName;
|
|
103
|
-
/** Initialize the plugin */
|
|
104
|
-
init(tracker: TrackerCore): void
|
|
103
|
+
/** Initialize the plugin (can be sync or async) */
|
|
104
|
+
init(tracker: TrackerCore): void | Promise<void>;
|
|
105
105
|
/** Cleanup when plugin is disabled */
|
|
106
106
|
destroy?(): void;
|
|
107
107
|
}
|
|
@@ -143,9 +143,94 @@ interface Contact {
|
|
|
143
143
|
jobTitle?: string;
|
|
144
144
|
phone?: string;
|
|
145
145
|
status?: 'lead' | 'contact' | 'customer';
|
|
146
|
+
lifecycleStage?: 'subscriber' | 'lead' | 'mql' | 'sql' | 'opportunity' | 'customer' | 'evangelist';
|
|
146
147
|
source?: string;
|
|
147
148
|
tags?: string[];
|
|
149
|
+
leadScore?: number;
|
|
148
150
|
customFields?: Record<string, unknown>;
|
|
151
|
+
companyId?: string;
|
|
152
|
+
assignedTo?: string;
|
|
153
|
+
createdAt?: string;
|
|
154
|
+
updatedAt?: string;
|
|
155
|
+
}
|
|
156
|
+
interface Company {
|
|
157
|
+
_id?: string;
|
|
158
|
+
workspaceId: string;
|
|
159
|
+
name: string;
|
|
160
|
+
industry?: string;
|
|
161
|
+
website?: string;
|
|
162
|
+
phone?: string;
|
|
163
|
+
address?: {
|
|
164
|
+
street?: string;
|
|
165
|
+
city?: string;
|
|
166
|
+
state?: string;
|
|
167
|
+
country?: string;
|
|
168
|
+
postalCode?: string;
|
|
169
|
+
};
|
|
170
|
+
companySize?: string;
|
|
171
|
+
annualRevenue?: number;
|
|
172
|
+
status?: 'prospect' | 'active' | 'inactive' | 'churned';
|
|
173
|
+
accountTier?: 'enterprise' | 'mid-market' | 'smb';
|
|
174
|
+
isTargetAccount?: boolean;
|
|
175
|
+
tags?: string[];
|
|
176
|
+
customFields?: Record<string, unknown>;
|
|
177
|
+
assignedTo?: string;
|
|
178
|
+
createdAt?: string;
|
|
179
|
+
updatedAt?: string;
|
|
180
|
+
}
|
|
181
|
+
interface Pipeline {
|
|
182
|
+
_id?: string;
|
|
183
|
+
workspaceId: string;
|
|
184
|
+
name: string;
|
|
185
|
+
description?: string;
|
|
186
|
+
stages: PipelineStage[];
|
|
187
|
+
isDefault?: boolean;
|
|
188
|
+
isActive?: boolean;
|
|
189
|
+
createdAt?: string;
|
|
190
|
+
updatedAt?: string;
|
|
191
|
+
}
|
|
192
|
+
interface PipelineStage {
|
|
193
|
+
_id?: string;
|
|
194
|
+
name: string;
|
|
195
|
+
order: number;
|
|
196
|
+
probability?: number;
|
|
197
|
+
color?: string;
|
|
198
|
+
rottenDays?: number;
|
|
199
|
+
}
|
|
200
|
+
interface Task {
|
|
201
|
+
_id?: string;
|
|
202
|
+
workspaceId: string;
|
|
203
|
+
title: string;
|
|
204
|
+
description?: string;
|
|
205
|
+
status?: 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
206
|
+
priority?: 'low' | 'medium' | 'high' | 'urgent';
|
|
207
|
+
dueDate?: string;
|
|
208
|
+
reminderDate?: string;
|
|
209
|
+
completedAt?: string;
|
|
210
|
+
tags?: string[];
|
|
211
|
+
relatedContactId?: string;
|
|
212
|
+
relatedCompanyId?: string;
|
|
213
|
+
relatedOpportunityId?: string;
|
|
214
|
+
assignedTo?: string;
|
|
215
|
+
createdAt?: string;
|
|
216
|
+
updatedAt?: string;
|
|
217
|
+
}
|
|
218
|
+
interface Activity {
|
|
219
|
+
_id?: string;
|
|
220
|
+
workspaceId: string;
|
|
221
|
+
type: 'call' | 'email' | 'meeting' | 'note' | 'task' | 'other';
|
|
222
|
+
title: string;
|
|
223
|
+
description?: string;
|
|
224
|
+
direction?: 'inbound' | 'outbound';
|
|
225
|
+
duration?: number;
|
|
226
|
+
outcome?: string;
|
|
227
|
+
emailSubject?: string;
|
|
228
|
+
emailBody?: string;
|
|
229
|
+
metadata?: Record<string, unknown>;
|
|
230
|
+
contactId?: string;
|
|
231
|
+
companyId?: string;
|
|
232
|
+
opportunityId?: string;
|
|
233
|
+
userId?: string;
|
|
149
234
|
createdAt?: string;
|
|
150
235
|
updatedAt?: string;
|
|
151
236
|
}
|
|
@@ -153,6 +238,7 @@ interface Opportunity {
|
|
|
153
238
|
_id?: string;
|
|
154
239
|
workspaceId: string;
|
|
155
240
|
contactId: string;
|
|
241
|
+
companyId?: string;
|
|
156
242
|
pipelineId: string;
|
|
157
243
|
stageId: string;
|
|
158
244
|
title: string;
|
|
@@ -161,8 +247,10 @@ interface Opportunity {
|
|
|
161
247
|
probability?: number;
|
|
162
248
|
expectedCloseDate?: string;
|
|
163
249
|
status?: 'open' | 'won' | 'lost';
|
|
250
|
+
priority?: 'low' | 'medium' | 'high';
|
|
164
251
|
lostReason?: string;
|
|
165
252
|
customFields?: Record<string, unknown>;
|
|
253
|
+
assignedTo?: string;
|
|
166
254
|
createdAt?: string;
|
|
167
255
|
updatedAt?: string;
|
|
168
256
|
}
|
|
@@ -181,6 +269,128 @@ interface PaginatedResponse<T> {
|
|
|
181
269
|
pages: number;
|
|
182
270
|
};
|
|
183
271
|
}
|
|
272
|
+
type TriggerEventType = 'contact.created' | 'contact.updated' | 'contact.deleted' | 'opportunity.created' | 'opportunity.updated' | 'opportunity.stage_changed' | 'opportunity.won' | 'opportunity.lost' | 'task.created' | 'task.completed' | 'task.overdue' | 'activity.logged' | 'form.submitted';
|
|
273
|
+
interface TriggerCondition {
|
|
274
|
+
/**
|
|
275
|
+
* Field to check - supports dynamic field names including custom fields
|
|
276
|
+
* Examples: 'status', 'lifecycleStage', 'leadScore', 'customFields.industry'
|
|
277
|
+
* Use dot notation for nested fields: 'contact.email', 'customFields.accountType'
|
|
278
|
+
*/
|
|
279
|
+
field: string;
|
|
280
|
+
/** Operator for comparison */
|
|
281
|
+
operator: 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'less_than' | 'in' | 'not_in';
|
|
282
|
+
/** Value to compare against */
|
|
283
|
+
value: unknown;
|
|
284
|
+
}
|
|
285
|
+
interface EmailTemplate {
|
|
286
|
+
/** Template ID */
|
|
287
|
+
_id?: string;
|
|
288
|
+
/** Template name */
|
|
289
|
+
name: string;
|
|
290
|
+
/** Email subject line (supports variables) */
|
|
291
|
+
subject: string;
|
|
292
|
+
/** Email body (supports HTML and variables) */
|
|
293
|
+
body: string;
|
|
294
|
+
/** Variables available in this template */
|
|
295
|
+
variables?: string[];
|
|
296
|
+
/** Sender email address */
|
|
297
|
+
fromEmail?: string;
|
|
298
|
+
/** Sender name */
|
|
299
|
+
fromName?: string;
|
|
300
|
+
}
|
|
301
|
+
interface EmailAction {
|
|
302
|
+
/** Action type identifier */
|
|
303
|
+
type: 'send_email';
|
|
304
|
+
/** Email template ID or inline template */
|
|
305
|
+
templateId?: string;
|
|
306
|
+
/** Inline email subject (if not using template) */
|
|
307
|
+
subject?: string;
|
|
308
|
+
/** Inline email body (if not using template) */
|
|
309
|
+
body?: string;
|
|
310
|
+
/** Recipient email (supports variables like {{contact.email}}) */
|
|
311
|
+
to: string;
|
|
312
|
+
/** CC recipients */
|
|
313
|
+
cc?: string[];
|
|
314
|
+
/** BCC recipients */
|
|
315
|
+
bcc?: string[];
|
|
316
|
+
/** Sender email */
|
|
317
|
+
from?: string;
|
|
318
|
+
/** Delay in minutes before sending */
|
|
319
|
+
delayMinutes?: number;
|
|
320
|
+
}
|
|
321
|
+
interface WebhookAction {
|
|
322
|
+
/** Action type identifier */
|
|
323
|
+
type: 'webhook';
|
|
324
|
+
/** Webhook URL to call */
|
|
325
|
+
url: string;
|
|
326
|
+
/** HTTP method */
|
|
327
|
+
method: 'POST' | 'PUT' | 'PATCH';
|
|
328
|
+
/** Custom headers */
|
|
329
|
+
headers?: Record<string, string>;
|
|
330
|
+
/** Request body template (supports variables) */
|
|
331
|
+
body?: string;
|
|
332
|
+
}
|
|
333
|
+
interface TaskAction {
|
|
334
|
+
/** Action type identifier */
|
|
335
|
+
type: 'create_task';
|
|
336
|
+
/** Task title (supports variables) */
|
|
337
|
+
title: string;
|
|
338
|
+
/** Task description */
|
|
339
|
+
description?: string;
|
|
340
|
+
/** Task priority */
|
|
341
|
+
priority?: 'low' | 'medium' | 'high' | 'urgent';
|
|
342
|
+
/** Due date in days from trigger */
|
|
343
|
+
dueDays?: number;
|
|
344
|
+
/** Assign to user ID */
|
|
345
|
+
assignedTo?: string;
|
|
346
|
+
}
|
|
347
|
+
interface ContactUpdateAction {
|
|
348
|
+
/** Action type identifier */
|
|
349
|
+
type: 'update_contact';
|
|
350
|
+
/** Fields to update */
|
|
351
|
+
updates: Partial<Contact>;
|
|
352
|
+
}
|
|
353
|
+
type TriggerAction = EmailAction | WebhookAction | TaskAction | ContactUpdateAction;
|
|
354
|
+
interface EventTrigger {
|
|
355
|
+
/** Trigger ID */
|
|
356
|
+
_id?: string;
|
|
357
|
+
/** Workspace ID */
|
|
358
|
+
workspaceId: string;
|
|
359
|
+
/** Trigger name */
|
|
360
|
+
name: string;
|
|
361
|
+
/** Description of what this trigger does */
|
|
362
|
+
description?: string;
|
|
363
|
+
/** Event type that activates this trigger */
|
|
364
|
+
eventType: TriggerEventType;
|
|
365
|
+
/** Conditions that must be met for trigger to fire */
|
|
366
|
+
conditions?: TriggerCondition[];
|
|
367
|
+
/** Actions to execute when trigger fires */
|
|
368
|
+
actions: TriggerAction[];
|
|
369
|
+
/** Whether this trigger is active */
|
|
370
|
+
isActive?: boolean;
|
|
371
|
+
/** Created timestamp */
|
|
372
|
+
createdAt?: string;
|
|
373
|
+
/** Updated timestamp */
|
|
374
|
+
updatedAt?: string;
|
|
375
|
+
}
|
|
376
|
+
interface TriggerExecution {
|
|
377
|
+
/** Execution ID */
|
|
378
|
+
_id?: string;
|
|
379
|
+
/** Trigger ID that was executed */
|
|
380
|
+
triggerId: string;
|
|
381
|
+
/** Event that triggered the execution */
|
|
382
|
+
eventType: TriggerEventType;
|
|
383
|
+
/** Entity ID that triggered the event */
|
|
384
|
+
entityId: string;
|
|
385
|
+
/** Execution status */
|
|
386
|
+
status: 'pending' | 'success' | 'failed';
|
|
387
|
+
/** Error message if failed */
|
|
388
|
+
error?: string;
|
|
389
|
+
/** Actions executed */
|
|
390
|
+
actionsExecuted: number;
|
|
391
|
+
/** Execution timestamp */
|
|
392
|
+
executedAt: string;
|
|
393
|
+
}
|
|
184
394
|
|
|
185
395
|
/**
|
|
186
396
|
* Clianta SDK - Main Tracker Class
|
|
@@ -200,6 +410,8 @@ declare class Tracker implements TrackerCore {
|
|
|
200
410
|
private sessionId;
|
|
201
411
|
private isInitialized;
|
|
202
412
|
private consentManager;
|
|
413
|
+
/** Pending identify retry on next flush */
|
|
414
|
+
private pendingIdentify;
|
|
203
415
|
constructor(workspaceId: string, userConfig?: CliantaConfig);
|
|
204
416
|
/**
|
|
205
417
|
* Create visitor ID based on storage mode
|
|
@@ -215,6 +427,7 @@ declare class Tracker implements TrackerCore {
|
|
|
215
427
|
private onConsentChange;
|
|
216
428
|
/**
|
|
217
429
|
* Initialize enabled plugins
|
|
430
|
+
* Handles both sync and async plugin init methods
|
|
218
431
|
*/
|
|
219
432
|
private initPlugins;
|
|
220
433
|
/**
|
|
@@ -229,6 +442,10 @@ declare class Tracker implements TrackerCore {
|
|
|
229
442
|
* Identify a visitor
|
|
230
443
|
*/
|
|
231
444
|
identify(email: string, traits?: UserTraits): Promise<void>;
|
|
445
|
+
/**
|
|
446
|
+
* Retry pending identify call
|
|
447
|
+
*/
|
|
448
|
+
private retryPendingIdentify;
|
|
232
449
|
/**
|
|
233
450
|
* Update consent state
|
|
234
451
|
*/
|
|
@@ -272,7 +489,170 @@ declare class Tracker implements TrackerCore {
|
|
|
272
489
|
/**
|
|
273
490
|
* Destroy tracker and cleanup
|
|
274
491
|
*/
|
|
275
|
-
destroy(): void
|
|
492
|
+
destroy(): Promise<void>;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Clianta SDK - Event Triggers Manager
|
|
497
|
+
* Manages event-driven automation and email notifications
|
|
498
|
+
*/
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Event Triggers Manager
|
|
502
|
+
* Handles event-driven automation based on CRM actions
|
|
503
|
+
*
|
|
504
|
+
* Similar to:
|
|
505
|
+
* - Salesforce: Process Builder, Flow Automation
|
|
506
|
+
* - HubSpot: Workflows, Email Sequences
|
|
507
|
+
* - Pipedrive: Workflow Automation
|
|
508
|
+
*/
|
|
509
|
+
declare class EventTriggersManager {
|
|
510
|
+
private apiEndpoint;
|
|
511
|
+
private workspaceId;
|
|
512
|
+
private authToken?;
|
|
513
|
+
private triggers;
|
|
514
|
+
private listeners;
|
|
515
|
+
constructor(apiEndpoint: string, workspaceId: string, authToken?: string);
|
|
516
|
+
/**
|
|
517
|
+
* Set authentication token
|
|
518
|
+
*/
|
|
519
|
+
setAuthToken(token: string): void;
|
|
520
|
+
/**
|
|
521
|
+
* Make authenticated API request
|
|
522
|
+
*/
|
|
523
|
+
private request;
|
|
524
|
+
/**
|
|
525
|
+
* Get all event triggers
|
|
526
|
+
*/
|
|
527
|
+
getTriggers(): Promise<ApiResponse<EventTrigger[]>>;
|
|
528
|
+
/**
|
|
529
|
+
* Get a single trigger by ID
|
|
530
|
+
*/
|
|
531
|
+
getTrigger(triggerId: string): Promise<ApiResponse<EventTrigger>>;
|
|
532
|
+
/**
|
|
533
|
+
* Create a new event trigger
|
|
534
|
+
*/
|
|
535
|
+
createTrigger(trigger: Partial<EventTrigger>): Promise<ApiResponse<EventTrigger>>;
|
|
536
|
+
/**
|
|
537
|
+
* Update an existing trigger
|
|
538
|
+
*/
|
|
539
|
+
updateTrigger(triggerId: string, updates: Partial<EventTrigger>): Promise<ApiResponse<EventTrigger>>;
|
|
540
|
+
/**
|
|
541
|
+
* Delete a trigger
|
|
542
|
+
*/
|
|
543
|
+
deleteTrigger(triggerId: string): Promise<ApiResponse<void>>;
|
|
544
|
+
/**
|
|
545
|
+
* Activate a trigger
|
|
546
|
+
*/
|
|
547
|
+
activateTrigger(triggerId: string): Promise<ApiResponse<EventTrigger>>;
|
|
548
|
+
/**
|
|
549
|
+
* Deactivate a trigger
|
|
550
|
+
*/
|
|
551
|
+
deactivateTrigger(triggerId: string): Promise<ApiResponse<EventTrigger>>;
|
|
552
|
+
/**
|
|
553
|
+
* Register a local event listener for client-side triggers
|
|
554
|
+
* This allows immediate client-side reactions to events
|
|
555
|
+
*/
|
|
556
|
+
on(eventType: TriggerEventType, callback: (data: unknown) => void): void;
|
|
557
|
+
/**
|
|
558
|
+
* Remove an event listener
|
|
559
|
+
*/
|
|
560
|
+
off(eventType: TriggerEventType, callback: (data: unknown) => void): void;
|
|
561
|
+
/**
|
|
562
|
+
* Emit an event (client-side only)
|
|
563
|
+
* This will trigger any registered local listeners
|
|
564
|
+
*/
|
|
565
|
+
emit(eventType: TriggerEventType, data: unknown): void;
|
|
566
|
+
/**
|
|
567
|
+
* Check if conditions are met for a trigger
|
|
568
|
+
* Supports dynamic field evaluation including custom fields and nested paths
|
|
569
|
+
*/
|
|
570
|
+
private evaluateConditions;
|
|
571
|
+
/**
|
|
572
|
+
* Execute actions for a triggered event (client-side preview)
|
|
573
|
+
* Note: Actual execution happens on the backend
|
|
574
|
+
*/
|
|
575
|
+
executeActions(trigger: EventTrigger, data: Record<string, unknown>): Promise<void>;
|
|
576
|
+
/**
|
|
577
|
+
* Execute a single action
|
|
578
|
+
*/
|
|
579
|
+
private executeAction;
|
|
580
|
+
/**
|
|
581
|
+
* Execute send email action (via backend API)
|
|
582
|
+
*/
|
|
583
|
+
private executeSendEmail;
|
|
584
|
+
/**
|
|
585
|
+
* Execute webhook action
|
|
586
|
+
*/
|
|
587
|
+
private executeWebhook;
|
|
588
|
+
/**
|
|
589
|
+
* Execute create task action
|
|
590
|
+
*/
|
|
591
|
+
private executeCreateTask;
|
|
592
|
+
/**
|
|
593
|
+
* Execute update contact action
|
|
594
|
+
*/
|
|
595
|
+
private executeUpdateContact;
|
|
596
|
+
/**
|
|
597
|
+
* Replace variables in a string template
|
|
598
|
+
* Supports syntax like {{contact.email}}, {{opportunity.value}}
|
|
599
|
+
*/
|
|
600
|
+
private replaceVariables;
|
|
601
|
+
/**
|
|
602
|
+
* Get nested value from object using dot notation
|
|
603
|
+
* Supports dynamic field access including custom fields
|
|
604
|
+
*/
|
|
605
|
+
private getNestedValue;
|
|
606
|
+
/**
|
|
607
|
+
* Extract all available field paths from a data object
|
|
608
|
+
* Useful for dynamic field discovery based on platform-specific attributes
|
|
609
|
+
* @param obj - The data object to extract fields from
|
|
610
|
+
* @param prefix - Internal use for nested paths
|
|
611
|
+
* @param maxDepth - Maximum depth to traverse (default: 3)
|
|
612
|
+
* @returns Array of field paths (e.g., ['email', 'contact.firstName', 'customFields.industry'])
|
|
613
|
+
*/
|
|
614
|
+
private extractAvailableFields;
|
|
615
|
+
/**
|
|
616
|
+
* Get available fields from sample data
|
|
617
|
+
* Helps with dynamic field detection for platform-specific attributes
|
|
618
|
+
* @param sampleData - Sample data object to analyze
|
|
619
|
+
* @returns Array of available field paths
|
|
620
|
+
*/
|
|
621
|
+
getAvailableFields(sampleData: Record<string, unknown>): string[];
|
|
622
|
+
/**
|
|
623
|
+
* Create a simple email trigger
|
|
624
|
+
* Helper method for common use case
|
|
625
|
+
*/
|
|
626
|
+
createEmailTrigger(config: {
|
|
627
|
+
name: string;
|
|
628
|
+
eventType: TriggerEventType;
|
|
629
|
+
to: string;
|
|
630
|
+
subject: string;
|
|
631
|
+
body: string;
|
|
632
|
+
conditions?: TriggerCondition[];
|
|
633
|
+
}): Promise<ApiResponse<EventTrigger>>;
|
|
634
|
+
/**
|
|
635
|
+
* Create a task creation trigger
|
|
636
|
+
*/
|
|
637
|
+
createTaskTrigger(config: {
|
|
638
|
+
name: string;
|
|
639
|
+
eventType: TriggerEventType;
|
|
640
|
+
taskTitle: string;
|
|
641
|
+
taskDescription?: string;
|
|
642
|
+
priority?: 'low' | 'medium' | 'high' | 'urgent';
|
|
643
|
+
dueDays?: number;
|
|
644
|
+
conditions?: TriggerCondition[];
|
|
645
|
+
}): Promise<ApiResponse<EventTrigger>>;
|
|
646
|
+
/**
|
|
647
|
+
* Create a webhook trigger
|
|
648
|
+
*/
|
|
649
|
+
createWebhookTrigger(config: {
|
|
650
|
+
name: string;
|
|
651
|
+
eventType: TriggerEventType;
|
|
652
|
+
webhookUrl: string;
|
|
653
|
+
method?: 'POST' | 'PUT' | 'PATCH';
|
|
654
|
+
conditions?: TriggerCondition[];
|
|
655
|
+
}): Promise<ApiResponse<EventTrigger>>;
|
|
276
656
|
}
|
|
277
657
|
|
|
278
658
|
/**
|
|
@@ -287,11 +667,17 @@ declare class CRMClient {
|
|
|
287
667
|
private apiEndpoint;
|
|
288
668
|
private workspaceId;
|
|
289
669
|
private authToken?;
|
|
670
|
+
triggers: EventTriggersManager;
|
|
290
671
|
constructor(apiEndpoint: string, workspaceId: string, authToken?: string);
|
|
291
672
|
/**
|
|
292
673
|
* Set authentication token for API requests
|
|
293
674
|
*/
|
|
294
675
|
setAuthToken(token: string): void;
|
|
676
|
+
/**
|
|
677
|
+
* Validate required parameter exists
|
|
678
|
+
* @throws {Error} if value is null/undefined or empty string
|
|
679
|
+
*/
|
|
680
|
+
private validateRequired;
|
|
295
681
|
/**
|
|
296
682
|
* Make authenticated API request
|
|
297
683
|
*/
|
|
@@ -350,6 +736,210 @@ declare class CRMClient {
|
|
|
350
736
|
* Move opportunity to a different stage
|
|
351
737
|
*/
|
|
352
738
|
moveOpportunity(opportunityId: string, stageId: string): Promise<ApiResponse<Opportunity>>;
|
|
739
|
+
/**
|
|
740
|
+
* Get all companies with pagination
|
|
741
|
+
*/
|
|
742
|
+
getCompanies(params?: {
|
|
743
|
+
page?: number;
|
|
744
|
+
limit?: number;
|
|
745
|
+
search?: string;
|
|
746
|
+
status?: string;
|
|
747
|
+
industry?: string;
|
|
748
|
+
}): Promise<ApiResponse<PaginatedResponse<Company>>>;
|
|
749
|
+
/**
|
|
750
|
+
* Get a single company by ID
|
|
751
|
+
*/
|
|
752
|
+
getCompany(companyId: string): Promise<ApiResponse<Company>>;
|
|
753
|
+
/**
|
|
754
|
+
* Create a new company
|
|
755
|
+
*/
|
|
756
|
+
createCompany(company: Partial<Company>): Promise<ApiResponse<Company>>;
|
|
757
|
+
/**
|
|
758
|
+
* Update an existing company
|
|
759
|
+
*/
|
|
760
|
+
updateCompany(companyId: string, updates: Partial<Company>): Promise<ApiResponse<Company>>;
|
|
761
|
+
/**
|
|
762
|
+
* Delete a company
|
|
763
|
+
*/
|
|
764
|
+
deleteCompany(companyId: string): Promise<ApiResponse<void>>;
|
|
765
|
+
/**
|
|
766
|
+
* Get contacts belonging to a company
|
|
767
|
+
*/
|
|
768
|
+
getCompanyContacts(companyId: string, params?: {
|
|
769
|
+
page?: number;
|
|
770
|
+
limit?: number;
|
|
771
|
+
}): Promise<ApiResponse<PaginatedResponse<Contact>>>;
|
|
772
|
+
/**
|
|
773
|
+
* Get deals/opportunities belonging to a company
|
|
774
|
+
*/
|
|
775
|
+
getCompanyDeals(companyId: string, params?: {
|
|
776
|
+
page?: number;
|
|
777
|
+
limit?: number;
|
|
778
|
+
}): Promise<ApiResponse<PaginatedResponse<Opportunity>>>;
|
|
779
|
+
/**
|
|
780
|
+
* Get all pipelines
|
|
781
|
+
*/
|
|
782
|
+
getPipelines(): Promise<ApiResponse<Pipeline[]>>;
|
|
783
|
+
/**
|
|
784
|
+
* Get a single pipeline by ID
|
|
785
|
+
*/
|
|
786
|
+
getPipeline(pipelineId: string): Promise<ApiResponse<Pipeline>>;
|
|
787
|
+
/**
|
|
788
|
+
* Create a new pipeline
|
|
789
|
+
*/
|
|
790
|
+
createPipeline(pipeline: Partial<Pipeline>): Promise<ApiResponse<Pipeline>>;
|
|
791
|
+
/**
|
|
792
|
+
* Update an existing pipeline
|
|
793
|
+
*/
|
|
794
|
+
updatePipeline(pipelineId: string, updates: Partial<Pipeline>): Promise<ApiResponse<Pipeline>>;
|
|
795
|
+
/**
|
|
796
|
+
* Delete a pipeline
|
|
797
|
+
*/
|
|
798
|
+
deletePipeline(pipelineId: string): Promise<ApiResponse<void>>;
|
|
799
|
+
/**
|
|
800
|
+
* Get all tasks with pagination
|
|
801
|
+
*/
|
|
802
|
+
getTasks(params?: {
|
|
803
|
+
page?: number;
|
|
804
|
+
limit?: number;
|
|
805
|
+
status?: string;
|
|
806
|
+
priority?: string;
|
|
807
|
+
contactId?: string;
|
|
808
|
+
companyId?: string;
|
|
809
|
+
opportunityId?: string;
|
|
810
|
+
}): Promise<ApiResponse<PaginatedResponse<Task>>>;
|
|
811
|
+
/**
|
|
812
|
+
* Get a single task by ID
|
|
813
|
+
*/
|
|
814
|
+
getTask(taskId: string): Promise<ApiResponse<Task>>;
|
|
815
|
+
/**
|
|
816
|
+
* Create a new task
|
|
817
|
+
*/
|
|
818
|
+
createTask(task: Partial<Task>): Promise<ApiResponse<Task>>;
|
|
819
|
+
/**
|
|
820
|
+
* Update an existing task
|
|
821
|
+
*/
|
|
822
|
+
updateTask(taskId: string, updates: Partial<Task>): Promise<ApiResponse<Task>>;
|
|
823
|
+
/**
|
|
824
|
+
* Mark a task as completed
|
|
825
|
+
*/
|
|
826
|
+
completeTask(taskId: string): Promise<ApiResponse<Task>>;
|
|
827
|
+
/**
|
|
828
|
+
* Delete a task
|
|
829
|
+
*/
|
|
830
|
+
deleteTask(taskId: string): Promise<ApiResponse<void>>;
|
|
831
|
+
/**
|
|
832
|
+
* Get activities for a contact
|
|
833
|
+
*/
|
|
834
|
+
getContactActivities(contactId: string, params?: {
|
|
835
|
+
page?: number;
|
|
836
|
+
limit?: number;
|
|
837
|
+
type?: string;
|
|
838
|
+
}): Promise<ApiResponse<PaginatedResponse<Activity>>>;
|
|
839
|
+
/**
|
|
840
|
+
* Get activities for an opportunity/deal
|
|
841
|
+
*/
|
|
842
|
+
getOpportunityActivities(opportunityId: string, params?: {
|
|
843
|
+
page?: number;
|
|
844
|
+
limit?: number;
|
|
845
|
+
type?: string;
|
|
846
|
+
}): Promise<ApiResponse<PaginatedResponse<Activity>>>;
|
|
847
|
+
/**
|
|
848
|
+
* Create a new activity
|
|
849
|
+
*/
|
|
850
|
+
createActivity(activity: Partial<Activity>): Promise<ApiResponse<Activity>>;
|
|
851
|
+
/**
|
|
852
|
+
* Update an existing activity
|
|
853
|
+
*/
|
|
854
|
+
updateActivity(activityId: string, updates: Partial<Activity>): Promise<ApiResponse<Activity>>;
|
|
855
|
+
/**
|
|
856
|
+
* Delete an activity
|
|
857
|
+
*/
|
|
858
|
+
deleteActivity(activityId: string): Promise<ApiResponse<void>>;
|
|
859
|
+
/**
|
|
860
|
+
* Log a call activity
|
|
861
|
+
*/
|
|
862
|
+
logCall(data: {
|
|
863
|
+
contactId?: string;
|
|
864
|
+
opportunityId?: string;
|
|
865
|
+
direction: 'inbound' | 'outbound';
|
|
866
|
+
duration?: number;
|
|
867
|
+
outcome?: string;
|
|
868
|
+
notes?: string;
|
|
869
|
+
}): Promise<ApiResponse<Activity>>;
|
|
870
|
+
/**
|
|
871
|
+
* Log a meeting activity
|
|
872
|
+
*/
|
|
873
|
+
logMeeting(data: {
|
|
874
|
+
contactId?: string;
|
|
875
|
+
opportunityId?: string;
|
|
876
|
+
title: string;
|
|
877
|
+
duration?: number;
|
|
878
|
+
outcome?: string;
|
|
879
|
+
notes?: string;
|
|
880
|
+
}): Promise<ApiResponse<Activity>>;
|
|
881
|
+
/**
|
|
882
|
+
* Add a note to a contact or opportunity
|
|
883
|
+
*/
|
|
884
|
+
addNote(data: {
|
|
885
|
+
contactId?: string;
|
|
886
|
+
opportunityId?: string;
|
|
887
|
+
content: string;
|
|
888
|
+
}): Promise<ApiResponse<Activity>>;
|
|
889
|
+
/**
|
|
890
|
+
* Get all email templates
|
|
891
|
+
*/
|
|
892
|
+
getEmailTemplates(params?: {
|
|
893
|
+
page?: number;
|
|
894
|
+
limit?: number;
|
|
895
|
+
}): Promise<ApiResponse<PaginatedResponse<EmailTemplate>>>;
|
|
896
|
+
/**
|
|
897
|
+
* Get a single email template by ID
|
|
898
|
+
*/
|
|
899
|
+
getEmailTemplate(templateId: string): Promise<ApiResponse<EmailTemplate>>;
|
|
900
|
+
/**
|
|
901
|
+
* Create a new email template
|
|
902
|
+
*/
|
|
903
|
+
createEmailTemplate(template: Partial<EmailTemplate>): Promise<ApiResponse<EmailTemplate>>;
|
|
904
|
+
/**
|
|
905
|
+
* Update an email template
|
|
906
|
+
*/
|
|
907
|
+
updateEmailTemplate(templateId: string, updates: Partial<EmailTemplate>): Promise<ApiResponse<EmailTemplate>>;
|
|
908
|
+
/**
|
|
909
|
+
* Delete an email template
|
|
910
|
+
*/
|
|
911
|
+
deleteEmailTemplate(templateId: string): Promise<ApiResponse<void>>;
|
|
912
|
+
/**
|
|
913
|
+
* Send an email using a template
|
|
914
|
+
*/
|
|
915
|
+
sendEmail(data: {
|
|
916
|
+
to: string;
|
|
917
|
+
templateId?: string;
|
|
918
|
+
subject?: string;
|
|
919
|
+
body?: string;
|
|
920
|
+
cc?: string[];
|
|
921
|
+
bcc?: string[];
|
|
922
|
+
variables?: Record<string, unknown>;
|
|
923
|
+
contactId?: string;
|
|
924
|
+
}): Promise<ApiResponse<{
|
|
925
|
+
messageId: string;
|
|
926
|
+
}>>;
|
|
927
|
+
/**
|
|
928
|
+
* Get all event triggers
|
|
929
|
+
*/
|
|
930
|
+
getEventTriggers(): Promise<ApiResponse<EventTrigger[]>>;
|
|
931
|
+
/**
|
|
932
|
+
* Create a new event trigger
|
|
933
|
+
*/
|
|
934
|
+
createEventTrigger(trigger: Partial<EventTrigger>): Promise<ApiResponse<EventTrigger>>;
|
|
935
|
+
/**
|
|
936
|
+
* Update an event trigger
|
|
937
|
+
*/
|
|
938
|
+
updateEventTrigger(triggerId: string, updates: Partial<EventTrigger>): Promise<ApiResponse<EventTrigger>>;
|
|
939
|
+
/**
|
|
940
|
+
* Delete an event trigger
|
|
941
|
+
*/
|
|
942
|
+
deleteEventTrigger(triggerId: string): Promise<ApiResponse<void>>;
|
|
353
943
|
}
|
|
354
944
|
|
|
355
945
|
/**
|
|
@@ -448,7 +1038,7 @@ interface StoredConsent {
|
|
|
448
1038
|
*/
|
|
449
1039
|
|
|
450
1040
|
/** SDK Version */
|
|
451
|
-
declare const SDK_VERSION = "1.
|
|
1041
|
+
declare const SDK_VERSION = "1.3.0";
|
|
452
1042
|
|
|
453
1043
|
/**
|
|
454
1044
|
* Clianta SDK
|
|
@@ -482,5 +1072,5 @@ declare const SDK_VERSION = "1.1.0";
|
|
|
482
1072
|
*/
|
|
483
1073
|
declare function clianta(workspaceId: string, config?: CliantaConfig): TrackerCore;
|
|
484
1074
|
|
|
485
|
-
export { CRMClient, ConsentManager, SDK_VERSION, Tracker, clianta, clianta as default };
|
|
486
|
-
export type { ApiResponse, CliantaConfig, ConsentChangeCallback, ConsentConfig, ConsentManagerConfig, ConsentState, Contact, EventType, Opportunity, PaginatedResponse, Plugin, PluginName, StoredConsent, TrackerCore, TrackingEvent, UserTraits };
|
|
1075
|
+
export { CRMClient, ConsentManager, EventTriggersManager, SDK_VERSION, Tracker, clianta, clianta as default };
|
|
1076
|
+
export type { Activity, ApiResponse, CliantaConfig, Company, ConsentChangeCallback, ConsentConfig, ConsentManagerConfig, ConsentState, Contact, ContactUpdateAction, EmailAction, EmailTemplate, EventTrigger, EventType, Opportunity, PaginatedResponse, Pipeline, PipelineStage, Plugin, PluginName, StoredConsent, Task, TaskAction, TrackerCore, TrackingEvent, TriggerAction, TriggerCondition, TriggerEventType, TriggerExecution, UserTraits, WebhookAction };
|