@zaplier/sdk 1.8.1 → 1.8.3
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/core-ultra.min.js +1 -1
- package/dist/index.cjs +1615 -34
- package/dist/index.d.ts +11 -7
- package/dist/index.esm.js +1615 -34
- package/dist/v2/chunks/browser-apis-AyU2utpF.min.js +6 -0
- package/dist/v2/chunks/confidence-BslwbUCt.min.js +6 -0
- package/dist/v2/chunks/device-signals-2L_62qNZ.min.js +6 -0
- package/dist/v2/chunks/dom-blockers-C467-IRd.min.js +6 -0
- package/dist/v2/chunks/fingerprint-FfUEEIAd.min.js +6 -0
- package/dist/v2/chunks/hardware-9ikfSEs-.min.js +6 -0
- package/dist/v2/chunks/incognito-CkKAdE8Z.min.js +6 -0
- package/dist/v2/chunks/math-Q4s6nkVD.min.js +6 -0
- package/dist/v2/chunks/plugins-enhanced-mUjU1EXe.min.js +6 -0
- package/dist/v2/chunks/session-replay-C5Tp0d16.min.js +6 -0
- package/dist/v2/chunks/storage-Bl_8oytT.min.js +6 -0
- package/dist/v2/chunks/system-DTjxyOZF.min.js +6 -0
- package/dist/v2/core.d.ts +289 -7
- package/dist/v2/core.min.js +2 -2
- package/dist/v2/modules/anti-adblock.js +1 -1
- package/dist/v2/modules/browser-apis-DzzjRXFN.js +6 -0
- package/dist/v2/modules/confidence-CLylpqVh.js +6 -0
- package/dist/v2/modules/device-signals-D-VQg-o6.js +6 -0
- package/dist/v2/modules/dom-blockers-D9M2aO9M.js +6 -0
- package/dist/v2/modules/fingerprint-Ddq30bun.js +6 -0
- package/dist/v2/modules/fingerprint.js +2 -2
- package/dist/v2/modules/hardware-BxWqOjae.js +6 -0
- package/dist/v2/modules/heatmap.js +1 -1
- package/dist/v2/modules/incognito-DpuYoC8S.js +6 -0
- package/dist/v2/modules/math-B13vt1ND.js +6 -0
- package/dist/v2/modules/plugins-enhanced-D5ft0k0e.js +6 -0
- package/dist/v2/modules/replay.js +1 -1
- package/dist/v2/modules/storage-D8dcMojB.js +6 -0
- package/dist/v2/modules/system-ZMflVbka.js +6 -0
- package/package.json +13 -13
package/dist/v2/core.d.ts
CHANGED
|
@@ -1,7 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visitor-related types for SDK responses
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Visitor information returned by getVisitorInfo()
|
|
6
|
+
*/
|
|
7
|
+
interface VisitorInfo {
|
|
8
|
+
visitorId: string;
|
|
9
|
+
workspaceId: string;
|
|
10
|
+
location: {
|
|
11
|
+
country?: string;
|
|
12
|
+
countryCode?: string;
|
|
13
|
+
city?: string;
|
|
14
|
+
};
|
|
15
|
+
device: {
|
|
16
|
+
browser?: string;
|
|
17
|
+
os?: string;
|
|
18
|
+
deviceType?: string;
|
|
19
|
+
userAgent?: string;
|
|
20
|
+
};
|
|
21
|
+
stats: {
|
|
22
|
+
visitCount: number;
|
|
23
|
+
firstSeenAt: string;
|
|
24
|
+
lastSeenAt: string;
|
|
25
|
+
identificationScore?: number;
|
|
26
|
+
};
|
|
27
|
+
signals?: {
|
|
28
|
+
smartSignals?: any;
|
|
29
|
+
tlsFingerprint?: string | null;
|
|
30
|
+
cookieFingerprint?: string | null;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Visit history entry
|
|
35
|
+
*/
|
|
36
|
+
interface VisitHistoryEntry {
|
|
37
|
+
id: string;
|
|
38
|
+
timestamp: string;
|
|
39
|
+
location: string | null;
|
|
40
|
+
country?: string | null;
|
|
41
|
+
countryCode?: string | null;
|
|
42
|
+
city?: string | null;
|
|
43
|
+
ip: string | null;
|
|
44
|
+
browser: string | null;
|
|
45
|
+
os: string | null;
|
|
46
|
+
deviceType: string | null;
|
|
47
|
+
isIncognito: boolean;
|
|
48
|
+
vpnDetected: boolean;
|
|
49
|
+
suspectScore: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Visitor history response
|
|
53
|
+
*/
|
|
54
|
+
interface VisitorHistory {
|
|
55
|
+
visitorId: string;
|
|
56
|
+
visits: VisitHistoryEntry[];
|
|
57
|
+
summary: {
|
|
58
|
+
totalVisits: number;
|
|
59
|
+
uniqueIPs: number;
|
|
60
|
+
uniqueLocations: number;
|
|
61
|
+
incognitoSessions: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* User data returned by getUserData()
|
|
66
|
+
*/
|
|
67
|
+
interface UserData {
|
|
68
|
+
sessionId: string;
|
|
69
|
+
visitorId?: string;
|
|
70
|
+
userId?: string;
|
|
71
|
+
location: {
|
|
72
|
+
city?: string;
|
|
73
|
+
country?: string;
|
|
74
|
+
coordinates?: {
|
|
75
|
+
lat: number;
|
|
76
|
+
lng: number;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
device: {
|
|
80
|
+
userAgent: string;
|
|
81
|
+
language: string;
|
|
82
|
+
screen: {
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
journey: any[];
|
|
88
|
+
fingerprint?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* SDK Configuration Types
|
|
93
|
+
*
|
|
94
|
+
* 100% Cookieless tracking using fingerprinting only.
|
|
95
|
+
* No storage dependencies - fully GDPR/LGPD compliant.
|
|
96
|
+
*/
|
|
97
|
+
interface SDKConfig {
|
|
98
|
+
/** Workspace token (required) */
|
|
99
|
+
token: string;
|
|
100
|
+
/** Enable session replay recording (default: false) */
|
|
101
|
+
replay?: boolean;
|
|
102
|
+
/** Enable heatmap tracking (default: false) */
|
|
103
|
+
heatmap?: boolean;
|
|
104
|
+
/** Enable debug mode for development (default: false) */
|
|
105
|
+
debug?: boolean;
|
|
106
|
+
/** Allow tracking on localhost (default: false) */
|
|
107
|
+
allow_localhost?: boolean;
|
|
108
|
+
/** GDPR mode - limits invasive fingerprinting (default: false) */
|
|
109
|
+
gdprMode?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Internal configuration with optimized defaults
|
|
113
|
+
* These settings are not exposed to the user but can be referenced internally
|
|
114
|
+
*/
|
|
115
|
+
interface InternalConfig extends SDKConfig {
|
|
116
|
+
apiEndpoint: string;
|
|
117
|
+
retryEnabled: boolean;
|
|
118
|
+
maxRetries: number;
|
|
119
|
+
retryDelays: number[];
|
|
120
|
+
autoTrack: boolean;
|
|
121
|
+
dedupeEnabled: boolean;
|
|
122
|
+
fingerprintEnabled: boolean;
|
|
123
|
+
presenceTracking: boolean;
|
|
124
|
+
heartbeatInterval: number;
|
|
125
|
+
scrollTracking: boolean;
|
|
126
|
+
scrollDepthTracking: boolean;
|
|
127
|
+
gdprCompliant: boolean;
|
|
128
|
+
enhancedTracking: 'ask' | 'true' | 'false';
|
|
129
|
+
replaySampling: number;
|
|
130
|
+
replayMaskInputs: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Event and Tracking Types
|
|
135
|
+
*/
|
|
136
|
+
interface BaseEventData {
|
|
137
|
+
eventType: string;
|
|
138
|
+
eventName?: string;
|
|
139
|
+
customData?: Record<string, any>;
|
|
140
|
+
}
|
|
141
|
+
interface PageViewEvent extends BaseEventData {
|
|
142
|
+
eventType: 'page_view';
|
|
143
|
+
url?: string;
|
|
144
|
+
pageTitle?: string;
|
|
145
|
+
referrer?: string;
|
|
146
|
+
spaNavigation?: boolean;
|
|
147
|
+
navigationType?: 'manual' | 'spa' | 'direct';
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Method parameter types for SDK calls
|
|
152
|
+
*/
|
|
153
|
+
/**
|
|
154
|
+
* Parameters for trackPurchase()
|
|
155
|
+
*/
|
|
156
|
+
interface TrackPurchaseParams {
|
|
157
|
+
value?: number;
|
|
158
|
+
revenue?: number;
|
|
159
|
+
currency?: string;
|
|
160
|
+
quantity?: number;
|
|
161
|
+
productId?: string;
|
|
162
|
+
productName?: string;
|
|
163
|
+
orderId?: string;
|
|
164
|
+
customData?: Record<string, any>;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Parameters for trackAddToCart()
|
|
168
|
+
*/
|
|
169
|
+
interface TrackAddToCartParams {
|
|
170
|
+
productId?: string;
|
|
171
|
+
productName?: string;
|
|
172
|
+
price?: number;
|
|
173
|
+
quantity?: number;
|
|
174
|
+
customData?: Record<string, any>;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Parameters for trackViewContent()
|
|
178
|
+
*/
|
|
179
|
+
interface TrackViewContentParams {
|
|
180
|
+
productId?: string;
|
|
181
|
+
productName?: string;
|
|
182
|
+
category?: string;
|
|
183
|
+
customData?: Record<string, any>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Parameters for trackInitiateCheckout()
|
|
187
|
+
*/
|
|
188
|
+
interface TrackInitiateCheckoutParams {
|
|
189
|
+
value?: number;
|
|
190
|
+
currency?: string;
|
|
191
|
+
numItems?: number;
|
|
192
|
+
customData?: Record<string, any>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Parameters for identify()
|
|
196
|
+
*/
|
|
197
|
+
interface IdentifyParams {
|
|
198
|
+
email?: string;
|
|
199
|
+
phone?: string;
|
|
200
|
+
[key: string]: any;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Response from trackConversion()
|
|
204
|
+
*/
|
|
205
|
+
interface ConversionLikelihoodResponse {
|
|
206
|
+
score: number;
|
|
207
|
+
factors: string[];
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Response from getUserSegment()
|
|
211
|
+
*/
|
|
212
|
+
interface UserSegmentResponse {
|
|
213
|
+
type: "high_intent" | "medium_intent" | "exploring";
|
|
214
|
+
confidence: number;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Main SDK interface
|
|
219
|
+
*/
|
|
220
|
+
interface ZaplierSDK {
|
|
221
|
+
track(eventType: string, eventData?: Record<string, any>): void;
|
|
222
|
+
trackCustomEvent(eventName: string, metadata?: Record<string, any>): boolean;
|
|
223
|
+
trackConversion(eventName: string, value?: number, currency?: string, metadata?: Record<string, any>): boolean;
|
|
224
|
+
trackPageView(data?: Partial<PageViewEvent>): void;
|
|
225
|
+
trackPurchase(data: TrackPurchaseParams): void;
|
|
226
|
+
trackAddToCart(data?: TrackAddToCartParams): void;
|
|
227
|
+
trackViewContent(data?: TrackViewContentParams): void;
|
|
228
|
+
trackInitiateCheckout(data?: TrackInitiateCheckoutParams): void;
|
|
229
|
+
trackLead(data?: Record<string, any>): void;
|
|
230
|
+
identify(userData: IdentifyParams): void;
|
|
231
|
+
trackSPANavigation(url?: string, title?: string): void;
|
|
232
|
+
resetScrollTracking(): void;
|
|
233
|
+
startPresenceTracking(): void;
|
|
234
|
+
stopPresenceTracking(): void;
|
|
235
|
+
heatmap: {
|
|
236
|
+
enable(): void;
|
|
237
|
+
disable(): void;
|
|
238
|
+
};
|
|
239
|
+
replay: {
|
|
240
|
+
enable(): void;
|
|
241
|
+
disable(): void;
|
|
242
|
+
addFunnelStep(stepData: Record<string, any>): void;
|
|
243
|
+
markConversion(data: Record<string, any>): void;
|
|
244
|
+
};
|
|
245
|
+
enableEnhancedTracking(): boolean;
|
|
246
|
+
disableEnhancedTracking(): void;
|
|
247
|
+
isEnhancedMode(): boolean;
|
|
248
|
+
getVisitorId(): string | null;
|
|
249
|
+
getVisitorInfo(): Promise<VisitorInfo | null>;
|
|
250
|
+
getVisitorHistory(): Promise<VisitorHistory | null>;
|
|
251
|
+
getUserData(): UserData;
|
|
252
|
+
getConversionLikelihood(): ConversionLikelihoodResponse;
|
|
253
|
+
getUserSegment(): UserSegmentResponse;
|
|
254
|
+
config: InternalConfig;
|
|
255
|
+
version: string;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Global window interface extension
|
|
259
|
+
*/
|
|
260
|
+
declare global {
|
|
261
|
+
interface Window {
|
|
262
|
+
Zaplier?: ZaplierSDK;
|
|
263
|
+
zaplier?: ZaplierSDK;
|
|
264
|
+
stalker?: {
|
|
265
|
+
config?: Partial<SDKConfig>;
|
|
266
|
+
q?: any[][];
|
|
267
|
+
} & ZaplierSDK;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
1
271
|
/**
|
|
2
272
|
* Zaplier SDK Core v2.0.0 - Performance Optimized
|
|
3
273
|
* Minimal core for instant initialization with lazy loading
|
|
4
274
|
*/
|
|
275
|
+
|
|
5
276
|
interface CoreConfig {
|
|
6
277
|
token: string;
|
|
7
278
|
debug?: boolean;
|
|
@@ -23,8 +294,16 @@ declare class ZaplierCore {
|
|
|
23
294
|
private sessionId?;
|
|
24
295
|
private visitorId?;
|
|
25
296
|
private modules;
|
|
297
|
+
private backendVisitorId?;
|
|
26
298
|
private readonly version;
|
|
299
|
+
/** Cached dev environment flag, computed once at init time */
|
|
300
|
+
private _isDev;
|
|
27
301
|
constructor(config: CoreConfig);
|
|
302
|
+
/**
|
|
303
|
+
* Detect dev environment for isDev event flagging.
|
|
304
|
+
* Matches ZaplierSDK.isDevEnvironment() for parity.
|
|
305
|
+
*/
|
|
306
|
+
private isDevEnvironment;
|
|
28
307
|
/**
|
|
29
308
|
* Instant core initialization - only essential setup
|
|
30
309
|
*/
|
|
@@ -70,14 +349,17 @@ declare class ZaplierCore {
|
|
|
70
349
|
*/
|
|
71
350
|
private generateTempVisitorId;
|
|
72
351
|
/**
|
|
73
|
-
* Get visitor
|
|
352
|
+
* Get the visitor ID (backend UUID if available, otherwise temp ID)
|
|
74
353
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
354
|
+
getVisitorId(): string | null;
|
|
355
|
+
/**
|
|
356
|
+
* Get client-side user data synchronously (SSR-safe)
|
|
357
|
+
*/
|
|
358
|
+
getUserData(): UserData;
|
|
359
|
+
/**
|
|
360
|
+
* Get full visitor info from backend (async, only fetches when backend UUID is available)
|
|
361
|
+
*/
|
|
362
|
+
getVisitorInfo(): Promise<VisitorInfo | null>;
|
|
81
363
|
}
|
|
82
364
|
/**
|
|
83
365
|
* Factory function for easy initialization
|