@clianta/sdk 1.5.0 → 1.6.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 +36 -0
- package/dist/angular.cjs.js +358 -57
- package/dist/angular.cjs.js.map +1 -1
- package/dist/angular.d.ts +136 -1
- package/dist/angular.esm.js +358 -57
- package/dist/angular.esm.js.map +1 -1
- package/dist/clianta.cjs.js +357 -56
- package/dist/clianta.cjs.js.map +1 -1
- package/dist/clianta.esm.js +357 -56
- package/dist/clianta.esm.js.map +1 -1
- package/dist/clianta.umd.js +357 -56
- 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 +242 -8
- package/dist/react.cjs.js +425 -69
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.d.ts +156 -4
- package/dist/react.esm.js +426 -71
- package/dist/react.esm.js.map +1 -1
- package/dist/svelte.cjs.js +358 -57
- package/dist/svelte.cjs.js.map +1 -1
- package/dist/svelte.d.ts +136 -1
- package/dist/svelte.esm.js +358 -57
- package/dist/svelte.esm.js.map +1 -1
- package/dist/vue.cjs.js +358 -57
- package/dist/vue.cjs.js.map +1 -1
- package/dist/vue.d.ts +136 -1
- package/dist/vue.esm.js +358 -57
- package/dist/vue.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/angular.d.ts
CHANGED
|
@@ -84,6 +84,63 @@ interface ConsentState {
|
|
|
84
84
|
personalization?: boolean;
|
|
85
85
|
}
|
|
86
86
|
type EventType = 'page_view' | 'button_click' | 'form_view' | 'form_submit' | 'form_interaction' | 'scroll_depth' | 'engagement' | 'download' | 'exit_intent' | 'error' | 'performance' | 'time_on_page' | 'custom';
|
|
87
|
+
interface TrackingEvent {
|
|
88
|
+
/** Workspace/project ID */
|
|
89
|
+
workspaceId: string;
|
|
90
|
+
/** Anonymous visitor identifier */
|
|
91
|
+
visitorId: string;
|
|
92
|
+
/** Session identifier */
|
|
93
|
+
sessionId: string;
|
|
94
|
+
/** Event type category */
|
|
95
|
+
eventType: EventType;
|
|
96
|
+
/** Human-readable event name */
|
|
97
|
+
eventName: string;
|
|
98
|
+
/** Current page URL */
|
|
99
|
+
url: string;
|
|
100
|
+
/** Referrer URL */
|
|
101
|
+
referrer?: string;
|
|
102
|
+
/** Event properties/metadata */
|
|
103
|
+
properties: Record<string, unknown>;
|
|
104
|
+
/** Device information */
|
|
105
|
+
device: DeviceInfo;
|
|
106
|
+
/** UTM parameters */
|
|
107
|
+
utm?: UTMParams;
|
|
108
|
+
/** ISO timestamp */
|
|
109
|
+
timestamp: string;
|
|
110
|
+
/** SDK version */
|
|
111
|
+
sdkVersion: string;
|
|
112
|
+
}
|
|
113
|
+
interface DeviceInfo {
|
|
114
|
+
userAgent: string;
|
|
115
|
+
screen: string;
|
|
116
|
+
language: string;
|
|
117
|
+
timezone?: string;
|
|
118
|
+
}
|
|
119
|
+
interface UTMParams {
|
|
120
|
+
utmSource?: string;
|
|
121
|
+
utmMedium?: string;
|
|
122
|
+
utmCampaign?: string;
|
|
123
|
+
utmTerm?: string;
|
|
124
|
+
utmContent?: string;
|
|
125
|
+
}
|
|
126
|
+
interface GroupTraits {
|
|
127
|
+
/** Company/account name */
|
|
128
|
+
name?: string;
|
|
129
|
+
/** Industry */
|
|
130
|
+
industry?: string;
|
|
131
|
+
/** Company size */
|
|
132
|
+
employees?: number;
|
|
133
|
+
/** Annual revenue */
|
|
134
|
+
revenue?: number;
|
|
135
|
+
/** Company website */
|
|
136
|
+
website?: string;
|
|
137
|
+
/** Company plan/tier */
|
|
138
|
+
plan?: string;
|
|
139
|
+
/** Additional custom properties */
|
|
140
|
+
[key: string]: unknown;
|
|
141
|
+
}
|
|
142
|
+
/** Event middleware function — intercept or transform events before they are sent */
|
|
143
|
+
type MiddlewareFn = (event: TrackingEvent, next: () => void) => void;
|
|
87
144
|
interface UserTraits {
|
|
88
145
|
firstName?: string;
|
|
89
146
|
lastName?: string;
|
|
@@ -119,6 +176,18 @@ interface TrackerCore {
|
|
|
119
176
|
deleteData(): void;
|
|
120
177
|
/** Get current consent state */
|
|
121
178
|
getConsentState(): ConsentState;
|
|
179
|
+
/** Associate the current visitor with a group (company/account) */
|
|
180
|
+
group(groupId: string, traits?: GroupTraits): void;
|
|
181
|
+
/** Merge two visitor identities (e.g., anonymous → logged-in) */
|
|
182
|
+
alias(newId: string, previousId?: string): Promise<boolean>;
|
|
183
|
+
/** Track a screen view (for mobile-first PWAs and SPAs) */
|
|
184
|
+
screen(name: string, properties?: Record<string, unknown>): void;
|
|
185
|
+
/** Register event middleware to intercept/transform events before sending */
|
|
186
|
+
use(middleware: MiddlewareFn): void;
|
|
187
|
+
/** Register a callback to be invoked when the SDK is fully initialized */
|
|
188
|
+
onReady(callback: () => void): void;
|
|
189
|
+
/** Check if the SDK is fully initialized and ready */
|
|
190
|
+
isReady(): boolean;
|
|
122
191
|
/** Get the current visitor's profile from the CRM */
|
|
123
192
|
getVisitorProfile(): Promise<VisitorProfile | null>;
|
|
124
193
|
/** Get the current visitor's recent activity */
|
|
@@ -137,6 +206,16 @@ interface TrackerCore {
|
|
|
137
206
|
getVisitorEngagement(): Promise<EngagementMetrics | null>;
|
|
138
207
|
/** Send a server-side inbound event (requires apiKey in config) */
|
|
139
208
|
sendEvent(payload: InboundEventPayload): Promise<InboundEventResult>;
|
|
209
|
+
/** Create or update a contact by email (upsert) */
|
|
210
|
+
createContact(data: PublicContactData): Promise<PublicCrmResult>;
|
|
211
|
+
/** Update an existing contact by ID (limited fields) */
|
|
212
|
+
updateContact(contactId: string, data: PublicContactUpdate): Promise<PublicCrmResult>;
|
|
213
|
+
/** Submit a form — creates/updates contact from form data */
|
|
214
|
+
submitForm(formId: string, data: PublicFormSubmission): Promise<PublicCrmResult>;
|
|
215
|
+
/** Log an activity linked to a contact (append-only) */
|
|
216
|
+
logActivity(data: PublicActivityData): Promise<PublicCrmResult>;
|
|
217
|
+
/** Create an opportunity (e.g., from "Request Demo" forms) */
|
|
218
|
+
createOpportunity(data: PublicOpportunityData): Promise<PublicCrmResult>;
|
|
140
219
|
}
|
|
141
220
|
interface VisitorProfile {
|
|
142
221
|
visitorId: string;
|
|
@@ -208,6 +287,62 @@ interface VisitorActivityOptions {
|
|
|
208
287
|
startDate?: string;
|
|
209
288
|
endDate?: string;
|
|
210
289
|
}
|
|
290
|
+
interface PublicContactData {
|
|
291
|
+
email: string;
|
|
292
|
+
firstName?: string;
|
|
293
|
+
lastName?: string;
|
|
294
|
+
company?: string;
|
|
295
|
+
jobTitle?: string;
|
|
296
|
+
phone?: string;
|
|
297
|
+
source?: string;
|
|
298
|
+
tags?: string[];
|
|
299
|
+
customFields?: Record<string, unknown>;
|
|
300
|
+
}
|
|
301
|
+
interface PublicContactUpdate {
|
|
302
|
+
firstName?: string;
|
|
303
|
+
lastName?: string;
|
|
304
|
+
company?: string;
|
|
305
|
+
jobTitle?: string;
|
|
306
|
+
phone?: string;
|
|
307
|
+
tags?: string[];
|
|
308
|
+
customFields?: Record<string, unknown>;
|
|
309
|
+
}
|
|
310
|
+
interface PublicActivityData {
|
|
311
|
+
contactId: string;
|
|
312
|
+
type: 'call' | 'email' | 'meeting' | 'note' | 'other';
|
|
313
|
+
title: string;
|
|
314
|
+
description?: string;
|
|
315
|
+
direction?: 'inbound' | 'outbound';
|
|
316
|
+
duration?: number;
|
|
317
|
+
emailSubject?: string;
|
|
318
|
+
metadata?: Record<string, unknown>;
|
|
319
|
+
}
|
|
320
|
+
interface PublicOpportunityData {
|
|
321
|
+
title: string;
|
|
322
|
+
contactId: string;
|
|
323
|
+
pipelineId: string;
|
|
324
|
+
stageId: string;
|
|
325
|
+
value?: number;
|
|
326
|
+
currency?: string;
|
|
327
|
+
description?: string;
|
|
328
|
+
expectedCloseDate?: string;
|
|
329
|
+
customFields?: Record<string, unknown>;
|
|
330
|
+
}
|
|
331
|
+
interface PublicFormSubmission {
|
|
332
|
+
fields: Record<string, unknown>;
|
|
333
|
+
metadata?: {
|
|
334
|
+
visitorId?: string;
|
|
335
|
+
sessionId?: string;
|
|
336
|
+
pageUrl?: string;
|
|
337
|
+
referrer?: string;
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
interface PublicCrmResult {
|
|
341
|
+
success: boolean;
|
|
342
|
+
data?: Record<string, unknown>;
|
|
343
|
+
error?: string;
|
|
344
|
+
status?: number;
|
|
345
|
+
}
|
|
211
346
|
|
|
212
347
|
/**
|
|
213
348
|
* Clianta SDK - Angular Integration
|
|
@@ -268,7 +403,7 @@ interface CliantaAngularConfig extends CliantaConfig {
|
|
|
268
403
|
* @example
|
|
269
404
|
* const instance = createCliantaTracker({
|
|
270
405
|
* projectId: 'your-project-id',
|
|
271
|
-
* apiEndpoint: '
|
|
406
|
+
* apiEndpoint: environment.cliantaApiEndpoint || 'http://localhost:5000',
|
|
272
407
|
* });
|
|
273
408
|
*
|
|
274
409
|
* instance.tracker?.track('page_view', 'Home Page');
|