@clianta/sdk 1.6.0 → 1.6.2

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/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 */
@@ -188,24 +154,6 @@ interface TrackerCore {
188
154
  onReady(callback: () => void): void;
189
155
  /** Check if the SDK is fully initialized and ready */
190
156
  isReady(): boolean;
191
- /** Get the current visitor's profile from the CRM */
192
- getVisitorProfile(): Promise<VisitorProfile | null>;
193
- /** Get the current visitor's recent activity */
194
- getVisitorActivity(options?: VisitorActivityOptions): Promise<{
195
- data: VisitorActivity[];
196
- pagination: {
197
- page: number;
198
- limit: number;
199
- total: number;
200
- pages: number;
201
- };
202
- } | null>;
203
- /** Get a summarized journey timeline for the current visitor */
204
- getVisitorTimeline(): Promise<VisitorTimeline | null>;
205
- /** Get engagement metrics for the current visitor */
206
- getVisitorEngagement(): Promise<EngagementMetrics | null>;
207
- /** Send a server-side inbound event (requires apiKey in config) */
208
- sendEvent(payload: InboundEventPayload): Promise<InboundEventResult>;
209
157
  /** Create or update a contact by email (upsert) */
210
158
  createContact(data: PublicContactData): Promise<PublicCrmResult>;
211
159
  /** Update an existing contact by ID (limited fields) */
@@ -216,76 +164,8 @@ interface TrackerCore {
216
164
  logActivity(data: PublicActivityData): Promise<PublicCrmResult>;
217
165
  /** Create an opportunity (e.g., from "Request Demo" forms) */
218
166
  createOpportunity(data: PublicOpportunityData): Promise<PublicCrmResult>;
219
- }
220
- interface VisitorProfile {
221
- visitorId: string;
222
- contactId?: string;
223
- email?: string;
224
- firstName?: string;
225
- lastName?: string;
226
- company?: string;
227
- jobTitle?: string;
228
- phone?: string;
229
- status?: string;
230
- lifecycleStage?: string;
231
- tags?: string[];
232
- leadScore?: number;
233
- firstSeen?: string;
234
- lastSeen?: string;
235
- sessionCount?: number;
236
- pageViewCount?: number;
237
- totalTimeSpent?: number;
238
- customFields?: Record<string, unknown>;
239
- }
240
- interface VisitorActivity {
241
- _id?: string;
242
- eventType: string;
243
- eventName: string;
244
- url: string;
245
- properties?: Record<string, unknown>;
246
- timestamp: string;
247
- }
248
- interface VisitorTimeline {
249
- visitorId: string;
250
- contactId?: string;
251
- firstSeen: string;
252
- lastSeen: string;
253
- totalSessions: number;
254
- totalPageViews: number;
255
- totalEvents: number;
256
- totalTimeSpentSeconds: number;
257
- averageSessionDurationSeconds: number;
258
- topPages: Array<{
259
- url: string;
260
- views: number;
261
- avgTimeSeconds?: number;
262
- }>;
263
- recentActivities: VisitorActivity[];
264
- devices: Array<{
265
- userAgent: string;
266
- lastSeen: string;
267
- }>;
268
- }
269
- interface EngagementMetrics {
270
- visitorId: string;
271
- totalTimeOnSiteSeconds: number;
272
- averageSessionDurationSeconds: number;
273
- totalPageViews: number;
274
- totalSessions: number;
275
- engagementScore: number;
276
- bounceRate: number;
277
- lastActiveAt: string;
278
- topEvents: Array<{
279
- eventType: string;
280
- count: number;
281
- }>;
282
- }
283
- interface VisitorActivityOptions {
284
- page?: number;
285
- limit?: number;
286
- eventType?: string;
287
- startDate?: string;
288
- endDate?: string;
167
+ /** Destroy the tracker instance, flush pending events, and clean up plugins */
168
+ destroy(): Promise<void>;
289
169
  }
290
170
  interface PublicContactData {
291
171
  email: string;
@@ -363,8 +243,6 @@ interface PublicCrmResult {
363
243
  * constructor() {
364
244
  * this.instance = createCliantaTracker({
365
245
  * projectId: environment.cliantaProjectId,
366
- * apiEndpoint: environment.cliantaApiEndpoint,
367
- * debug: !environment.production,
368
246
  * });
369
247
  * }
370
248
  *
@@ -403,7 +281,6 @@ interface CliantaAngularConfig extends CliantaConfig {
403
281
  * @example
404
282
  * const instance = createCliantaTracker({
405
283
  * projectId: 'your-project-id',
406
- * apiEndpoint: environment.cliantaApiEndpoint || 'http://localhost:5000',
407
284
  * });
408
285
  *
409
286
  * instance.tracker?.track('page_view', 'Home Page');