@extn/segi-js 0.2.13 → 0.2.14
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/cdn.global.js +25 -25
- package/dist/index.js +7 -0
- package/dist/index.mjs +7 -0
- package/dist/replay/index.js +9 -5
- package/dist/replay/index.mjs +5 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -223,6 +223,12 @@ var Segi = {
|
|
|
223
223
|
if (_optionalChain([replay, 'optionalAccess', _3 => _3.__segi_replay])) {
|
|
224
224
|
void Promise.resolve().then(() => _interopRequireWildcard(require("./replay/index.js"))).then((mod) => {
|
|
225
225
|
Segi.replay = mod.replayApi;
|
|
226
|
+
if (state.user) {
|
|
227
|
+
mod.replayApi.setUser({
|
|
228
|
+
id: state.user.id,
|
|
229
|
+
email: state.user.email
|
|
230
|
+
});
|
|
231
|
+
}
|
|
226
232
|
return mod.activateReplay({
|
|
227
233
|
projectKey: core.projectKey,
|
|
228
234
|
// Empty/undefined here is fine — the replay transport falls
|
|
@@ -295,6 +301,7 @@ var Segi = {
|
|
|
295
301
|
setUser(user) {
|
|
296
302
|
try {
|
|
297
303
|
state.user = user;
|
|
304
|
+
Segi.replay.setUser(user ? { id: user.id, email: user.email } : null);
|
|
298
305
|
} catch (e9) {
|
|
299
306
|
}
|
|
300
307
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -223,6 +223,12 @@ var Segi = {
|
|
|
223
223
|
if (replay?.__segi_replay) {
|
|
224
224
|
void import("./replay/index.mjs").then((mod) => {
|
|
225
225
|
Segi.replay = mod.replayApi;
|
|
226
|
+
if (state.user) {
|
|
227
|
+
mod.replayApi.setUser({
|
|
228
|
+
id: state.user.id,
|
|
229
|
+
email: state.user.email
|
|
230
|
+
});
|
|
231
|
+
}
|
|
226
232
|
return mod.activateReplay({
|
|
227
233
|
projectKey: core.projectKey,
|
|
228
234
|
// Empty/undefined here is fine — the replay transport falls
|
|
@@ -295,6 +301,7 @@ var Segi = {
|
|
|
295
301
|
setUser(user) {
|
|
296
302
|
try {
|
|
297
303
|
state.user = user;
|
|
304
|
+
Segi.replay.setUser(user ? { id: user.id, email: user.email } : null);
|
|
298
305
|
} catch {
|
|
299
306
|
}
|
|
300
307
|
},
|
package/dist/replay/index.js
CHANGED
|
@@ -123,6 +123,7 @@ async function gzipString(str) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
var active = null;
|
|
126
|
+
var pendingUser = void 0;
|
|
126
127
|
function deviceClass() {
|
|
127
128
|
if (typeof window === "undefined") return "desktop";
|
|
128
129
|
const w = window.innerWidth;
|
|
@@ -197,6 +198,7 @@ async function activateReplay(args) {
|
|
|
197
198
|
clickCount: 0,
|
|
198
199
|
recordingEnabled: false
|
|
199
200
|
};
|
|
201
|
+
if (pendingUser !== void 0) replayApi.setUser(pendingUser);
|
|
200
202
|
return;
|
|
201
203
|
}
|
|
202
204
|
active = {
|
|
@@ -212,6 +214,7 @@ async function activateReplay(args) {
|
|
|
212
214
|
clickCount: 0,
|
|
213
215
|
recordingEnabled: true
|
|
214
216
|
};
|
|
217
|
+
if (pendingUser !== void 0) replayApi.setUser(pendingUser);
|
|
215
218
|
let lastSessionBump = Date.now();
|
|
216
219
|
const bumpIfStale = () => {
|
|
217
220
|
const now = Date.now();
|
|
@@ -345,8 +348,9 @@ var replayApi = {
|
|
|
345
348
|
bumpSessionActivity();
|
|
346
349
|
},
|
|
347
350
|
setUser(user) {
|
|
351
|
+
pendingUser = user;
|
|
348
352
|
if (!active) return;
|
|
349
|
-
active.userId = _nullishCoalesce(_optionalChain([user, 'optionalAccess', _22 => _22.id]), () => ( null));
|
|
353
|
+
active.userId = _nullishCoalesce(_optionalChain([user, 'optionalAccess', _22 => _22.id, 'optionalAccess', _23 => _23.slice, 'call', _24 => _24(0, 128)]), () => ( null));
|
|
350
354
|
void postTrace(active.config, "/session/start", {
|
|
351
355
|
sessionUid: active.sessionUid,
|
|
352
356
|
anonId: getOrCreateAnonId(),
|
|
@@ -382,17 +386,17 @@ var replayApi = {
|
|
|
382
386
|
const nowBlocked = isPathBlocked(active.options, location.pathname);
|
|
383
387
|
if (nowBlocked) {
|
|
384
388
|
if (!active.paused) {
|
|
385
|
-
_optionalChain([active, 'access',
|
|
389
|
+
_optionalChain([active, 'access', _25 => _25.rrweb, 'optionalAccess', _26 => _26.pause, 'call', _27 => _27()]);
|
|
386
390
|
active.paused = true;
|
|
387
391
|
}
|
|
388
392
|
return;
|
|
389
393
|
}
|
|
390
394
|
if (active.paused) {
|
|
391
|
-
_optionalChain([active, 'access',
|
|
395
|
+
_optionalChain([active, 'access', _28 => _28.rrweb, 'optionalAccess', _29 => _29.resume, 'call', _30 => _30()]);
|
|
392
396
|
active.paused = false;
|
|
393
397
|
}
|
|
394
398
|
active.pagesVisited += 1;
|
|
395
|
-
_optionalChain([active, 'access',
|
|
399
|
+
_optionalChain([active, 'access', _31 => _31.rrweb, 'optionalAccess', _32 => _32.takeFullSnapshot, 'call', _33 => _33()]);
|
|
396
400
|
void postTrace(active.config, "/events", {
|
|
397
401
|
events: [
|
|
398
402
|
{
|
|
@@ -407,7 +411,7 @@ var replayApi = {
|
|
|
407
411
|
},
|
|
408
412
|
/** Test seam: returns null when replay was not activated for this session. */
|
|
409
413
|
_sessionUid() {
|
|
410
|
-
return _nullishCoalesce(_optionalChain([active, 'optionalAccess',
|
|
414
|
+
return _nullishCoalesce(_optionalChain([active, 'optionalAccess', _34 => _34.sessionUid]), () => ( null));
|
|
411
415
|
}
|
|
412
416
|
};
|
|
413
417
|
|
package/dist/replay/index.mjs
CHANGED
|
@@ -123,6 +123,7 @@ async function gzipString(str) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
var active = null;
|
|
126
|
+
var pendingUser = void 0;
|
|
126
127
|
function deviceClass() {
|
|
127
128
|
if (typeof window === "undefined") return "desktop";
|
|
128
129
|
const w = window.innerWidth;
|
|
@@ -197,6 +198,7 @@ async function activateReplay(args) {
|
|
|
197
198
|
clickCount: 0,
|
|
198
199
|
recordingEnabled: false
|
|
199
200
|
};
|
|
201
|
+
if (pendingUser !== void 0) replayApi.setUser(pendingUser);
|
|
200
202
|
return;
|
|
201
203
|
}
|
|
202
204
|
active = {
|
|
@@ -212,6 +214,7 @@ async function activateReplay(args) {
|
|
|
212
214
|
clickCount: 0,
|
|
213
215
|
recordingEnabled: true
|
|
214
216
|
};
|
|
217
|
+
if (pendingUser !== void 0) replayApi.setUser(pendingUser);
|
|
215
218
|
let lastSessionBump = Date.now();
|
|
216
219
|
const bumpIfStale = () => {
|
|
217
220
|
const now = Date.now();
|
|
@@ -345,8 +348,9 @@ var replayApi = {
|
|
|
345
348
|
bumpSessionActivity();
|
|
346
349
|
},
|
|
347
350
|
setUser(user) {
|
|
351
|
+
pendingUser = user;
|
|
348
352
|
if (!active) return;
|
|
349
|
-
active.userId = user?.id ?? null;
|
|
353
|
+
active.userId = user?.id?.slice(0, 128) ?? null;
|
|
350
354
|
void postTrace(active.config, "/session/start", {
|
|
351
355
|
sessionUid: active.sessionUid,
|
|
352
356
|
anonId: getOrCreateAnonId(),
|