@zaplier/sdk 1.8.0 → 1.8.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.
Files changed (144) hide show
  1. package/dist/core-ultra.min.js +10 -0
  2. package/dist/index.cjs +1615 -34
  3. package/dist/index.d.ts +11 -7
  4. package/dist/index.esm.js +1615 -34
  5. package/dist/v2/chunks/browser-apis-AyU2utpF.min.js +6 -0
  6. package/dist/v2/chunks/confidence-BslwbUCt.min.js +6 -0
  7. package/dist/v2/chunks/device-signals-2L_62qNZ.min.js +6 -0
  8. package/dist/v2/chunks/dom-blockers-C467-IRd.min.js +6 -0
  9. package/dist/v2/chunks/fingerprint-FfUEEIAd.min.js +6 -0
  10. package/dist/v2/chunks/hardware-9ikfSEs-.min.js +6 -0
  11. package/dist/v2/chunks/incognito-CkKAdE8Z.min.js +6 -0
  12. package/dist/v2/chunks/math-Q4s6nkVD.min.js +6 -0
  13. package/dist/v2/chunks/plugins-enhanced-mUjU1EXe.min.js +6 -0
  14. package/dist/v2/chunks/session-replay-C5Tp0d16.min.js +6 -0
  15. package/dist/v2/chunks/storage-Bl_8oytT.min.js +6 -0
  16. package/dist/v2/chunks/system-DTjxyOZF.min.js +6 -0
  17. package/dist/v2/core.d.ts +7 -0
  18. package/dist/v2/core.js +2 -2
  19. package/dist/v2/core.min.js +2 -2
  20. package/dist/v2/modules/anti-adblock.js +2 -2
  21. package/dist/v2/modules/browser-apis-C32PGYAh.js +6 -0
  22. package/dist/v2/modules/browser-apis-DzzjRXFN.js +6 -0
  23. package/dist/v2/modules/confidence-CLylpqVh.js +6 -0
  24. package/dist/v2/modules/device-signals-ChNkNSJR.js +6 -0
  25. package/dist/v2/modules/device-signals-D-VQg-o6.js +6 -0
  26. package/dist/v2/modules/dom-blockers-BamKJxCs.js +6 -0
  27. package/dist/v2/modules/dom-blockers-D9M2aO9M.js +6 -0
  28. package/dist/v2/modules/fingerprint-CRCL21-p.js +6 -0
  29. package/dist/v2/modules/fingerprint-Ddq30bun.js +6 -0
  30. package/dist/v2/modules/fingerprint.js +2 -2
  31. package/dist/v2/modules/hardware-BxWqOjae.js +6 -0
  32. package/dist/v2/modules/heatmap.js +1 -1
  33. package/dist/v2/modules/incognito-CBxUhUOT.js +6 -0
  34. package/dist/v2/modules/incognito-DpuYoC8S.js +6 -0
  35. package/dist/v2/modules/math-B13vt1ND.js +6 -0
  36. package/dist/v2/modules/plugins-enhanced-CnBdC9_k.js +6 -0
  37. package/dist/v2/modules/plugins-enhanced-D5ft0k0e.js +6 -0
  38. package/dist/v2/modules/replay.js +2 -2
  39. package/dist/v2/modules/storage-D8dcMojB.js +6 -0
  40. package/dist/v2/modules/system-ZMflVbka.js +6 -0
  41. package/package.json +47 -22
  42. package/dist/index.cjs.map +0 -1
  43. package/dist/index.esm.js.map +0 -1
  44. package/dist/index.js +0 -3517
  45. package/dist/index.js.map +0 -1
  46. package/dist/sdk.js +0 -26960
  47. package/dist/sdk.js.map +0 -1
  48. package/dist/sdk.legacy.min.js +0 -6
  49. package/dist/sdk.min.js +0 -7
  50. package/dist/src/core.d.ts +0 -87
  51. package/dist/src/core.d.ts.map +0 -1
  52. package/dist/src/index.d.ts +0 -15
  53. package/dist/src/index.d.ts.map +0 -1
  54. package/dist/src/modules/anti-adblock.d.ts +0 -113
  55. package/dist/src/modules/anti-adblock.d.ts.map +0 -1
  56. package/dist/src/modules/auto-tracker.d.ts +0 -240
  57. package/dist/src/modules/auto-tracker.d.ts.map +0 -1
  58. package/dist/src/modules/bot-detection.d.ts +0 -15
  59. package/dist/src/modules/bot-detection.d.ts.map +0 -1
  60. package/dist/src/modules/fingerprint/accessibility.d.ts +0 -155
  61. package/dist/src/modules/fingerprint/accessibility.d.ts.map +0 -1
  62. package/dist/src/modules/fingerprint/audio.d.ts +0 -15
  63. package/dist/src/modules/fingerprint/audio.d.ts.map +0 -1
  64. package/dist/src/modules/fingerprint/browser-apis.d.ts +0 -108
  65. package/dist/src/modules/fingerprint/browser-apis.d.ts.map +0 -1
  66. package/dist/src/modules/fingerprint/browser.d.ts +0 -14
  67. package/dist/src/modules/fingerprint/browser.d.ts.map +0 -1
  68. package/dist/src/modules/fingerprint/canvas.d.ts +0 -14
  69. package/dist/src/modules/fingerprint/canvas.d.ts.map +0 -1
  70. package/dist/src/modules/fingerprint/confidence.d.ts +0 -89
  71. package/dist/src/modules/fingerprint/confidence.d.ts.map +0 -1
  72. package/dist/src/modules/fingerprint/datetime-locale.d.ts +0 -76
  73. package/dist/src/modules/fingerprint/datetime-locale.d.ts.map +0 -1
  74. package/dist/src/modules/fingerprint/device-signals.d.ts +0 -29
  75. package/dist/src/modules/fingerprint/device-signals.d.ts.map +0 -1
  76. package/dist/src/modules/fingerprint/dom-blockers.d.ts +0 -56
  77. package/dist/src/modules/fingerprint/dom-blockers.d.ts.map +0 -1
  78. package/dist/src/modules/fingerprint/font-preferences.d.ts +0 -70
  79. package/dist/src/modules/fingerprint/font-preferences.d.ts.map +0 -1
  80. package/dist/src/modules/fingerprint/fonts-enhanced.d.ts +0 -43
  81. package/dist/src/modules/fingerprint/fonts-enhanced.d.ts.map +0 -1
  82. package/dist/src/modules/fingerprint/fonts.d.ts +0 -14
  83. package/dist/src/modules/fingerprint/fonts.d.ts.map +0 -1
  84. package/dist/src/modules/fingerprint/hardware.d.ts +0 -40
  85. package/dist/src/modules/fingerprint/hardware.d.ts.map +0 -1
  86. package/dist/src/modules/fingerprint/hashing.d.ts +0 -29
  87. package/dist/src/modules/fingerprint/hashing.d.ts.map +0 -1
  88. package/dist/src/modules/fingerprint/incognito.d.ts +0 -6
  89. package/dist/src/modules/fingerprint/incognito.d.ts.map +0 -1
  90. package/dist/src/modules/fingerprint/math-enhanced.d.ts +0 -70
  91. package/dist/src/modules/fingerprint/math-enhanced.d.ts.map +0 -1
  92. package/dist/src/modules/fingerprint/math.d.ts +0 -32
  93. package/dist/src/modules/fingerprint/math.d.ts.map +0 -1
  94. package/dist/src/modules/fingerprint/plugins-enhanced.d.ts +0 -97
  95. package/dist/src/modules/fingerprint/plugins-enhanced.d.ts.map +0 -1
  96. package/dist/src/modules/fingerprint/screen.d.ts +0 -15
  97. package/dist/src/modules/fingerprint/screen.d.ts.map +0 -1
  98. package/dist/src/modules/fingerprint/storage.d.ts +0 -45
  99. package/dist/src/modules/fingerprint/storage.d.ts.map +0 -1
  100. package/dist/src/modules/fingerprint/system.d.ts +0 -40
  101. package/dist/src/modules/fingerprint/system.d.ts.map +0 -1
  102. package/dist/src/modules/fingerprint/webgl.d.ts +0 -15
  103. package/dist/src/modules/fingerprint/webgl.d.ts.map +0 -1
  104. package/dist/src/modules/fingerprint.d.ts +0 -35
  105. package/dist/src/modules/fingerprint.d.ts.map +0 -1
  106. package/dist/src/modules/global-interface.d.ts +0 -157
  107. package/dist/src/modules/global-interface.d.ts.map +0 -1
  108. package/dist/src/modules/heatmap.d.ts +0 -145
  109. package/dist/src/modules/heatmap.d.ts.map +0 -1
  110. package/dist/src/modules/incognito-detection.d.ts +0 -23
  111. package/dist/src/modules/incognito-detection.d.ts.map +0 -1
  112. package/dist/src/modules/session-replay.d.ts +0 -93
  113. package/dist/src/modules/session-replay.d.ts.map +0 -1
  114. package/dist/src/modules/user-agent.d.ts +0 -35
  115. package/dist/src/modules/user-agent.d.ts.map +0 -1
  116. package/dist/src/modules/visitor-persistence.d.ts +0 -51
  117. package/dist/src/modules/visitor-persistence.d.ts.map +0 -1
  118. package/dist/src/sdk.d.ts +0 -289
  119. package/dist/src/sdk.d.ts.map +0 -1
  120. package/dist/src/types/config.d.ts +0 -44
  121. package/dist/src/types/config.d.ts.map +0 -1
  122. package/dist/src/types/detection.d.ts +0 -114
  123. package/dist/src/types/detection.d.ts.map +0 -1
  124. package/dist/src/types/events.d.ts +0 -174
  125. package/dist/src/types/events.d.ts.map +0 -1
  126. package/dist/src/types/fingerprint.d.ts +0 -252
  127. package/dist/src/types/fingerprint.d.ts.map +0 -1
  128. package/dist/src/types/index.d.ts +0 -83
  129. package/dist/src/types/index.d.ts.map +0 -1
  130. package/dist/src/types/methods.d.ts +0 -83
  131. package/dist/src/types/methods.d.ts.map +0 -1
  132. package/dist/src/types/visitor.d.ts +0 -90
  133. package/dist/src/types/visitor.d.ts.map +0 -1
  134. package/dist/src/utils/browser.d.ts +0 -114
  135. package/dist/src/utils/browser.d.ts.map +0 -1
  136. package/dist/src/utils/lazy-loader.d.ts +0 -60
  137. package/dist/src/utils/lazy-loader.d.ts.map +0 -1
  138. package/dist/src/utils/session-utils.d.ts +0 -58
  139. package/dist/src/utils/session-utils.d.ts.map +0 -1
  140. package/dist/src/utils/webgl-cache.d.ts +0 -43
  141. package/dist/src/utils/webgl-cache.d.ts.map +0 -1
  142. package/dist/v2/chunks/fingerprint-ergvAID6.js +0 -8461
  143. package/dist/v2/chunks/replay-CM8dTFmL.js +0 -12158
  144. package/dist/v2/chunks/session-replay-C_UkGoTj.js +0 -240
