@clianta/sdk 1.2.0 → 1.4.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 CHANGED
@@ -5,6 +5,39 @@ All notable changes to the Clianta SDK will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.4.0] - 2026-02-27
9
+
10
+ ### Fixed
11
+ - **CRITICAL: contactId propagation** - `identify()` now stores the returned `contactId` and attaches it to every subsequent `track()` call. Previously, all events remained anonymous after identification.
12
+ - **CRITICAL: identify() return type** - `identify()` now returns `Promise<string | null>` (the contactId) instead of `Promise<void>`, so callers can use the contactId immediately.
13
+ - **Transport: contactId extraction** - `sendIdentify()` now parses the server response body and returns `contactId` in `TransportResult`.
14
+ - **Event deduplication** - Every tracked event now includes a unique `eventId` UUID in properties. Prevents duplicate events when events are retried after network timeouts or restored from localStorage on page reload.
15
+
16
+ ### Added
17
+ - **`sendEvent()` method on Tracker** - Convenience proxy to `CRMClient.sendEvent()` for server-side inbound events. Requires `apiKey` in the SDK config. No need to instantiate a separate `CRMClient`.
18
+ - **`contactId` field on TransportResult** - TypeScript type updated.
19
+ - **`sendEvent()` on TrackerCore interface** - Full TypeScript support.
20
+
21
+ ### Changed
22
+ - `TrackerCore.identify()` signature: `Promise<void>` → `Promise<string | null>`
23
+
24
+ ## [1.3.0] - 2026-02-17
25
+
26
+ ### Added
27
+ - **ContactUpdateAction Type** - New trigger action type for automatically updating contact fields when triggers fire
28
+ - Supports partial contact updates via `updates: Partial<Contact>`
29
+ - **TriggerExecution Interface** - Full execution tracking for event triggers
30
+ - Fields: `triggerId`, `eventType`, `entityId`, `status`, `error`, `actionsExecuted`, `executedAt`
31
+ - Status tracking: `pending`, `success`, `failed`
32
+ - **deleteEventTrigger()** - New CRM client method to delete event triggers by ID
33
+ - `crm.deleteEventTrigger(triggerId)` - removes a trigger from the workspace
34
+ - **Vue Type Augmentation** - Added `ComponentCustomProperties` declaration for `$clianta` global property
35
+ - Enables type-safe access to tracker via Options API in Vue components
36
+ - **Export: ContactUpdateAction** - Now exported from main SDK entry point
37
+
38
+ ### Changed
39
+ - `TriggerAction` union type now includes `ContactUpdateAction` alongside `EmailAction`, `WebhookAction`, and `TaskAction`
40
+
8
41
  ## [1.2.0] - 2026-02-02
9
42
 
10
43
  ### Added
package/README.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # Clianta SDK
2
2
 
3
- Professional CRM and tracking SDK for lead generation. Works with any website or JavaScript framework.
3
+ Professional CRM and tracking SDK for lead generation with **automated email triggers** and workflows. Works with any website or JavaScript framework.
4
+
5
+ ## ✨ Key Features
6
+
7
+ - 📊 **Visitor & Event Tracking** - Track page views, clicks, forms, and custom events
8
+ - 👥 **CRM Management** - Contacts, companies, opportunities, tasks, and activities
9
+ - 🤖 **Event Triggers & Automation** - Automated emails, tasks, and webhooks (like Salesforce & HubSpot)
10
+ - 📧 **Email Notifications** - Send automated emails based on CRM actions
11
+ - 🔒 **GDPR Compliant** - Built-in consent management
12
+ - ⚡ **Framework Agnostic** - Works with React, Vue, Next.js, or vanilla JavaScript
4
13
 
5
14
  ## Installation
6
15
 
@@ -431,6 +440,67 @@ import {
431
440
 
432
441
  ---
433
442
 
443
+ ## Event Triggers & Automation
444
+
445
+ Automate your workflows with event-driven triggers. Send emails, create tasks, or call webhooks when specific actions occur.
446
+
447
+ ### Quick Example
448
+
449
+ ```typescript
450
+ import { CRMClient } from '@clianta/sdk';
451
+
452
+ const crm = new CRMClient(
453
+ 'https://api.clianta.online',
454
+ 'your-workspace-id',
455
+ 'your-auth-token'
456
+ );
457
+
458
+ // Send welcome email when a contact is created
459
+ await crm.createEventTrigger({
460
+ name: 'Welcome Email',
461
+ eventType: 'contact.created',
462
+ actions: [
463
+ {
464
+ type: 'send_email',
465
+ to: '{{contact.email}}',
466
+ subject: 'Welcome to Our Platform!',
467
+ body: 'Hello {{contact.firstName}}, welcome aboard!',
468
+ }
469
+ ],
470
+ isActive: true,
471
+ });
472
+
473
+ // Create task when high-value opportunity is created
474
+ await crm.triggers.createTaskTrigger({
475
+ name: 'Follow-up Task',
476
+ eventType: 'opportunity.created',
477
+ taskTitle: 'Call {{contact.firstName}} about {{opportunity.title}}',
478
+ priority: 'high',
479
+ dueDays: 1,
480
+ conditions: [
481
+ { field: 'value', operator: 'greater_than', value: 10000 }
482
+ ],
483
+ });
484
+ ```
485
+
486
+ ### Supported Event Types
487
+
488
+ - **Contact Events**: `contact.created`, `contact.updated`, `contact.deleted`
489
+ - **Opportunity Events**: `opportunity.created`, `opportunity.won`, `opportunity.stage_changed`
490
+ - **Task Events**: `task.created`, `task.completed`, `task.overdue`
491
+ - **Activity Events**: `activity.logged`, `form.submitted`
492
+
493
+ ### Action Types
494
+
495
+ 1. **Send Email** - Automated email notifications with template variables
496
+ 2. **Create Task** - Auto-create follow-up tasks
497
+ 3. **Webhook** - Call external services (Slack, Zapier, etc.)
498
+ 4. **Update Contact** - Automatically update contact fields
499
+
500
+ 📚 **[Full Event Triggers Documentation](./docs/EVENT_TRIGGERS.md)**
501
+
502
+ ---
503
+
434
504
  ## Self-Hosted
435
505
 
436
506
  For self-hosted deployments, configure the API endpoint: