@zaplier/sdk 1.8.7 → 1.9.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/dist/v2/chunks/anti-adblock-B_7p9rSc.min.js +6 -0
- package/dist/v2/chunks/anti-adblock-B_aAB361.min.js +6 -0
- package/dist/v2/chunks/auto-tracker-5ij0Y4C-.min.js +6 -0
- package/dist/v2/chunks/browser-apis-zkKPQ-Pn.min.js +6 -0
- package/dist/v2/chunks/confidence-DCUtUduG.min.js +6 -0
- package/dist/v2/chunks/core-BUMPOlca.min.js +6 -0
- package/dist/v2/chunks/core-CGxFM5QW.min.js +6 -0
- package/dist/v2/chunks/core-NFvhjAfH.min.js +6 -0
- package/dist/v2/chunks/core-zJiDcx4q.min.js +6 -0
- package/dist/v2/chunks/device-signals-DzcCjR7i.min.js +6 -0
- package/dist/v2/chunks/dom-blockers-CtmwJ8XW.min.js +6 -0
- package/dist/v2/chunks/fingerprint-C1MH_xUr.min.js +6 -0
- package/dist/v2/chunks/hardware-VrMyNUbt.min.js +6 -0
- package/dist/v2/chunks/heatmap-BxbXSH7M.min.js +6 -0
- package/dist/v2/chunks/incognito-CUk-WJ9L.min.js +6 -0
- package/dist/v2/chunks/math-k-cWr0Zr.min.js +6 -0
- package/dist/v2/chunks/plugins-enhanced-DybbZw-x.min.js +6 -0
- package/dist/v2/chunks/session-replay-DsIhuKDJ.min.js +6 -0
- package/dist/v2/chunks/session-replay-DzEF_WqO.min.js +6 -0
- package/dist/v2/chunks/storage-DGh64hgU.min.js +6 -0
- package/dist/v2/chunks/system-Bu10BgJe.min.js +6 -0
- package/dist/v2/chunks/visitor-persistence-BUu5td5h.min.js +6 -0
- package/dist/v2/chunks/visitor-persistence-CIXH9EKf.min.js +6 -0
- package/dist/v2/chunks/visitor-persistence-DSIEfVJQ.min.js +6 -0
- package/dist/v2/chunks/visitor-persistence-Djomq4wG.min.js +6 -0
- package/dist/v2/core.d.ts +149 -80
- package/dist/v2/core.min.js +2 -2
- package/dist/v2/modules/anti-adblock.js +2 -2
- package/dist/v2/modules/auto-tracker.js +6 -0
- package/dist/v2/modules/browser-apis-BFbMjhvj.js +6 -0
- package/dist/v2/modules/confidence-B8ji6M6W.js +6 -0
- package/dist/v2/modules/device-signals-OERVSprN.js +6 -0
- package/dist/v2/modules/dom-blockers-NN7G4m7O.js +6 -0
- package/dist/v2/modules/fingerprint-BmsWDNK6.js +6 -0
- package/dist/v2/modules/fingerprint.js +2 -2
- package/dist/v2/modules/hardware-DEB_C62e.js +6 -0
- package/dist/v2/modules/heatmap.js +1 -1
- package/dist/v2/modules/incognito-B8-4CGqL.js +6 -0
- package/dist/v2/modules/math-D6mV6BoT.js +6 -0
- package/dist/v2/modules/plugins-enhanced-Bs-rTKz4.js +6 -0
- package/dist/v2/modules/replay.js +2 -2
- package/dist/v2/modules/storage-DpYaBLNV.js +6 -0
- package/dist/v2/modules/system-C8YX5XCh.js +6 -0
- package/dist/v2/modules/visitor-persistence.js +6 -0
- package/package.json +2 -3
package/dist/v2/core.d.ts
CHANGED
|
@@ -206,14 +206,16 @@ interface IdentifyParams {
|
|
|
206
206
|
*/
|
|
207
207
|
interface ConversionLikelihoodResponse {
|
|
208
208
|
score: number;
|
|
209
|
+
level: string;
|
|
209
210
|
factors: string[];
|
|
210
211
|
}
|
|
211
212
|
/**
|
|
212
213
|
* Response from getUserSegment()
|
|
213
214
|
*/
|
|
214
215
|
interface UserSegmentResponse {
|
|
215
|
-
|
|
216
|
+
segment: string;
|
|
216
217
|
confidence: number;
|
|
218
|
+
traits: string[];
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
/**
|
|
@@ -237,13 +239,30 @@ interface ZaplierSDK {
|
|
|
237
239
|
heatmap: {
|
|
238
240
|
enable(): void;
|
|
239
241
|
disable(): void;
|
|
242
|
+
enableMouseTracking(): void;
|
|
243
|
+
disableMouseTracking(): void;
|
|
244
|
+
getStats(): any;
|
|
245
|
+
isRecording(): boolean;
|
|
240
246
|
};
|
|
241
247
|
replay: {
|
|
242
248
|
enable(): void;
|
|
243
249
|
disable(): void;
|
|
250
|
+
start(): Promise<boolean>;
|
|
251
|
+
stop(): void;
|
|
252
|
+
isRecording(): boolean;
|
|
253
|
+
getEventCount(): number;
|
|
244
254
|
addFunnelStep(stepData: Record<string, any>): void;
|
|
245
255
|
markConversion(data: Record<string, any>): void;
|
|
246
256
|
};
|
|
257
|
+
autoTrack: {
|
|
258
|
+
enable(): void;
|
|
259
|
+
disable(): void;
|
|
260
|
+
configure(config: Record<string, any>): void;
|
|
261
|
+
refreshTracking(): void;
|
|
262
|
+
getDiagnostics(): any;
|
|
263
|
+
getStats(): any;
|
|
264
|
+
isEnabled(): boolean;
|
|
265
|
+
};
|
|
247
266
|
enableEnhancedTracking(): boolean;
|
|
248
267
|
disableEnhancedTracking(): void;
|
|
249
268
|
isEnhancedMode(): boolean;
|
|
@@ -271,103 +290,153 @@ declare global {
|
|
|
271
290
|
}
|
|
272
291
|
|
|
273
292
|
/**
|
|
274
|
-
* Zaplier SDK
|
|
275
|
-
*
|
|
293
|
+
* Zaplier SDK v1.9.0 - Unified SDK
|
|
294
|
+
* Instant init (<1ms) + full features via lazy loading
|
|
295
|
+
* Replaces both ZaplierCore (v2, no enrichment) and ZaplierSDK (v1.7, 400KB)
|
|
276
296
|
*/
|
|
277
297
|
|
|
278
|
-
interface CoreConfig {
|
|
279
|
-
token: string;
|
|
280
|
-
debug?: boolean;
|
|
281
|
-
apiEndpoint?: string;
|
|
282
|
-
allow_localhost?: boolean;
|
|
283
|
-
replay?: boolean;
|
|
284
|
-
replaySampling?: number;
|
|
285
|
-
deferAdvanced?: boolean;
|
|
286
|
-
loadTimeout?: number;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Minimal SDK Core - Only essential tracking functionality
|
|
290
|
-
* Heavy operations are lazy-loaded to avoid blocking main thread
|
|
291
|
-
*/
|
|
292
298
|
declare class ZaplierCore {
|
|
293
|
-
|
|
294
|
-
|
|
299
|
+
config: InternalConfig;
|
|
300
|
+
readonly version = "1.9.0";
|
|
295
301
|
private isInitialized;
|
|
302
|
+
private eventQueue;
|
|
296
303
|
private sessionId?;
|
|
297
304
|
private visitorId?;
|
|
298
|
-
private modules;
|
|
299
305
|
private backendVisitorId?;
|
|
300
306
|
private cachedVisitorInfo?;
|
|
301
|
-
private
|
|
302
|
-
/** Cached dev environment flag, computed once at init time */
|
|
307
|
+
private fingerprint?;
|
|
303
308
|
private _isDev;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
309
|
+
private antiAdblockManager?;
|
|
310
|
+
private visitorIdentityManager?;
|
|
311
|
+
heatmap: {
|
|
312
|
+
enable(): void;
|
|
313
|
+
disable(): void;
|
|
314
|
+
enableMouseTracking(): void;
|
|
315
|
+
disableMouseTracking(): void;
|
|
316
|
+
getStats(): any;
|
|
317
|
+
isRecording(): boolean;
|
|
318
|
+
};
|
|
319
|
+
replay: {
|
|
320
|
+
enable(): void;
|
|
321
|
+
disable(): void;
|
|
322
|
+
start(): Promise<boolean>;
|
|
323
|
+
stop(): void;
|
|
324
|
+
isRecording(): boolean;
|
|
325
|
+
getEventCount(): number;
|
|
326
|
+
addFunnelStep(stepData: Record<string, any>): void;
|
|
327
|
+
markConversion(data: Record<string, any>): void;
|
|
328
|
+
};
|
|
329
|
+
autoTrack: {
|
|
330
|
+
enable(): void;
|
|
331
|
+
disable(): void;
|
|
332
|
+
configure(config: Record<string, any>): void;
|
|
333
|
+
refreshTracking(): void;
|
|
334
|
+
getDiagnostics(): any;
|
|
335
|
+
getStats(): any;
|
|
336
|
+
isEnabled(): boolean;
|
|
337
|
+
};
|
|
338
|
+
private _heatmapEngine?;
|
|
339
|
+
private _replayEngine?;
|
|
340
|
+
private _autoTracker?;
|
|
341
|
+
constructor(userConfig: SDKConfig);
|
|
313
342
|
private initializeCore;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
private loadFingerprinting;
|
|
330
|
-
/**
|
|
331
|
-
* Load replay module
|
|
332
|
-
*/
|
|
333
|
-
private loadReplayModule;
|
|
334
|
-
/**
|
|
335
|
-
* Schedule advanced loading when browser is idle
|
|
336
|
-
*/
|
|
337
|
-
private scheduleAdvancedLoading;
|
|
338
|
-
/**
|
|
339
|
-
* Send event to backend (simplified)
|
|
340
|
-
*/
|
|
343
|
+
private scheduleModuleLoading;
|
|
344
|
+
private loadFingerprint;
|
|
345
|
+
private collectFallbackEntropy;
|
|
346
|
+
private loadAntiAdblock;
|
|
347
|
+
private loadAutoTracker;
|
|
348
|
+
private shouldRecord;
|
|
349
|
+
private fetchFeatureFlags;
|
|
350
|
+
private loadReplayEngine;
|
|
351
|
+
private loadHeatmapEngine;
|
|
352
|
+
private createHeatmapProxy;
|
|
353
|
+
private createReplayProxy;
|
|
354
|
+
private createAutoTrackProxy;
|
|
355
|
+
/** Force-load replay engine (bypasses sampling/feature-flag for explicit enable) */
|
|
356
|
+
private loadReplayEngineForced;
|
|
357
|
+
private extractUTMParameters;
|
|
341
358
|
private sendEvent;
|
|
342
359
|
/**
|
|
343
|
-
*
|
|
360
|
+
* Send session replay batch to backend
|
|
344
361
|
*/
|
|
362
|
+
sendReplayBatch(replayData: {
|
|
363
|
+
sessionId: string;
|
|
364
|
+
events: any[];
|
|
365
|
+
metadata: any;
|
|
366
|
+
}): Promise<any>;
|
|
367
|
+
private makeRequest;
|
|
368
|
+
private updateTrackingEnginesSessionId;
|
|
345
369
|
private processEventQueue;
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
*/
|
|
370
|
+
private isLocalhost;
|
|
371
|
+
private isDevEnvironment;
|
|
349
372
|
private generateTempSessionId;
|
|
350
|
-
/**
|
|
351
|
-
* Generate temporary visitor ID
|
|
352
|
-
*/
|
|
353
373
|
private generateTempVisitorId;
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
374
|
+
private generateSessionId;
|
|
375
|
+
track(eventType: string, eventData?: Record<string, any>): void;
|
|
376
|
+
trackCustomEvent(eventName: string, metadata?: Record<string, any>): boolean;
|
|
377
|
+
trackConversion(eventName: string, value?: number, currency?: string, metadata?: Record<string, any>): boolean;
|
|
378
|
+
trackPageView(data?: Partial<PageViewEvent>): void;
|
|
379
|
+
trackSPANavigation(url?: string, title?: string): void;
|
|
380
|
+
trackPurchase(data: {
|
|
381
|
+
value?: number;
|
|
382
|
+
revenue?: number;
|
|
383
|
+
currency?: string;
|
|
384
|
+
quantity?: number;
|
|
385
|
+
productId?: string;
|
|
386
|
+
productName?: string;
|
|
387
|
+
orderId?: string;
|
|
388
|
+
customData?: Record<string, any>;
|
|
389
|
+
}): void;
|
|
390
|
+
trackAddToCart(data?: {
|
|
391
|
+
productId?: string;
|
|
392
|
+
productName?: string;
|
|
393
|
+
price?: number;
|
|
394
|
+
quantity?: number;
|
|
395
|
+
customData?: Record<string, any>;
|
|
396
|
+
}): void;
|
|
397
|
+
trackViewContent(data?: {
|
|
398
|
+
productId?: string;
|
|
399
|
+
productName?: string;
|
|
400
|
+
category?: string;
|
|
401
|
+
customData?: Record<string, any>;
|
|
402
|
+
}): void;
|
|
403
|
+
trackInitiateCheckout(data?: {
|
|
404
|
+
value?: number;
|
|
405
|
+
currency?: string;
|
|
406
|
+
numItems?: number;
|
|
407
|
+
customData?: Record<string, any>;
|
|
408
|
+
}): void;
|
|
409
|
+
trackLead(data?: Record<string, any>): void;
|
|
410
|
+
identify(userData: {
|
|
411
|
+
email?: string;
|
|
412
|
+
phone?: string;
|
|
413
|
+
[key: string]: any;
|
|
414
|
+
}): void;
|
|
415
|
+
startPresenceTracking(): void;
|
|
416
|
+
stopPresenceTracking(): void;
|
|
417
|
+
enableAdvancedFeatures(): Promise<void>;
|
|
418
|
+
enableEnhancedTracking(): boolean;
|
|
419
|
+
disableEnhancedTracking(): void;
|
|
420
|
+
isEnhancedMode(): boolean;
|
|
421
|
+
resetScrollTracking(): void;
|
|
357
422
|
getVisitorId(): string | null;
|
|
358
|
-
/**
|
|
359
|
-
* Get client-side user data synchronously (SSR-safe)
|
|
360
|
-
*/
|
|
361
423
|
getUserData(): UserData;
|
|
362
|
-
/**
|
|
363
|
-
* Get full visitor info from backend (async, only fetches when backend UUID is available)
|
|
364
|
-
*/
|
|
365
424
|
getVisitorInfo(): Promise<VisitorInfo | null>;
|
|
425
|
+
getVisitorHistory(): Promise<VisitorHistory | null>;
|
|
426
|
+
getConversionLikelihood(): {
|
|
427
|
+
score: number;
|
|
428
|
+
level: string;
|
|
429
|
+
factors: string[];
|
|
430
|
+
};
|
|
431
|
+
getUserSegment(): {
|
|
432
|
+
segment: string;
|
|
433
|
+
confidence: number;
|
|
434
|
+
traits: string[];
|
|
435
|
+
};
|
|
366
436
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
declare function initZaplierCore(config: CoreConfig): ZaplierCore;
|
|
437
|
+
declare function initZaplier(config: SDKConfig): ZaplierCore;
|
|
438
|
+
/** @deprecated Use initZaplier instead */
|
|
439
|
+
declare const initZaplierCore: typeof initZaplier;
|
|
371
440
|
|
|
372
|
-
export { ZaplierCore, ZaplierCore as default, initZaplierCore };
|
|
373
|
-
export type {
|
|
441
|
+
export { ZaplierCore, ZaplierCore as default, initZaplier, initZaplierCore };
|
|
442
|
+
export type { UserData, VisitorHistory, VisitorInfo };
|
package/dist/v2/core.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Zaplier SDK
|
|
2
|
+
* Zaplier SDK v3.0.0 - Unified SDK
|
|
3
3
|
* Advanced privacy-first tracking with code splitting
|
|
4
4
|
* (c) 2026 Zaplier Team
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
export{Z as ZaplierCore,Z as default,i as initZaplier,a as initZaplierCore}from"./chunks/core-zJiDcx4q.min.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Zaplier SDK
|
|
2
|
+
* Zaplier SDK v3.0.0 - Unified SDK
|
|
3
3
|
* Advanced privacy-first tracking with code splitting
|
|
4
4
|
* (c) 2026 Zaplier Team
|
|
5
5
|
*/
|
|
6
|
-
class e{constructor(){this.name="fetch",this.available="undefined"!=typeof fetch}async send(e,t){const s=Date.now();try{const n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`HTTP ${n.status}`);return{success:!0,method:this.name,latency:Date.now()-s}}catch(e){return{success:!1,method:this.name,latency:Date.now()-s,error:e instanceof Error?e.message:String(e)}}}}class t{constructor(e){this.name="websocket",this.available="undefined"!=typeof WebSocket,this.connected=!1,this.messageQueue=[],this.baseUrl=e.replace(/^http/,"ws")}async connect(){if(!this.connected&&this.available)return new Promise((e,t)=>{try{this.ws=new WebSocket(`${this.baseUrl}/ws/track`),this.ws.onopen=()=>{this.connected=!0,this.processQueue(),e()},this.ws.onerror=()=>{t(new Error("WebSocket connection failed"))},this.ws.onclose=()=>{this.connected=!1,setTimeout(()=>this.connect().catch(()=>{}),
|
|
6
|
+
class e{constructor(){this.name="fetch",this.available="undefined"!=typeof fetch}async send(e,t){const s=Date.now();try{const n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`HTTP ${n.status}`);return{success:!0,method:this.name,latency:Date.now()-s}}catch(e){return{success:!1,method:this.name,latency:Date.now()-s,error:e instanceof Error?e.message:String(e)}}}}class t{constructor(e){this.name="websocket",this.available="undefined"!=typeof WebSocket,this.connected=!1,this.messageQueue=[],this.reconnectAttempts=0,this.MAX_RECONNECT_ATTEMPTS=5,this.MAX_QUEUE_SIZE=50,this.baseUrl=e.replace(/^http/,"ws")}async connect(){if(!this.connected&&this.available)return new Promise((e,t)=>{try{this.ws=new WebSocket(`${this.baseUrl}/ws/track`),this.ws.onopen=()=>{this.connected=!0,this.reconnectAttempts=0,this.processQueue(),e()},this.ws.onerror=()=>{t(new Error("WebSocket connection failed"))},this.ws.onclose=()=>{if(this.connected=!1,this.reconnectAttempts<this.MAX_RECONNECT_ATTEMPTS){const e=Math.min(3e4,1e3*Math.pow(2,this.reconnectAttempts));this.reconnectAttempts++,setTimeout(()=>this.connect().catch(()=>{}),e)}}}catch(e){t(e)}})}processQueue(){for(;this.messageQueue.length>0&&this.connected;){const e=this.messageQueue.shift();if(e&&this.ws)try{this.ws.send(JSON.stringify(e.data)),e.resolve({success:!0,method:this.name})}catch(t){e.resolve({success:!1,method:this.name,error:t instanceof Error?t.message:String(t)})}}}async send(e,t){const s=Date.now();if(!this.available)return{success:!1,method:this.name,error:"WebSocket not available"};if(!this.connected)try{await this.connect()}catch(e){return{success:!1,method:this.name,error:e instanceof Error?e.message:String(e)}}return new Promise(t=>{if(this.connected&&this.ws)try{this.ws.send(JSON.stringify(e)),t({success:!0,method:this.name,latency:Date.now()-s})}catch(e){t({success:!1,method:this.name,error:e instanceof Error?e.message:String(e)})}else this.messageQueue.length>=this.MAX_QUEUE_SIZE&&this.messageQueue.shift(),this.messageQueue.push({data:e,resolve:e=>t({...e,latency:Date.now()-s})})})}destroy(){this.ws&&(this.ws.close(),this.connected=!1)}}class s{constructor(e,t){this.name="elysia-websocket",this.available="undefined"!=typeof WebSocket,this.connected=!1,this.baseUrl=e,this.token=t}async send(e,t){const s=Date.now();try{if(!this.token)throw new Error("Missing token for WebSocket connection");if(await this.connect(),!this.ws||!this.connected)throw new Error("WebSocket not connected");return new Promise((t,n)=>{var o,r;const i=e=>{var o,r;try{const n=JSON.parse(e.data);null===(o=this.ws)||void 0===o||o.removeEventListener("message",i),t({success:n.success||!1,method:this.name,latency:Date.now()-s})}catch(e){null===(r=this.ws)||void 0===r||r.removeEventListener("message",i),n(new Error("Failed to parse WebSocket response"))}};null===(o=this.ws)||void 0===o||o.addEventListener("message",i),null===(r=this.ws)||void 0===r||r.send(JSON.stringify({...e,eventId:e.eventId||crypto.randomUUID(),sessionId:e.sessionId||e.s,eventType:e.eventType||e.type||"websocket_event",eventName:e.eventName||e.name,url:e.url,userAgent:e.userAgent||navigator.userAgent,timestamp:(new Date).toISOString(),fingerprintHash:e.fingerprintHash,stableCoreHash:e.stableCoreHash,stableCoreVector:e.stableCoreVector})),setTimeout(()=>{var e;null===(e=this.ws)||void 0===e||e.removeEventListener("message",i),n(new Error("WebSocket response timeout"))},5e3)})}catch(e){return{success:!1,method:this.name,latency:Date.now()-s,error:e instanceof Error?e.message:String(e)}}}async connect(){var e;if(!this.connected||(null===(e=this.ws)||void 0===e?void 0:e.readyState)!==WebSocket.OPEN)return new Promise((e,t)=>{try{const s=new URL(this.baseUrl),n=`${"https:"===s.protocol?"wss:":"ws:"}//${s.host}/ws/track?token=${encodeURIComponent(this.token)}`;this.ws=new WebSocket(n),this.ws.onopen=()=>{this.connected=!0,e()},this.ws.onerror=()=>{this.connected=!1,t(new Error("WebSocket connection failed"))},this.ws.onclose=()=>{this.connected=!1},setTimeout(()=>{var e;this.connected||(null===(e=this.ws)||void 0===e||e.close(),t(new Error("WebSocket connection timeout")))},5e3)}catch(e){t(e)}})}cleanup(){this.ws&&(this.ws.close(),this.connected=!1)}}class n{constructor(e,t,s={}){this.transports=[],this.stats={totalRequests:0,successfulRequests:0,methodSuccess:new Map,methodFailures:new Map},this.baseUrl=e,this.token=t,this.config={enabled:!0,methods:["elysia-websocket","fetch"],fallbackDelay:100,maxRetries:2,debug:!1,...s},this.initializeTransports()}initializeTransports(){const t={"elysia-websocket":()=>new s(this.baseUrl,this.token),fetch:()=>new e};this.transports=this.config.methods.map(e=>{var s;return null===(s=t[e])||void 0===s?void 0:s.call(t)}).filter(e=>void 0!==e&&e.available),this.config.debug}async send(e,t="/tracking/event"){if(this.stats.totalRequests++,!this.config.enabled||0===this.transports.length)return{success:!1,method:"none",error:"No transports available"};let s="";for(const n of this.transports){this.config.debug;try{const o=await n.send(e,`${this.baseUrl}${t}`);if(o.success)return this.stats.successfulRequests++,this.updateMethodStats(n.name,!0),this.config.debug,o;this.updateMethodStats(n.name,!1),s=o.error||"Unknown error",this.config.debug}catch(e){s=e instanceof Error?e.message:String(e),this.updateMethodStats(n.name,!1),this.config.debug}this.config.fallbackDelay>0&&await new Promise(e=>setTimeout(e,this.config.fallbackDelay))}return{success:!1,method:"all_failed",error:`All transports failed. Last error: ${s}`}}updateMethodStats(e,t){t?this.stats.methodSuccess.set(e,(this.stats.methodSuccess.get(e)||0)+1):this.stats.methodFailures.set(e,(this.stats.methodFailures.get(e)||0)+1)}getStats(){return{...this.stats}}getSuccessRates(){const e={};for(const t of this.transports){const s=this.stats.methodSuccess.get(t.name)||0,n=s+(this.stats.methodFailures.get(t.name)||0);e[t.name]=n>0?s/n*100:0}return e}destroy(){this.transports.forEach(e=>{e.destroy&&e.destroy()}),this.transports=[]}async testTransports(){const e={},t={test:!0,timestamp:Date.now()};for(const s of this.transports)try{e[s.name]=await s.send(t,`${this.baseUrl}/test`)}catch(t){e[s.name]={success:!1,method:s.name,error:t instanceof Error?t.message:String(t)}}return e}}export{n as AntiAdblockManager,s as ElysiaWebSocketTransport,e as FetchTransport,t as WebSocketTransport};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Zaplier SDK v3.0.0 - Unified SDK
|
|
3
|
+
* Advanced privacy-first tracking with code splitting
|
|
4
|
+
* (c) 2026 Zaplier Team
|
|
5
|
+
*/
|
|
6
|
+
class t{constructor(t,e={}){this.observedElements=new Set,this.scrollThrottle=0,this.isInitialized=!1,this.delegationHandlers=new Map,this.initializationAttempts=0,this.maxInitializationAttempts=3,this.diagnostics={},this.cachedScrollElements=null,this.lastScrollElementsCheck=0,this.sdkInstance=t,this.config={enabled:!0,trackClicks:!0,trackScrolls:!0,trackViews:!0,trackHovers:!0,trackForms:!0,debug:!1,...e}}start(){this.config.enabled&&(this.initializationAttempts++,this.runDiagnostics(),this.config.debug,this.tryInitialization())}runDiagnostics(){var t;this.diagnostics={timestamp:(new Date).toISOString(),attempt:this.initializationAttempts,environment:{domReady:document.readyState,reactDetected:this.detectReact(),reactVersion:this.getReactVersion(),userAgent:navigator.userAgent,isMobile:/Mobile|Android|iPhone|iPad/.test(navigator.userAgent),isSafari:/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent),protocol:window.location.protocol,isLocalhost:"localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname},dom:{documentElement:!!document.documentElement,body:!!document.body,querySelector:"function"==typeof document.querySelector,addEventListener:"function"==typeof document.addEventListener,elementsFound:this.getElementCounts(),hasReactRoot:this.findReactRoot()},tracking:{sdkInstance:!!this.sdkInstance,trackCustomEvent:"function"==typeof(null===(t=this.sdkInstance)||void 0===t?void 0:t.trackCustomEvent),config:this.config,isInitialized:this.isInitialized,activeHandlers:Array.from(this.delegationHandlers.keys())}}}detectReact(){return!!(window.__REACT_DEVTOOLS_GLOBAL_HOOK__||window.React||document.querySelector("[data-reactroot]")||document.querySelector("#root")||document.querySelector("#__next"))}getReactVersion(){try{const t=window.React;return(null==t?void 0:t.version)||null}catch{return null}}findReactRoot(){const t=document.querySelector("[data-reactroot]")||document.querySelector("#root")||document.querySelector("#__next")||document.querySelector("div[data-react-helmet]");return t?t.tagName+(t.id?"#"+t.id:""):null}getElementCounts(){return{click:document.querySelectorAll("[data-track-click]").length,scroll:document.querySelectorAll("[data-track-scroll]").length,view:document.querySelectorAll("[data-track-view]").length,hover:document.querySelectorAll("[data-track-hover]").length,form:document.querySelectorAll("[data-track-form]").length}}tryInitialization(){const t=[()=>this.immediateInitialization(),()=>this.delayedInitialization(100),()=>this.delayedInitialization(500),()=>this.delayedInitialization(1e3),()=>this.reactReadyInitialization()];"complete"===document.readyState?this.attemptStrategy(0,t):"interactive"===document.readyState?this.attemptStrategy(1,t):document.addEventListener("DOMContentLoaded",()=>{this.attemptStrategy(0,t)},{once:!0})}attemptStrategy(t,e){if(!(t>=e.length||this.isInitialized)){this.config.debug;try{const i=e[t];i&&"function"==typeof i?(i(),setTimeout(()=>{this.verifyInitialization()?this.config.debug:(this.config.debug,this.attemptStrategy(t+1,e))},50)):this.attemptStrategy(t+1,e)}catch(i){this.config.debug,this.attemptStrategy(t+1,e)}}}immediateInitialization(){this.initializeTracking()}delayedInitialization(t){setTimeout(()=>{this.initializeTracking()},t)}reactReadyInitialization(){"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>{setTimeout(()=>{this.initializeTracking()},0)}):setTimeout(()=>{this.initializeTracking()},16)}verifyInitialization(){const t=this.getElementCounts(),e=Object.values(t).reduce((t,e)=>t+e,0),i=this.delegationHandlers.size>0;return this.config.debug,this.isInitialized&&(e>0||i)}initializeTracking(){this.config.debug,this.observeDOM(),this.processExistingElements(),this.config.trackViews&&this.setupViewTracking(),this.setupEventDelegation(),this.config.debug&&(this.logFoundElements(),setTimeout(()=>{this.logFoundElements()},500),setTimeout(()=>{this.logFoundElements()},2e3))}logFoundElements(){document.querySelectorAll("[data-track-click]");const t=document.querySelectorAll("[data-track-scroll]");document.querySelectorAll("[data-track-view]"),document.querySelectorAll("[data-track-hover]"),document.querySelectorAll("[data-track-form]"),t.length}setupEventDelegation(){this.config.debug;const t=this.getOptimalDelegationTarget();if(this.config.debug,this.config.trackClicks){const e=this.createReactCompatibleClickHandler();this.delegationHandlers.set("click",e),t.addEventListener("click",e,this.getEventOptions("click")),this.config.debug}this.config.trackScrolls&&(this.config.debug,this.setupIntersectionObserverScrollTracking(),this.setupFallbackScrollListener(),this.config.debug),this.setupIntelligentMutationObserver(),this.isInitialized=!0,this.config.debug}getOptimalDelegationTarget(){var t;const e=document.querySelector("#root")||document.querySelector("#__next")||document.querySelector("[data-reactroot]");return e&&(null===(t=this.diagnostics.environment)||void 0===t?void 0:t.reactDetected)?(this.config.debug,e):document}getEventOptions(t){var e,i;null===(e=this.diagnostics.environment)||void 0===e||e.isMobile;const n=null===(i=this.diagnostics.environment)||void 0===i?void 0:i.isSafari;let s={};switch(t){case"click":s={passive:!n,capture:!1};break;case"scroll":s={passive:!0,capture:!1};break;default:s={passive:!0}}return this.config.debug,s}createReactCompatibleClickHandler(){return t=>{try{if(!this.config.trackClicks)return;const e=t.target;if(!e)return;let i=null;if(i=e.closest("[data-track-click]"),!i&&e.hasAttribute&&e.hasAttribute("data-track-click")&&(i=e),i||(i=this.findTrackingElementManually(e,"data-track-click")),!i)return void this.config.debug;const n=i.getAttribute("data-track-click");if(!n)return;const s=this.extractMetadata(i);this.trackEvent(n,{type:"click",element:i.tagName.toLowerCase(),reactCompatible:!0,...s}),this.config.debug}catch(t){this.config.debug}}}findTrackingElementManually(t,e,i=10){let n=t,s=0;for(;n&&n!==document.documentElement&&s<i;){if(n.hasAttribute&&n.hasAttribute(e))return n;n=n.parentElement,s++}return null}setupIntersectionObserverScrollTracking(){if("undefined"==typeof window||!("IntersectionObserver"in window))return void this.config.debug;const t=document.querySelectorAll("[data-track-scroll]");if(0===t.length)return void this.config.debug;const e=new IntersectionObserver(t=>{t.forEach(t=>{const i=t.target,n=i.getAttribute("data-track-scroll"),s=parseFloat(i.getAttribute("data-scroll-threshold")||"0.5"),r="true"===i.getAttribute("data-scroll-triggered");if(!n||r)return;const o=t.intersectionRatio;if(this.config.debug,o>=s){i.setAttribute("data-scroll-triggered","true");const t=this.extractMetadata(i);this.trackEvent(n,{type:"scroll",method:"IntersectionObserver",element:i.tagName.toLowerCase(),threshold:s,visibilityRatio:Math.round(1e3*o)/1e3,enhanced:!0,modern:!0,...t}),this.config.debug,e.unobserve(i)}})},{root:null,rootMargin:"0px",threshold:[0,.1,.25,.5,.75,.9,1]});t.forEach(t=>{e.observe(t),this.config.debug}),this.intersectionObserver=e,this.config.debug}setupFallbackScrollListener(){if("undefined"==typeof window)return;const t=this.createThrottledScrollHandler();[()=>window.addEventListener("scroll",t,{passive:!0}),()=>document.addEventListener("scroll",t,{passive:!0}),()=>window.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{setTimeout(()=>{window.addEventListener("scroll",t,{passive:!0})},100)},()=>{"complete"===document.readyState?window.addEventListener("scroll",t,{passive:!0}):window.addEventListener("load",()=>{window.addEventListener("scroll",t,{passive:!0})})}].forEach((t,e)=>{try{t(),this.config.debug}catch(t){this.config.debug}}),this.delegationHandlers.set("scroll",t),this.config.debug&&setTimeout(()=>{window.addEventListener("scroll",()=>{},{once:!0,passive:!0});const t=window.scrollY;window.scrollBy(0,1),setTimeout(()=>window.scrollTo(0,t),50)},2e3)}createThrottledScrollHandler(){let t=0,e=!1;return()=>{t=window.scrollY,e||(setTimeout(()=>{this.config.debug,this.processFallbackScroll(t),e=!1},20),e=!0)}}processFallbackScroll(t){const e=document.querySelectorAll('[data-track-scroll]:not([data-scroll-triggered="true"])');0!==e.length&&e.forEach(e=>{const i=e.getAttribute("data-track-scroll"),n=parseFloat(e.getAttribute("data-scroll-threshold")||"0.5");if(!i)return;const s=e.getBoundingClientRect(),r=window.innerHeight,o=s.height;if(o<=0)return;const a=Math.max(s.top,0),c=Math.min(s.bottom,r),l=Math.max(0,c-a)/o;if(l>=n){e.setAttribute("data-scroll-triggered","true");const s=this.extractMetadata(e);this.trackEvent(i,{type:"scroll",method:"fallback_scroll",element:e.tagName.toLowerCase(),threshold:n,visibilityRatio:Math.round(1e3*l)/1e3,scrollPosition:t,fallback:!0,...s}),this.config.debug}})}createEnhancedScrollHandler(){return()=>{var t;try{if(this.config.debug,!this.config.trackScrolls)return void this.config.debug;const e=Date.now(),i=e-this.scrollThrottle,n=(null===(t=this.diagnostics.environment)||void 0===t?void 0:t.isMobile)?150:100;if(this.config.debug,i<n)return void this.config.debug;this.scrollThrottle=e;const s=this.getCachedScrollElements();this.config.debug,s.length>0?(this.config.debug,s.forEach((t,e)=>{this.config.debug,this.processScrollElementEnhanced(t)}),this.config.debug):this.config.debug}catch(t){this.config.debug}}}getCachedScrollElements(){const t=Date.now();return(!this.cachedScrollElements||t-this.lastScrollElementsCheck>2e3)&&(this.cachedScrollElements=document.querySelectorAll("[data-track-scroll]"),this.lastScrollElementsCheck=t,this.config.debug&&Array.from(this.cachedScrollElements).forEach((t,e)=>{})),this.cachedScrollElements}processScrollElementEnhanced(t){try{if("true"===t.getAttribute("data-scroll-triggered"))return void this.config.debug;const e=parseFloat(t.getAttribute("data-scroll-threshold")||"0.5"),i=t.getBoundingClientRect(),n=i.height,s=window.innerHeight;if(n<=0)return void this.config.debug;const r=Math.max(i.top,0),o=Math.min(i.bottom,s),a=Math.max(0,o-r)/n,c=t.getAttribute("data-track-scroll");if(!c)return void this.config.debug;if(this.config.debug,a>=e){t.setAttribute("data-scroll-triggered","true");const i=this.extractMetadata(t),n={type:"scroll",element:t.tagName.toLowerCase(),threshold:e,scrollDepth:window.scrollY,visibilityRatio:Math.round(1e3*a)/1e3,enhanced:!0,...i};this.config.debug,this.trackEvent(c,n),this.config.debug}}catch(t){this.config.debug}}processScrollElement(t){this.processScrollElementEnhanced(t)}setupIntelligentMutationObserver(){if(this.mutationObserver)return;const t=this.debounce(t=>{let e=!1;t.forEach(t=>{t.addedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){const i=t;(this.hasTrackingAttributes(i)||this.hasTrackingDescendants(i))&&(e=!0,this.config.debug)}})}),e&&(this.config.debug,this.processExistingElements())},150);this.mutationObserver=new MutationObserver(t),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0}),this.config.debug}hasTrackingAttributes(t){return t.hasAttribute&&(t.hasAttribute("data-track-click")||t.hasAttribute("data-track-scroll")||t.hasAttribute("data-track-view")||t.hasAttribute("data-track-hover")||t.hasAttribute("data-track-form"))}hasTrackingDescendants(t){return!!t.querySelector&&!!(t.querySelector("[data-track-click]")||t.querySelector("[data-track-scroll]")||t.querySelector("[data-track-view]")||t.querySelector("[data-track-hover]")||t.querySelector("[data-track-form]"))}debounce(t,e){let i;return(...n)=>{clearTimeout(i),i=setTimeout(()=>t.apply(this,n),e)}}stop(){this.config.debug,this.delegationHandlers.forEach((t,e)=>{"click"===e?this.getOptimalDelegationTarget().removeEventListener("click",t):"scroll"===e?(window.removeEventListener("scroll",t),document.removeEventListener("scroll",t),this.config.debug):document.removeEventListener(e,t)}),this.delegationHandlers.clear(),this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=void 0),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=void 0),this.observedElements.clear(),this.isInitialized=!1,this.config.debug}observeDOM(){this.config.debug}processExistingElements(){document.querySelectorAll("[data-track-click], [data-track-scroll], [data-track-view], [data-track-hover], [data-track-form]").forEach(t=>{this.processElement(t)})}processElement(t){this.config.trackViews&&t.hasAttribute("data-track-view")&&this.setupElementViewTracking(t),this.config.trackHovers&&t.hasAttribute("data-track-hover")&&this.setupHoverTracking(t),this.config.trackForms&&t.hasAttribute("data-track-form")&&this.setupFormTracking(t)}setupViewTracking(){this.intersectionObserver=new IntersectionObserver(t=>{t.forEach(t=>{var e;if(t.isIntersecting){const i=t.target,n=i.getAttribute("data-track-view");if(!n)return;const s=this.extractMetadata(i);this.trackEvent(n,{type:"view",element:i.tagName.toLowerCase(),intersectionRatio:t.intersectionRatio,...s}),this.config.debug,null===(e=this.intersectionObserver)||void 0===e||e.unobserve(i)}})},{threshold:.5,rootMargin:"0px"})}setupElementViewTracking(t){this.intersectionObserver&&(this.observedElements.has(t)||(this.intersectionObserver.observe(t),this.observedElements.add(t)))}setupHoverTracking(t){let e;const i=parseInt(t.getAttribute("data-hover-time")||"1000");t.addEventListener("mouseenter",()=>{e=Date.now()}),t.addEventListener("mouseleave",()=>{const n=Date.now()-e;if(n>=i){const e=t.getAttribute("data-track-hover");if(!e)return;const s=this.extractMetadata(t);this.trackEvent(e,{type:"hover",element:t.tagName.toLowerCase(),hoverDuration:n,minHoverTime:i,...s}),this.config.debug}})}setupFormTracking(t){"form"===t.tagName.toLowerCase()&&t.addEventListener("submit",e=>{const i=t.getAttribute("data-track-form");if(!i)return;const n=new FormData(t),s=this.extractMetadata(t),r={};for(const[t,e]of n.entries())this.isSensitiveField(t)||(r[t]="string"==typeof e?e.substring(0,100):"file");this.trackEvent(i,{type:"form_submit",element:"form",fieldCount:Array.from(n.entries()).length,fields:r,...s}),this.config.debug})}extractMetadata(t){var e;const i={};Array.from(t.attributes).forEach(t=>{if(t.name.startsWith("data-meta-")){const e=t.name.replace("data-meta-","");i[e]=t.value}}),t.id&&(i.elementId=t.id),t.className&&(i.elementClass=t.className);const n=null===(e=t.textContent)||void 0===e?void 0:e.trim();n&&n.length>0&&(i.textContent=n.substring(0,50));const s=t.getBoundingClientRect();return i.elementPosition={x:Math.round(s.left),y:Math.round(s.top),width:Math.round(s.width),height:Math.round(s.height)},i}isSensitiveField(t){return[/password/i,/pass/i,/pwd/i,/secret/i,/token/i,/api[_-]?key/i,/credit[_-]?card/i,/ssn/i,/social/i,/tax/i].some(e=>e.test(t))}trackEvent(t,e){var i,n;const s=performance.now();if(this.config.debug,this.validateTrackingCall(t,e).isValid)try{const r={autoTracked:!0,enhanced:!0,timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,trackingLatency:Math.round(100*(performance.now()-s))/100,isReactApp:null===(i=this.diagnostics.environment)||void 0===i?void 0:i.reactDetected,isMobile:null===(n=this.diagnostics.environment)||void 0===n?void 0:n.isMobile,...e};if(this.config.debug,!this.sdkInstance)return void this.config.debug;if("function"!=typeof this.sdkInstance.trackCustomEvent)return void this.config.debug;this.sdkInstance.trackCustomEvent(t,r),this.config.debug&&performance.now()}catch(t){this.config.debug}else this.config.debug}validateTrackingCall(t,e){const i=[];return t&&"string"==typeof t||i.push("Event name is required and must be a string"),this.sdkInstance||i.push("SDK instance is null or undefined"),this.sdkInstance&&"function"!=typeof this.sdkInstance.trackCustomEvent&&i.push("trackCustomEvent is not a function: "+typeof this.sdkInstance.trackCustomEvent),window&&"object"==typeof window||i.push("Window object is not available"),{isValid:0===i.length,errors:i}}refreshTracking(){this.isInitialized?(this.config.debug,this.processExistingElements(),this.config.debug&&this.logFoundElements()):this.config.debug}rescan(){this.refreshTracking()}getDiagnostics(){const t={triggerScrollHandler:()=>{this.config.debug;const t=this.delegationHandlers.get("scroll");t&&t(new Event("scroll"))},forceScrollEvent:t=>{const e=document.querySelector(t);e&&e.getAttribute("data-track-scroll")&&(e.removeAttribute("data-scroll-triggered"),this.processScrollElementEnhanced(e))},testTrackEvent:(t="test_event")=>{this.trackEvent(t,{type:"test",source:"manual_diagnostic",timestamp:Date.now()})},testIntersectionObserver:()=>{const t=document.querySelectorAll("[data-track-scroll]");if(this.intersectionObserver&&t.length>0){const e=t[0];e&&(e.removeAttribute("data-scroll-triggered"),this.intersectionObserver.observe(e))}},testScrollFallback:()=>{const t=this.delegationHandlers.get("scroll");t&&t(new Event("scroll"))}};return"undefined"!=typeof window&&(window.autoTrackerTests=t),{initialization:{isInitialized:this.isInitialized,attempts:this.initializationAttempts,maxAttempts:this.maxInitializationAttempts,timestamp:(new Date).toISOString()},eventHandlers:{hasClickHandler:this.delegationHandlers.has("click"),hasScrollHandler:this.delegationHandlers.has("scroll"),activeHandlers:Array.from(this.delegationHandlers.keys()),delegationTarget:this.getOptimalDelegationTarget()===document?"document":"react-root"},observers:{observedElements:this.observedElements.size,hasMutationObserver:!!this.mutationObserver,hasIntersectionObserver:!!this.intersectionObserver,scrollElementsCache:!!this.cachedScrollElements,cacheExpiry:new Date(this.lastScrollElementsCheck+5e3).toISOString()},config:this.config,environment:this.diagnostics.environment||{},dom:this.diagnostics.dom||{},tracking:this.diagnostics.tracking||{},elementsFound:this.getElementCounts(),performance:{lastScrollThrottle:this.scrollThrottle,cacheLastUpdate:this.lastScrollElementsCheck},validation:this.validateTrackingCall("test",{}),recommendations:this.generateRecommendations(),manualTests:{available:!0,usage:{triggerScrollHandler:"window.autoTrackerTests.triggerScrollHandler()",forceScrollEvent:'window.autoTrackerTests.forceScrollEvent("[data-track-scroll]")',testTrackEvent:'window.autoTrackerTests.testTrackEvent("my_event")',testIntersectionObserver:"window.autoTrackerTests.testIntersectionObserver()",testScrollFallback:"window.autoTrackerTests.testScrollFallback()"},description:"Use these functions in the browser console to manually test the AutoTracker"}}}generateRecommendations(){var t,e;const i=[],n=this.getElementCounts(),s=Object.values(n).reduce((t,e)=>t+e,0);return this.isInitialized||i.push("AutoTracker is not initialized. Check console for errors."),0===s&&i.push("No trackable elements found. Ensure data-track-* attributes are present in the DOM."),this.sdkInstance||i.push("SDK instance is missing. Ensure the SDK is properly initialized."),this.sdkInstance&&"function"!=typeof this.sdkInstance.trackCustomEvent&&i.push("trackCustomEvent method is not available on SDK instance."),!(null===(t=this.diagnostics.environment)||void 0===t?void 0:t.reactDetected)&&window.location.hostname.includes("localhost")&&i.push("React not detected. If using React, ensure proper setup and try refreshTracking() after route changes."),(null===(e=this.diagnostics.environment)||void 0===e?void 0:e.isMobile)&&!this.delegationHandlers.has("scroll")&&i.push("Mobile device detected but scroll tracking not active. Check scroll tracking configuration."),this.initializationAttempts>1&&i.push(`AutoTracker required ${this.initializationAttempts} initialization attempts. Consider adding delay before enabling.`),i}configure(t){this.config={...this.config,...t}}getStats(){return{observedElements:this.observedElements.size,config:this.config,isModern:this.isInitialized,diagnostics:this.config.debug?this.getDiagnostics():void 0}}}export{t as AutoTracker};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Zaplier SDK v3.0.0 - Unified SDK
|
|
3
|
+
* Advanced privacy-first tracking with code splitting
|
|
4
|
+
* (c) 2026 Zaplier Team
|
|
5
|
+
*/
|
|
6
|
+
import{i as e,a as t,b as n}from"./fingerprint-BmsWDNK6.js";function r(){var t;try{return e()&&null!==(t=navigator.pdfViewerEnabled)&&void 0!==t?t:null}catch{return null}}function o(){try{if(!t())return-1;const{ApplePaySession:e}=window;if("function"!=typeof(null==e?void 0:e.canMakePayments))return-1;if(!n())return-2;if(window.self!==window.top)return-3;try{return e.canMakePayments()?1:0}catch(e){if(e instanceof Error&&"InvalidAccessError"===e.name)return-2;throw e}}catch{return-1}}function i(){try{return"attributionReporting"in window||"privateClickMeasurement"in window||null}catch{return null}}function a(){const t={enabled:!1,sameSiteSupport:!1,secureSupport:!1,partitionedSupport:!1};try{if(t.enabled=navigator.cookieEnabled,!t.enabled)return t;t.sameSiteSupport=c("__rb_test_samesite","SameSite=Strict"),n()&&(t.secureSupport=c("__rb_test_secure","Secure")),n()&&e()&&(t.partitionedSupport=c("__rb_test_partitioned","Partitioned; Secure; SameSite=None"))}catch{}return t}function c(e,t){try{const n="1",r=`${e}=${n}; ${t}; path=/`;document.cookie=r;const o=document.cookie.includes(`${e}=${n}`);return u(e),o}catch{return u(e),!1}}function u(e){try{const t=[`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`,`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=${location.hostname}`,`${e}=; max-age=0; path=/`,`${e}=; max-age=0; path=/; domain=${location.hostname}`];for(const e of t)try{document.cookie=e}catch{}setTimeout(()=>{try{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`}catch{}},100)}catch{}}function s(){try{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");return t?(t.getSupportedExtensions()||[]).sort():[]}catch{return[]}}function l(){try{const e=performance.memory;return e?{usedJSHeapSize:e.usedJSHeapSize,totalJSHeapSize:e.totalJSHeapSize,jsHeapSizeLimit:e.jsHeapSizeLimit}:null}catch{return null}}function p(){try{const e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return e?{effectiveType:e.effectiveType,downlink:e.downlink,rtt:e.rtt,saveData:e.saveData}:null}catch{return null}}function d(){var e;const t={};try{t.webkitTemporaryStorage="webkitTemporaryStorage"in navigator,t.webkitPersistentStorage="webkitPersistentStorage"in navigator,window.safari&&(t.safariObjectTypes=Object.getOwnPropertyNames(window.safari)),t.chromeRuntime=!!(null===(e=window.chrome)||void 0===e?void 0:e.runtime),t.mozInnerScreenX="mozInnerScreenX"in window,t.msCredentials="msCredentials"in navigator}catch{}return t}function m(){return"undefined"!=typeof window&&"undefined"!=typeof navigator}function f(){const e=r(),t=o(),n=i(),c=a(),u=s(),m=l(),f=p(),w=d();let S="unknown";w.chromeRuntime?S="chrome":-1!==t?S="safari":w.mozInnerScreenX?S="firefox":w.msCredentials&&(S="edge");const h=Boolean(e||t>-1||n||m||f),g=[null!==e,-1!==t,null!==n,c.enabled,u.length>0,null!==m,null!==f,Object.keys(w).length>0];return{pdfViewerEnabled:e,applePayState:t,privateClickMeasurement:n,cookieCapabilities:c,webglExtensions:u,performanceMemory:m,connectionInfo:f,vendorProperties:w,browserVendor:S,hasNativeFeatures:h,apiScore:Math.round(g.filter(Boolean).length/g.length*100)}}export{o as getApplePayState,f as getBrowserApisFingerprint,p as getConnectionInfo,a as getCookieCapabilities,r as getPdfViewerEnabled,l as getPerformanceMemory,i as getPrivateClickMeasurement,d as getVendorProperties,s as getWebGLExtensions,m as isBrowserApisDetectionAvailable};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Zaplier SDK v3.0.0 - Unified SDK
|
|
3
|
+
* Advanced privacy-first tracking with code splitting
|
|
4
|
+
* (c) 2026 Zaplier Team
|
|
5
|
+
*/
|
|
6
|
+
const e={canvas:{stability:.95,entropy:.9,uniqueness:.85,spoofResistance:.8},webgl:{stability:.92,entropy:.88,uniqueness:.82,spoofResistance:.85},audio:{stability:.9,entropy:.85,uniqueness:.8,spoofResistance:.9},hardware:{stability:.98,entropy:.7,uniqueness:.75,spoofResistance:.95},screen:{stability:.85,entropy:.6,uniqueness:.65,spoofResistance:.7},system:{stability:.8,entropy:.65,uniqueness:.7,spoofResistance:.6},browser:{stability:.75,entropy:.6,uniqueness:.65,spoofResistance:.5},fonts:{stability:.7,entropy:.75,uniqueness:.7,spoofResistance:.4},math:{stability:.95,entropy:.8,uniqueness:.9,spoofResistance:.95},storage:{stability:.6,entropy:.5,uniqueness:.6,spoofResistance:.3},incognito:{stability:.5,entropy:.4,uniqueness:.3,spoofResistance:.2},domBlockers:{stability:.8,entropy:.7,uniqueness:.6,spoofResistance:.9},accessibility:{stability:.9,entropy:.6,uniqueness:.7,spoofResistance:.85},browserApis:{stability:.85,entropy:.75,uniqueness:.8,spoofResistance:.7},pluginsEnhanced:{stability:.7,entropy:.65,uniqueness:.75,spoofResistance:.5},mathFingerprint:{stability:.99,entropy:.95,uniqueness:.9,spoofResistance:.98},fontPreferences:{stability:.92,entropy:.88,uniqueness:.85,spoofResistance:.75},dateTimeLocale:{stability:.95,entropy:.7,uniqueness:.75,spoofResistance:.8},accessibilityEnhanced:{stability:.93,entropy:.65,uniqueness:.8,spoofResistance:.9},enhancedFonts:{stability:.88,entropy:.85,uniqueness:.82,spoofResistance:.7},webrtc:{stability:.92,entropy:.85,uniqueness:.8,spoofResistance:.9},permissions:{stability:.88,entropy:.75,uniqueness:.72,spoofResistance:.8},speech:{stability:.9,entropy:.7,uniqueness:.65,spoofResistance:.85},cssFeatures:{stability:.97,entropy:.88,uniqueness:.85,spoofResistance:.95},mediaCodecs:{stability:.95,entropy:.82,uniqueness:.78,spoofResistance:.92},wasmFeatures:{stability:.98,entropy:.7,uniqueness:.72,spoofResistance:.97},mathml:{stability:.9,entropy:.8,uniqueness:.75,spoofResistance:.88},clientHints:{stability:.93,entropy:.92,uniqueness:.9,spoofResistance:.85}},s={domBlockers:{stability:.8,entropy:.7,uniqueness:.6,spoofResistance:.9},accessibility:{stability:.9,entropy:.6,uniqueness:.7,spoofResistance:.85},browserApis:{stability:.85,entropy:.75,uniqueness:.8,spoofResistance:.7}};function n(n){const t=e[n]||s[n];if(!t)return.5;const i=.3*t.stability+.25*t.entropy+.25*t.uniqueness+.2*t.spoofResistance;return Math.max(.1,Math.min(1,i))}function t(t,i={}){const{requireMinimumComponents:o=4,penalizeMissingCore:a=!0,adjustForIncognito:c=!0}=i,r=t.filter(e=>e.success),p=[];r.length<o&&p.push(`Collect at least ${o} components for reliable identification`);let u=0,l=0,y=0,f=0,b=0;const m=["canvas","webgl","audio","hardware"].filter(e=>!r.some(s=>s.component===e));for(const t of r){const i=n(t.component),o=e[t.component]||s[t.component];o&&(u+=i,l+=o.stability*i,y+=o.entropy*i,f+=o.uniqueness*i,b+=o.spoofResistance*i)}const h=u>0?l/u:0,q=u>0?y/u:0,R=u>0?b/u:0;let d,g,w=.35*h+.25*q+.25*(u>0?f/u:0)+.15*R,M=w;return a&&m.length>0&&(M-=.1*m.length,p.push(`Missing core components: ${m.join(", ")}`)),r.length<6&&(M-=.05*(6-r.length)),c&&r.some(e=>"incognito"===e.component)&&(M+=.02),r.filter(e=>["domBlockers","accessibility","browserApis","math"].includes(e.component)).length>=2&&(M+=.05),M=Math.max(0,Math.min(1,M)),M>=.995?(d=.995,g="Very High"):M>=.99?(d=.99,g="High"):M>=.95?(d=.95,g="Medium"):M>=.8?(d=.8,g="Low"):(d=.5,g="Very Low",p.push("Consider implementing additional fingerprinting techniques")),M<.95&&p.push("Enable all available fingerprinting components for better accuracy"),R<.6&&p.push("Include more spoof-resistant components like audio and WebGL"),q<.6&&p.push("Add high-entropy components like canvas and math fingerprinting"),{score:d,level:g,factors:{componentCount:r.length,weightedScore:Math.round(1e3*w)/1e3,stabilityScore:Math.round(1e3*h)/1e3,entropyScore:Math.round(1e3*q)/1e3,spoofResistanceScore:Math.round(1e3*R)/1e3},recommendations:p.slice(0,3)}}export{s as ADVANCED_COMPONENT_CHARACTERISTICS,e as COMPONENT_CHARACTERISTICS,n as calculateComponentWeight,t as calculateConfidence};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Zaplier SDK v3.0.0 - Unified SDK
|
|
3
|
+
* Advanced privacy-first tracking with code splitting
|
|
4
|
+
* (c) 2026 Zaplier Team
|
|
5
|
+
*/
|
|
6
|
+
function n(){var n,e,t,r;try{const i=screen,c=null!==(n=i.availTop)&&void 0!==n?n:0,u=null!==(e=i.availLeft)&&void 0!==e?e:0,o=null!==(t=i.availWidth)&&void 0!==t?t:i.width,l=null!==(r=i.availHeight)&&void 0!==r?r:i.height,a=c||null,s=i.width-o-u||null,d=i.height-l-c||null,h=u||null;if(null===a&&null===s&&null===d&&null===h)return null;const v=n=>null===n?null:10*Math.round(n/10);return{top:v(a),right:v(s),bottom:v(d),left:v(h)}}catch{return null}}function e(){var n,e,t,r;try{const i=(null===(n=navigator.platform)||void 0===n?void 0:n.toLowerCase())||"",c=(null===(e=navigator.userAgent)||void 0===e?void 0:e.toLowerCase())||"";if(i.includes("win")&&(c.includes("wow64")||c.includes("x64")||c.includes("x86_64")))return 0;if(i.includes("linux")&&(i.includes("x86_64")||c.includes("x86_64")))return 0;if(i.includes("mac")&&(i.includes("intel")||c.includes("intel mac")))return 0;if(i.includes("x86")||i.includes("x64")||i.includes("intel")||i.includes("amd64")||c.includes("x86")||c.includes("amd64"))return 0;if(i.includes("arm")||c.includes("arm")||c.includes("aarch64")||i.includes("aarch64"))return 255;try{const n=document.createElement("canvas"),e=n.getContext("webgl")||n.getContext("experimental-webgl");if(e&&"getExtension"in e&&"getParameter"in e){const n=e.getExtension("WEBGL_debug_renderer_info");if(n){const i=(null===(t=e.getParameter(n.UNMASKED_VENDOR_WEBGL))||void 0===t?void 0:t.toLowerCase())||"",c=(null===(r=e.getParameter(n.UNMASKED_RENDERER_WEBGL))||void 0===r?void 0:r.toLowerCase())||"";if(i.includes("intel")||i.includes("nvidia")||i.includes("amd")||c.includes("intel")||c.includes("nvidia")||c.includes("amd")||c.includes("radeon")||c.includes("geforce")||c.includes("quadro")||c.includes("iris")||c.includes("uhd")||c.includes("hd graphics"))return 0;if(c.includes("mali")||c.includes("adreno")||c.includes("powervr")||c.includes("tegra")||c.includes("apple gpu")||i.includes("arm")||c.includes("videocore"))return 255}}}catch{}try{const n=new Float32Array(1),e=new Uint8Array(n.buffer);n[0]=1/0,n[0]=n[0]-n[0];const t=e[3];return i.includes("linux"),t}catch{return}}catch{return}}function t(){try{const n=navigator;let e=0;void 0!==n.maxTouchPoints?e=n.maxTouchPoints:void 0!==n.msMaxTouchPoints&&(e=n.msMaxTouchPoints);let t=!1;try{document.createEvent("TouchEvent"),t=!0}catch{t=!1}return{maxTouchPoints:e,touchEvent:t,touchStart:"ontouchstart"in window}}catch{return}}function r(){const n=[],e=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];for(const t of e){const e=window[t];e&&"object"==typeof e&&n.push(t)}return n.sort()}function i(){try{const n=navigator.deviceMemory;if("number"==typeof n)return Math.round(n);if("string"==typeof n){const e=parseFloat(n);return isNaN(e)?void 0:Math.round(e)}return}catch{return}}function c(){try{return screen.colorDepth||void 0}catch{return}}function u(){try{for(const n of["rec2020","p3","srgb"])if(window.matchMedia(`(color-gamut: ${n})`).matches)return n;return}catch{return}}function o(){return{screenFrame:n(),hardwareConcurrency:navigator.hardwareConcurrency||void 0,deviceMemory:i(),architecture:e(),touchSupport:t(),vendorFlavors:r(),cpuClass:navigator.cpuClass||void 0,colorDepth:c(),colorGamut:u()}}export{o as collectDeviceSignals};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Zaplier SDK v3.0.0 - Unified SDK
|
|
3
|
+
* Advanced privacy-first tracking with code splitting
|
|
4
|
+
* (c) 2026 Zaplier Team
|
|
5
|
+
*/
|
|
6
|
+
import{g as e}from"./fingerprint-BmsWDNK6.js";function t(){const e=atob;return{adBlock:["#ad-banner",".advertisement",e("I2FkLWNvbnRhaW5lcg=="),e("LmFkdmVydGlzZW1lbnQ="),e("W2NsYXNzKj0iYWQtIl0=")],uBlockOrigin:["#ublock-stats",".adsbygoogle",e("I2dvb2dsZV9hZHM="),e("LmFkc2J5Z29vZ2xl"),e("LnVibG9jay1ibG9ja2Vk")],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0"),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],privacyBadger:["#privacy-badger-popup",".privacy-badger-blocked",e("LnByaXZhY3ktYmFkZ2Vy")],ghostery:["#ghostery-popup",".ghostery-blocking",e("Lmdob3N0ZXJ5LWJsb2NrZWQ=")],brave:["#brave-ads-blocked",".brave-blocked",e("LmJyYXZlLWFkLWJsb2Nr")],facebookContainer:[".facebook-container-blocked",e("LmZiLWJsb2NrZWQ=")],cookieBlockers:[".cookie-notice-blocked","#cookie-banner-hidden",e("LmNvb2tpZS1ibG9ja2Vy")],trackingProtection:[".tracking-blocked","#tracking-protection-enabled",e("LnRyYWNrZXItYmxvY2tlZA==")]}}function r(e){const t=document.createElement("div");if(e.startsWith("#"))t.id=e.substring(1);else if(e.startsWith("."))t.className=e.substring(1);else if(e.includes("["))try{const r=e.match(/\[([^=]+)([*^$|~]?=)"([^"]+)"\]/);if(r&&r[1]&&r[3]){const[,e,o,n]=r;"*="===o?t.setAttribute(e,`test-${n}-test`):t.setAttribute(e,n)}}catch{t.className="test-element"}else t.className=e.replace(/[^a-zA-Z0-9-_]/g,"");return t}function o(e){const t=e.style;t.setProperty("visibility","hidden","important"),t.setProperty("display","block","important"),t.setProperty("position","absolute","important"),t.setProperty("left","-9999px","important"),t.setProperty("width","1px","important"),t.setProperty("height","1px","important"),t.setProperty("pointer-events","none","important"),t.setProperty("z-index","-1","important")}function n(e){return new Promise(t=>setTimeout(t,e))}async function a(e){var t,a;const i=document,s=i.createElement("div"),c=new Array(e.length),l={};o(s);const d=i.createDocumentFragment();for(let n=0;n<e.length;n++){const s=e[n];if(s)try{const e=r(s),l=i.createElement("div");"DIALOG"===e.tagName&&(null===(a=(t=e).show)||void 0===a||a.call(t)),o(l),l.appendChild(e),d.appendChild(l),c[n]=e}catch(e){c[n]=void 0}}s.appendChild(d);let m=0;for(;!i.body&&m<100;)await n(50),m++;if(!i.body)throw new Error("Document body not available for DOM blockers detection");i.body.appendChild(s);try{await n(50),await new Promise(t=>{requestAnimationFrame(()=>{for(let t=0;t<e.length;t++){const r=c[t],o=e[t];r&&o&&!r.offsetParent&&(l[o]=!0)}t()})})}finally{try{s.parentNode&&s.parentNode.removeChild(s)}catch(e){setTimeout(()=>{try{s.parentNode&&s.parentNode.removeChild(s)}catch{}},0)}}return l}async function i(e={}){const{debug:r=!1,timeout:o=5e3}=e;try{if(!s())return"BROWSER_INCOMPATIBLE";if(!document||!document.body)return"DOM_NOT_AVAILABLE";const e=t(),r=Object.keys(e),n=[].concat(...r.map(t=>e[t]||[])),i=new Promise((e,t)=>{setTimeout(()=>t(new Error("DOM blockers detection timeout")),o)}),c=await Promise.race([a(n),i]);return r.filter(t=>{const r=e[t];return!(!r||0===r.length)&&r.map(e=>c[e]).filter(Boolean).length>.6*r.length}).sort()}catch(e){if(e instanceof Error){if(e.message.includes("timeout"))return"TIMEOUT";if("SecurityError"===e.name||e.message.includes("SecurityError"))return"SECURITY_ERROR"}return"NOT_SUPPORTED"}}function s(){return e().canRunDOMBlockers}async function c(e={}){const t=await i(e),r=Array.isArray(t)?t:[];return{activeBlockers:r,blockerCount:r.length,hasAdBlocker:r.some(e=>["adBlock","uBlockOrigin","adGuardBase","easyList"].includes(e)),hasPrivacyExtension:r.some(e=>["privacyBadger","ghostery","brave"].includes(e)),hasTrackingProtection:r.includes("trackingProtection")}}export{a as getBlockedSelectors,t as getBlockerFilters,i as getDomBlockers,c as getDomBlockersFingerprint,s as isDomBlockersDetectionAvailable};
|