@clianta/sdk 1.5.1 → 1.6.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/CHANGELOG.md +20 -0
- package/README.md +250 -384
- package/dist/angular.cjs.js +177 -1286
- package/dist/angular.cjs.js.map +1 -1
- package/dist/angular.d.ts +69 -122
- package/dist/angular.esm.js +177 -1286
- package/dist/angular.esm.js.map +1 -1
- package/dist/clianta.cjs.js +177 -1288
- package/dist/clianta.cjs.js.map +1 -1
- package/dist/clianta.esm.js +178 -1287
- package/dist/clianta.esm.js.map +1 -1
- package/dist/clianta.umd.js +177 -1288
- 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 +91 -970
- package/dist/react.cjs.js +244 -1298
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.d.ts +89 -125
- package/dist/react.esm.js +245 -1300
- package/dist/react.esm.js.map +1 -1
- package/dist/svelte.cjs.js +177 -1286
- package/dist/svelte.cjs.js.map +1 -1
- package/dist/svelte.d.ts +69 -122
- package/dist/svelte.esm.js +177 -1286
- package/dist/svelte.esm.js.map +1 -1
- package/dist/vue.cjs.js +177 -1286
- package/dist/vue.cjs.js.map +1 -1
- package/dist/vue.d.ts +69 -122
- package/dist/vue.esm.js +177 -1286
- package/dist/vue.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/angular.d.ts
CHANGED
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clianta SDK - CRM API Client
|
|
3
|
-
* @see SDK_VERSION in core/config.ts
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
type InboundEventType = 'user.registered' | 'user.updated' | 'user.subscribed' | 'user.unsubscribed' | 'contact.created' | 'contact.updated' | 'purchase.completed';
|
|
7
|
-
interface InboundEventPayload {
|
|
8
|
-
/** Event type (e.g. "user.registered") */
|
|
9
|
-
event: InboundEventType;
|
|
10
|
-
/** Contact data — at least email or phone is required */
|
|
11
|
-
contact: {
|
|
12
|
-
email?: string;
|
|
13
|
-
phone?: string;
|
|
14
|
-
firstName?: string;
|
|
15
|
-
lastName?: string;
|
|
16
|
-
company?: string;
|
|
17
|
-
jobTitle?: string;
|
|
18
|
-
tags?: string[];
|
|
19
|
-
};
|
|
20
|
-
/** Optional extra data stored as customFields on the contact */
|
|
21
|
-
data?: Record<string, unknown>;
|
|
22
|
-
}
|
|
23
|
-
interface InboundEventResult {
|
|
24
|
-
success: boolean;
|
|
25
|
-
contactCreated: boolean;
|
|
26
|
-
contactId?: string;
|
|
27
|
-
event: string;
|
|
28
|
-
error?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
1
|
/**
|
|
32
2
|
* Clianta SDK - Type Definitions
|
|
33
3
|
* @see SDK_VERSION in core/config.ts
|
|
@@ -37,10 +7,6 @@ interface CliantaConfig {
|
|
|
37
7
|
projectId?: string;
|
|
38
8
|
/** Backend API endpoint URL */
|
|
39
9
|
apiEndpoint?: string;
|
|
40
|
-
/** Auth token for server-side API access (user JWT) */
|
|
41
|
-
authToken?: string;
|
|
42
|
-
/** Workspace API key for server-to-server access (use instead of authToken for external apps) */
|
|
43
|
-
apiKey?: string;
|
|
44
10
|
/** Enable debug mode with verbose logging */
|
|
45
11
|
debug?: boolean;
|
|
46
12
|
/** Automatically track page views on load and navigation */
|
|
@@ -84,6 +50,63 @@ interface ConsentState {
|
|
|
84
50
|
personalization?: boolean;
|
|
85
51
|
}
|
|
86
52
|
type EventType = 'page_view' | 'button_click' | 'form_view' | 'form_submit' | 'form_interaction' | 'scroll_depth' | 'engagement' | 'download' | 'exit_intent' | 'error' | 'performance' | 'time_on_page' | 'custom';
|
|
53
|
+
interface TrackingEvent {
|
|
54
|
+
/** Workspace/project ID */
|
|
55
|
+
workspaceId: string;
|
|
56
|
+
/** Anonymous visitor identifier */
|
|
57
|
+
visitorId: string;
|
|
58
|
+
/** Session identifier */
|
|
59
|
+
sessionId: string;
|
|
60
|
+
/** Event type category */
|
|
61
|
+
eventType: EventType;
|
|
62
|
+
/** Human-readable event name */
|
|
63
|
+
eventName: string;
|
|
64
|
+
/** Current page URL */
|
|
65
|
+
url: string;
|
|
66
|
+
/** Referrer URL */
|
|
67
|
+
referrer?: string;
|
|
68
|
+
/** Event properties/metadata */
|
|
69
|
+
properties: Record<string, unknown>;
|
|
70
|
+
/** Device information */
|
|
71
|
+
device: DeviceInfo;
|
|
72
|
+
/** UTM parameters */
|
|
73
|
+
utm?: UTMParams;
|
|
74
|
+
/** ISO timestamp */
|
|
75
|
+
timestamp: string;
|
|
76
|
+
/** SDK version */
|
|
77
|
+
sdkVersion: string;
|
|
78
|
+
}
|
|
79
|
+
interface DeviceInfo {
|
|
80
|
+
userAgent: string;
|
|
81
|
+
screen: string;
|
|
82
|
+
language: string;
|
|
83
|
+
timezone?: string;
|
|
84
|
+
}
|
|
85
|
+
interface UTMParams {
|
|
86
|
+
utmSource?: string;
|
|
87
|
+
utmMedium?: string;
|
|
88
|
+
utmCampaign?: string;
|
|
89
|
+
utmTerm?: string;
|
|
90
|
+
utmContent?: string;
|
|
91
|
+
}
|
|
92
|
+
interface GroupTraits {
|
|
93
|
+
/** Company/account name */
|
|
94
|
+
name?: string;
|
|
95
|
+
/** Industry */
|
|
96
|
+
industry?: string;
|
|
97
|
+
/** Company size */
|
|
98
|
+
employees?: number;
|
|
99
|
+
/** Annual revenue */
|
|
100
|
+
revenue?: number;
|
|
101
|
+
/** Company website */
|
|
102
|
+
website?: string;
|
|
103
|
+
/** Company plan/tier */
|
|
104
|
+
plan?: string;
|
|
105
|
+
/** Additional custom properties */
|
|
106
|
+
[key: string]: unknown;
|
|
107
|
+
}
|
|
108
|
+
/** Event middleware function — intercept or transform events before they are sent */
|
|
109
|
+
type MiddlewareFn = (event: TrackingEvent, next: () => void) => void;
|
|
87
110
|
interface UserTraits {
|
|
88
111
|
firstName?: string;
|
|
89
112
|
lastName?: string;
|
|
@@ -119,24 +142,18 @@ interface TrackerCore {
|
|
|
119
142
|
deleteData(): void;
|
|
120
143
|
/** Get current consent state */
|
|
121
144
|
getConsentState(): ConsentState;
|
|
122
|
-
/**
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/** Get a summarized journey timeline for the current visitor */
|
|
135
|
-
getVisitorTimeline(): Promise<VisitorTimeline | null>;
|
|
136
|
-
/** Get engagement metrics for the current visitor */
|
|
137
|
-
getVisitorEngagement(): Promise<EngagementMetrics | null>;
|
|
138
|
-
/** Send a server-side inbound event (requires apiKey in config) */
|
|
139
|
-
sendEvent(payload: InboundEventPayload): Promise<InboundEventResult>;
|
|
145
|
+
/** Associate the current visitor with a group (company/account) */
|
|
146
|
+
group(groupId: string, traits?: GroupTraits): void;
|
|
147
|
+
/** Merge two visitor identities (e.g., anonymous → logged-in) */
|
|
148
|
+
alias(newId: string, previousId?: string): Promise<boolean>;
|
|
149
|
+
/** Track a screen view (for mobile-first PWAs and SPAs) */
|
|
150
|
+
screen(name: string, properties?: Record<string, unknown>): void;
|
|
151
|
+
/** Register event middleware to intercept/transform events before sending */
|
|
152
|
+
use(middleware: MiddlewareFn): void;
|
|
153
|
+
/** Register a callback to be invoked when the SDK is fully initialized */
|
|
154
|
+
onReady(callback: () => void): void;
|
|
155
|
+
/** Check if the SDK is fully initialized and ready */
|
|
156
|
+
isReady(): boolean;
|
|
140
157
|
/** Create or update a contact by email (upsert) */
|
|
141
158
|
createContact(data: PublicContactData): Promise<PublicCrmResult>;
|
|
142
159
|
/** Update an existing contact by ID (limited fields) */
|
|
@@ -148,76 +165,6 @@ interface TrackerCore {
|
|
|
148
165
|
/** Create an opportunity (e.g., from "Request Demo" forms) */
|
|
149
166
|
createOpportunity(data: PublicOpportunityData): Promise<PublicCrmResult>;
|
|
150
167
|
}
|
|
151
|
-
interface VisitorProfile {
|
|
152
|
-
visitorId: string;
|
|
153
|
-
contactId?: string;
|
|
154
|
-
email?: string;
|
|
155
|
-
firstName?: string;
|
|
156
|
-
lastName?: string;
|
|
157
|
-
company?: string;
|
|
158
|
-
jobTitle?: string;
|
|
159
|
-
phone?: string;
|
|
160
|
-
status?: string;
|
|
161
|
-
lifecycleStage?: string;
|
|
162
|
-
tags?: string[];
|
|
163
|
-
leadScore?: number;
|
|
164
|
-
firstSeen?: string;
|
|
165
|
-
lastSeen?: string;
|
|
166
|
-
sessionCount?: number;
|
|
167
|
-
pageViewCount?: number;
|
|
168
|
-
totalTimeSpent?: number;
|
|
169
|
-
customFields?: Record<string, unknown>;
|
|
170
|
-
}
|
|
171
|
-
interface VisitorActivity {
|
|
172
|
-
_id?: string;
|
|
173
|
-
eventType: string;
|
|
174
|
-
eventName: string;
|
|
175
|
-
url: string;
|
|
176
|
-
properties?: Record<string, unknown>;
|
|
177
|
-
timestamp: string;
|
|
178
|
-
}
|
|
179
|
-
interface VisitorTimeline {
|
|
180
|
-
visitorId: string;
|
|
181
|
-
contactId?: string;
|
|
182
|
-
firstSeen: string;
|
|
183
|
-
lastSeen: string;
|
|
184
|
-
totalSessions: number;
|
|
185
|
-
totalPageViews: number;
|
|
186
|
-
totalEvents: number;
|
|
187
|
-
totalTimeSpentSeconds: number;
|
|
188
|
-
averageSessionDurationSeconds: number;
|
|
189
|
-
topPages: Array<{
|
|
190
|
-
url: string;
|
|
191
|
-
views: number;
|
|
192
|
-
avgTimeSeconds?: number;
|
|
193
|
-
}>;
|
|
194
|
-
recentActivities: VisitorActivity[];
|
|
195
|
-
devices: Array<{
|
|
196
|
-
userAgent: string;
|
|
197
|
-
lastSeen: string;
|
|
198
|
-
}>;
|
|
199
|
-
}
|
|
200
|
-
interface EngagementMetrics {
|
|
201
|
-
visitorId: string;
|
|
202
|
-
totalTimeOnSiteSeconds: number;
|
|
203
|
-
averageSessionDurationSeconds: number;
|
|
204
|
-
totalPageViews: number;
|
|
205
|
-
totalSessions: number;
|
|
206
|
-
engagementScore: number;
|
|
207
|
-
bounceRate: number;
|
|
208
|
-
lastActiveAt: string;
|
|
209
|
-
topEvents: Array<{
|
|
210
|
-
eventType: string;
|
|
211
|
-
count: number;
|
|
212
|
-
}>;
|
|
213
|
-
}
|
|
214
|
-
interface VisitorActivityOptions {
|
|
215
|
-
page?: number;
|
|
216
|
-
limit?: number;
|
|
217
|
-
eventType?: string;
|
|
218
|
-
startDate?: string;
|
|
219
|
-
endDate?: string;
|
|
220
|
-
}
|
|
221
168
|
interface PublicContactData {
|
|
222
169
|
email: string;
|
|
223
170
|
firstName?: string;
|