@@ -1,240 +0,0 @@
1
- /*!
2
- * Zaplier SDK v2.0.0 - Performance Optimized
3
- * Advanced privacy-first tracking with code splitting
4
- * (c) 2025 Zaplier Team
5
- */
6
- import { r as record } from './replay-CM8dTFmL.js';
7
-
8
- /**
9
- * Session Replay Engine - Simplified Implementation
10
- * Based on official rrweb example for maximum compatibility
11
- */
12
- class SessionReplayEngine {
13
- constructor(sessionId, visitorId, config = {}) {
14
- this.events = [];
15
- this.isActive = false;
16
- this.isPaused = false;
17
- this.lastActivityTime = Date.now();
18
- this.sessionStartTime = Date.now();
19
- this.sessionId = sessionId;
20
- this.visitorId = visitorId;
21
- this.config = {
22
- enabled: true,
23
- sampleRate: 1.0,
24
- batchInterval: 10000, // 10 seconds like official example
25
- inactivityTimeout: 30000, // 30 seconds of inactivity
26
- pauseOnInactive: true, // Pause recording during inactivity
27
- ...config,
28
- };
29
- }
30
- /**
31
- * Start session replay recording - Simplified like official example
32
- */
33
- start() {
34
- if (!this.config.enabled || this.isActive) {
35
- return false;
36
- }
37
- // Check sampling
38
- if (Math.random() > this.config.sampleRate) {
39
- return false;
40
- }
41
- try {
42
- // Simple rrweb recording configuration like official example
43
- this.rrwebStopRecord = record({
44
- emit: (event) => {
45
- // Update activity time on any event
46
- this.onActivity();
47
- // Only capture events if not paused
48
- if (!this.isPaused) {
49
- this.events.push(event);
50
- }
51
- },
52
- });
53
- this.isActive = true;
54
- this.startBatchTimer();
55
- this.startInactivityTracking();
56
- console.log("[Zaplier] Session replay started - with inactivity detection");
57
- return true;
58
- }
59
- catch (error) {
60
- console.error("[Zaplier] Failed to start rrweb recording:", error);
61
- return false;
62
- }
63
- }
64
- /**
65
- * Stop session replay recording
66
- */
67
- stop() {
68
- if (!this.isActive)
69
- return;
70
- this.isActive = false;
71
- // Stop rrweb recording
72
- if (this.rrwebStopRecord) {
73
- this.rrwebStopRecord();
74
- this.rrwebStopRecord = undefined;
75
- }
76
- if (this.batchTimer) {
77
- clearInterval(this.batchTimer);
78
- this.batchTimer = undefined;
79
- }
80
- if (this.inactivityTimer) {
81
- clearTimeout(this.inactivityTimer);
82
- this.inactivityTimer = undefined;
83
- }
84
- // Send final batch
85
- this.sendBatch();
86
- }
87
- /**
88
- * Start batch timer
89
- */
90
- startBatchTimer() {
91
- this.batchTimer = window.setInterval(() => {
92
- this.sendBatch();
93
- }, this.config.batchInterval);
94
- }
95
- /**
96
- * Send batch of events - Simplified like official example
97
- */
98
- sendBatch() {
99
- if (this.events.length === 0) {
100
- return;
101
- }
102
- // Enhanced payload structure with visitor linking
103
- const payload = {
104
- sessionId: this.sessionId,
105
- visitorId: this.visitorId,
106
- events: [...this.events], // Copy events array
107
- metadata: {
108
- userAgent: navigator.userAgent,
109
- timestamp: Date.now(),
110
- startUrl: window.location.href,
111
- duration: Date.now() - this.sessionStartTime,
112
- activeTime: this.getActiveTime(),
113
- funnelSteps: [],
114
- hasConversion: false,
115
- eventsCount: this.events.length,
116
- isPaused: this.isPaused,
117
- },
118
- };
119
- // Reset events array like official example
120
- this.events = [];
121
- console.log(`[Zaplier] Sending batch with ${payload.events.length} events`);
122
- // Send to backend
123
- this.sendToBackend(payload);
124
- }
125
- /**
126
- * Set SDK instance for transport
127
- */
128
- setSDKInstance(sdk) {
129
- this.sdkInstance = sdk;
130
- }
131
- /**
132
- * Send replay batch via SDK's transport system
133
- */
134
- async sendToBackend(payload) {
135
- try {
136
- if (!this.sdkInstance) {
137
- console.error("[Zaplier] No SDK instance available for replay transport");
138
- return;
139
- }
140
- // Use SDK's sendReplayBatch method with simplified payload
141
- const result = await this.sdkInstance.sendReplayBatch(payload);
142
- if (result && result.success) {
143
- console.log("[Zaplier] Session replay batch sent successfully");
144
- }
145
- else {
146
- console.error("[Zaplier] Session replay batch failed:", result);
147
- }
148
- }
149
- catch (error) {
150
- console.error("[Zaplier] Session replay error:", error);
151
- }
152
- }
153
- /**
154
- * Get current event count
155
- */
156
- getEventCount() {
157
- return this.events.length;
158
- }
159
- /**
160
- * Check if recording is active
161
- */
162
- isRecording() {
163
- return this.isActive;
164
- }
165
- /**
166
- * Check if recording is paused
167
- */
168
- isPausedState() {
169
- return this.isPaused;
170
- }
171
- /**
172
- * Start inactivity tracking
173
- */
174
- startInactivityTracking() {
175
- if (!this.config.pauseOnInactive)
176
- return;
177
- // Listen for user activity events
178
- const activityEvents = ['mousedown', 'mousemove', 'keypress', 'scroll', 'touchstart', 'click'];
179
- activityEvents.forEach(event => {
180
- document.addEventListener(event, this.onActivity.bind(this), true);
181
- });
182
- this.resetInactivityTimer();
183
- }
184
- /**
185
- * Handle activity event
186
- */
187
- onActivity() {
188
- this.lastActivityTime = Date.now();
189
- // Resume if paused
190
- if (this.isPaused) {
191
- this.resume();
192
- }
193
- this.resetInactivityTimer();
194
- }
195
- /**
196
- * Reset inactivity timer
197
- */
198
- resetInactivityTimer() {
199
- if (this.inactivityTimer) {
200
- clearTimeout(this.inactivityTimer);
201
- }
202
- this.inactivityTimer = window.setTimeout(() => {
203
- this.pauseForInactivity();
204
- }, this.config.inactivityTimeout);
205
- }
206
- /**
207
- * Pause recording due to inactivity
208
- */
209
- pauseForInactivity() {
210
- if (this.isPaused)
211
- return;
212
- this.isPaused = true;
213
- console.log("[Zaplier] Session replay paused due to inactivity");
214
- }
215
- /**
216
- * Resume recording after activity
217
- */
218
- resume() {
219
- if (!this.isPaused)
220
- return;
221
- this.isPaused = false;
222
- console.log("[Zaplier] Session replay resumed after activity");
223
- }
224
- /**
225
- * Get total active time (excluding paused periods)
226
- */
227
- getActiveTime() {
228
- const totalTime = Date.now() - this.sessionStartTime;
229
- // For now, return total time. In production, track pause periods accurately
230
- return totalTime;
231
- }
232
- /**
233
- * Get visitor ID
234
- */
235
- getVisitorId() {
236
- return this.visitorId;
237
- }
238
- }
239
-
240
- export { SessionReplayEngine };